aboutsummaryrefslogtreecommitdiff
path: root/videogrid
diff options
context:
space:
mode:
authorlluís gómez i bigordà <lluisbigorda@users.sourceforge.net>2007-10-24 20:37:21 +0000
committerlluís gómez i bigordà <lluisbigorda@users.sourceforge.net>2007-10-24 20:37:21 +0000
commit3c050000c6918b77a353583999e6e810aa675fda (patch)
treefc6aab7c92efb156966f5c926517f2f02e7b417e /videogrid
This commit was generated by cvs2svn to compensate for changes in r8875,svn2git-root
which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/pdvjtools/; revision=8876
Diffstat (limited to 'videogrid')
-rwxr-xr-xvideogrid/INSTALL_videogrid48
-rw-r--r--videogrid/LICENSE674
-rwxr-xr-xvideogrid/Makefile38
-rwxr-xr-xvideogrid/cat-help-videogrid.pd20
-rw-r--r--videogrid/cua.c164
-rw-r--r--videogrid/cua.h47
-rwxr-xr-xvideogrid/help-videogrid.pd21
-rw-r--r--videogrid/qtconverter.c133
-rw-r--r--videogrid/qtconverter.h27
-rw-r--r--videogrid/tk2c.sh25
-rw-r--r--videogrid/videogrid.c827
-rw-r--r--videogrid/videogrid.tk146
-rw-r--r--videogrid/videogrid.tk2c115
13 files changed, 2285 insertions, 0 deletions
diff --git a/videogrid/INSTALL_videogrid b/videogrid/INSTALL_videogrid
new file mode 100755
index 0000000..1733d70
--- /dev/null
+++ b/videogrid/INSTALL_videogrid
@@ -0,0 +1,48 @@
+
+VIDEOGRID INSTALL
+
+[ENG]
+
+In order to compile this source it must have the library QuickTime and the source code of Puredata.
+
+tar xzvf videogrid[-version].tar.gz in folder pd/extra/ o edit file Makefile modifying the value of PD_SRC whit the correct path location of the pd/src/. If you don't have ir, download and copy the src/ folder into pd/ folder.
+
+$ cd videogrid[-version]
+
+# make clean
+
+# make
+
+# make install
+
+now you can open example: help-videogrid.pd
+
+$ pd help-videogrid.pd
+
+Thanks.
+
+Sergi Lario
+slario(at)gmail.com
+
+[CAT]
+
+Per compilar el codi font cal disposar de la biblioteca QuickTime i el codi font de Puredata.
+
+tar xzvf videogrid[-versio].tar.gz en el directori pd/extra/ o bé edita el fitxer Makefile modificant el valor de la variable PD_SRC amb el path correcte del codi font de pd/src/. Si no el tens el pots descarregar i copiar la carpeta src/ dins el directori pd/
+
+$ cd videogrid[-versio]
+
+# make clean
+
+# make
+
+# make install
+
+ara ja pots obrir l'exemple help-videogrid.pd
+
+$ pd help-videogrid.pd
+
+Gràcies.
+
+Sergi Lario
+slario(at)gmail.com
diff --git a/videogrid/LICENSE b/videogrid/LICENSE
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/videogrid/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/videogrid/Makefile b/videogrid/Makefile
new file mode 100755
index 0000000..298532e
--- /dev/null
+++ b/videogrid/Makefile
@@ -0,0 +1,38 @@
+PD_SRC=../../src
+
+NAME=videogrid
+CSYM=videogrid
+
+current: pd_linux
+
+# ----------------------- LINUX -----------------------
+
+pd_linux: $(NAME).pd_linux
+
+.SUFFIXES: .pd_linux
+
+LINUXCFLAGS = -fPIC -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \
+ -Wall -W -Wno-shadow -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+
+LINUXINCLUDE = -I$(PD_SRC) -I/usr/include/
+
+.c.pd_linux:
+ cc -fPIC -c -ansi -O -Wall -Wmissing-prototypes cua.c
+ cc -fPIC -c -O -Wall -Wmissing-prototypes -o qtconverter.o -c qtconverter.c
+# ./tk2c.bash < $*.tk > $*.tk2c
+ cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ ld -export_dynamic -shared -o $*.pd_linux $*.o cua.o qtconverter.o -lc -lm -lquicktime
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o ../$*.pd_linux
+ ln -s $*/$*.pd_linux ..
+
+# ----------------------------------------------------------
+
+install:
+ cp help-*.pd ../../doc/5.reference
+
+clean:
+ rm -f *.o *.pd_* so_locations
+
diff --git a/videogrid/cat-help-videogrid.pd b/videogrid/cat-help-videogrid.pd
new file mode 100755
index 0000000..a14bca1
--- /dev/null
+++ b/videogrid/cat-help-videogrid.pd
@@ -0,0 +1,20 @@
+#N canvas 772 365 1148 655 10;
+#X text 24 93 LLISTA STDOUT;
+#X symbolatom 72 324 60 0 0 0 - - -;
+#X obj 26 110 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 24 13 VIDEOGRID;
+#X text 25 29 Objecte per seleccionar amb un sol clic la ubicacio d'un
+video amb el frame afegit al tauler.;
+#X text 154 63 AFEGIR VIDEO;
+#X text 154 113 AFEGIR VIDEOS D'UN DIRECTORI;
+#X text 74 344 PATH DEL VIDEO CLICAT;
+#X obj 72 179 videogrid videogrid2 3 5 #F0F0F0 #0F0F0F /usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0243.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0243.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0243.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0243.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0243.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/lib/pd/extra/videogrid/videos/dscn0241.mov|
+;
+#X msg 156 127 putimgdir /usr/lib/pd/extra/videogrid/videos;
+#X msg 156 77 putimg /usr/lib/pd/extra/videogrid/videos/dscn0241.mov
+;
+#X connect 2 0 8 0;
+#X connect 8 0 1 0;
+#X connect 9 0 8 0;
+#X connect 10 0 8 0;
diff --git a/videogrid/cua.c b/videogrid/cua.c
new file mode 100644
index 0000000..f03fb2a
--- /dev/null
+++ b/videogrid/cua.c
@@ -0,0 +1,164 @@
+/*
+cue for videogrid external
+Copyright (C) 2007 Sergi Lario
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "cua.h"
+
+/*
+- compilació:
+ $ gcc -c -ansi -O -Wall -Wmissing-prototypes cua.c
+- muntatge:
+ $ gcc cua.o -o cua
+- execució:
+ $ ./cua
+*/
+/* programa principal de prova */
+/*
+int main()
+{
+
+ int opc=8;
+ char path[BYTESNOMFITXER];
+ int ok;
+ Cua cua;
+ crearCua(&cua);
+
+ while(opc!=5)
+ {
+ printf("\t\t\tMENU PRINCIPAL\n\n\n");
+ printf("\t 1. Encuar\n");
+ printf("\t 2. Desencuar\n");
+ printf("\t 3. Nombre de nodes\n");
+ printf("\t 4. Contingut de la cua\n");
+ printf("\t 5. Sortir\n");
+
+ scanf("%d", &opc);
+
+ switch(opc)
+ {
+ case 1:
+ printf("path a introduir:\n");
+ scanf("%s", path);
+ encuar(&cua, path);
+ break;
+
+ case 2:
+ ok = desencuar(&cua);
+ if(ok) printf("node eliminat de la cua\n");
+ break;
+
+ case 3:
+ printf("nombre de nodes de la cua %d\n", numNodes(&cua));
+ break;
+ case 4:
+ escriuCua(&cua);
+ break;
+ case 5:
+ eliminarCua(&cua);
+ break;
+ }
+ }
+ getchar();
+ return 0;
+}
+*/
+/* implementació de les funcions */
+void crearCua(Cua *cua)
+{
+ cua->davanter=cua->final=NULL;
+}
+
+/* funció que encua el node al final de la cua */
+void encuar (Cua *cua, path x)
+{
+ Node *nou;
+ nou=(Node*)malloc(sizeof(Node));
+ strcpy(nou->pathFitxer,x);
+ nou->seguent=NULL;
+ if(cuaBuida(cua))
+ {
+ cua->davanter=nou;
+ }
+ else
+ cua->final->seguent=nou;
+ cua->final=nou;
+}
+
+/* elimina l'element del principi de la cua */
+int desencuar (Cua *cua)
+{
+ if(!cuaBuida(cua))
+ {
+ Node *nou;
+ nou=cua->davanter;
+ cua->davanter=cua->davanter->seguent;
+ free(nou);
+ return 1;
+ }
+ else
+ {
+ /* printf("Cua buida\a\n"); */
+ return 0;
+ }
+
+}
+
+/* funció que retorna si la cua és buida */
+int cuaBuida(Cua *cua)
+{
+ return (cua->davanter==NULL);
+}
+
+/* elimina el contingut de la cua */
+void eliminarCua(Cua *cua)
+{
+ while (!cuaBuida(cua)) desencuar(cua);
+ printf("Cua eliminada\a\n");
+}
+
+/* funció que retorna el nombre de nodes de la cua */
+int numNodes(Cua *cua)
+{
+ int contador=0;
+ Node *actual;
+ actual=cua->davanter;
+ if(actual) contador=1;
+ while((actual)&&(actual != cua->final)){
+ contador ++;
+ actual = actual->seguent;
+ }
+ return (contador);
+}
+
+/* funció que escriu la cua de nodes per la sortida estàndard */
+void escriuCua(Cua *cua)
+{
+ if(!cuaBuida(cua))
+ {
+ Node *actual;
+ actual=cua->davanter;
+ printf("CUA DE NODES\n[");
+ do{
+ printf("#%s#",actual->pathFitxer);
+ actual = actual->seguent;
+ }while(actual);
+ printf("]\n");
+
+ }
+ else
+ printf("Cua buida\a\n");
+}
diff --git a/videogrid/cua.h b/videogrid/cua.h
new file mode 100644
index 0000000..4144770
--- /dev/null
+++ b/videogrid/cua.h
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* nombre de caracters per el nom del path del fitxer */
+#define BYTESNOMFITXER 512
+
+typedef char path[BYTESNOMFITXER];
+
+/* estructures i tipus de dades de la cua */
+
+/* estructura de dades: un node de la cua */
+struct node
+{
+ /* nom del path de la imatge */
+ path pathFitxer;
+ /* apuntador al següent node en cua */
+ struct node *seguent;
+};
+
+/* definició del tipus node */
+typedef struct node Node;
+
+/* definició del tipus de cua */
+typedef struct
+{
+ Node *davanter;
+ Node *final;
+}Cua;
+
+
+/* declaracions de les funcions */
+
+/* crea una cua */
+void crearCua(Cua *cua);
+/* encuara un element al final de la cua */
+void encuar (Cua *cua, path x);
+/* elimina un element de la cua */
+int desencuar (Cua *cua);
+/* retorna si la cua és buida */
+int cuaBuida(Cua *cua);
+/* elimina el contingut de la cua */
+void eliminarCua(Cua *cua);
+/* retorna el nombre de nodes de la cua */
+int numNodes(Cua *cua);
+/* escriu el contingut de la cua */
+void escriuCua(Cua *cua);
diff --git a/videogrid/help-videogrid.pd b/videogrid/help-videogrid.pd
new file mode 100755
index 0000000..cd556c1
--- /dev/null
+++ b/videogrid/help-videogrid.pd
@@ -0,0 +1,21 @@
+#N canvas 323 160 580 404 10;
+#X symbolatom 72 324 60 0 0 0 - - -;
+#X obj 26 110 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 24 13 VIDEOGRID;
+#X obj 72 178 videogrid videogrid1 3 5 #F0F0F0 #0F0F0F /usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0248.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0248.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0248.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0248.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0248.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov|/usr/local/lib/pd/extra/videogrid/videos/dscn0248.mov|
+;
+#X text 154 63 ADD VIDEO;
+#X text 154 113 ADD VIDEOS FROM FOLDER;
+#X text 25 29 Object to select the path location of a video quiktime
+added in the grid \, in form of image of its first frame.;
+#X text 74 344 LOCATION OF THE SELECTED VIDEO;
+#X text 24 93 LIST STDOUT;
+#X msg 156 77 putvideo /usr/local/lib/pd/extra/videogrid/videos/dscn0241.mov
+;
+#X msg 156 127 putvideodir /usr/local/lib/pd/extra/videogrid/videos
+;
+#X connect 1 0 3 0;
+#X connect 3 0 0 0;
+#X connect 9 0 3 0;
+#X connect 10 0 3 0;
diff --git a/videogrid/qtconverter.c b/videogrid/qtconverter.c
new file mode 100644
index 0000000..24e99fd
--- /dev/null
+++ b/videogrid/qtconverter.c
@@ -0,0 +1,133 @@
+#include "qtconverter.h"
+
+/*
+void post(char args[]){
+ printf("%s",args);
+}
+*/
+
+int convertir_img(pathimage pathFitxer, tipus_format f, int W, int H, int posi){
+ /*
+ Quicktime per les conversions
+ */
+
+ /* RGB vectors */
+ unsigned char * qt_rows[3];
+ /* YUV vesctor frame */
+ unsigned char *qt_frame = NULL;
+ /* quicktime decoder */
+ quicktime_t *qt;
+ /* quicktime color model */
+ int qt_cmodel;
+
+ int nN = posi;
+ int x_vwidth = 0;
+ int x_vheight = 0;
+ /* convertir(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN); */
+ qt = quicktime_open(pathFitxer, 1, 0);
+
+ if (!(qt)){
+ /* post("videogrid: error opening qt file"); */
+ return -1;
+ }
+
+ if (!quicktime_has_video(qt)) {
+ /* post("videogrid: no video stream"); */
+ quicktime_close(qt);
+ return -1;
+
+ }
+ else if (!quicktime_supported_video(qt,0)) {
+ /* post("videogrid: unsupported video codec\n"); */
+ quicktime_close(qt);
+ return -1;
+ }
+ else
+ {
+ qt_cmodel = BC_YUV420P;
+ x_vwidth = quicktime_video_width(qt,0);
+ x_vheight = quicktime_video_height(qt,0);
+
+
+ free(qt_frame);
+ qt_frame = (unsigned char*)malloc(x_vwidth*x_vheight*4);
+
+ int size = x_vwidth * x_vheight;
+ qt_rows[0] = &qt_frame[0];
+ qt_rows[2] = &qt_frame[size];
+ qt_rows[1] = &qt_frame[size + (size>>2)];
+
+ quicktime_set_cmodel(qt, qt_cmodel);
+ }
+
+ /* int length = quicktime_video_length(qt,0); */
+ /* int Vpos = quicktime_video_position(qt,0); */
+ lqt_decode_video(qt, qt_rows, 0);
+
+ switch(qt_cmodel){
+ case BC_YUV420P:
+ printf(" ");
+ /* post("videogrid: qt colormodel : BC_YUV420P"); */
+
+ /* per a fer la miniatura
+ cada k colomnes pillem una
+ cada l files pillem una */
+ int w = x_vwidth;
+ int h = x_vheight;
+ int k = (w/W);
+ int l = (h/H);
+
+ /*int cont=0;*/
+
+ char nNstr[BYTES_NUM_TEMP];
+ pathimage ig_path = PATH_TEMPORAL;
+
+ sprintf(nNstr, "%d", nN);
+ strcat(ig_path,nNstr);
+ strcat(ig_path,".");
+ strcat(ig_path,FORMAT_MINIATURA);
+ /* printf("Creacio de la imatge %s ...",ig_path); */
+ /* escriu el contingut de data a un arxiu. */
+ FILE *fp = fopen(ig_path, "w");
+ fprintf (fp, "P6\n%d %d\n255\n", W, H);
+
+ int i,j,y,u,v,r,g,b;
+
+ for (i=0;i<(l*H);i=i+l) {
+ for (j=0;j<(k*W);j=j+k) {
+ y=qt_rows[0][(w*i+j)];
+ u=qt_rows[1][(w/2)*(i/2)+(j/2)];
+ v=qt_rows[2][(w/2)*(i/2)+(j/2)];
+ r = CLAMP8(y + 1.402 *(v-128));
+ g = CLAMP8(y - 0.34414 *(u-128) - 0.71414 *(v-128));
+ b = CLAMP8(y + 1.772 *(u-128));
+ fprintf (fp, "%c%c%c", r,g,b);
+ }
+ }
+
+ /* escriu el contingut de data a un arxiu.*/
+ fclose (fp);
+ }
+ return 0;
+}
+
+
+
+/*
+cc -fPIC -c -O -Wall -Wmissing-prototypes -o qtconverter.o -c qtconverter.c
+cc -o qtconverter qtconverter.o -lc -lm -lquicktime `Wand-config --ldflags --libs`
+./qtconverter
+*/
+
+/*
+int main(void){
+ pathimage imatge = "/usr/lib/pd/extra/videogrid/videos/dscn0243.mov";
+ tipus_format fo = "ppm";
+ int flauta;
+ flauta = convertir(imatge,fo,60,40,2);
+ printf("\n%d FET\n", flauta);
+ return(0);
+}
+*/
+
+
diff --git a/videogrid/qtconverter.h b/videogrid/qtconverter.h
new file mode 100644
index 0000000..da70f40
--- /dev/null
+++ b/videogrid/qtconverter.h
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+//#include <quicktime/lqt.h>
+//#include <quicktime/colormodels.h>
+#include <lqt/lqt.h>
+#include <lqt/colormodels.h>
+
+/* 8bits clamp rgb values */
+
+#define CLAMP8(x) (((x)<0) ? 0 : ((x>255)? 255 : (x)))
+
+#define BYTESNOMFITXERIMATGE 512
+#define BYTESTIPUSFROMAT 4
+
+#define FORMAT_MINIATURA "ppm"
+#define PATH_TEMPORAL "/tmp/vigrid_"
+#define BYTES_NUM_TEMP 4
+
+typedef char pathimage[BYTESNOMFITXERIMATGE];
+
+typedef char tipus_format[BYTESTIPUSFROMAT];
+
+int convertir_img(pathimage pathFitxer, tipus_format f, int W, int H, int posi);
+/* void post(char args[]); */
+
diff --git a/videogrid/tk2c.sh b/videogrid/tk2c.sh
new file mode 100644
index 0000000..1b1dc09
--- /dev/null
+++ b/videogrid/tk2c.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+#set -x
+
+while read line
+do
+ for word in $line
+ do
+ if [ "X"$word != "X"${word#\#} ]
+ then
+ echo // ${line#\#}
+ break
+ else
+ line=${line//\'/\\\'}
+#useless, slashes never gets in
+ line=${line//\\/\\\\}
+#this one's dirty, i know
+ line=${line//;/\\\\;}
+ line=${line//\"/\\\"}
+ echo 'sys_gui("'$line'\n");'
+ break
+ fi
+ done
+done
+
diff --git a/videogrid/videogrid.c b/videogrid/videogrid.c
new file mode 100644
index 0000000..b2b6587
--- /dev/null
+++ b/videogrid/videogrid.c
@@ -0,0 +1,827 @@
+/*
+videogrid external for Puredata
+Copyright (C) 2007 Sergi Lario
+sll :: slario-at-gmail.com
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdio.h>
+#include <dirent.h>
+#include <string.h>
+#include <unistd.h>
+#include <math.h>
+
+/* incloure les definicions de variables i
+ prototipus de dades i de funcions de puredata */
+#include "m_pd.h"
+/* incloure estructures de dades i capceleres de funcions gàfiques bàsiques de pd */
+#include "g_canvas.h"
+/* incloure estructures de dades i capceleres de funcions per a gestionar una cua */
+#include "cua.h"
+/* incloure estructures de dades i capceleres de funcions per convertir imatges a diferents formats */
+/* #include "magickconverter.h" */
+/* incloure estructures de dades i capceleres de funcions per tractar frames de vídeo */
+#include "qtconverter.h"
+/* incloure estructures de dades i capceleres de funcions per traballar amb threads */
+#include "pthread.h"
+
+/* &&&&&&&&&&&&&&&&&&&&&&&&&&&&& VIDEOGRID &&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
+
+/* definició de l'amplada i l'alçada d'una casella */
+#define W_CELL 60
+#define H_CELL 40
+
+/* crear un apuntador al nou objecte */
+static t_class *videogrid_class;
+/* indica el nombre de videogrid creats - utilitzat per diferenciar el nom d'instàncies d'objectes del mateix tipus */
+static int videogridcount = 0;
+
+/* definició de la classe i la seva estructura de dades */
+
+typedef struct _videogrid {
+ t_object x_obj;
+ /* declaració de la sortida de l'objecte */
+ t_outlet *x_sortida;
+ /* llista d'objectes gràfics */
+ t_glist *x_glist;
+ /* nombre de files */
+ int x_num_fil;
+ /* nombre de columnes */
+ int x_num_col;
+ /* posició de la última imatge en el tauler */
+ int x_ultima_img;
+ /* path del directori actual */
+ path x_dir_actual;
+ /* path del directori a canviar */
+ path x_dir_canvi;
+ /* posicio ultim al directori actual */
+ int x_dir_pos;
+ /* apuntador al primer element posicionat al tauler */
+ Node *x_tauler_primer;
+ /* cua d'imatges */
+ Cua x_cua;
+ /* nom de l'objecte */
+ t_symbol *x_name;
+ /* color de fons */
+ t_symbol *x_color_fons;
+ /* color del marge */
+ t_symbol *x_color_marc;
+ /* mutex per evitar concurrencia sobre la cua al accedir diferents threads*/
+ pthread_mutex_t x_lock;
+
+} t_videogrid;
+
+
+/* calcula la posició x del tauler a partir de la posició de l'element de la cua (d'esquerra a dreta) */
+int getX(t_videogrid* x, int posCua){
+ int c = x->x_num_col;
+ int xpos = (posCua % c) * W_CELL;
+ return(xpos + 1);
+}
+
+/* calcula la posició y del tauler a partir de la posició de l'element de la cua (de dalt a baix) */
+int getY(t_videogrid* x, int posCua){
+ int c = x->x_num_col;
+ int ypos = (posCua / c) * H_CELL;
+ return(ypos + 1);
+}
+
+/* elimina les imatges temporals */
+void eliminar_imatges_temporals(int maxim){
+ FILE *fitxer;
+ path path_total;
+ int contador = 0;
+ char contador_str[BYTES_NUM_TEMP];
+ while(contador < maxim){
+ strcpy(path_total,PATH_TEMPORAL);
+ sprintf(contador_str,"%d", contador);
+ strcat(path_total,contador_str);
+ strcat(path_total,".");
+ strcat(path_total,FORMAT_MINIATURA);
+ /* elimina el fitxer si no hi ha cap problema */
+ if(unlink(path_total)){
+ /* post("Imatge temporal %s eliminada\n",path_total); */
+ }
+ contador++;
+ }
+ post("Videogrid: Imatges temporals eliminades\n",path_total);
+}
+
+int format_adequat_v(path nomF){
+ int retorn = 0;
+ path ig_path = "";
+ strcat(ig_path,nomF);
+ char *t1;
+ path extensio = "";
+ for ( t1 = strtok(ig_path,".");
+ t1 != NULL;
+ t1 = strtok(NULL,".") )
+ strcpy(extensio,t1);
+ if(strcmp(extensio,"mov")==0) retorn = 1;
+ /*
+ if(strcmp(extensio,"eps")==0) retorn = 1;
+ if(strcmp(extensio,"gif")==0) retorn = 1;
+ if(strcmp(extensio,"jpg")==0) retorn = 1;
+ if(strcmp(extensio,"jpeg")==0) retorn = 1;
+ if(strcmp(extensio,"png")==0) retorn = 1;
+ if(strcmp(extensio,"ppm")==0) retorn = 1;
+ if(strcmp(extensio,"tif")==0) retorn = 1;
+ if(strcmp(extensio,"tiff")==0) retorn = 1;
+ */
+
+ return (retorn);
+}
+
+/* afegir una imatge al grid */
+void videogrid_afegir_imatge(t_videogrid *x, path entrada)
+{
+ int maxim;
+ char nNstr[BYTES_NUM_TEMP];
+ int pos = 0;
+ /* escriu l'argument entrat */
+ if (format_adequat_v(entrada) == 1){
+ /* post("Afegint la imatge %s ...",entrada); */
+ maxim = x->x_num_fil * x->x_num_col;
+ path ig_path = PATH_TEMPORAL;
+
+ /* si hi ha tants nodes a la cua com el maxim */
+ if((numNodes(&x->x_cua)) >= maxim){
+ /* desencua */
+ int extret;
+ extret = desencuar(&x->x_cua);
+ /* obtenir la posició en la cua del nou node */
+ if(x->x_ultima_img == maxim-1) {
+ pos = 0;
+ }else{
+ pos = x->x_ultima_img+1;
+ }
+ sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, pos);
+ }
+ /* encua el nou node */
+ encuar(&x->x_cua, entrada);
+ /* si no és el primer element a encuar incrementem la posicio de la última imatge insertada */
+ if(numNodes(&x->x_cua) != 1) x->x_ultima_img ++;
+ /* si assoleix el maxim torna a començar, inicialitzant la posició en el tauler de la última imatge insertada */
+ if(x->x_ultima_img == maxim) x->x_ultima_img = 0;
+
+ /*
+ Quicktime per les conversions
+ */
+ int nN = x->x_ultima_img;
+ convertir_img(entrada,FORMAT_MINIATURA, W_CELL, H_CELL, nN);
+ sprintf(nNstr, "%d", nN);
+ strcat(ig_path,nNstr);
+ strcat(ig_path,".");
+ strcat(ig_path,FORMAT_MINIATURA);
+ /*printf("Creacio de la imatge %s ...",ig_path);*/
+ sys_vgui("image create photo img%x%d -file %s\n",x,nN,ig_path);
+ /* printf("1. Creacio de la imatge %s ...",ig_path); */
+ sys_vgui(".x%x.c create image %d %d -image img%x%d -tags %xS%d\n",
+ glist_getcanvas(x->x_glist),
+ text_xpix(&x->x_obj, x->x_glist) + getX(x,nN) + (W_CELL/2),
+ text_ypix(&x->x_obj, x->x_glist) + getY(x,nN) + (H_CELL/2),
+ x,nN,x,nN);
+ /* printf("2. Creacio de la imatge %s ...",ig_path); */
+ if(nN == 0){
+ x->x_tauler_primer = x->x_cua.final;
+ /* post("Ara el primer del tauler es %s\n",x->x_tauler_primer->pathFitxer); */
+ }
+ /* printf("SURT de la creacio de la imatge %s ...",ig_path); */
+ }else{
+ post("Videogrid: El format del fitxer %s és incompatible.",entrada);
+ }
+ /*
+ sys_vgui("image create photo img%x -file %s\n",x,entrada);
+ sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n",
+ glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x,x);
+ */
+}
+
+/* dibuixa videogrid */
+void videogrid_drawme(t_videogrid *x, t_glist *glist, int firsttime)
+{
+ /* post("Entra a drawme amb firsttime: %d", firsttime); */
+ if (firsttime) {
+ char name[MAXPDSTRING];
+ canvas_makefilename(glist_getcanvas(x->x_glist), x->x_name->s_name, name, MAXPDSTRING);
+ sys_vgui(".x%x.c create rectangle %d %d %d %d -fill %s -tags %xGRID -outline %s\n",
+ glist_getcanvas(glist),
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + (x->x_num_col * W_CELL) + 1, text_ypix(&x->x_obj, glist) + (x->x_num_fil * H_CELL) + 1,
+ x->x_color_fons->s_name, x,x->x_color_marc->s_name);
+
+ canvas_fixlinesfor(glist_getcanvas(glist), (t_text*)x);
+ /* si hi elements a la cua els afegeix (redimensió) */
+ if(!cuaBuida(&x->x_cua))
+ {
+ path ig_path;
+ int nN = 0;
+ char nNstr[BYTES_NUM_TEMP];
+ Node *actual;
+ actual=x->x_cua.davanter;
+ do{
+ strcpy(ig_path,PATH_TEMPORAL);
+ sprintf(nNstr, "%d", nN);
+ strcat(ig_path,nNstr);
+ strcat(ig_path,".");
+ strcat(ig_path,FORMAT_MINIATURA);
+ /* post("reestablint la imatge %s", actual->pathFitxer); */
+ // videogrid_afegir_imatge(x,actual->pathFitxer);
+ convertir_img(actual->pathFitxer,FORMAT_MINIATURA, W_CELL, H_CELL, nN);
+ sys_vgui("image create photo img%x%d -file %s\n",x,nN,ig_path);
+ sys_vgui(".x%x.c create image %d %d -image img%x%d -tags %xS%d\n",
+ glist_getcanvas(x->x_glist),text_xpix(&x->x_obj, x->x_glist) + getX(x,nN) + (W_CELL/2), text_ypix(&x->x_obj, x->x_glist) + getY(x,nN) + (H_CELL/2),x,nN,x,nN);
+ actual = actual->seguent;
+ nN++;
+ }while(actual);
+ }
+ }
+ else {
+ sys_vgui(".x%x.c coords %xGRID %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),text_xpix(&x->x_obj, glist) + (x->x_num_col*W_CELL) + 1, text_ypix(&x->x_obj, glist) + (x->x_num_fil*H_CELL) + 1);
+ if(!cuaBuida(&x->x_cua))
+ {
+ int contador = 0;
+ while(contador < numNodes(&x->x_cua)){
+ sys_vgui(".x%x.c coords %xS%d \
+ %d %d\n",
+ glist_getcanvas(glist), x, contador,
+ text_xpix(&x->x_obj, x->x_glist) + getX(x,contador) + (W_CELL/2), text_ypix(&x->x_obj, x->x_glist) + getY(x,contador) + (H_CELL/2));
+ contador++;
+ }
+
+ /* char buf[800];
+ sprintf(buf, "pdtk_videogrid_table %%s %s %d %d\n", x->x_name->s_name, x->x_num_fil, x->x_num_col);
+ gfxstub_new(&x->x_obj.ob_pd, x, buf); */
+ }
+ }
+}
+
+/* borra videogrid */
+void videogrid_erase(t_videogrid* x,t_glist* glist)
+{
+ int maxim = x->x_num_fil * x->x_num_col;
+ path path_total;
+ char contador_str[2];
+ /* post("Entra a erase"); */
+ /* elimina les imatges */
+ int contador = 0;
+ while(contador < numNodes(&x->x_cua)){
+ sys_vgui(".x%x.c delete %xS%d\n", glist_getcanvas(x->x_glist), x, contador);
+ strcpy(path_total,PATH_TEMPORAL);
+ sprintf(contador_str,"%d", contador);
+ strcat(path_total,contador_str);
+ strcat(path_total,".");
+ strcat(path_total,FORMAT_MINIATURA);
+ if(unlink(path_total)){
+ /* post("Imatge temporal %s eliminada\n",path_total); */
+ }
+ contador++;
+ }
+
+ /* elimina el grid */
+ sys_vgui(".x%x.c delete %xGRID\n", glist_getcanvas(glist), x);
+ eliminar_imatges_temporals(maxim);
+}
+
+/* mètode de la clase que escriu un missatge al rebre un bang */
+void videogrid_bang(t_videogrid *x)
+{
+ /* post("Hello videogrid !!"); */
+ escriuCua(&x->x_cua);
+}
+
+/* mètode de la classe que es dispara al rebre una entrada de missatge amb [putvideo +string( com a paràmetre */
+void videogrid_putvideo(t_videogrid *x, t_symbol *entrada)
+{
+ /* comprova que existeixi el fitxer */
+ FILE *fitxer;
+ path e;
+ strcpy(e,entrada->s_name);
+ /* post("putvideo de %s\n", e); */
+
+ fitxer = fopen(e,"r");
+ if (!fitxer) {
+ post("Videogrid: Problema amb l'obertura del fitxer %s\n",e);
+ }
+ else {
+ /* post("s'encua la imatge %s\n", e); */
+ videogrid_afegir_imatge(x,e);
+ /*outlet_symbol(x->x_sortida, entrada);*/
+ }
+ /* post("putvideo amb img = %s\n", e); */
+}
+
+/* mètode de la classe que es dispara al rebre una entrada de missatge amb [putvideodir +string( com a paràmetre */
+void *videogrid_putvideodir_thread(t_videogrid *x)
+{
+ DIR *dirp;
+ struct dirent * direntp;
+ path nomImatge, directoriAnterior, pathActual;
+ int numEncuats = 0, numPosDir = 0;
+ int maxim;
+ if ((dirp = opendir(x->x_dir_canvi)) == NULL)
+ {
+ post("Videogrid: No es pot obrir el directori %s\n", x->x_dir_canvi);
+ }else{
+ maxim = x->x_num_fil * x->x_num_col;
+ strcpy(directoriAnterior, x->x_dir_actual);
+ strcpy(x->x_dir_actual, x->x_dir_canvi);
+ /* si es el mateix directori entrat l'ultim busca la ultima imatge afegida per a seguir a encuant a partir d'ella en endavant */
+ if(strcmp(directoriAnterior, x->x_dir_actual) == 0){
+ post("Videogrid: Repeteix directori %s\n", x->x_dir_actual);
+ while ( (direntp = readdir( dirp )) != NULL ){
+ /* es descarta el mateix directori, el directori anterior i tot el que no sigui un fitxer regular */
+ if((strcmp(direntp->d_name,"..") != 0)&&(strcmp(direntp->d_name,".") != 0)&&(direntp->d_type == DT_REG)){
+ /* incrementa la posició en el directori */
+ numPosDir++;
+ /* assolir la posició anterior en el directori */
+ if(numPosDir > x->x_dir_pos){
+ /* si el nombre de nodes encuats per aquest directori no supera el màxim encua el nou node */
+ if(numEncuats < maxim){
+ /* post("s'encua la imatge %s\n", direntp->d_name); */
+ /* concatena el path i el nom de la imatge */
+ strcpy(nomImatge,direntp->d_name);
+ strcpy(pathActual,x->x_dir_actual);
+ strcat(pathActual,"/");
+ strcat(pathActual,nomImatge);
+ pthread_mutex_lock(&x->x_lock);
+ videogrid_afegir_imatge(x, pathActual);
+ pthread_mutex_unlock(&x->x_lock);
+ /* incrementa en 1 per indicar el nombre de nodes encuats per aquest directori */
+ numEncuats++;
+ /* es desa la posició en el directori de l'últim node encuat */
+ x->x_dir_pos = numPosDir;
+ }
+ }
+ }
+ }
+ }else{
+ /* directori diferent omple la cua començant pel primer fitxer */
+ post("Videogrid: Nou directori %s \n", x->x_dir_actual);
+ while ( (direntp = readdir( dirp )) != NULL ){
+ /* es descarta el mateix directori, el directori anterior i tot el que no sigui un fitxer regular */
+ if((strcmp(direntp->d_name,"..") != 0)&&(strcmp(direntp->d_name,".") != 0)&&(direntp->d_type == DT_REG)){
+ /* incrementa la posició en el directori */
+ numPosDir++;
+ /* si el nombre de nodes encuats per aquest directori no supera el màxim enca el nou node */
+ if(numEncuats < maxim){
+ /* post("s'encua la imatge %s\n", direntp->d_name); */
+ /* concatena el path i el nom de la imatge */
+ strcpy(nomImatge,direntp->d_name);
+ strcpy(pathActual,x->x_dir_actual);
+ strcat(pathActual,"/");
+ strcat(pathActual,nomImatge);
+ pthread_mutex_lock(&x->x_lock);
+ videogrid_afegir_imatge(x, pathActual);
+ pthread_mutex_unlock(&x->x_lock);
+ /* incrementa en 1 per indicar el nombre de nodes encuats per aquest directori */
+ numEncuats++;
+ /* es desa la posició en el directori de l'últim node encuat */
+ x->x_dir_pos = numPosDir;
+ }
+ }
+ }
+ }
+ /* si la posicio de l'actual es la de l'utim fitxer del directori, inicialitza la posició */
+ if(x->x_dir_pos >= numPosDir) x->x_dir_pos = 0;
+ closedir(dirp);
+ }
+ /* escriu l'argument entrat */
+ /* post("Obtenint imatges del directori: %s ...",x->x_dir_canvi); */
+ /* envia a la sorida l'argument entrat */
+ /* outlet_symbol(x->x_sortida, entrada); */
+ pthread_exit(NULL);
+}
+
+void videogrid_putvideodir(t_videogrid *x, t_symbol *entrada)
+{
+
+ pthread_t unthread;
+ pthread_attr_t unatribut;
+ pthread_attr_init( &unatribut );
+
+ strcpy(x->x_dir_canvi,entrada->s_name);
+
+ // ---------------- THREAD CREAT -------------------------
+ pthread_mutex_init(&x->x_lock, NULL);
+ pthread_create(&unthread,&unatribut,(void *)videogrid_putvideodir_thread, x);
+ pthread_mutex_destroy(&x->x_lock);
+}
+
+static int videogrid_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit)
+{
+ t_videogrid* x = (t_videogrid *)z;
+ int x_pos = xpix - text_xpix(&x->x_obj, x->x_glist);
+ int y_pos = ypix - text_ypix(&x->x_obj, x->x_glist);
+ int xa, ya, postauler, contador, maxim;
+ path pathSortida;
+ Node *actual;
+ if (doit)
+ {
+ /* obtenir la posicio en el tauler */
+ xa = x_pos / W_CELL;
+ ya = (y_pos / H_CELL) * x->x_num_col;
+ postauler = ya + xa;
+ /* obtenir el path per enviar a la sortida */
+ if((!cuaBuida(&x->x_cua))&&(postauler < numNodes(&x->x_cua))){
+ contador = 0;
+ maxim = x->x_num_fil * x->x_num_col;
+ if(x->x_tauler_primer){
+ actual = x->x_tauler_primer;
+ while(contador <= postauler){
+ if(contador == postauler){
+ strcpy(pathSortida,actual->pathFitxer);
+ }
+ if(actual->seguent == NULL){
+ actual = x->x_cua.davanter;
+ }else{
+ actual = actual->seguent;
+ }
+ contador++;
+ }
+ outlet_symbol(x->x_sortida, gensym(pathSortida));
+ }
+ }
+ }
+ return (1);
+}
+
+static void videogrid_getrect(t_gobj *z, t_glist *glist,int *xp1, int *yp1, int *xp2, int *yp2)
+{
+ int cols, fils;
+ t_videogrid* x = (t_videogrid*)z;
+ cols = x->x_num_col;
+ fils = x->x_num_fil;
+ *xp1 = text_xpix(&x->x_obj, glist);
+ *yp1 = text_ypix(&x->x_obj, glist);
+ *xp2 = text_xpix(&x->x_obj, glist) + (cols*W_CELL);
+ *yp2 = text_ypix(&x->x_obj, glist) + (fils*H_CELL);
+ /* post("Esta amb el ratoli en el punt %d %d %d %d o son els vetexs de la caixa... es/bd", xp1, yp1, xp2, yp2); */
+}
+
+static void videogrid_displace(t_gobj *z, t_glist *glist,int dx, int dy)
+{
+ /* post("Entra a displace amb dx %d i dy %d", dx, dy); */
+ t_videogrid *x = (t_videogrid *)z;
+ x->x_obj.te_xpix += dx;
+ x->x_obj.te_ypix += dy;
+ sys_vgui(".x%x.c coords %xGRID %d %d %d %d\n",
+ glist_getcanvas(glist), x,
+ text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
+ text_xpix(&x->x_obj, glist) + (x->x_num_col*W_CELL), text_ypix(&x->x_obj, glist) + (x->x_num_fil*H_CELL));
+ videogrid_drawme(x, glist, 0);
+ canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x);
+}
+
+static void videogrid_select(t_gobj *z, t_glist *glist, int state)
+{
+ /* post("Entra select amb state %d", state); */
+ t_videogrid *x = (t_videogrid *)z;
+ if (state) {
+ /* post("Videogrid seleccionat"); */
+ sys_vgui(".x%x.c itemconfigure %xGRID -outline #0000FF\n", glist_getcanvas(glist), x);
+ }
+ else {
+ /* post("Videogrid deseleccionat"); */
+ sys_vgui(".x%x.c itemconfigure %xGRID -outline %s\n", glist_getcanvas(glist), x, x->x_color_marc->s_name);
+ }
+}
+
+static void videogrid_delete(t_gobj *z, t_glist *glist)
+{
+ /* post("Entra a delete"); */
+ t_text *x = (t_text *)z;
+ canvas_deletelinesfor(glist_getcanvas(glist), x);
+}
+
+static void videogrid_vis(t_gobj *z, t_glist *glist, int vis)
+{
+ /* post("Entra a vist amb vis %d", vis); */
+ t_videogrid* s = (t_videogrid*)z;
+ if (vis)
+ videogrid_drawme(s, glist, 1);
+ else
+ videogrid_erase(s,glist);
+}
+
+
+static void videogrid_save(t_gobj *z, t_binbuf *b)
+{
+ /* post("Entra a save"); */
+ t_videogrid *x = (t_videogrid *)z;
+ /* crea la cadena de paths per desar */
+ /* 100 possibles paths com a màxim a 512 cada path*/
+ /* char cadenaPaths[51200];*/
+ char *cadenaPaths, *cadenaPathsInicials;
+ path ultimPath = "";
+ cadenaPaths = (char *)malloc(51200*sizeof(char));
+ strcpy(cadenaPaths,"");
+ cadenaPathsInicials = (char *)malloc(51200*sizeof(char));
+ strcpy(cadenaPathsInicials,"");
+ /*strcpy(cadenaPaths,(char *)argv[5].a_w.w_symbol->s_name);*/
+ if(!cuaBuida(&x->x_cua))
+ {
+ Node *actual;
+ int maxim = x->x_num_fil * x->x_num_col;
+ int contador = x->x_ultima_img + 1;
+
+ if (contador > maxim) {
+ contador = 0;
+ }
+ /* printf("\n contador %d i maxim %d i laultimaPOS %d \n", contador, maxim, x->x_ultima_img); */
+ /*
+ strcat(cadenaPaths, actual->pathFitxer);
+ strcat(cadenaPaths, "1|\n");
+ contador ++;
+ */
+ /* prenem el davanter de la cua */
+ actual=x->x_cua.davanter;
+
+ while(contador < numNodes(&x->x_cua)){
+ /* afegim els paths del davanter fins a l'ultim node al tauler */
+ strcat(cadenaPaths, actual->pathFitxer);
+ strcat(cadenaPaths, "|");
+ actual = actual->seguent;
+ contador ++;
+ }
+ if(actual != x->x_cua.final){
+ /* ara resten els de de l'inici del tauler fins al final de la cua */
+ while(actual != x->x_cua.final){
+ strcat(cadenaPathsInicials, actual->pathFitxer);
+ strcat(cadenaPathsInicials, "|");
+ actual = actual->seguent;
+ }
+ /* afegeix l'últim */
+ strcat(ultimPath, actual->pathFitxer);
+ strcat(ultimPath, "|");
+ /* afegeix l'ultim de la cua */
+ strcat(cadenaPathsInicials, ultimPath);
+ }else{
+ if(x->x_ultima_img == 0){
+ strcat(ultimPath, actual->pathFitxer);
+ strcat(ultimPath, "|");
+ strcat(cadenaPathsInicials, ultimPath);
+ }
+ }
+ /* ordena el paths segons aparicio en el tauler */
+ strcat(cadenaPathsInicials, cadenaPaths);
+ /* DE MOMENT NO DESA ELS PATHS */
+ strcat(cadenaPathsInicials, "");
+ /* printf("%s",cadenaPathsInicials); */
+ }
+
+ binbuf_addv(b, "ssiissiisss", gensym("#X"),gensym("obj"),
+ x->x_obj.te_xpix, x->x_obj.te_ypix,
+ gensym("videogrid"),x->x_name,x->x_num_fil,x->x_num_col,x->x_color_fons,x->x_color_marc,gensym(cadenaPathsInicials));
+ binbuf_addv(b, ";");
+}
+
+static void videogrid_properties(t_gobj *z, t_glist *owner)
+{
+ char buf[800];
+ t_videogrid *x=(t_videogrid *)z;
+
+ /* post("Es crida a pdtk_videogrid dialog passant nom = %s\n fils = %d \t cols = %d \t color fons = %s \t color marc = %s\n", x->x_name->s_name, x->x_num_fil, x->x_num_col, x->x_color_fons->s_name, x->x_color_marc->s_name); */
+ sprintf(buf, "pdtk_videogrid_dialog %%s %s %d %d %s %s\n",
+ x->x_name->s_name, x->x_num_fil, x->x_num_col, x->x_color_fons->s_name, x->x_color_marc->s_name);
+ /* post("videogrid_properties : %s", buf ); */
+ gfxstub_new(&x->x_obj.ob_pd, x, buf);
+}
+
+static void videogrid_dialog(t_videogrid *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int maxim, nfil, ncol, maxdigit;
+ if ( !x ) {
+ post("Videogrid: error_ intent de modificar le propietats d'un objecte inexistent\n");
+ }
+ if ( argc != 5 )
+ {
+ post("Videogrid: error_ sobre el nombre d'arguments ( 5 enlloc de %d )\n",argc);
+ return;
+ }
+ if (argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || argv[2].a_type != A_FLOAT || argv[3].a_type != A_SYMBOL || argv[4].a_type != A_SYMBOL)
+ {
+ post("Videogrid: error_ algun dels arguments no es del tipus adequat\n");
+ return;
+ }
+ x->x_name = argv[0].a_w.w_symbol;
+ nfil = (int)argv[1].a_w.w_float;
+ ncol = (int)argv[2].a_w.w_float;
+ x->x_color_fons = argv[3].a_w.w_symbol;
+ x->x_color_marc = argv[4].a_w.w_symbol;
+ /* el màxim es fixa pel nombre de digits utilitzats pel nom de la imatge temporal */
+ maxdigit = pow(10,BYTES_NUM_TEMP);
+ if((nfil*ncol) <= maxdigit){
+ if((nfil*ncol) > 0){
+ x->x_num_fil = nfil;
+ x->x_num_col = ncol;
+ }else{
+ post("Videogrid: El nombre de files i columnes són inferiors al mímin permès: 1 casella\n",maxdigit);
+ }
+ }else{
+ post("Videogrid: El nombre de files i columnes excedeixen del màxim permès: un total de %d caselles\n",maxdigit);
+ }
+
+ post("Videogrid: Valors modificats_ nom = %s\n fils = %d \t cols = %d\n", x->x_name->s_name, x->x_num_fil, x->x_num_col);
+ /* elimina els nodes no representables amb la nova configuració */
+ maxim = x->x_num_fil * x->x_num_col;
+ int extret;
+ videogrid_erase(x, x->x_glist);
+ /* si hi ha més nodes a la cua que el maxim */
+ while((numNodes(&x->x_cua)) > maxim){
+ /* desencuem */
+ extret = desencuar(&x->x_cua);
+ }
+ /* al reestablir el tamany del tauler cal saber la posició de l'últim element */
+ x->x_ultima_img = numNodes(&x->x_cua) - 1;
+ if (x->x_ultima_img < 0) x->x_ultima_img = 0;
+ x->x_tauler_primer = x->x_cua.davanter;
+ videogrid_drawme(x, x->x_glist, 1);
+}
+
+t_widgetbehavior videogrid_widgetbehavior;
+
+static void videogrid_setwidget(void)
+{
+ /* post("Entra a setwidget"); */
+ videogrid_widgetbehavior.w_getrectfn = videogrid_getrect;
+ videogrid_widgetbehavior.w_displacefn = videogrid_displace;
+ videogrid_widgetbehavior.w_selectfn = videogrid_select;
+ videogrid_widgetbehavior.w_activatefn = NULL;
+ videogrid_widgetbehavior.w_deletefn = videogrid_delete;
+ videogrid_widgetbehavior.w_visfn = videogrid_vis;
+ /* clic del ratoli */
+ videogrid_widgetbehavior.w_clickfn = videogrid_click;
+
+#if PD_MINOR_VERSION < 37
+ videogrid_widgetbehavior.w_savefn = videogrid_save;
+ videogrid_widgetbehavior.w_propertiesfn = videogrid_properties;
+#endif
+
+}
+
+/* el constructor de la classe*/
+static void *videogrid_new(t_symbol* name, int argc, t_atom *argv)
+{
+ /* instanciació del nou objecte */
+ t_videogrid *x = (t_videogrid *)pd_new(videogrid_class);
+ /* crea una sortida per l'objecte*/
+ x->x_sortida = outlet_new(&x->x_obj,&s_symbol);
+ /* s'obté el canvas de pd */
+ x->x_glist = (t_glist*) canvas_getcurrent();
+
+ /* posició en el tauler de la última imatge afegida */
+ x->x_ultima_img = 0;
+ /* posició de l'últim fitxer del directori encuat */
+ x->x_dir_pos = 0;
+ /* apuntador al primer element en el tauler */
+ x->x_tauler_primer = NULL;
+ /* fixa el nom de l'objecte */
+ char nom[15];
+ sprintf(nom, "videogrid%d", ++videogridcount);
+ name = gensym(nom);
+ x->x_name = name;
+ /* amb aquest nom es prepara per poder rebre dades */
+ pd_bind(&x->x_obj.ob_pd, x->x_name);
+ /* crea la cua de nodes */
+ crearCua(&x->x_cua);
+ post("NOU videogrid: s'han entrat %d arguments\n", argc);
+
+ if (argc != 0)
+ {
+ post("NOU videogrid: s'obre un objecte existent o amb arguments definits\n");
+ /* x->x_name */
+ x->x_num_fil = (int)atom_getintarg(1, argc, argv);
+ x->x_num_col = (int)atom_getintarg(2, argc, argv);
+ x->x_color_fons = argv[3].a_w.w_symbol;
+ x->x_color_marc = argv[4].a_w.w_symbol;
+ post("!!!NOU videogrid: s'han entrat %d arguments\n", argc);
+ if(argc == 6){
+ /* llegir la cadena de paths | afegir els paths a la cua */
+ char *cadenaPaths;
+ cadenaPaths = (char *)malloc(51200*sizeof(char));
+ strcpy(cadenaPaths,(char *)argv[5].a_w.w_symbol->s_name);
+ /* printf("Es carreguen els paths %s --- %s **** %s\n", cadenaPaths, argv[5].a_w.w_symbol->s_name,argv[3].a_w.w_symbol->s_name); */
+ /* split */
+
+ char *token;
+ t_symbol *tt;
+ for ( token = strtok(argv[5].a_w.w_symbol->s_name,"|");
+ token != NULL;
+ token = strtok(NULL,"|") ){
+ tt = gensym(token);
+
+ /* printf("AFEGINT CARREGANT %s\n",tt->s_name); */
+ /* videogrid_putvideo(x,tt); */
+ /* DE MOMENT NO AFEGEIX ELS PATHS */
+ /* videogrid_afegir_imatge(x,tt->s_name); */
+ }
+ /*
+ token = strtok(cadenaPaths,"|");
+ while(token){
+ tt = gensym(token);
+ printf("AFEGINT CARREGANT %s\n",tt->s_name);
+ videogrid_putvideo(x,tt);
+ token = strtok(NULL,"|");
+ }
+ */
+ free(cadenaPaths);
+ }
+ }else{
+ /* crea un objecte nou */
+ post("NOU videogrid: es crea un objecte nou\n");
+ /* fixa el nombre de files */
+ x->x_num_fil = 3;
+ /* fixa el nombre de columnes */
+ x->x_num_col = 5;
+
+ /* colors de fons i de marc*/
+ x->x_color_fons = gensym("#F0F0F0");
+ x->x_color_marc = gensym("#0F0F0F");
+ }
+ /* printf("S'ha instanciat un videogrid anomenat %s amb les caracteristiques seguents:",x->x_name->s_name);
+ printf("Nombre de files %d - Nombre de columnes: %d", x->x_num_fil, x->x_num_col); */
+
+ return (x);
+}
+
+static void videogrid_destroy(t_videogrid *x){
+ /* elimina el contingut de la cua */
+ eliminarCua(&x->x_cua);
+ post("Videogrid eliminat");
+}
+
+/* generacio d'una nova classe */
+/* al carregar la nova llibreria my_lib pd intenta cridar la funció my_lib_setup */
+/* aquesta crea la nova classe i les seves propietats només un sol cop */
+
+void videogrid_setup(void)
+{
+ /* post("Entra a setup per generar la classe videogrid"); */
+ #include "videogrid.tk2c"
+ /*
+ sense pas d'arguments
+ videogrid_class = class_new(gensym("videogrid"),
+ (t_newmethod)videogrid_new,
+ (t_method)videogrid_destroy,
+ sizeof(t_videogrid),
+ CLASS_DEFAULT,
+ A_DEFSYM,
+ 0);
+ amb pas d'arguments:
+ */
+ videogrid_class = class_new(gensym("videogrid"),
+ (t_newmethod)videogrid_new,
+ (t_method)videogrid_destroy,
+ sizeof(t_videogrid),
+ CLASS_DEFAULT,
+ A_GIMME,
+ 0);
+ /* class_new crea la nova classe retornant un punter al seu prototipus,
+ el primer argument es el nom simbolic de la classe,
+ el segon i tercer corresponen al constructor i destructor de la classe respectivament,
+ (el constructor instancia un objecte i inicialitza les seves dades cada cop que es crea un objecte
+ el destructor allibera la memoria reservada al destruid l'objecte per qualsevol causa)
+ el quart correspon a la mida de l'estructura de dades, per tal de poder reservar la memoria necessària,
+ el cinquè influeix en el mòde de representació gràfica del objectes. Per defecte CLASS_DEFAULT o ``0',
+ la resta d'arguments defineixen els arguments de l'objecte i el seu tipus, la llista acaba amb 0
+ */
+
+ /* afegeix el mètode helloworld_bang a la classe helloworld_class */
+ class_addbang(videogrid_class, videogrid_bang);
+
+ /* afegeix el mètode videogrid_putvideo a la classe videogrid per a entrades de missatge
+ que inicien amb putvideo i una cadena string com a argument */
+ class_addmethod(videogrid_class,(t_method)videogrid_putvideo,gensym("putvideo"), A_DEFSYMBOL, 0);
+
+ /* afegeix el mètode videogrid_putvideodir a la classe videogrid per a entrades de missatge
+ que inicien amb putvideodir i una cadena string com a argument */
+ class_addmethod(videogrid_class,(t_method)videogrid_putvideodir,gensym("putvideodir"), A_DEFSYMBOL, 0);
+ /* afegeix un metode per a modificar el valor de les propietats de l'objecte */
+ class_addmethod(videogrid_class, (t_method)videogrid_dialog, gensym("dialog"), A_GIMME, 0);
+ /* afegeix un metode per l'obtencio de la posicio del clic del ratolí */
+ class_addmethod(videogrid_class, (t_method)videogrid_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+ /* inicia el comportament de videogrid */
+ videogrid_setwidget();
+
+#if PD_MINOR_VERSION >= 37
+ class_setsavefn(videogrid_class,&videogrid_save);
+ class_setpropertiesfn(videogrid_class, videogrid_properties);
+#endif
+
+ /* afegeix el mètode videogrid_widgetbehavior al la classe videogrid per a la creació de l'element visual */
+ class_setwidget(videogrid_class,&videogrid_widgetbehavior);
+ class_sethelpsymbol(videogrid_class, gensym("videogrid.pd"));
+}
diff --git a/videogrid/videogrid.tk b/videogrid/videogrid.tk
new file mode 100644
index 0000000..9505b6b
--- /dev/null
+++ b/videogrid/videogrid.tk
@@ -0,0 +1,146 @@
+############ procediments per videogrid -- slario(at)gmail.com [a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] #########
+
+proc videogrid_apply {id} {
+# strip "." from the TK id to make a variable name suffix
+ set vid [string trimleft $id .]
+
+# for each variable, make a local variable to hold its name...
+ set var_graph_name [concat graph_name_$vid]
+ global $var_graph_name
+ set var_graph_num_fil [concat graph_num_fil_$vid]
+ global $var_graph_num_fil
+ set var_graph_num_col [concat graph_num_col_$vid]
+ global $var_graph_num_col
+ set var_graph_color_fons [concat graph_color_fons_$vid]
+ global $var_graph_color_fons
+ set var_graph_color_marc [concat graph_color_marc_$vid]
+ global $var_graph_color_marc
+
+
+ set cmd [concat $id dialog \
+ [eval concat $$var_graph_name] \
+ [eval concat $$var_graph_num_fil] \
+ [eval concat $$var_graph_num_col] \
+ [eval concat $$var_graph_color_fons] \
+ [eval concat $$var_graph_color_marc] \
+ \;]
+#puts stderr $cmd
+ pd $cmd
+}
+
+proc videogrid_cancel {id} {
+ set cmd [concat $id cancel \;]
+#puts stderr $cmd
+ pd $cmd
+}
+
+proc videogrid_ok {id} {
+ videogrid_apply $id
+ videogrid_cancel $id
+}
+
+proc pdtk_videogrid_dialog {id name num_fil num_col color_fons color_marc} {
+ set vid [string trimleft $id .]
+ set var_graph_name [concat graph_name_$vid]
+ global $var_graph_name
+ set var_graph_num_fil [concat graph_num_fil_$vid]
+ global $var_graph_num_fil
+ set var_graph_num_col [concat graph_num_col_$vid]
+ global $var_graph_num_col
+ set var_graph_color_fons [concat graph_color_fons_$vid]
+ global $var_graph_color_fons
+ set var_graph_color_marc [concat graph_color_marc_$vid]
+ global $var_graph_color_marc
+
+ set $var_graph_name $name
+ set $var_graph_num_fil $num_fil
+ set $var_graph_num_col $num_col
+ set $var_graph_color_fons $color_fons
+ set $var_graph_color_marc $color_marc
+
+ toplevel $id
+ wm title $id {videogrid}
+ wm protocol $id WM_DELETE_WINDOW [concat videogrid_cancel $id]
+
+ label $id.label -text {VIDEOGRID PROPERTIES}
+ pack $id.label -side top
+
+ frame $id.buttonframe
+ pack $id.buttonframe -side bottom -fill x -pady 2m
+ button $id.buttonframe.cancel -text {Cancel}\
+ -command "videogrid_cancel $id"
+ button $id.buttonframe.apply -text {Apply}\
+ -command "videogrid_apply $id"
+ button $id.buttonframe.ok -text {OK}\
+ -command "videogrid_ok $id"
+ pack $id.buttonframe.cancel -side left -expand 1
+ pack $id.buttonframe.apply -side left -expand 1
+ pack $id.buttonframe.ok -side left -expand 1
+
+ frame $id.1rangef
+ pack $id.1rangef -side top
+ label $id.1rangef.lname -text "Nom :"
+ entry $id.1rangef.name -textvariable $var_graph_name -width 7
+ pack $id.1rangef.lname $id.1rangef.name -side left
+
+ frame $id.2rangef
+ pack $id.2rangef -side top
+ label $id.2rangef.lnum_fil -text "Fils :"
+ entry $id.2rangef.num_fil -textvariable $var_graph_num_fil -width 7
+ pack $id.2rangef.lnum_fil $id.2rangef.num_fil -side left
+
+ frame $id.3rangef
+ pack $id.3rangef -side top
+ label $id.3rangef.lnum_col -text "Cols :"
+ entry $id.3rangef.num_col -textvariable $var_graph_num_col -width 7
+ pack $id.3rangef.lnum_col $id.3rangef.num_col -side left
+
+ frame $id.4rangef
+ pack $id.4rangef -side top
+ label $id.4rangef.lcolor_fons -text "Color fons :"
+ entry $id.4rangef.color_fons -textvariable $var_graph_color_fons -width 7
+ pack $id.4rangef.lcolor_fons $id.4rangef.color_fons -side left
+
+ frame $id.5rangef
+ pack $id.5rangef -side top
+ label $id.5rangef.lcolor_marc -text "Color marc :"
+ entry $id.5rangef.color_marc -textvariable $var_graph_color_marc -width 7
+ pack $id.5rangef.lcolor_marc $id.5rangef.color_marc -side left
+
+
+ bind $id.1rangef.name <KeyPress-Return> [concat videogrid_ok $id]
+ bind $id.2rangef.num_fil <KeyPress-Return> [concat videogrid_ok $id]
+ bind $id.3rangef.num_col <KeyPress-Return> [concat videogrid_ok $id]
+ bind $id.4rangef.color_fons <KeyPress-Return> [concat videogrid_ok $id]
+ bind $id.5rangef.color_marc <KeyPress-Return> [concat videogrid_ok $id]
+
+ focus $id.1rangef.name
+}
+
+proc table {w content args} {
+ frame $w -bg black
+ set r 0
+ foreach row $content {
+ set fields {}
+ set c 0
+ foreach col $row {
+ # lappend fields [label $w.$r/$c -text $col]
+ set img [image create photo -file $col]
+ lappend fields [label $w.$r/$c -image $img]
+ incr c
+ }
+ eval grid $fields -sticky news -padx 1 -pady 1
+ incr r
+ }
+ set w
+}
+
+proc pdtk_videogrid_table {id name num_fil num_col} {
+ table .tauler {
+ {sll80x60.gif 3160x120.gif sll80x60.gif}
+ {sll80x60.gif sll80x60.gif sll80x60.gif}
+ {sll80x60.ppm sll80x60.gif 3160x120.gif}
+ }
+ pack .tauler
+}
+############ FINAL procediments per videogrid -- slario(at)gmail.com [a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] ######### \ No newline at end of file
diff --git a/videogrid/videogrid.tk2c b/videogrid/videogrid.tk2c
new file mode 100644
index 0000000..69aa210
--- /dev/null
+++ b/videogrid/videogrid.tk2c
@@ -0,0 +1,115 @@
+// ########### procediments per videogrid -- slario(at)gmail.com [a partir del codi del grid de l'Ives: ydegoyon(at)free.fr] #########
+sys_gui("proc videogrid_apply {id} {\n");
+// strip "." from the TK id to make a variable name suffix
+sys_gui("set vid [string trimleft $id .]\n");
+// for each variable, make a local variable to hold its name...
+sys_gui("set var_graph_name [concat graph_name_$vid]\n");
+sys_gui("global $var_graph_name\n");
+sys_gui("set var_graph_num_fil [concat graph_num_fil_$vid]\n");
+sys_gui("global $var_graph_num_fil\n");
+sys_gui("set var_graph_num_col [concat graph_num_col_$vid]\n");
+sys_gui("global $var_graph_num_col\n");
+sys_gui("set var_graph_color_fons [concat graph_color_fons_$vid]\n");
+sys_gui("global $var_graph_color_fons\n");
+sys_gui("set var_graph_color_marc [concat graph_color_marc_$vid]\n");
+sys_gui("global $var_graph_color_marc\n");
+sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_num_fil] [eval concat $$var_graph_num_col] [eval concat $$var_graph_color_fons] [eval concat $$var_graph_color_marc] \\;]\n");
+// puts stderr $cmd
+sys_gui("pd $cmd\n");
+sys_gui("}\n");
+sys_gui("proc videogrid_cancel {id} {\n");
+sys_gui("set cmd [concat $id cancel \\;]\n");
+// puts stderr $cmd
+sys_gui("pd $cmd\n");
+sys_gui("}\n");
+sys_gui("proc videogrid_ok {id} {\n");
+sys_gui("videogrid_apply $id\n");
+sys_gui("videogrid_cancel $id\n");
+sys_gui("}\n");
+sys_gui("proc pdtk_videogrid_dialog {id name num_fil num_col color_fons color_marc} {\n");
+sys_gui("set vid [string trimleft $id .]\n");
+sys_gui("set var_graph_name [concat graph_name_$vid]\n");
+sys_gui("global $var_graph_name\n");
+sys_gui("set var_graph_num_fil [concat graph_num_fil_$vid]\n");
+sys_gui("global $var_graph_num_fil\n");
+sys_gui("set var_graph_num_col [concat graph_num_col_$vid]\n");
+sys_gui("global $var_graph_num_col\n");
+sys_gui("set var_graph_color_fons [concat graph_color_fons_$vid]\n");
+sys_gui("global $var_graph_color_fons\n");
+sys_gui("set var_graph_color_marc [concat graph_color_marc_$vid]\n");
+sys_gui("global $var_graph_color_marc\n");
+sys_gui("set $var_graph_name $name\n");
+sys_gui("set $var_graph_num_fil $num_fil\n");
+sys_gui("set $var_graph_num_col $num_col\n");
+sys_gui("set $var_graph_color_fons $color_fons\n");
+sys_gui("set $var_graph_color_marc $color_marc\n");
+sys_gui("toplevel $id\n");
+sys_gui("wm title $id {videogrid}\n");
+sys_gui("wm protocol $id WM_DELETE_WINDOW [concat videogrid_cancel $id]\n");
+sys_gui("label $id.label -text {VIDEOGRID PROPERTIES}\n");
+sys_gui("pack $id.label -side top\n");
+sys_gui("frame $id.buttonframe\n");
+sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
+sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"videogrid_cancel $id\"\n");
+sys_gui("button $id.buttonframe.apply -text {Apply} -command \"videogrid_apply $id\"\n");
+sys_gui("button $id.buttonframe.ok -text {OK} -command \"videogrid_ok $id\"\n");
+sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
+sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
+sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
+sys_gui("frame $id.1rangef\n");
+sys_gui("pack $id.1rangef -side top\n");
+sys_gui("label $id.1rangef.lname -text \"Nom :\"\n");
+sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 7\n");
+sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n");
+sys_gui("frame $id.2rangef\n");
+sys_gui("pack $id.2rangef -side top\n");
+sys_gui("label $id.2rangef.lnum_fil -text \"Fils :\"\n");
+sys_gui("entry $id.2rangef.num_fil -textvariable $var_graph_num_fil -width 7\n");
+sys_gui("pack $id.2rangef.lnum_fil $id.2rangef.num_fil -side left\n");
+sys_gui("frame $id.3rangef\n");
+sys_gui("pack $id.3rangef -side top\n");
+sys_gui("label $id.3rangef.lnum_col -text \"Cols :\"\n");
+sys_gui("entry $id.3rangef.num_col -textvariable $var_graph_num_col -width 7\n");
+sys_gui("pack $id.3rangef.lnum_col $id.3rangef.num_col -side left\n");
+sys_gui("frame $id.4rangef\n");
+sys_gui("pack $id.4rangef -side top\n");
+sys_gui("label $id.4rangef.lcolor_fons -text \"Color fons :\"\n");
+sys_gui("entry $id.4rangef.color_fons -textvariable $var_graph_color_fons -width 7\n");
+sys_gui("pack $id.4rangef.lcolor_fons $id.4rangef.color_fons -side left\n");
+sys_gui("frame $id.5rangef\n");
+sys_gui("pack $id.5rangef -side top\n");
+sys_gui("label $id.5rangef.lcolor_marc -text \"Color marc :\"\n");
+sys_gui("entry $id.5rangef.color_marc -textvariable $var_graph_color_marc -width 7\n");
+sys_gui("pack $id.5rangef.lcolor_marc $id.5rangef.color_marc -side left\n");
+sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat videogrid_ok $id]\n");
+sys_gui("bind $id.2rangef.num_fil <KeyPress-Return> [concat videogrid_ok $id]\n");
+sys_gui("bind $id.3rangef.num_col <KeyPress-Return> [concat videogrid_ok $id]\n");
+sys_gui("bind $id.4rangef.color_fons <KeyPress-Return> [concat videogrid_ok $id]\n");
+sys_gui("bind $id.5rangef.color_marc <KeyPress-Return> [concat videogrid_ok $id]\n");
+sys_gui("focus $id.1rangef.name\n");
+sys_gui("}\n");
+sys_gui("proc table {w content args} {\n");
+sys_gui("frame $w -bg black\n");
+sys_gui("set r 0\n");
+sys_gui("foreach row $content {\n");
+sys_gui("set fields {}\n");
+sys_gui("set c 0\n");
+sys_gui("foreach col $row {\n");
+// lappend fields [label $w.$r/$c -text $col]
+sys_gui("set img [image create photo -file $col]\n");
+sys_gui("lappend fields [label $w.$r/$c -image $img]\n");
+sys_gui("incr c\n");
+sys_gui("}\n");
+sys_gui("eval grid $fields -sticky news -padx 1 -pady 1\n");
+sys_gui("incr r\n");
+sys_gui("}\n");
+sys_gui("set w\n");
+sys_gui("}\n");
+sys_gui("proc pdtk_videogrid_table {id name num_fil num_col} {\n");
+sys_gui("table .tauler {\n");
+sys_gui("{sll80x60.gif 3160x120.gif sll80x60.gif}\n");
+sys_gui("{sll80x60.gif sll80x60.gif sll80x60.gif}\n");
+sys_gui("{sll80x60.ppm sll80x60.gif 3160x120.gif}\n");
+sys_gui("}\n");
+sys_gui("pack .tauler\n");
+sys_gui("}\n");