sozi-12.05.orig/0000755000000000000000000000000011765605665012163 5ustar rootrootsozi-12.05.orig/CMakeLists.txt0000664000000000000000000000300311752172636014712 0ustar rootrootCMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(sozi) ################################################################################ ### Compute the sozi version with the current date ################################################################################ IF (WIN32) # FIXME EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE SOZI_VERSION) STRING(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" SOZI_VERSION ${SOZI_VERSION}) ELSEIF(UNIX) EXECUTE_PROCESS(COMMAND "date" "+%y.%m-%d%H%M%S" OUTPUT_VARIABLE SOZI_VERSION) STRING(REPLACE "\n" "" SOZI_VERSION ${SOZI_VERSION}) ELSE (WIN32) MESSAGE(SEND_ERROR "date not implemented") SET(SOZI_VERSION 000000) ENDIF (WIN32) #MESSAGE(STATUS "SOZI_VERSION=${SOZI_VERSION}") ################################################################################ ### Recurse to subfolders ################################################################################ ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(player) ADD_SUBDIRECTORY(editors) ################################################################################ ### Packaging ################################################################################ SET(CPACK_PACKAGE_NAME "sozi") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sozi is a zooming presentation program") SET(CPACK_PACKAGE_VERSION "${SOZI_VERSION}") SET(CPACK_GENERATOR "TGZ") SET(CPACK_ARCHIVE_COMPONENT_INSTALL "ON") SET(CPACK_COMPONENTS_GROUPING "IGNORE") INCLUDE(CPack) sozi-12.05.orig/Makefile0000664000000000000000000000370411752172636013622 0ustar rootroot VERSION := $(shell date +%y.%m-%d%H%M%S) PLAYER_JS := $(wildcard player/js/*.js) EXTRAS_JS := $(wildcard player/extras/*.js) #MINIFY_OPT += --nomunge JUICER_OPT += --force JUICER_OPT += --skip-verification # JUICER_OPT += --minifyer none MINIFY := juicer merge $(JUICER_OPT) --arguments "$(MINIFY_OPT)" SRC := \ $(wildcard editors/inkscape/*.py) \ $(wildcard editors/inkscape/extras/*.py) \ $(wildcard editors/inkscape/*.inx) \ $(wildcard editors/inkscape/*.png) \ $(wildcard editors/inkscape/extras/*.inx) \ $(wildcard doc/install*.html) \ $(wildcard doc/*license.txt) \ $(wildcard player/js/extras/*.js) \ player/js/sozi.js \ player/css/sozi.css TARGET := $(addprefix release/, $(notdir $(SRC))) INSTALL_DIR := $(HOME)/.config/inkscape/extensions TIMESTAMP := release/sozi-timestamp-$(VERSION) .PHONY: zip verify minify install timestamp clean all: zip zip: release/sozi-release-$(VERSION).zip verify: $(PLAYER_JS) $(EXTRAS_JS) juicer verify $^ minify: release/sozi.js release/sozi.css install: $(TARGET) cp release/*.inx $(INSTALL_DIR) cp release/*.py $(INSTALL_DIR) cp release/*.js $(INSTALL_DIR) cp release/*.css $(INSTALL_DIR) cp release/*.svg $(INSTALL_DIR) timestamp: release/sozi-timestamp-$(VERSION) $(TIMESTAMP): touch $@ release/sozi-release-$(VERSION).zip: $(TARGET) cd release ; zip $(notdir $@) $(notdir $^) release/sozi.js: $(PLAYER_JS) $(MINIFY) --output $@ player/js/sozi.js release/%.css: player/css/%.css $(MINIFY) --output $@ $< release/%.js: player/js/extras/%.js $(MINIFY) --output $@ $< release/%.py: editors/inkscape/%.py $(TIMESTAMP) sed "s/{{SOZI_VERSION}}/$(VERSION)/g" $< > $@ release/%.py: editors/inkscape/extras/%.py $(TIMESTAMP) sed "s/{{SOZI_VERSION}}/$(VERSION)/g" $< > $@ release/%.inx: editors/inkscape/%.inx cp $< $@ release/%.inx: editors/inkscape/extras/%.inx cp $< $@ release/%.png: editors/inkscape/%.png cp $< $@ release/%: doc/% cp $< $@ clean: rm -f $(TARGET) release/sozi-timestamp-* sozi-12.05.orig/README0000664000000000000000000000027211752172636013037 0ustar rootroot Sozi is a presentation tool using the SVG standard. Sozi is delivered as an extension for the SVG editor Inkscape. Installation and licensing details are provided in the doc/ folder. sozi-12.05.orig/doc/0000775000000000000000000000000011752172636012723 5ustar rootrootsozi-12.05.orig/doc/CMakeLists.txt0000664000000000000000000000052111752172636015461 0ustar rootrootSET(sozi_doc_files ${CMAKE_CURRENT_SOURCE_DIR}/GPL-license.txt ${CMAKE_CURRENT_SOURCE_DIR}/MIT-license.txt ${PROJECT_SOURCE_DIR}/README) ### Hugly hack SET(sozi_doc_files ${sozi_doc_files} PARENT_SCOPE) INSTALL(FILES ${sozi_doc_files} DESTINATION share/doc/sozi COMPONENT doc) sozi-12.05.orig/doc/GPL-license.txt0000664000000000000000000010451311752172636015532 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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. Copyright (C) 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 . 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: Copyright (C) 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 . 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 . sozi-12.05.orig/doc/MIT-license.txt0000664000000000000000000000210211752172636015530 0ustar rootrootCopyright (c) 2012 Guillaume Savaton, http://senshu.baierouge.fr Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sozi-12.05.orig/doc/install-en.html0000664000000000000000000001025211752172636015657 0ustar rootroot en:install

Installing Sozi

Installation on GNU/Linux

First install Inkscape and PyGTK using the package manager of your distribution.

Copy all files whose names begin with "sozi" from the archive sozi-release-[...].zip into one of these folders:

  • the extensions folder for all users (/usr/share/inkscape/extensions/)
  • or your personal inkscape extensions folder (~/.config/inkscape/extensions)

If you are updating from version 10.x, you should also remove files sozi_install.inx, sozi_install.py, sozi_edit_frame.inx and sozi_edit_frame.py from the installation folder.

Start or relaunch Inkscape. You should now see a submenu “Sozi” in the “Extensions” menu.

You can now create your first presentation.

Installation on Windows

These instructions have been tested with Inkscape 0.48, Python 2.6.6 and PyGTK 2.22.

  1. Download and install Inkscape. The default installation location is C:\Program Files\Inkscape.
  2. Download and install Python. The default installation location is C:\Python26.
  3. Download and install PyGTK (choose the "all-in-one" installer for Python 2.6). PyGTK is added to the Python installation tree.
  4. Copy all files from C:\Python26 to C:\Program Files\Inkscape\python.
  5. Copy all files whose names begin with "sozi" from the archive sozi-release-[...].zip into C:\Program Files\Inkscape\share\extensions.

If you are updating from version 10.x, you should also remove files sozi_install.inx, sozi_install.py, sozi_edit_frame.inx and sozi_edit_frame.py from the installation folder.

Start or relaunch Inkscape. You should now see a submenu “Sozi” in the “Extensions” menu.

You can now create your first presentation.

Installation on MacOS X

Damien Riquet provides detailed instructions to install Sozi on MacOS X Lion with the official release of Inkscape. This is the recommended method.

Using Fink (not recommended)

Currently, the most straightforward way to install Inkscape and Sozi on MacOS X consists in using the Fink distribution. However, the complete installation process can take several hours.

  1. Install Fink. During the setup process, enable the “unstable” tree.
  2. Install Inkscape, lxml and PyGTK by typing the following command in a terminal window:
    fink install inkscape python lxml-py27 pygtk2-gtk-py27
  3. Copy all files whose names begin with "sozi" from the archive sozi-release-[...].zip into /sw/share/inkscape/extensions.

If you are updating from version 10.x, you should also remove files sozi_install.inx, sozi_install.py, sozi_edit_frame.inx and sozi_edit_frame.py from the installation folder.

Start or relaunch Inkscape (using the command line). You should now see a submenu “Sozi” in the “Extensions” menu.

You can now create your first presentation.

sozi-12.05.orig/doc/install-fr.html0000664000000000000000000001142211752172636015664 0ustar rootroot fr:installer

Installer Sozi

Installation pour GNU/Linux

Vous devez d'abord installer Inkscape et PyGTK en utilisant le gestionnaire de paquets de votre distribution.

Parmi les fichiers provenant de l'archive sozi-release-[...].zip, copiez ceux dont le nom commence par "sozi" dans l'un des dossiers suivants :

  • dans le dossier des extensions disponibles pour tous les utilisateurs (/usr/share/inkscape/extensions/)
  • ou dans votre dossier personnel (~/.config/inkscape/extensions)

Si vous mettez à jour à partir d'une version 10.x, vous devez supprimer les fichiers sozi_install.inx, sozi_install.py, sozi_edit_frame.inx et sozi_edit_frame.py déjà présents dans le dossier d'installation.

Démarrez ou relancez l'application Inkscape. Vous devez voir apparaître un sous-menu “Sozi” dans le menu “Extensions”.

À présent, vous pouvez créer votre première présentation.

Installation pour Windows

Ces instructions ont été testées pour la version 0.48 d'Inkscape avec Python 2.6.6 et PyGTK 2.22.

  1. Téléchargez et installez Inkscape. Par défaut le dossier d'installation est C:\Program Files\Inkscape.
  2. Téléchargez et installez l'environnement d'exécution Python. Par défaut, le dossier d'installation est C:\Python26.
  3. Téléchargez et installez la bibliothèque PyGTK (sélectionnez l'installeur "all-in-one" pour Python 2.6). Les fichiers sont installés dans l'arborescence de Python.
  4. Copiez tous les fichiers du dossier C:\Python26 vers C:\Program Files\Inkscape\python.
  5. Parmi les fichiers provenant de l'archive sozi-release-[...].zip, copiez ceux dont le nom commence par "sozi" dans le dossier C:\Program Files\Inkscape\share\extensions.

Si vous mettez à jour à partir d'une version 10.x, vous devez supprimer les fichiers sozi_install.inx, sozi_install.py, sozi_edit_frame.inx et sozi_edit_frame.py déjà présents dans le dossier d'installation.

Démarrez ou relancez l'application Inkscape. Vous devez voir apparaître un sous-menu “Sozi” dans le menu “Extensions”.

À présent, vous pouvez créer votre première présentation.

Installation pour MacOS X

Damien Riquet fournit des instructions détaillées (en anglais) pour installer Sozi sous MacOS X Lion en utilisant l'installeur officiel d'Inkscape pour OS X. Nous recommandons de suivre cette méthode.

Installation avec Fink (déconseillée)

Pour le moment, la manière la plus “directe” d'installer Inkscape et Sozi sous MacOS X consiste à utiliser la distribution Fink. L'installation complète peut prendre plusieurs heures.

  1. Installez Fink en activant l'utilisation de la branche “unstable”.
  2. Installez Inkscape, lxml et PyGTK en entrant la commande ci-dessous dans un terminal.
    fink install inkscape python lxml-py27 pygtk2-gtk-py27
  3. Parmi les fichiers provenant de l'archive sozi-release-[...].zip, copiez ceux dont le nom commence par "sozi" dans le dossier /sw/share/inkscape/extensions.

Si vous mettez à jour à partir d'une version 10.x, vous devez supprimer les fichiers sozi_install.inx, sozi_install.py, sozi_edit_frame.inx et sozi_edit_frame.py déjà présents dans le dossier d'installation.

Démarrez ou relancez Inkscape (en ligne de commande). Vous devez voir apparaître un sous-menu “Sozi” dans le menu “Extensions”.

À présent, vous pouvez créer votre première présentation.

sozi-12.05.orig/doc/logo.svg0000664000000000000000000002242211752172636014406 0ustar rootroot image/svg+xml sozi-12.05.orig/editors/0000775000000000000000000000000011765605666013637 5ustar rootrootsozi-12.05.orig/editors/CMakeLists.txt0000664000000000000000000000003411752172636016364 0ustar rootrootADD_SUBDIRECTORY(inkscape) sozi-12.05.orig/editors/inkscape/0000775000000000000000000000000011752172636015424 5ustar rootrootsozi-12.05.orig/editors/inkscape/CMakeLists.txt0000664000000000000000000000375211752172636020173 0ustar rootroot################################################################################ ### The sozi.py output file contains the sozi inkscape integration ################################################################################ ADD_CUSTOM_COMMAND( OUTPUT sozi_upgrade.py DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sozi_upgrade.py COMMAND sed -e 's/{{SOZI_VERSION}}/${SOZI_VERSION}/g' ${CMAKE_CURRENT_SOURCE_DIR}/sozi_upgrade.py > sozi_upgrade.py ) ADD_CUSTOM_COMMAND( OUTPUT sozi_extras_addvideo_upgrade.py DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/extras/sozi_extras_addvideo_upgrade.py COMMAND sed -e 's/{{SOZI_VERSION}}/${SOZI_VERSION}/g' ${CMAKE_CURRENT_SOURCE_DIR}/extras/sozi_extras_addvideo_upgrade.py > sozi_extras_addvideo_upgrade.py ) SET(sozi_inkscape_files ${CMAKE_CURRENT_SOURCE_DIR}/sozi.inx ${CMAKE_CURRENT_SOURCE_DIR}/sozi.py ${CMAKE_CURRENT_SOURCE_DIR}/sozi.py.png ${CMAKE_CURRENT_SOURCE_DIR}/extras/sozi_extras_addvideo.inx ${CMAKE_CURRENT_SOURCE_DIR}/extras/sozi_extras_addvideo.py ${CMAKE_CURRENT_SOURCE_DIR}/extras/sozi_extras_upgrade.inx ${CMAKE_CURRENT_SOURCE_DIR}/extras/sozi_extras_upgrade.py ${CMAKE_CURRENT_BINARY_DIR}/sozi_upgrade.py ${CMAKE_CURRENT_BINARY_DIR}/sozi_extras_addvideo_upgrade.py) ################################################################################ ### The inkscape integration files target ################################################################################ #MESSAGE(WARNING "sozi_inkscape_files=${sozi_inkscape_files} sozi_player_files=${sozi_player_files}") ADD_CUSTOM_TARGET(sozi_inkscape ALL DEPENDS ${sozi_inkscape_files} ${sozi_player_files}) INSTALL(FILES ${sozi_inkscape_files} ${sozi_player_files} ${sozi_doc_files} DESTINATION share/inkscape/extensions COMPONENT inkscape_integration) sozi-12.05.orig/editors/inkscape/extras/0000775000000000000000000000000011752172636016732 5ustar rootrootsozi-12.05.orig/editors/inkscape/extras/sozi_extras_addvideo.inx0000664000000000000000000000357011752172636023670 0ustar rootroot <_name>Add video or audio sozi.extras.addvideo inkex.py sozi_extras_addvideo.py sozi_extras_addvideo.js video audio 640 480 video/ogg filename.ogv false 1 1 all sozi-12.05.orig/editors/inkscape/extras/sozi_extras_addvideo.py0000664000000000000000000001136511752172636023523 0ustar rootroot#!/usr/bin/env python # Sozi - A presentation tool using the SVG standard # # Copyright (C) 2010-2012 Guillaume Savaton # # This program is dual licensed under the terms of the MIT license # or the GNU General Public License (GPL) version 3. # A copy of both licenses is provided in the doc/ folder of the # official release of Sozi. # # See http://sozi.baierouge.fr/wiki/en:license for details. # These lines are only needed if you don't put the script directly into # the installation directory import sys # Unix sys.path.append('/usr/share/inkscape/extensions') # OS X sys.path.append('/Applications/Inkscape.app/Contents/Resources/extensions') # Windows sys.path.append('C:\Program Files\Inkscape\share\extensions') # We will use the inkex module with the predefined Effect base class. import inkex import sozi_extras_addvideo_upgrade class SoziExtrasAddVideo(inkex.Effect): NS_URI = u"http://sozi.baierouge.fr" def __init__(self): inkex.Effect.__init__(self) self.OptionParser.add_option('-E', '--element', action = 'store', type = 'string', dest = 'element', default = 'video', help = 'Media element (video | audio)') self.OptionParser.add_option('-W', '--width', action = 'store', type = 'int', dest = 'width', default = 640, help = 'Media region width') self.OptionParser.add_option('-H', '--height', action = 'store', type = 'int', dest = 'height', default = 480, help = 'Media region height') self.OptionParser.add_option('-T', '--type', action = 'store', type = 'string', dest = 'type', default = 'video/ogg', help = 'Media MIME type') self.OptionParser.add_option('-S', '--src', action = 'store', type = 'string', dest = 'src', default = '', help = 'Media file name') self.OptionParser.add_option('-A', '--auto', action = 'store', type = 'string', dest = 'auto', default = 'false', help = 'Play automatically in Sozi frame') self.OptionParser.add_option('-F', '--start-frame', action = 'store', type = 'int', dest = 'start_frame', default = '1', help = 'Start playing when entering frame number') self.OptionParser.add_option('-G', '--stop-frame', action = 'store', type = 'int', dest = 'stop_frame', default = '1', help = 'Stop playing when entering frame number') inkex.NSS[u"sozi"] = SoziExtrasAddVideo.NS_URI def effect(self): sozi_extras_addvideo_upgrade.upgrade_or_install(self) self.add_media() def add_media(self): rect = None if len(self.selected) != 0: elt = self.selected.values()[0] if elt.tag == inkex.addNS("g", "svg") and len(elt) > 0 and elt[0].tag == inkex.addNS("rect", "svg") and len(elt[0]) > 0 and elt[0][0].tag == inkex.addNS(self.options.element, "sozi"): rect = elt[0] if rect == None: rect = inkex.etree.Element("rect") rect.set("x", "0") rect.set("y", "0") rect.set("width", unicode(self.options.width)) rect.set("height", unicode(self.options.height)) rect.set("stroke", "none") rect.set("fill", "#aaa") g = inkex.etree.Element("g") g.append(rect) self.document.getroot().append(g) v = inkex.etree.Element(inkex.addNS(self.options.element, "sozi")) v.set(inkex.addNS("type", "sozi"), unicode(self.options.type)) v.set(inkex.addNS("src", "sozi"), unicode(self.options.src)) if self.options.auto == "true": start_frame = self.document.xpath("//sozi:frame[@sozi:sequence='" + unicode(self.options.start_frame) + "']", namespaces=inkex.NSS) stop_frame = self.document.xpath("//sozi:frame[@sozi:sequence='" + unicode(self.options.stop_frame) + "']", namespaces=inkex.NSS) if len(start_frame) == 0: sys.stderr.write("The start frame does not exist in this Sozi presentation.\n") exit() elif len(stop_frame) == 0: sys.stderr.write("The stop frame does not exist in this Sozi presentation.\n") exit() elif "id" in start_frame[0].attrib and "id" in stop_frame[0].attrib: v.set(inkex.addNS("start-frame", "sozi"), unicode(start_frame[0].attrib["id"])) v.set(inkex.addNS("stop-frame", "sozi"), unicode(stop_frame[0].attrib["id"])) else: sys.stderr.write("The chosen frames are not compatible with this version of Sozi. Please run Sozi to upgrade your document.\n") exit() rect.append(v) # Create effect instance effect = SoziExtrasAddVideo() effect.affect() sozi-12.05.orig/editors/inkscape/extras/sozi_extras_addvideo_upgrade.py0000664000000000000000000000666211752172636025236 0ustar rootroot import os import sys import inkex SOZI_VERSION = "{{SOZI_VERSION}}" def upgrade_or_install(context): upgrade_or_install_element(context, "script", "js") upgrade_document(context) def upgrade_or_install_element(context, tag, ext): # Check version and remove older versions latest_version_found = False for elt in context.document.xpath("//svg:" + tag + "[@id='sozi-extras-addvideo-" + tag + "']", namespaces=inkex.NSS): version_attr = inkex.addNS("version", "sozi") if version_attr in elt.attrib: version = elt.attrib[version_attr] else: version = "0" if version == SOZI_VERSION: latest_version_found = True elif version < SOZI_VERSION: elt.getparent().remove(elt) else: sys.stderr.write("Document has been created using a higher version of Sozi. Please upgrade the Inkscape plugin.\n") exit() # Create new element if needed if not latest_version_found: elt = inkex.etree.Element(inkex.addNS(tag, "svg")) elt.text = open(os.path.join(os.path.dirname(__file__), "sozi_extras_addvideo." + ext)).read() elt.set("id","sozi-extras-addvideo-" + tag) elt.set(inkex.addNS("version", "sozi"), SOZI_VERSION) context.document.getroot().append(elt) def upgrade_document(context): # Upgrade from 11.10 frame_count = len(context.document.xpath("//sozi:frame", namespaces=inkex.NSS)) # For each video element in the document for velt in context.document.xpath("//sozi:video", namespaces=inkex.NSS): # Get the Sozi frame index for the current video if it is set frame_index = None if "frame" in velt.attrib: frame_index = velt.attrib["frame"] del velt.attrib["frame"] # If the video was set to start automatically and has a frame index set if "auto" in velt.attrib: if velt.attrib["auto"] == "true" and frame_index is not None: # Get the frame element at the given index felt = context.document.xpath("//sozi:frame[@sozi:sequence='" + frame_index + "']", namespaces=inkex.NSS) if len(felt) > 0: # Use the ID of that frame to start the video velt.set(inkex.addNS("start-frame", "sozi"), felt[0].attrib["id"]) # Get the next frame element # We assume that the frames are correctly numbered if int(frame_index) >= frame_count: frame_index = "1" else: frame_index = unicode(int(frame_index) + 1) felt = context.document.xpath("//sozi:frame[@sozi:sequence='" + frame_index + "']", namespaces=inkex.NSS) if len(felt) > 0: # Use the ID of that frame to stop the video velt.set(inkex.addNS("stop-frame", "sozi"), felt[0].attrib["id"]) del velt.attrib["auto"] # If the video has attributes "type" and "src" with no namespace, add Sozi namespace if "type" in velt.attrib: velt.set(inkex.addNS("type", "sozi"), velt.attrib["type"]) del velt.attrib["type"] if "src" in velt.attrib: velt.set(inkex.addNS("src", "sozi"), velt.attrib["src"]) del velt.attrib["src"] sozi-12.05.orig/editors/inkscape/extras/sozi_extras_upgrade.inx0000664000000000000000000000221711752172636023535 0ustar rootroot <_name>Upgrade sozi.extras.upgrade inkex.py sozi_extras_upgrade.py sozi.py sozi_extras_addvideo.py all sozi-12.05.orig/editors/inkscape/extras/sozi_extras_upgrade.py0000664000000000000000000000237211752172636023371 0ustar rootroot#!/usr/bin/env python # Sozi - A presentation tool using the SVG standard # # Copyright (C) 2010-2012 Guillaume Savaton # # This program is dual licensed under the terms of the MIT license # or the GNU General Public License (GPL) version 3. # A copy of both licenses is provided in the doc/ folder of the # official release of Sozi. # # See http://sozi.baierouge.fr/wiki/en:license for details. # These lines are only needed if you don't put the script directly into # the installation directory import sys # Unix sys.path.append('/usr/share/inkscape/extensions') # OS X sys.path.append('/Applications/Inkscape.app/Contents/Resources/extensions') # Windows sys.path.append('C:\Program Files\Inkscape\share\extensions') # We will use the inkex module with the predefined Effect base class. import inkex import sozi_upgrade import sozi_extras_addvideo_upgrade class SoziExtrasUpgrade(inkex.Effect): NS_URI = u"http://sozi.baierouge.fr" def __init__(self): inkex.Effect.__init__(self) inkex.NSS[u"sozi"] = SoziExtrasUpgrade.NS_URI def effect(self): sozi_upgrade.upgrade_or_install(self) sozi_extras_addvideo_upgrade.upgrade_or_install(self) # Create effect instance effect = SoziExtrasUpgrade() effect.affect() sozi-12.05.orig/editors/inkscape/sozi.inx0000664000000000000000000000167011752172636017134 0ustar rootroot <_name>Sozi sozi inkex.py sozi.py sozi.js all sozi-12.05.orig/editors/inkscape/sozi.py0000664000000000000000000011762611752172636016777 0ustar rootroot#!/usr/bin/env python2 # Sozi - A presentation tool using the SVG standard # # Copyright (C) 2010-2012 Guillaume Savaton # # This program is dual licensed under the terms of the MIT license # or the GNU General Public License (GPL) version 3. # A copy of both licenses is provided in the doc/ folder of the # official release of Sozi. # # See http://sozi.baierouge.fr/wiki/en:license for details. # These lines are only needed if you don't put the script directly into # the installation directory import sys # Unix sys.path.append('/usr/share/inkscape/extensions') # OS X sys.path.append('/Applications/Inkscape.app/Contents/Resources/extensions') # Windows sys.path.append('C:\Program Files\Inkscape\share\extensions') # We will use the inkex module with the predefined Effect base class. import inkex import pygtk pygtk.require("2.0") import gtk import re import sozi_upgrade class SoziField: """ A field is a wrapper for a GTK input control mapped to a Sozi frame attribute. Provide a subclass of SoziField for each type of GTK control. """ def __init__(self, parent, attr, label, container_widget, input_widget, default_value, focus_events=True): """ Initialize a new field. - parent: the UI object that contains the current field - attr: the frame attribute that corresponds to the current field - label: the human-readable text that describes the current field - container_widget: the GTK widget that will contain the current field - input_widget: the GTK input control for the current field - default_value: the default value of the current field - focus_events: True if the GTK input control handles focus events, False otherwise """ self.parent = parent self.ns_attr = inkex.addNS(attr, "sozi") self.label = label self.container_widget = container_widget self.input_widget = input_widget self.default_value = unicode(default_value) if focus_events: self.input_widget.connect("focus-out-event", self.on_focus_out) else: self.input_widget.connect("changed", self.on_focus_out) self.last_value = None self.current_frame = None def set_value(self, value): """ Fill the GTK control for the current field with the given value. The value must be provided as a string. Implemented by subclasses. """ pass def get_value(self): """ Return the value of the GTK control for the current field. The value is returned as a string. Implemented by subclasses. """ pass def reset_last_value(self): self.last_value = self.get_value() def write_if_needed(self): """ Write the value of the current field to the SVG document. This operation is performed if all these conditions are met: - the current field shows a property of an existing frame - this frame has not been removed from the document - the value of the current field has changed since it was last written The write operation is delegated to a SoziFieldAction object. """ if self.current_frame is not None and self.current_frame in self.parent.effect.frames and self.last_value != self.get_value(): self.parent.do_action(SoziFieldAction(self)) self.reset_last_value() def set_with_frame(self, frame): """ Set the value of the current field with the corresponding attribute of the given frame. If frame is None, the field is filled with its default value and edition is inhibited. The previous value of the field is written to the document if needed. """ self.write_if_needed() self.current_frame = frame if frame is not None and self.ns_attr in frame["frame_element"].attrib: self.last_value = frame["frame_element"].attrib[self.ns_attr] else: self.last_value = self.default_value self.set_value(self.last_value) self.input_widget.set_sensitive(frame is not None) def on_focus_out(self, widget, event=None): """ Event handler, called each time the current field loses focus. """ self.write_if_needed() class SoziTextField(SoziField): """ A wrapper for a GTK Entry mapped to a Sozi frame attribute. """ def __init__(self, parent, attr, label, default_value): """ Initialize a new text field. See class SoziField for initializer arguments. """ SoziField.__init__(self, parent, attr, label, gtk.HBox(), gtk.Entry(), default_value) self.container_widget.add(gtk.Label(label)) self.container_widget.add(self.input_widget) def set_value(self, value): self.input_widget.set_text(value) def get_value(self): return unicode(self.input_widget.get_text()) class SoziComboField(SoziField): """ A wrapper for a GTK ComboBox with text items mapped to a Sozi frame attribute. """ def __init__(self, parent, attr, label, items, default_value): """ Initialize a new combo field. - items: the list of items in the combo box See class SoziField for other initializer arguments. """ SoziField.__init__(self, parent, attr, label, gtk.HBox(), gtk.combo_box_new_text(), default_value, False) self.items = items for text in items: self.input_widget.append_text(text) self.container_widget.add(gtk.Label(label)) self.container_widget.add(self.input_widget) def set_value(self, value): self.input_widget.set_active(self.items.index(value)) def get_value(self): return unicode(self.items[self.input_widget.get_active()]) class SoziCheckButtonField(SoziField): """ A wrapper for a GTK CheckButton mapped to a Sozi frame attribute. """ def __init__(self, parent, attr, label, default_value): """ Initialize a new check button field. See class SoziField for initializer arguments. """ button = gtk.CheckButton(label) SoziField.__init__(self, parent, attr, label, button, button, default_value) def set_value(self, value): self.input_widget.set_active(value == "true") def get_value(self): return unicode("true" if self.input_widget.get_active() else "false") class SoziSpinButtonField(SoziField): """ A wrapper for a GTK SpinButton mapped to a Sozi frame attribute. """ def __init__(self, parent, attr, label, min_value, max_value, default_value, factor=1, digits=0, increments=1): """ Initialize a new spin button field. - label: label for the field - min_value: the minimum float value for the current field - max_value: the maximum float value for the current field - default_value: the default_value - factor : eg: factor 1000 -> comboBox=1.3s ; sozi_svg=1300 - decimals: number of decimals to display, eg: 2=> 1.00 or 0=> 1 - increments: step between 2 number when clic left on a arrow. See class SoziField for other initializer arguments. """ factor = float(factor) min_value = min_value * factor max_value = max_value * factor default_value = default_value * factor SoziField.__init__(self, parent, attr, label, gtk.HBox(), gtk.SpinButton(digits=digits), default_value) self.input_widget.set_range(min_value, max_value) # def set_increments(step, page) # step : increment applied for each left mousebutton press. # page : increment applied for each middle mousebutton press. self.input_widget.set_increments(increments, increments * 2) self.input_widget.set_numeric(True) self.container_widget.pack_start(gtk.Label(label)) self.container_widget.pack_start(self.input_widget) self.factor = factor def set_value(self, value): self.input_widget.set_value(float(value) / self.factor) def get_value(self): return unicode(float(self.input_widget.get_value()) * self.factor) def on_focus_out(self, widget, event=None): self.input_widget.update() SoziField.on_focus_out(self, widget, event) class SoziAction: """ A wrapper for UI actions. Action objects can be executed, undone and redone. They can be stored in undo and redo stacks. """ def __init__(self, undo_description, redo_description): """ Initialize a new action. - undo_description: a human-readable text that describes the undo action - redo_description: a human-readable text that describes the redo action """ self.undo_description = undo_description self.redo_description = redo_description def do(self): """ Execute the current action. Implemented by subclasses. """ pass def undo(self): """ Undo the current action. Implemented by subclasses. """ pass def redo(self): """ Redo the current action. The default implementation simply calls the do() method on the current action. Override this method to provide a specific implementation. """ self.do() class SoziFieldAction(SoziAction): """ A wrapper for a field modification action. Executing a field action will write the field value to the SVG document. """ def __init__(self, field): """ Initialize a new field action for the given field. The action object saves a copy of the previous and current values of the field. """ index = field.parent.effect.frames.index(field.current_frame) SoziAction.__init__(self, "Restore " + field.label + " in frame " + str(index + 1), "Change " + field.label + " in frame " + str(index + 1) ) self.field = field self.frame = field.current_frame self.last_value = field.last_value self.value = field.get_value() def do(self): """ Write the new value of the field to the current frame. """ self.frame["frame_element"].set(self.field.ns_attr, self.value) def undo(self): """ Restore the previous value of the field in the frame and in the UI. If needed, select the frame that was active when the field was modified. """ self.frame["frame_element"].set(self.field.ns_attr, self.last_value) if self.field.current_frame is self.frame: self.field.set_value(self.last_value) self.field.reset_last_value() else: self.field.parent.select_frame(self.frame) def redo(self): """ Write the new value of the field to the frame and to the UI. If needed, select the frame that was active when the field was modified. """ self.do() if self.field.current_frame is self.frame: self.field.set_value(self.value) self.field.reset_last_value() else: self.field.parent.select_frame(self.frame) class SoziCreateAction(SoziAction): """ A wrapper for a frame creation action. """ def __init__(self, ui): """ Initialize a new frame creation action. - ui: an instance of SoziUI """ # The new frame will be added at the end of the presentation new_frame_number = str(len(ui.effect.frames) + 1) SoziAction.__init__(self, "Remove frame " + new_frame_number, "Recreate frame " + new_frame_number) self.ui = ui def do(self): """ Create a new frame and select it in the frame list. """ self.ui.fill_form(None) # The new frame is a copy of the currently selected frame frame = self.ui.effect.create_new_frame(None) for field in self.ui.fields.itervalues(): frame["frame_element"].set(field.ns_attr, field.get_value()) self.ui.effect.add_frame(frame) self.ui.append_frame_title(-1) self.ui.select_index(-1) def undo(self): """ Remove the created frame and select the previously selected frame. """ self.ui.remove_last_frame_title() self.ui.effect.delete_frame(-1) class SoziDeleteAction(SoziAction): """ A wrapper for a frame delete action. """ def __init__(self, ui): """ Initialize a new frame delete action. - ui: an instance of SoziUI """ index = ui.get_selected_index() SoziAction.__init__(self, "Restore frame " + str(index + 1), "Remove frame " + str(index + 1)) self.ui = ui self.index = index self.frame = ui.effect.frames[index] model = self.ui.list_view.get_model() self.row = model.get(model.get_iter(index), 0, 1, 2) def do(self): """ Remove the current frame and select the next one in the frame list. """ self.ui.effect.delete_frame(self.index) self.ui.remove_frame_title(self.index) # If the removed frame was the last, and if the frame list is not empty, # select the last frame if self.index > 0 and self.index >= len(self.ui.effect.frames): self.ui.select_index(-1) def undo(self): """ Add the removed frame and select it. """ self.ui.effect.insert_frame(self.index, self.frame) self.ui.insert_row(self.index, self.row) class SoziDuplicateAction(SoziAction): """ A wrapper for a frame creation action. """ def __init__(self, ui): """ Initialize a new frame creation action. - ui: an instance of SoziUI """ # The new frame will be added at the end of the presentation new_frame_number = str(len(ui.effect.frames) + 1) SoziAction.__init__(self, "Remove frame " + new_frame_number, "Recreate frame " + new_frame_number) self.ui = ui # The new frame is a copy of the currently selected frame self.index = ui.get_selected_index() self.frame = ui.effect.create_new_frame(self.index) for field in ui.fields.itervalues(): self.frame["frame_element"].set(field.ns_attr, field.get_value()) def do(self): """ Create a new frame and select it in the frame list. """ self.ui.effect.add_frame(self.frame) self.ui.append_frame_title(-1) self.ui.select_index(-1) def undo(self): """ Remove the created frame and select the previously selected frame. """ self.ui.remove_last_frame_title() self.ui.effect.delete_frame(-1) if self.index is not None: self.ui.select_index(self.index) class SoziReorderAction(SoziAction): """ A wrapper for a frame reordering action. """ def __init__(self, ui, down): """ Initialize a new frame reorder action. - ui: an instance of SoziUI """ index = ui.get_selected_index() if down: index_other = index + 1 else: index_other = index - 1 SoziAction.__init__(self, "Move frame " + str(index_other + 1) + (" up" if down else " down"), "Move frame " + str(index + 1) + (" down" if down else " up")) self.ui = ui self.index = index self.index_other = index_other def move(self, first, second): # Swap frames in the document self.ui.effect.swap_frames(first, second) # Swap frame numbers in current and other rows model = self.ui.list_view.get_model() iter_first = model.get_iter(first) iter_second = model.get_iter(second) model.set(iter_first, 0, second + 1) model.set(iter_second, 0, first + 1) # Move selected row if first < second: model.move_after(iter_first, iter_second) else: model.move_before(iter_first, iter_second) self.ui.list_view.scroll_to_cell(second) # Update up/down button sensitivity self.ui.up_button.set_sensitive(second > 0) self.ui.down_button.set_sensitive(second < len(self.ui.effect.frames) - 1) def do(self): """ Swap current frame and next/previous frame. """ self.move(self.index, self.index_other) def undo(self): """ Swap frames back. """ self.move(self.index_other, self.index) self.ui.select_index(self.index) def redo(self): """ Swap frames again. """ self.do() self.ui.select_index(self.index_other) class SoziUI: """ The user interface of Sozi. """ PROFILES = ["linear", "accelerate", "strong-accelerate", "decelerate", "strong-decelerate", "accelerate-decelerate", "strong-accelerate-decelerate", "decelerate-accelerate", "strong-decelerate-accelerate"] def __init__(self, effect): """ Create a new window with the frame edition form. - effect: the effect instance given by Inkscape """ self.effect = effect self.undo_stack = [] self.redo_stack = [] self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy", self.on_destroy) self.window.connect("key-press-event", self.on_key_press) self.window.set_title("Sozi") self.window.set_icon_from_file(__file__ + ".png") self.window.set_border_width(5) # Enable icons on stock buttons #gtk.settings_get_default().set_long_property("gtk-button-images", True, "Sozi") # Create fields for frame information self.fields = { "title": SoziTextField(self, "title", "Title", "New frame"), "hide": SoziCheckButtonField(self, "hide", "Hide", "true"), "clip": SoziCheckButtonField(self, "clip", "Clip", "true"), "timeout-enable": SoziCheckButtonField(self, "timeout-enable", "Timeout enable", "false"), "timeout-ms": SoziSpinButtonField(self, "timeout-ms", "Timeout (s)", 0, 3600, 5, factor=1000, digits=2, increments=0.2), "transition-duration-ms": SoziSpinButtonField(self, "transition-duration-ms", "Duration (s)", 0, 3600, 1, factor=1000, digits=2, increments=0.1), "transition-zoom-percent": SoziSpinButtonField(self, "transition-zoom-percent", "Zoom (%)", -100, 100, 0, increments=5), "transition-profile": SoziComboField(self, "transition-profile", "Profile", SoziUI.PROFILES, SoziUI.PROFILES[0]) } # Undo/redo widgets self.undo_button = gtk.ToolButton(gtk.STOCK_UNDO) self.undo_button.set_sensitive(False) self.undo_button.set_label("Annuler") self.undo_button.connect("clicked", self.on_undo) self.redo_button = gtk.ToolButton(gtk.STOCK_REDO) self.redo_button.set_sensitive(False) self.redo_button.connect("clicked", self.on_redo) toolBar = gtk.Toolbar() toolBar.set_style(gtk.TOOLBAR_ICONS) toolBar.set_icon_size(gtk.ICON_SIZE_SMALL_TOOLBAR) toolBar.add(self.undo_button) toolBar.add(self.redo_button) # Frame properties frame_box = gtk.VBox(spacing=0) frame_box.pack_start(self.fields["title"].container_widget, expand=False) frame_box.pack_start(self.fields["hide"].container_widget, expand=False) frame_box.pack_start(self.fields["clip"].container_widget, expand=False) frame_box.pack_start(self.fields["timeout-enable"].container_widget, expand=False) frame_box.pack_start(self.fields["timeout-ms"].container_widget, expand=False) frame_group = gtk.Frame() # fixme, spaces are here for set width of list.. frame_label=gtk.Label("Frame properties ") frame_label.set_use_markup(True) # enable bold with frame_group.set_label_widget(frame_label) frame_group.add(frame_box) # Transition properties transition_box = gtk.VBox(spacing=5) transition_box.pack_start(self.fields["transition-duration-ms"].container_widget, expand=False) transition_box.pack_start(self.fields["transition-zoom-percent"].container_widget, expand=False) transition_box.pack_start(self.fields["transition-profile"].container_widget, expand=False) transition_group = gtk.Frame("Transition") transition_label=gtk.Label("Transition ") transition_label.set_use_markup(True) # enable bold with transition_group.set_label_widget(transition_label) transition_group.add(transition_box) # Fill right pane right_pane = gtk.VBox(spacing=5) right_pane.pack_start(frame_group, expand=False) right_pane.pack_start(transition_group, expand=False) # Create frame list list_renderer = gtk.CellRendererText() list_renderer.set_property("background", "white") sequence_column = gtk.TreeViewColumn("Seq.", list_renderer, text=0, foreground=2) title_column = gtk.TreeViewColumn("Title", list_renderer, text=1, foreground=2) store = gtk.ListStore(int, str, str) self.list_view = gtk.TreeView(store) self.list_view.append_column(sequence_column) self.list_view.append_column(title_column) list_scroll = gtk.ScrolledWindow() list_scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) list_scroll.add(self.list_view) selection = self.list_view.get_selection() selection.set_mode(gtk.SELECTION_SINGLE) # TODO multiple selection selection.set_select_function(self.on_selection_changed) # Create "new" button # This button is enabled only if an element is selected in Inkscape self.new_button = gtk.ToolButton() if len(effect.selected) > 0: # The tooltip of the "new" button will show the tag of the SVG element # selected in Inkscape, removing the namespace URI if present self.new_button.set_tooltip_text("Create a new frame using the selected '" + re.sub("{.*}", "", effect.selected.values()[0].tag) + "'") else: self.new_button.set_sensitive(False) self.new_button.set_stock_id(gtk.STOCK_ADD) self.new_button.connect("clicked", self.on_create_new_frame) # Create "delete" and "duplicate" buttons # These buttons are disabled until a frame is selected self.delete_button = gtk.ToolButton() self.delete_button.set_tooltip_text("Delete the current frame") self.delete_button.set_stock_id(gtk.STOCK_REMOVE) self.delete_button.connect("clicked", self.on_delete_frame) self.delete_button.set_sensitive(False) self.duplicate_button = gtk.ToolButton() self.duplicate_button.set_tooltip_text("Duplicate the current frame") self.duplicate_button.set_stock_id(gtk.STOCK_COPY) self.duplicate_button.connect("clicked", self.on_duplicate_frame) self.duplicate_button.set_sensitive(False) # Create up/down buttons # These buttons are disabled until a frame is selected self.up_button = gtk.ToolButton() self.up_button.set_tooltip_text("Move the current frame up") self.up_button.set_stock_id(gtk.STOCK_GO_UP) self.up_button.connect("clicked", self.on_move_frame_up) self.up_button.set_sensitive(False) self.down_button = gtk.ToolButton() self.down_button.set_tooltip_text("Move the current frame down") self.down_button.set_stock_id(gtk.STOCK_GO_DOWN) self.down_button.connect("clicked", self.on_move_frame_down) self.down_button.set_sensitive(False) listToolBar = gtk.Toolbar() listToolBar.set_icon_size(1) listToolBar.add(self.new_button) listToolBar.add(self.delete_button) listToolBar.add(self.duplicate_button) listToolBar.add(self.up_button) listToolBar.add(self.down_button) # Fill left pane left_pane_content = gtk.VBox(spacing=0) left_pane_content.pack_start(list_scroll, expand=True, fill=True) left_pane_content.pack_end(listToolBar, expand=False) list_group = gtk.Frame() # fixme, spaces are here for set width of list.. list_frame_label=gtk.Label("Frame list ") list_frame_label.set_use_markup(True) # enable bold with list_group.set_label_widget(list_frame_label) list_group.add(left_pane_content) left_pane = list_group hbox = gtk.HBox(spacing=5) hbox.pack_start(left_pane) hbox.pack_start(right_pane) # button Bar cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL) cancel_button.set_tooltip_text("Cancel all changes and go back to Inkscape") cancel_button.connect("clicked", self.on_full_undo) ok_button = gtk.Button(stock=gtk.STOCK_OK)#or Apply ok_button.set_tooltip_text("Apply changes and go back to Inkscape") ok_button.connect("clicked", gtk.main_quit) buttonBar = gtk.HBox(spacing=10) buttonBar.pack_end(ok_button, False, False) buttonBar.pack_end(cancel_button, False, False) statusBar = gtk.Statusbar() #statusBar.push(statusBar.getContexteId("a"),"Etat initial") vbox = gtk.VBox(spacing=5) vbox.pack_start(toolBar) vbox.add(hbox) vbox.add(buttonBar) vbox.pack_end(statusBar) self.window.add(vbox) self.window.show_all() # If an element is selected in Inkscape, and if it corresponds to # one or more existing frames, select the first matching frame. # If no element is selected in Inkscape, if at least one frame exists # in the document, select the first frame. selected_frame = None if len(effect.selected) > 0: for f in effect.frames: if f["svg_element"].attrib["id"] in effect.selected: selected_frame = f break elif len(effect.frames) > 0: selected_frame = effect.frames[0] # Fill frame list for i in range(len(effect.frames)): self.append_frame_title(i) # Select current frame in frame list and fill form if selected_frame is not None: index = effect.frames.index(selected_frame) self.list_view.get_selection().select_path((index,)) self.list_view.scroll_to_cell(index) else: self.fill_form(None) gtk.main() def append_frame_title(self, index): """ Append the title of the frame at the given index to the frame list view. This method is used when filling the list view initially or when creating a new frame. """ # A negative index is counted back from the end of the frame list. # This is not needed for Python arrays, but we need to show the corect # frame number in the list view. if (index < 0): index += len(self.effect.frames) frame = self.effect.frames[index] # Get the title of the frame title_attr = inkex.addNS("title", "sozi") if title_attr in frame["frame_element"].attrib: title = frame["frame_element"].attrib[title_attr] else: title = "Untitled" # The text color will show whether the current frame # corresponds to the selected object in Inkscape if frame["svg_element"] in self.effect.selected.values(): color = "#ff0000" else: color = "#000000" self.list_view.get_model().append([index + 1, title, color]) def insert_row(self, index, row): """ Insert a row in the frame list view. This method is used when undoing a frame deletion. """ model = self.list_view.get_model() model.insert(index, row) # Renumber frames in list view for i in range(index + 1, len(self.effect.frames)): model.set(model.get_iter(i), 0, i + 1) # Select the inserted frame self.select_index(index) def remove_last_frame_title(self): """ Remove the title of the last frame in the list view. This method is used when undoing the creation of a new frame. """ model = self.list_view.get_model() model.remove(model.get_iter(len(self.effect.frames) - 1)) def remove_frame_title(self, index): """ Remove the title of the frame at the given index from the list view. This method is used when deleting a frame. """ model = self.list_view.get_model() iter = model.get_iter(index) if model.remove(iter): self.list_view.get_selection().select_iter(iter) # Renumber frames for i in range(index, len(self.effect.frames)): model.set(model.get_iter(i), 0, i + 1) else: self.fill_form(None) def fill_form(self, frame): """ Fill all fields with the values of the attributes of the given frame. """ for field in self.fields.itervalues(): field.set_with_frame(frame) self.duplicate_button.set_sensitive(frame is not None ) self.delete_button.set_sensitive(frame is not None) def get_selected_index(self): """ Return the index of the currently selected frame. None is returned if no frame is selected. """ selection = self.list_view.get_selection() model, iter = selection.get_selected() if iter: return model.get_path(iter)[0] else: return None def select_index(self, index): """ Select the frame at the given index. A negative index is counted back from the end of the frame list. """ if (index < 0): index += len(self.effect.frames) self.list_view.get_selection().select_path((index,)) self.list_view.scroll_to_cell(index) def select_frame(self, frame): """ Select the given frame in the frame list. """ self.select_index(self.effect.frames.index(frame)) def on_create_new_frame(self, widget): """ Event handler: click on button "create new frame". """ self.do_action(SoziCreateAction(self)) def on_delete_frame(self, widget): """ Event handler: click on button "Delete frame". """ self.do_action(SoziDeleteAction(self)) def on_duplicate_frame(self, widget): """ """ self.do_action(SoziDuplicateAction(self)) def on_move_frame_up(self, widget): """ Event handler: click on button "Move frame up". """ self.do_action(SoziReorderAction(self, False)) def on_move_frame_down(self, widget): """ Event handler: click on button "Move frame down". """ self.do_action(SoziReorderAction(self, True)) def on_selection_changed(self, path): """ Event handler: selection changed in frame list view. This event can be triggered either due to a user action or due to a programmatic selection change. """ if self.list_view.get_selection().path_is_selected(path): # If the selection change happens on a selected row # then the action is a deselection frame = None self.up_button.set_sensitive(False) self.down_button.set_sensitive(False) self.delete_button.set_sensitive(False) else: # If the selection change happens on a non-selected row # then the action is a selection index = path[0] frame = self.effect.frames[index] self.up_button.set_sensitive(index > 0) self.down_button.set_sensitive(index < len(self.effect.frames) - 1) self.delete_button.set_sensitive(True) # Show the properties of the selected frame, # or default values if no frame is selected. self.fill_form(frame) # Success: highlight or clear the affected row in the frame list return True def on_key_press(self, widget, event): if event.state & gtk.gdk.CONTROL_MASK: if event.keyval == gtk.keysyms.z: self.window.set_focus(None) self.on_undo() elif event.keyval == gtk.keysyms.y: self.on_redo() def do_action(self, action): """ Execute the given action and push it to the undo stack. The redo stack is emptied. """ action.do() self.undo_stack.append(action) self.redo_stack = [] self.finalize_action(action) def on_undo(self, widget=None): """ Event handler: click on button "Undo". Undo the action at the top of the undo stack and push it to the redo stack. """ if self.undo_stack: action = self.undo_stack.pop() self.redo_stack.append(action) action.undo() self.finalize_action(action) def on_full_undo(self, widget=None): """ Event handler: click on button "Cancel". Undo all actions. """ while self.undo_stack: self.on_undo() gtk.main_quit() def on_redo(self, widget=None): """ Event handler: click on button "Redo". Execute the action at the top of the redo stack and push it to the undo stack. """ if self.redo_stack: action = self.redo_stack.pop() self.undo_stack.append(action) action.redo() self.finalize_action(action) def finalize_action(self, action): """ Update the UI after an action has been executed or undone. """ # Update the frame list view if the "title" field of a frame has changed. if isinstance(action, SoziFieldAction) and action.field is self.fields["title"]: index = self.effect.frames.index(action.frame) model = self.list_view.get_model() model.set(model.get_iter(index), 1, action.frame["frame_element"].get(action.field.ns_attr)) # Update the status of the "Undo" button if self.undo_stack: self.undo_button.set_tooltip_text(self.undo_stack[-1].undo_description) else: self.undo_button.set_tooltip_text("") self.undo_button.set_sensitive(bool(self.undo_stack)) # Update the status of the "Redo" button if self.redo_stack: self.redo_button.set_tooltip_text(self.redo_stack[-1].redo_description) else: self.redo_button.set_tooltip_text("") self.redo_button.set_sensitive(bool(self.redo_stack)) def on_destroy(self, widget): """ Event handler: close the Sozi window. """ gtk.main_quit() class Sozi(inkex.Effect): NS_URI = u"http://sozi.baierouge.fr" def __init__(self): inkex.Effect.__init__(self) inkex.NSS[u"sozi"] = Sozi.NS_URI self.frames = [] def effect(self): sozi_upgrade.upgrade_or_install(self) self.analyze_document() self.ui = SoziUI(self) def analyze_document(self): """ Analyze the document and collect information about the presentation. Frames with no corresponding SVG element are removed. Frames numbers are updated if needed. FIXME this method currently does not support frames with layers """ # Get list of valid frame elements and remove orphan frames refid_attr = inkex.addNS("refid", "sozi") self.frames = [] for f in self.document.xpath("//sozi:frame", namespaces=inkex.NSS): if refid_attr in f.attrib: e = self.document.xpath("//svg:*[@id='" + f.attrib[refid_attr] + "']", namespaces=inkex.NSS) if len(e) == 0: self.document.getroot().remove(f) else: self.frames.append( { "frame_element": f, "svg_element": e[0] } ) else: # Frame elements with layers do not always contain a "refid" attribute. # FIXME add the frame only if it contains valid layer elements self.frames.append( { "frame_element": f, "svg_element": None } ) # Sort frames by sequence attribute sequence_attr = inkex.addNS("sequence", "sozi") self.frames = sorted(self.frames, key=lambda f: int(f["frame_element"].attrib[sequence_attr]) if sequence_attr in f["frame_element"].attrib else len(self.frames)) # Renumber frames for i, f in enumerate(self.frames): f["frame_element"].set(inkex.addNS("sequence", "sozi"), unicode(i + 1)) def swap_frames(self, first, second): """ Swap frames with the given indices. """ # Swap frames in SVG document sequence_attr = inkex.addNS("sequence", "sozi") self.frames[first]["frame_element"].set(sequence_attr, unicode(second + 1)) self.frames[second]["frame_element"].set(sequence_attr, unicode(first + 1)) # Swap frames in frame list self.frames[first], self.frames[second] = self.frames[second], self.frames[first] def create_new_frame(self, index): """ Create a new frame using the SVG element of the frame at the given index. The new frame is not added to the document. """ if index is not None: svg_element = self.frames[index]["svg_element"] else: svg_element = self.selected.values()[0] frame_element = inkex.etree.Element(inkex.addNS("frame", "sozi")) frame_element.set(inkex.addNS("refid", "sozi"), svg_element.attrib["id"]) # TODO check namespace? frame_element.set(inkex.addNS("sequence", "sozi"), unicode(len(self.frames)+1)) frame_element.set("id", self.uniqueId("frame" + unicode(len(self.frames)+1))) frame = { "frame_element": frame_element, "svg_element": svg_element } return frame def add_frame(self, frame): """ Add the given frame to the document. """ self.document.getroot().append(frame["frame_element"]) self.frames.append(frame) def insert_frame(self, index, frame): """ Insert the given frame at the given index. """ self.document.getroot().append(frame["frame_element"]) self.frames.insert(index, frame) self.renumber_from_index(index) def delete_frame(self, index): """ Remove the frame at the given index from the document. """ self.document.getroot().remove(self.frames[index]["frame_element"]) del self.frames[index] self.renumber_from_index(index) def renumber_from_index(self, index): if index >= 0: for i in range(index, len(self.frames)): self.frames[i]["frame_element"].set(inkex.addNS("sequence", "sozi"), unicode(i + 1)) # Create effect instance effect = Sozi() effect.affect() sozi-12.05.orig/editors/inkscape/sozi.py.png0000664000000000000000000001354311752172636017553 0ustar rootrootPNG  IHDR@@iqsBIT|d pHYsu85tEXtSoftwarewww.inkscape.org<tEXtAuthorAndy FitzsimonֺdtEXtCreation Time2006IDATx[wXvVPX X@{h=H~5cn%\ HQAAȲ-ؕPY0<<03;soΜs33 1az4'Y lM.YYY:4\.$fΜyq„ @<»TPP{oeff>;vO>\.]v^ݺuݼyDZ7T00 c}Z"bHDD!s%Jjkk+BbO8ٵk򨨨?4<]v)ۅju^sbY~~]!vڥ7n !"fǎ~ӧO?,]X"$cƌ.>>_~?5Y+8D{2aIIIh9v-7o+aD$#"/^h-"ҵSssg(\o˳:Jƪ7; rHMSO u7zDPJ^2~ɓ'=93vkSn۶`rra5E; Id/VGf5=znر]a27 %%e3B=zT8c S۔?Ofn#"-裏gff6 ""\r#"r.\6qƾҢ񱺷`e fcҥs~P8"//پ}`={<\=s8kyVۓ:l/Vǯ^߹y=Ñ6SN!//)~K.C)H8D*[ʵZLV,v}@Xv-1d#<<6m'H7(L&eY+!@@ܹsܹs?A3Za{VUʮnk}e}=_,)zleYƪ´iիWC*Caa!v n!&&R7vآAhygV+\\\|֭[o?~|* 3F- ਭ|j;|e!uƤI 6eYFD"̛7vʕ+ w&f q;wnuxxv`۴iKw퓰x^똃;wL'"@8)c#˟ BTЀ(11,g^Z*** |2k`h4zѣGBD٢Pȱy/ƘvXX|t"hnmAXQ^X5^4b6BH >۶m˲0 F\.JFq`Xf9dD(Q(lV{0:_]N喹Glm RUe` PՈBXX>3p8 @B.CTBVCTJš5k;c8'N?| #h! #0}pⴌ3Gߴ KnF\.lZ-&N޽{cϞ=r0 ݻT*Q]] R BR,={CBBFc ff͚ 6,zAn\7(7_\tKٔv`^`ږ%Tٷg㺺:DGG8 Nӧ۷oCR'ODII h4"++ 0:-r5YW ׿4\zxc2my_k1( l>^ǤIPXXUV!77FzZOFyy9\VfpuuARえDo #""a[IlWDR[,:9WM7G93[\WUY'joȆF#␛ɓ'III^NCii)8. >ojm1ݸq֭ .6ԩS9_>"j>>>?,q$C&zgBaGN+T]ɄiӦ!##&Mb^o"^GYYa0f& 0LMJ~ ׯbsDGv?uT w4]QK``G E ]3fm*c/Th61c \z'Oju(ZƣGZ,xw`ZG[iu L CH)(y4:~~v%Pl2\xP:TVVq0,W\ !!!P&q KjwѢW&vф@oh~Fi'no@tt4iUΓlv d2|> K"Պzo ˜m\2\v 2^t DԪzޡ;"g5ɓd#G7 n>3<)5۵k: ͽ׻u 2[>|8Ξ=Tܼyeeeh4 +iA@q…<*|LÆ KJl?"+hMo1h)"[*/G:ѿYVɡ[Ɏ0x< IJ,U\.D"H$ԹsgdHo *D3Pd;v,/ʕ+#U]"gZ۔!  I&Q||<]zaҡCdr $s>O*HD^j*us HII@-iteΦ-[W~:uٳgSzz:YVsVܳg " %ٳg=CD=;Ĝ''Uڣ`'(kkkU^^^rssa2p0k^NNrrr<]tk '20 G$ܾ};l֬YhZ׿p@L&c%;wa{X푞)))Ri|? عs~޽7feeW^ȑ#rJ, a  [-,BVC*">>gϞ\.G\\0c Y-I+ *|l3a6m?OOm۶n-'^#@߾}7o\_iiiHOOD"oKBñ |>{ 8p˕ G9`Y ,$q@0'N_77wzs{ `3223^q矑@b<"I EZZZ1uWs-Ⱦs΃h/7s*$"DŽj=Dkh8.lv.KD6luf2h-[VQL|#x#zQcʓ_>ȏrwS x33gLD swܙ|r!!ʷ5~E]wgJ:OOO㡏=__={6lmbz dO @`4#555vɔsҥꨨqO3G^^^nddWjj[gΜU*Fh4bFT*4h4r9U AP(4 Q͝;woyqÁg\\\*lٲ:**jWjj*x|>\.iƿrJɓ'44Gv'E9n?Sj_V$zh4F.22O;J='~ahLLiJGD/""eL믿ҥKŖ-[Q7'j,~_@ndKK6nnD՞={rݻWUSS@>Q ޽{K#ȾB"Ϟ= f/EZJKK+ܶm۝ٳgtDLW Z@PLL{Æ 1--J0 jl6i$$$|6m|Sm`9MBD:TW\068!:*Zz q,YwG4d1?%R) w؄;Һ3? /peYrѷ/^ŝ;wQwEYjGd4؂NSLٲnݺD,ex*r]Fʖd*Թsg /pwΜ9언'] $<ٵk<" zֆ7=(|믿~pĈ$ ,2eٔWɖND]Z^|r_d{オDTF51@lI @RTT䟔4EEOEETպ*bF"($IH$Y,k0Dz=7..T7?O image/svg+xml Andy Fitzsimon Andrew Michael Fitzsimon Fitzsimon IT Consulting Pty Ltd http://andy.fitzsimon.com.au 2006 sozi-12.05.orig/editors/inkscape/sozi_upgrade.py0000664000000000000000000000613311752172636020474 0ustar rootroot import os import sys import inkex # Replaced automatically by the version number during the build process SOZI_VERSION = "{{SOZI_VERSION}}" def upgrade_or_install(context): upgrade_or_install_element(context, "script") upgrade_or_install_element(context, "style") upgrade_document(context) def upgrade_or_install_element(context, tag): """ Upgrade or install a script or a style sheet into the document. - tag: "script" or "style" Depending on the argument, the content of file "sozi.js" or "sozi.css" will be copied to the script or style element. """ # Check version and remove older versions latest_version_found = False for elt in context.document.xpath("//svg:" + tag + "[@id='sozi-" + tag + "']", namespaces=inkex.NSS): version_attr = inkex.addNS("version", "sozi") if version_attr in elt.attrib: version = elt.attrib[version_attr] else: version = "0" if version == SOZI_VERSION: latest_version_found = True elif version < SOZI_VERSION: elt.getparent().remove(elt) else: sys.stderr.write("Document has been created using a higher version of Sozi. Please upgrade the Inkscape plugin.\n") exit() # Create new element if needed if not latest_version_found: ext = "js" if tag == "script" else "css" elt = inkex.etree.Element(inkex.addNS(tag, "svg")) elt.text = open(os.path.join(os.path.dirname(__file__), "sozi." + ext)).read() elt.set("id","sozi-" + tag) elt.set(inkex.addNS("version", "sozi"), SOZI_VERSION) context.document.getroot().append(elt) def upgrade_document(context): """ Upgrade the Sozi-specific elements of the document to follow the evolutions of the document format. """ # Upgrade from 10.x SOZI_ATTR = ["title", "sequence", "hide", "clip", "timeout-enable", "timeout-ms", "transition-duration-ms", "transition-zoom-percent", "transition-profile"] # FIXME allow multiple classes in element for elt in context.document.xpath("//svg:*[@class='sozi-frame']", namespaces=inkex.NSS): del elt.attrib["class"] # Create a new frame element f = inkex.etree.Element(inkex.addNS("frame", "sozi")) f.set(inkex.addNS("refid", "sozi"), elt.attrib["id"]) # TODO check namespace for id? context.document.getroot().append(f) # Move all Sozi-specific attributes from the original element to the frame element for attr in SOZI_ATTR: ns_attr = inkex.addNS(attr, "sozi") if ns_attr in elt.attrib: f.set(ns_attr, elt.attrib[ns_attr]) del elt.attrib[ns_attr] # Upgrade from 11.10 sequence_attr = inkex.addNS("sequence", "sozi") for i, elt in enumerate(context.document.xpath("//sozi:frame", namespaces=inkex.NSS)): if sequence_attr not in elt.attrib: elt.set(sequence_attr, unicode(i + 1)) if "id" not in elt.attrib: elt.set("id", context.uniqueId("frame" + elt.attrib[sequence_attr])) sozi-12.05.orig/player/0000775000000000000000000000000011752172636013452 5ustar rootrootsozi-12.05.orig/player/CMakeLists.txt0000664000000000000000000001321211752172636016211 0ustar rootroot################################################################################ # # Type of minifier option # ################################################################################ SET(minifier_type "juicer" CACHE STRING "Wich minifier to use : juicer, yuicompressor, sed") IF(${minifier_type} STREQUAL "juicer") MESSAGE(STATUS "juicer minifier") SET(minifier "juicer" CACHE FILEPATH "Path to juicer minifier" ) ELSEIF(${minifier_type} STREQUAL "yuicompressor") MESSAGE(STATUS "yuicompressor minifier") SET(minifier "yuicompressor-2.4.6.jar" CACHE FILEPATH "Path to yuicompressor minifier") ELSE() MESSAGE(WARNING "Default minifier") SET(minifier "sed") ENDIF() ################################################################################ # # Build sozi player engine # ################################################################################ ################################################################################ ### The sozi_player_files variable contains all output files ################################################################################ SET(sozi_player_files "" PARENT_SCOPE) ################################################################################ ### The sozi.version output file contains the version string ################################################################################ ADD_CUSTOM_COMMAND( OUTPUT sozi.version COMMAND echo ${SOZI_VERSION} > sozi.version ) LIST(APPEND sozi_player_files ${CMAKE_CURRENT_BINARY_DIR}/sozi.version) ################################################################################ ### The sozi.js output file contains the javascript sozi engine ################################################################################ # The order is important because of dependencies (in case we don't use juicer) # This list can be obtained by running juicer list player/js/sozi.js SET(sozi_js ${CMAKE_CURRENT_SOURCE_DIR}/js/module.js ${CMAKE_CURRENT_SOURCE_DIR}/js/events.js ${CMAKE_CURRENT_SOURCE_DIR}/js/framenumber.js ${CMAKE_CURRENT_SOURCE_DIR}/js/framelist.js ${CMAKE_CURRENT_SOURCE_DIR}/js/animation.js ${CMAKE_CURRENT_SOURCE_DIR}/js/display.js ${CMAKE_CURRENT_SOURCE_DIR}/js/player.js ${CMAKE_CURRENT_SOURCE_DIR}/js/actions.js ${CMAKE_CURRENT_SOURCE_DIR}/js/document.js ${CMAKE_CURRENT_SOURCE_DIR}/js/location.js ${CMAKE_CURRENT_SOURCE_DIR}/js/sozi.js) ADD_CUSTOM_COMMAND( OUTPUT sozi.js DEPENDS ${sozi_js} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/minifier ${minifier} sozi.js ${sozi_js} ) LIST(APPEND sozi_player_files ${CMAKE_CURRENT_BINARY_DIR}/sozi.js) ################################################################################ ### The sozi.css output file contains the sozi style sheet ################################################################################ SET(sozi_css ${CMAKE_CURRENT_SOURCE_DIR}/css/sozi.css) ADD_CUSTOM_COMMAND( OUTPUT sozi.css DEPENDS ${sozi_css} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/minifier ${minifier} sozi.css ${sozi_css} ) LIST(APPEND sozi_player_files ${CMAKE_CURRENT_BINARY_DIR}/sozi.css) ################################################################################ ### The sozi_extras_addvideo.js output file contain code for inserting video ################################################################################ SET(sozi_extras_addvideo_js ${CMAKE_CURRENT_SOURCE_DIR}/js/extras/sozi_extras_addvideo.js) ADD_CUSTOM_COMMAND( OUTPUT sozi_extras_addvideo.js DEPENDS ${sozi_extras_addvideo_js} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/minifier ${minifier} sozi_extras_addvideo.js ${sozi_extras_addvideo_js} ) LIST(APPEND sozi_player_files ${CMAKE_CURRENT_BINARY_DIR}/sozi_extras_addvideo.js) ################################################################################ ### The player core target ################################################################################ ADD_CUSTOM_TARGET(sozi_player ALL DEPENDS ${sozi_player_files}) INSTALL(FILES ${sozi_player_files} DESTINATION share/sozi COMPONENT player) ### Ugly hack because cmake don't keep PARENT_SCOPE with LIST(APPEND... SET(sozi_player_files ${sozi_player_files} PARENT_SCOPE) ################################################################################ # # Build sozi player headers # ################################################################################ ################################################################################ ### The sozi_player_files global variable contains all output files ################################################################################ SET(sozi_header_files "" PARENT_SCOPE) ################################################################################ ### The sozi.h output file contain binary of the player engine for c integration ################################################################################ ADD_CUSTOM_COMMAND( OUTPUT sozi.h DEPENDS ${sozi_player_files} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/header sozi.h ${sozi_player_files} ) LIST(APPEND sozi_header_files ${CMAKE_CURRENT_BINARY_DIR}/sozi.h) ################################################################################ ### The player header target ################################################################################ ADD_CUSTOM_TARGET(sozi_header ALL DEPENDS ${sozi_header_files}) INSTALL(FILES ${sozi_header_files} DESTINATION include COMPONENT player) ### Ugly hack because cmake don't keep PARENT_SCOPE with LIST(APPEND... SET(sozi_header_files ${sozi_header_files} PARENT_SCOPE) sozi-12.05.orig/player/css/0000775000000000000000000000000011752172636014242 5ustar rootrootsozi-12.05.orig/player/css/sozi.css0000664000000000000000000000205411752172636015741 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. */ #sozi-toc text { fill: #eff; font-family: Verdana, sans-serif; font-size: 12pt; } #sozi-toc text:hover { fill: #0cf; cursor: pointer; } #sozi-toc text.sozi-toc-current { fill: #fa4; } #sozi-toc-background { stroke: #222; stroke-opacity: 0.1; stroke-width: 10; fill: #222; fill-opacity: 0.9; } .sozi-toc-arrow { fill: #eff; fill-opacity: 0.75; stroke: none; } .sozi-toc-arrow:hover { fill: #0cf; } #sozi-framenumber circle { stroke: #222; stroke-opacity: 0.1; stroke-width: 4; fill: #222; fill-opacity: 0.9; } #sozi-framenumber text { fill: #eff; font-family: Verdana, sans-serif; font-size: 12pt; } sozi-12.05.orig/player/js/0000775000000000000000000000000011752172636014066 5ustar rootrootsozi-12.05.orig/player/js/actions.js0000664000000000000000000002165711752172636016077 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend player.js * @depend display.js */ /*global module:true sozi:true */ module("sozi.actions", function (exports) { var player = sozi.player, display = sozi.display, window = this, document = window.document, DRAG_BUTTON = 0, // Left button TOC_BUTTON = 1, // Middle button SCALE_FACTOR = 1.05, ROTATE_STEP = 5, dragButtonIsDown = false, dragged = false, dragClientX = 0, dragClientY = 0; /* * Zooms the display in the given direction. * * Only the sign of direction is used: * - zoom in when direction > 0 * - zoom out when direction <= 0 * * The scaling is centered around point (x, y). */ function zoom(direction, x, y) { player.stop(); display.zoom(direction > 0 ? SCALE_FACTOR : 1 / SCALE_FACTOR, x, y); } /* * Rotate the display in the given direction. * * Only the sign of direction is used: * - rotate anticlockwise when direction > 0 * - rotate clockwise when direction <= 0 */ function rotate(direction) { player.stop(); display.rotate(direction > 0 ? ROTATE_STEP : -ROTATE_STEP); } /* * Show/hide the frame list. * * The presentation stops when the frame list is showed, * and restarts when the frame list is hidden. */ function toggleFrameList() { if (sozi.framelist.isVisible()) { sozi.framelist.hide(); player.restart(); } else { player.stop(); sozi.framelist.show(); } } /* * Event handler: mouse down. * * When the left button is pressed, we register the current coordinates * in case the mouse will be dragged. Flag "dragButtonIsDown" is set until * the button is released (onMouseUp). This flag is used by onMouseMove. * * When the middle button is pressed, the table of contents is shown or hidden. */ function onMouseDown(evt) { if (evt.button === DRAG_BUTTON) { dragButtonIsDown = true; dragged = false; dragClientX = evt.clientX; dragClientY = evt.clientY; } else if (evt.button === TOC_BUTTON) { toggleFrameList(); } evt.stopPropagation(); evt.preventDefault(); } /* * Event handler: mouse move. * * If the left mouse button is down, then the mouse move is a drag action. * This method computes the displacement since the button was pressed or * since the last move, and updates the reference coordinates for the next move. */ function onMouseMove(evt) { if (dragButtonIsDown) { player.stop(); dragged = true; sozi.events.fire("cleanup"); display.drag(evt.clientX - dragClientX, evt.clientY - dragClientY); dragClientX = evt.clientX; dragClientY = evt.clientY; } evt.stopPropagation(); } /* * Event handler: mouse up. * * Releasing the left button resets the "dragButtonIsDown" flag. */ function onMouseUp(evt) { if (evt.button === DRAG_BUTTON) { dragButtonIsDown = false; } evt.stopPropagation(); evt.preventDefault(); } /* * Event handler: context menu (i.e. right click). * * Right click goes one frame back. * * There is no "click" event for the right mouse button and the menu * can't be disabled in "onMouseDown". */ function onContextMenu(evt) { player.moveToPrevious(); evt.stopPropagation(); evt.preventDefault(); } /* * Event handler: mouse click. * * Left-click moves the presentation to the next frame. * * No "click" event is generated for the middle button in Firefox. * See "onMouseDown" for middle click handling. * * Dragging the mouse produces a "click" event when the button is released. * If flag "dragged" was set by "onMouseMove", then the click event is the result * of a drag action. */ function onClick(evt) { if (!dragged && evt.button !== TOC_BUTTON) { player.moveToNext(); } evt.stopPropagation(); evt.preventDefault(); } /* * Event handler: mouse wheel. * * Rolling the mouse wheel stops the presentation and zooms the current display. * * FIXME shift key does not work in Opera */ function onWheel(evt) { var delta = 0; if (!evt) { evt = window.event; } if (evt.wheelDelta) { // IE and Opera delta = evt.wheelDelta; } else if (evt.detail) { // Mozilla delta = -evt.detail; } if (delta !== 0) { if (evt.shiftKey) { rotate(delta); } else { zoom(delta, evt.clientX, evt.clientY); } } evt.stopPropagation(); evt.preventDefault(); } /* * Event handler: key press. * * Keyboard handling is split into two methods: onKeyPress and onKeyDown * in order to get the same behavior across browsers. * * This method handles character keys "+", "-", "=", "F" and "T". */ function onKeyPress(evt) { // Keys with modifiers are ignored if (evt.altKey || evt.ctrlKey || evt.metaKey) { return; } switch (evt.charCode || evt.keyCode) { case 43: // + zoom(1, window.innerWidth / 2, window.innerHeight / 2); break; case 45: // - zoom(-1, window.innerWidth / 2, window.innerHeight / 2); break; case 61: // = player.moveToCurrent(); break; case 70: // F case 102: // f player.showAll(); break; case 84: // T case 116: // t toggleFrameList(); break; case 82: // R rotate(-1); break; case 114: // r rotate(1); break; } evt.stopPropagation(); evt.preventDefault(); } /* * Event handler: key down. * * Keyboard handling is split into two methods: onKeyPress and onKeyDown * in order to get the same behavior across browsers. * * This method handles navigation keys (arrows, page up/down, home, end) * and the space and enter keys. */ function onKeyDown(evt) { // Keys with modifiers are ignored if (evt.altKey || evt.ctrlKey || evt.metaKey) { return; } switch (evt.keyCode) { case 36: // Home player.moveToFirst(); break; case 35: // End player.moveToLast(); break; case 38: // Arrow up player.jumpToPrevious(); break; case 33: // Page up case 37: // Arrow left player.moveToPrevious(); break; case 40: // Arrow down player.jumpToNext(); break; case 34: // Page down case 39: // Arrow right case 13: // Enter case 32: // Space player.moveToNext(); break; } evt.stopPropagation(); // In Chrome/Chromium, preventDefault() inhibits the "keypress" event } function stopEvent(evt) { evt.stopPropagation(); } function onLoad() { // Prevent event propagation when clicking on a link var links = document.getElementsByTagName("a"); for (var i = 0; i < links.length; i += 1) { links[i].addEventListener("click", stopEvent, false); links[i].addEventListener("contextmenu", stopEvent, false); } // TODO also use shift-click as an alternative for middle-click var svgRoot = document.documentElement; svgRoot.addEventListener("click", onClick, false); svgRoot.addEventListener("mousedown", onMouseDown, false); svgRoot.addEventListener("mouseup", onMouseUp, false); svgRoot.addEventListener("mousemove", onMouseMove, false); svgRoot.addEventListener("keypress", onKeyPress, false); svgRoot.addEventListener("keydown", onKeyDown, false); svgRoot.addEventListener("contextmenu", onContextMenu, false); svgRoot.addEventListener("DOMMouseScroll", onWheel, false); // Mozilla window.onmousewheel = onWheel; } window.addEventListener("load", onLoad, false); }); sozi-12.05.orig/player/js/animation.js0000664000000000000000000001636411752172636016415 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js */ /*global module:true sozi:true */ module("sozi.animation", function (exports) { var window = this, TIME_STEP_MS = 40, animatorList = [], timer, requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame; /* * This function is called periodically and triggers the * animation steps in all animators managed by this module. * * If all animators are removed from the list of animators * managed by this module, then the periodic calling is disabled. * * This function can be called either through requestAnimationFrame() * if the browser supports it, or through setInterval(). */ function loop(timestamp) { var i; if (animatorList.length > 0) { // If there is at least one animator, // and if the browser provides animation frames, // schedule this function to be called again in the next frame. if (requestAnimationFrame) { requestAnimationFrame(loop); } // Step all animators animatorList.forEach(function (animator) { animator.step(timestamp); }); } else { // If all animators have been removed, // and if this function is called periodically // through setInterval, disable the periodic calling. if (!requestAnimationFrame) { window.clearInterval(timer); } } } /* * Start the animation loop. * * This function delegates the periodic update of all animators * to the loop() function, either through requestAnimationFrame() * if the browser supports it, or through setInterval(). */ function start() { if (requestAnimationFrame) { requestAnimationFrame(loop); } else { timer = window.setInterval(function () { loop(Date.now()); }, TIME_STEP_MS); } } /* * Add a new animator object to the list of animators managed * by this module. * * If the animator list was empty before calling this function, * then the animation loop is started. */ function addAnimator(animator) { animatorList.push(animator); if (animatorList.length === 1) { start(); } } /* * Remove the given animator from the list of animators * managed by this module. */ function removeAnimator(animator) { animatorList.splice(animatorList.indexOf(animator), 1); } /* * Construct a new animator. * * Parameters: * - onStep: the function to call on each animation step * - onDone: the function to call when the animation time is elapsed * * The onStep() function is expected to have the following parameters: * - progress: a number between 0 and 1 (included) corresponding to * the elapsed fraction of the total duration * - data: an optional object passed to the application-specific animation code * * The new animator is initialized in the "stopped" state. */ exports.Animator = function (onStep, onDone) { this.onStep = onStep; this.onDone = onDone; this.durationMs = 0; this.data = {}; this.initialTime = 0; this.started = false; }; /* * Start the current animator. * * Parameters: * - durationMs: the animation duration, in milliseconds * - data: an object to pass to the onStep function * * The current animator is added to the list of animators managed * by this module and is put in the "started" state. * It will be removed from the list automatically when the given duration * has elapsed. * * The onStep() function is called once before starting the animation. */ exports.Animator.prototype.start = function (durationMs, data) { this.durationMs = durationMs; this.data = data; this.initialTime = Date.now(); this.onStep(0, this.data); if (!this.started) { this.started = true; addAnimator(this); } }; /* * Stop the current animator. * * The current animator is removed from the list of animators managed * by this module and is put in the "stopped" state. */ exports.Animator.prototype.stop = function () { if (this.started) { removeAnimator(this); this.started = false; } }; /* * Perform one animation step. * * This function is called automatically by the loop() function. * It calls the onStep() function of this animator. * If the animation duration has elapsed, the onDone() function of * the animator is called. */ exports.Animator.prototype.step = function (timestamp) { var elapsedTime = timestamp - this.initialTime; if (elapsedTime >= this.durationMs) { this.stop(); this.onStep(1, this.data); this.onDone(); } else { this.onStep(elapsedTime / this.durationMs, this.data); } }; /* * The acceleration profiles. * * Each profile is a function that operates in the interval [0, 1] * and produces a result in the same interval. * * These functions are meant to be called in onStep() functions * to transform the progress indicator according to the desired * acceleration effect. */ exports.profiles = { "linear": function (x) { return x; }, "accelerate": function (x) { return Math.pow(x, 3); }, "strong-accelerate": function (x) { return Math.pow(x, 5); }, "decelerate": function (x) { return 1 - Math.pow(1 - x, 3); }, "strong-decelerate": function (x) { return 1 - Math.pow(1 - x, 5); }, "accelerate-decelerate": function (x) { var xs = x <= 0.5 ? x : 1 - x, y = Math.pow(2 * xs, 3) / 2; return x <= 0.5 ? y : 1 - y; }, "strong-accelerate-decelerate": function (x) { var xs = x <= 0.5 ? x : 1 - x, y = Math.pow(2 * xs, 5) / 2; return x <= 0.5 ? y : 1 - y; }, "decelerate-accelerate": function (x) { var xs = x <= 0.5 ? x : 1 - x, y = (1 - Math.pow(1 - 2 * xs, 2)) / 2; return x <= 0.5 ? y : 1 - y; }, "strong-decelerate-accelerate": function (x) { var xs = x <= 0.5 ? x : 1 - x, y = (1 - Math.pow(1 - 2 * xs, 3)) / 2; return x <= 0.5 ? y : 1 - y; } }; }); sozi-12.05.orig/player/js/display.js0000664000000000000000000002465611752172636016106 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend events.js */ /*global module:true sozi:true */ module("sozi.display", function (exports) { var window = this, document = window.document, initialBBox, SVG_NS = "http://www.w3.org/2000/svg"; exports.layers = {}; /* * Initializes the current Display. * * This method prepares the DOM representation of the current SVG document. * All the image is embedded into a global "g" element on which transformations will be applied. * A clipping rectangle is added. * * This method must be called when the document is ready to be manipulated. */ function onDocumentReady() { var svgClippedGroup, svgClipPath, idLayer, svgRoot = document.documentElement; // TODO check SVG tag initialBBox = svgRoot.getBBox(); svgRoot.setAttribute("width", window.innerWidth); svgRoot.setAttribute("height", window.innerHeight); // Initialize display geometry for all layers sozi.document.idLayerList.forEach(function (idLayer) { exports.layers[idLayer] = { geometry: { cx: 0, cy: 0, width: 1, height: 1, rotate: 0, clip: true }, svgClipRect: document.createElementNS(SVG_NS, "rect"), svgLayer: document.getElementById(idLayer) }; // Add a clipping path svgClipPath = document.createElementNS(SVG_NS, "clipPath"); svgClipPath.setAttribute("id", "sozi-clip-path-" + idLayer); svgClipPath.appendChild(exports.layers[idLayer].svgClipRect); svgRoot.appendChild(svgClipPath); // Create a group that will support the clipping operation // and move the layer group into that new group svgClippedGroup = document.createElementNS(SVG_NS, "g"); svgClippedGroup.setAttribute("clip-path", "url(#sozi-clip-path-" + idLayer + ")"); // Adding the layer group to the clipped group must preserve layer ordering svgRoot.insertBefore(svgClippedGroup, exports.layers[idLayer].svgLayer); svgClippedGroup.appendChild(exports.layers[idLayer].svgLayer); }); sozi.events.fire("displayready"); } /* * Resizes the SVG document to fit the browser window. */ function resize() { var svgRoot = document.documentElement; svgRoot.setAttribute("width", window.innerWidth); svgRoot.setAttribute("height", window.innerHeight); exports.update(); } /* * Returns an object with the geometrical properties of the current display. * * Attributes of the returned object : * - x, y: the location of the top-left corner, in pixels * - width, height: the size of the visible area, in pixels * - scale: the scale factor to apply to the SVG document so that is fits the visible area */ function getFrameGeometry(idLayer) { var g = exports.layers[idLayer].geometry, result = {}; result.scale = Math.min(window.innerWidth / g.width, window.innerHeight / g.height); result.width = g.width * result.scale; result.height = g.height * result.scale; result.x = (window.innerWidth - result.width) / 2; result.y = (window.innerHeight - result.height) / 2; return result; } /* * Returns the geometrical properties of the frame that can be * created from a given element. * * If the element is a rectangle, the properties of the frames are based * on the geometrical properties of the rectangle. * Otherwise, the properties of the frame are based on the bounding box * of the given element. * * Parameters: * - svgElement: an element from the SVG DOM * * Returns: * - The default size, translation and rotation for the given element */ exports.getElementGeometry = function (svgElement) { var x, y, w, h, b, c, matrix = svgElement.getCTM(), scale = Math.sqrt(matrix.a * matrix.a + matrix.b * matrix.b); if (svgElement.nodeName === "rect") { x = svgElement.x.baseVal.value; y = svgElement.y.baseVal.value; w = svgElement.width.baseVal.value; h = svgElement.height.baseVal.value; } else { b = svgElement.getBBox(); x = b.x; y = b.y; w = b.width; h = b.height; } c = document.documentElement.createSVGPoint(); c.x = x + w / 2; c.y = y + h / 2; c = c.matrixTransform(matrix); return { cx: c.x, cy: c.y, width: w * scale, height: h * scale, rotate: Math.atan2(matrix.b, matrix.a) * 180 / Math.PI }; }; /* * Returns the geometrical properties of the SVG document * * Returns: * - The default size, translation and rotation for the document's bounding box */ exports.getDocumentGeometry = function () { var idLayer, result = { layers: {} }, value = { geometry: { cx: initialBBox.x + initialBBox.width / 2, cy: initialBBox.y + initialBBox.height / 2, width: initialBBox.width, height: initialBBox.height, rotate: 0, clip: false } }; for (idLayer in exports.layers) { if (exports.layers.hasOwnProperty(idLayer)) { result.layers[idLayer] = value; } } return result; }; /* * Apply geometrical transformations to the image according to the current * geometrical attributes of this Display. * * This method is called automatically when the window is resized. */ exports.update = function () { var idLayer, fg, lg, cr, translateX, translateY; for (idLayer in exports.layers) { if (exports.layers.hasOwnProperty(idLayer)) { lg = exports.layers[idLayer].geometry; fg = getFrameGeometry(idLayer); // Adjust the location and size of the clipping rectangle and the frame rectangle cr = exports.layers[idLayer].svgClipRect; cr.setAttribute("x", lg.clip ? fg.x : 0); cr.setAttribute("y", lg.clip ? fg.y : 0); cr.setAttribute("width", lg.clip ? fg.width : window.innerWidth); cr.setAttribute("height", lg.clip ? fg.height : window.innerHeight); // Compute and apply the geometrical transformation to the layer group translateX = -lg.cx + lg.width / 2 + fg.x / fg.scale; translateY = -lg.cy + lg.height / 2 + fg.y / fg.scale; exports.layers[idLayer].svgLayer.setAttribute("transform", "scale(" + fg.scale + ")" + "translate(" + translateX + "," + translateY + ")" + "rotate(" + (-lg.rotate) + ',' + lg.cx + "," + lg.cy + ")" ); } } }; /* * Transform the SVG document to show the given frame. * * Parameters: * - frame: the frame to show */ exports.showFrame = function (frame) { var idLayer, lg, fg, attr; for (idLayer in frame.layers) { if (frame.layers.hasOwnProperty(idLayer)) { fg = frame.layers[idLayer].geometry; lg = exports.layers[idLayer].geometry; for (attr in fg) { if (fg.hasOwnProperty(attr)) { lg[attr] = fg[attr]; } } } } exports.update(); }; /* * Apply an additional translation to the SVG document based on onscreen coordinates. * * Parameters: * - deltaX: the horizontal displacement, in pixels * - deltaY: the vertical displacement, in pixels */ exports.drag = function (deltaX, deltaY) { var idLayer, lg, fg, angleRad; for (idLayer in exports.layers) { if (exports.layers.hasOwnProperty(idLayer)) { lg = exports.layers[idLayer].geometry; fg = getFrameGeometry(idLayer); angleRad = lg.rotate * Math.PI / 180; lg.cx -= (deltaX * Math.cos(angleRad) - deltaY * Math.sin(angleRad)) / fg.scale; lg.cy -= (deltaX * Math.sin(angleRad) + deltaY * Math.cos(angleRad)) / fg.scale; lg.clip = false; } } exports.update(); }; /* * Zooms the display with the given factor. * * The zoom is centered around (x, y) with respect to the center of the display area. */ exports.zoom = function (factor, x, y) { var idLayer, deltaX = (1 - factor) * (x - window.innerWidth / 2), deltaY = (1 - factor) * (y - window.innerHeight / 2); for (idLayer in exports.layers) { if (exports.layers.hasOwnProperty(idLayer)) { exports.layers[idLayer].geometry.width /= factor; exports.layers[idLayer].geometry.height /= factor; } } exports.drag(deltaX, deltaY); }; /* * Rotate the display with the given angle. * * The rotation is centered around the center of the display area. */ exports.rotate = function (angle) { var idLayer; for (idLayer in exports.layers) { if (exports.layers.hasOwnProperty(idLayer)) { exports.layers[idLayer].geometry.rotate += angle; exports.layers[idLayer].geometry.rotate %= 360; } } exports.update(); }; sozi.events.listen("documentready", onDocumentReady); window.addEventListener("resize", resize, false); }); sozi-12.05.orig/player/js/document.js0000664000000000000000000002323011752172636016242 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend events.js */ /*global module:true sozi:true */ module("sozi.document", function (exports) { var window = this, document = window.document, SOZI_NS = "http://sozi.baierouge.fr", DEFAULTS = { "title": "Untitled", "sequence": "0", "hide": "true", "clip": "true", "timeout-enable": "false", "timeout-ms": "5000", "transition-duration-ms": "1000", "transition-zoom-percent": "0", "transition-profile": "linear" }; exports.frames = []; exports.idLayerList = []; /* * Returns the value of an attribute of a given Sozi SVG element. * * If the attribute is not set, then a default value is returned. * See DEFAULTS. */ function readAttribute(soziElement, attr) { var value = soziElement.getAttributeNS(SOZI_NS, attr); return value === "" ? DEFAULTS[attr] : value; } function readLayerProperties(frame, idLayer, soziElement) { var layer = frame.layers[idLayer] = frame.layers[idLayer] || { idLayer: idLayer, // FIXME never used geometry: { clip: DEFAULTS.clip } }, clip = layer.geometry.clip, svgElement; if (typeof layer.hide === "undefined" || soziElement.hasAttributeNS(SOZI_NS, "hide")) { layer.hide = readAttribute(soziElement, "hide") === "true"; } if (typeof layer.transitionZoomPercent === "undefined" || soziElement.hasAttributeNS(SOZI_NS, "transition-zoom-percent")) { layer.transitionZoomPercent = parseInt(readAttribute(soziElement, "transition-zoom-percent"), 10); } if (typeof layer.transitionProfile === "undefined" || soziElement.hasAttributeNS(SOZI_NS, "transition-profile")) { layer.transitionProfile = sozi.animation.profiles[readAttribute(soziElement, "transition-profile") || "linear"]; } if (soziElement.hasAttributeNS(SOZI_NS, "refid")) { // The previous value of the "clip" attribute will be preserved // when setting the new geometry object. svgElement = document.getElementById(soziElement.getAttributeNS(SOZI_NS, "refid")); if (svgElement) { if (layer.hide) { svgElement.style.visibility = "hidden"; } layer.geometry = sozi.display.getElementGeometry(svgElement); layer.geometry.clip = clip; } } if (soziElement.hasAttributeNS(SOZI_NS, "clip")) { layer.geometry.clip = readAttribute(soziElement, "clip") === "true"; } } /* * Builds the list of frames from the current document. * * This method collects all elements with tag "sozi:frame" and * retrieves their geometrical and animation attributes. * SVG elements that should be hidden during the presentation are hidden. * * The resulting list is available in frames, sorted by frame indices. */ function readFrames() { var soziFrameList, soziLayerList, svgWrapper, svgElementList, svgRoot = document.documentElement, SVG_NS = "http://www.w3.org/2000/svg"; // Collect all group ids of elements soziLayerList = Array.prototype.slice.call(document.getElementsByTagNameNS(SOZI_NS, "layer")); soziLayerList.forEach(function (soziLayer) { var idLayer = soziLayer.getAttributeNS(SOZI_NS, "group"); if (idLayer && exports.idLayerList.indexOf(idLayer) === -1 && document.getElementById(idLayer)) { exports.idLayerList.push(idLayer); } }); // If at least one element has a refid attribute, // reorganize the document, grouping objects that do not belong // to a group referenced in elements soziFrameList = Array.prototype.slice.call(document.getElementsByTagNameNS(SOZI_NS, "frame")); if (soziFrameList.some(function (soziFrame) { return soziFrame.hasAttributeNS(SOZI_NS, "refid"); })) { // Create the first wrapper group svgWrapper = document.createElementNS(SVG_NS, "g"); // For each child of the root SVG element svgElementList = Array.prototype.slice.call(svgRoot.childNodes); svgElementList.forEach(function (svgElement, index) { if (!svgElement.getAttribute) { // Remove text elements svgRoot.removeChild(svgElement); } else if (exports.idLayerList.indexOf(svgElement.getAttribute("id")) === -1) { // If the current element is not a referenced layer, // move it to the current wrapper element // FIXME move graphic elements only svgRoot.removeChild(svgElement); svgWrapper.appendChild(svgElement); } else if (svgWrapper.firstChild) { // If the current element is a referenced layer, // and if there were other non-referenced elements before it, // insert the wrapper group before the current element svgWrapper.setAttribute("id", "sozi-wrapper-" + index); exports.idLayerList.push("sozi-wrapper-" + index); svgRoot.insertBefore(svgWrapper, svgElement); // Prepare a new wrapper element svgWrapper = document.createElementNS(SVG_NS, "g"); } }); // Append last wrapper if needed if (svgWrapper.firstChild) { svgWrapper.setAttribute("id", "sozi-wrapper-" + svgElementList.length); exports.idLayerList.push("sozi-wrapper-" + svgElementList.length); svgRoot.appendChild(svgWrapper); } } // Analyze elements soziFrameList.forEach(function (soziFrame, indexFrame) { var idLayer, newFrame = { id: soziFrame.getAttribute("id"), title: readAttribute(soziFrame, "title"), sequence: parseInt(readAttribute(soziFrame, "sequence"), 10), timeoutEnable: readAttribute(soziFrame, "timeout-enable") === "true", timeoutMs: parseInt(readAttribute(soziFrame, "timeout-ms"), 10), transitionDurationMs: parseInt(readAttribute(soziFrame, "transition-duration-ms"), 10), layers: {} }; // Get the default properties for all layers, either from // the current element or from the corresponding // layer in the previous frame. // Those properties can later be overriden by elements exports.idLayerList.forEach(function (idLayer) { var attr, currentLayer, previousLayer; if (indexFrame === 0 || idLayer.search("sozi-wrapper-[0-9]+") !== -1) { // In the first frame, or in wrapper layers, // read layer attributes from the element readLayerProperties(newFrame, idLayer, soziFrame); } else { // After the first frame, in referenced layers, // copy attributes from the corresponding layer in the previous frame currentLayer = newFrame.layers[idLayer] = {}; previousLayer = exports.frames[exports.frames.length - 1].layers[idLayer]; for (attr in previousLayer) { currentLayer[attr] = previousLayer[attr]; } } }); // Collect and analyze elements in the current element soziLayerList = Array.prototype.slice.call(soziFrame.getElementsByTagNameNS(SOZI_NS, "layer")); soziLayerList.forEach(function (soziLayer) { var idLayer = soziLayer.getAttributeNS(SOZI_NS, "group"); if (idLayer && exports.idLayerList.indexOf(idLayer) !== -1) { readLayerProperties(newFrame, idLayer, soziLayer); } }); // If the element has at least one valid layer, // add it to the frame list for (idLayer in newFrame.layers) { if (newFrame.layers.hasOwnProperty(idLayer)) { exports.frames.push(newFrame); break; } } }); // Sort frames by sequence index exports.frames.sort( function (a, b) { return a.sequence - b.sequence; } ); } /* * Event handler: document load. * * This function reads the frames from the document and fires * the "documentready" event. */ function onLoad() { document.documentElement.removeAttribute("viewBox"); readFrames(); sozi.events.fire("documentready"); } window.addEventListener("load", onLoad, false); }); sozi-12.05.orig/player/js/events.js0000664000000000000000000000270111752172636015730 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js */ /*global module:true sozi:true */ module("sozi.events", function (exports) { var listenerRegistry = {}; /* * Adds a listener for a given event type. * * The event type is provided as a string by the key parameter. * The function to be executed is provided by the handler parameter. */ exports.listen = function (key, handler) { if (!listenerRegistry.hasOwnProperty(key)) { listenerRegistry[key] = []; } listenerRegistry[key].push(handler); }; /* * Fire an event of the given type. * * All event handlers added for the given event type are * executed. * Additional arguments provided to this function are passed * to the event handlers. */ exports.fire = function (key) { var args = Array.prototype.slice.call(arguments, 1); if (listenerRegistry.hasOwnProperty(key)) { listenerRegistry[key].forEach(function (listener) { listener.apply(null, args); }); } }; }); sozi-12.05.orig/player/js/extras/0000775000000000000000000000000011752172636015374 5ustar rootrootsozi-12.05.orig/player/js/extras/sozi_extras_addvideo.js0000664000000000000000000000717411752172636022154 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. */ this.addEventListener("load", function () { var svgNs = "http://www.w3.org/2000/svg", soziNs = "http://sozi.baierouge.fr", xhtmlNs = "http://www.w3.org/1999/xhtml", window = this, document = window.document, mediaSources = [], mediaList, i, j, k, rect, foreignObject, html, htmlMedia, htmlSource; function clickHandler(evt) { evt.stopPropagation(); } function registerFrameChangeHandler(htmlMedia, startFrame, stopFrame) { sozi.events.listen("framechange", function(index) { var frameId = sozi.document.frames[index].id; if (frameId === startFrame) { htmlMedia.play(); } else if (frameId === stopFrame) { htmlMedia.pause(); } }); } mediaSources.push(document.getElementsByTagNameNS(soziNs, "video")); mediaSources.push(document.getElementsByTagNameNS(soziNs, "audio")); mediaList = []; for (k = 0; k < mediaSources.length; k += 1) { for (i = 0; i < mediaSources[k].length; i += 1) { rect = mediaSources[k][i].parentNode; // Create HTML media source element htmlSource = document.createElementNS(xhtmlNs, "source"); htmlSource.setAttribute("type", mediaSources[k][i].getAttributeNS(soziNs, "type")); htmlSource.setAttribute("src", mediaSources[k][i].getAttributeNS(soziNs, "src")); for (j = 0; j < mediaList.length; j += 1) { if (mediaList[j].rect === rect) { break; } } if (j === mediaList.length) { rect.setAttribute("visibility", "hidden"); // Create HTML media element htmlMedia = document.createElementNS(xhtmlNs, mediaSources[k][i].localName); htmlMedia.setAttribute("controls", "controls"); if (mediaSources[k][i].localName === "video") { htmlMedia.setAttribute("width", rect.getAttribute("width")); htmlMedia.setAttribute("height", rect.getAttribute("height")); } htmlMedia.addEventListener("click", clickHandler, false); htmlMedia.addEventListener("contextmenu", clickHandler, false); // Create HTML root element html = document.createElementNS(xhtmlNs, "html"); html.appendChild(htmlMedia); // Create SVG foreign object foreignObject = document.createElementNS(svgNs, "foreignObject"); foreignObject.setAttribute("x", rect.getAttribute("x")); foreignObject.setAttribute("y", rect.getAttribute("y")); foreignObject.setAttribute("width", rect.getAttribute("width")); foreignObject.setAttribute("height", rect.getAttribute("height")); foreignObject.appendChild(html); rect.parentNode.insertBefore(foreignObject, rect.nextSibling); if (mediaSources[k][i].hasAttributeNS(soziNs, "start-frame")) { registerFrameChangeHandler(htmlMedia, mediaSources[k][i].getAttributeNS(soziNs, "start-frame"), mediaSources[k][i].getAttributeNS(soziNs, "stop-frame") ); } mediaList.push({ rect: mediaSources[k][i].parentNode, htmlMedia: htmlMedia }); } // Append HTML source element to current HTML media element mediaList[j].htmlMedia.appendChild(htmlSource); } } }, false); sozi-12.05.orig/player/js/framelist.js0000664000000000000000000001760411752172636016422 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend events.js */ /*global module:true sozi:true */ module("sozi.framelist", function (exports) { var window = this, document = window.document, tocGroup, linksBox, tocHeight = 0, MARGIN = 5, translateXHidden, translateXVisible, translateXStart, translateXEnd, translateX, animator, ANIMATION_TIME_MS = 300, ANIMATION_PROFILE = "decelerate", SVG_NS = "http://www.w3.org/2000/svg"; function onMouseOut(evt) { var rel = evt.relatedTarget, svgRoot = document.documentElement; while (rel !== tocGroup && rel !== svgRoot) { rel = rel.parentNode; } if (rel === svgRoot) { exports.hide(); sozi.player.restart(); evt.stopPropagation(); } } function onClickArrowUp(evt) { var ty = linksBox.getCTM().f; if (ty <= -window.innerHeight / 2) { ty += window.innerHeight / 2; } else if (ty < 0) { ty = 0; } linksBox.setAttribute("transform", "translate(0," + ty + ")"); evt.stopPropagation(); } function onClickArrowDown(evt) { var ty = linksBox.getCTM().f; if (ty + tocHeight >= window.innerHeight * 3 / 2) { ty -= window.innerHeight / 2; } else if (ty + tocHeight > window.innerHeight + 2 * MARGIN) { ty = window.innerHeight - tocHeight - 4 * MARGIN; } linksBox.setAttribute("transform", "translate(0," + ty + ")"); evt.stopPropagation(); } function onAnimationStep(progress) { var profileProgress = sozi.animation.profiles[ANIMATION_PROFILE](progress), remaining = 1 - profileProgress; translateX = translateXEnd * profileProgress + translateXStart * remaining; tocGroup.setAttribute("transform", "translate(" + translateX + ",0)"); } function onAnimationDone() { // Empty } /* * Create a function that responds to clicks on frame list entries. */ function makeClickHandler(index) { return function (evt) { sozi.player.previewFrame(index); evt.stopPropagation(); }; } /* * The default event handler, to prevent event propagation * through the frame list. */ function defaultEventHandler(evt) { evt.stopPropagation(); } /* * Adds a table of contents to the document. * * The table of contents is a rectangular region with the list of frame titles. * Clicking on a title moves the presentation to the corresponding frame. * * The table of contents is hidden by default. */ function onDisplayReady() { var tocBackground = document.createElementNS(SVG_NS, "rect"), tocUp = document.createElementNS(SVG_NS, "path"), tocDown = document.createElementNS(SVG_NS, "path"), tocWidth = 0, textWidth, currentFrameIndex = sozi.location.getFrameIndex(); tocGroup = document.createElementNS(SVG_NS, "g"); tocGroup.setAttribute("id", "sozi-toc"); document.documentElement.appendChild(tocGroup); linksBox = document.createElementNS(SVG_NS, "g"); tocGroup.appendChild(linksBox); tocBackground.setAttribute("id", "sozi-toc-background"); tocBackground.setAttribute("x", MARGIN); tocBackground.setAttribute("y", MARGIN); tocBackground.setAttribute("rx", MARGIN); tocBackground.setAttribute("ry", MARGIN); tocBackground.addEventListener("click", defaultEventHandler, false); tocBackground.addEventListener("mousedown", defaultEventHandler, false); tocBackground.addEventListener("mouseout", onMouseOut, false); linksBox.appendChild(tocBackground); sozi.document.frames.forEach(function (frame, frameIndex) { var text = document.createElementNS(SVG_NS, "text"); text.appendChild(document.createTextNode(frame.title)); linksBox.appendChild(text); if (frameIndex === currentFrameIndex) { text.setAttribute("class", "sozi-toc-current"); } textWidth = text.getBBox().width; tocHeight += text.getBBox().height; if (textWidth > tocWidth) { tocWidth = textWidth; } text.setAttribute("x", 2 * MARGIN); text.setAttribute("y", tocHeight + MARGIN); text.addEventListener("click", makeClickHandler(frameIndex), false); text.addEventListener("mousedown", defaultEventHandler, false); }); tocUp.setAttribute("class", "sozi-toc-arrow"); tocUp.setAttribute("d", "M" + (tocWidth + 3 * MARGIN) + "," + (5 * MARGIN) + " l" + (4 * MARGIN) + ",0" + " l-" + (2 * MARGIN) + ",-" + (3 * MARGIN) + " z"); tocUp.addEventListener("click", onClickArrowUp, false); tocUp.addEventListener("mousedown", defaultEventHandler, false); tocGroup.appendChild(tocUp); tocDown.setAttribute("class", "sozi-toc-arrow"); tocDown.setAttribute("d", "M" + (tocWidth + 3 * MARGIN) + "," + (7 * MARGIN) + " l" + (4 * MARGIN) + ",0" + " l-" + (2 * MARGIN) + "," + (3 * MARGIN) + " z"); tocDown.addEventListener("click", onClickArrowDown, false); tocDown.addEventListener("mousedown", defaultEventHandler, false); tocGroup.appendChild(tocDown); tocBackground.setAttribute("width", tocWidth + 7 * MARGIN); tocBackground.setAttribute("height", tocHeight + 2 * MARGIN); translateXHidden = -tocWidth - 9 * MARGIN; translateXVisible = 0; translateX = translateXEnd = translateXHidden; tocGroup.setAttribute("transform", "translate(" + translateXHidden + ",0)"); animator = new sozi.animation.Animator(onAnimationStep, onAnimationDone); } /* * Highlight the current frame title in the frame list. * * This handler is called on each frame change, * even when the frame list is hidden. */ function onFrameChange(index) { var currentElementList = Array.prototype.slice.call(document.getElementsByClassName("sozi-toc-current")), textElements = linksBox.getElementsByTagName("text"); currentElementList.forEach(function (svgElement) { svgElement.removeAttribute("class"); }); textElements[index].setAttribute("class", "sozi-toc-current"); } /* * Makes the table of contents visible. */ exports.show = function () { translateXStart = translateX; translateXEnd = translateXVisible; animator.start(ANIMATION_TIME_MS); // FIXME depends on current elapsed time }; /* * Makes the table of contents invisible. */ exports.hide = function () { translateXStart = translateX; translateXEnd = translateXHidden; animator.start(ANIMATION_TIME_MS); // FIXME depends on current elapsed time }; /* * Returns true if the table of contents is visible, false otherwise. */ exports.isVisible = function () { return translateXEnd === translateXVisible; }; sozi.events.listen("displayready", onDisplayReady); sozi.events.listen("cleanup", exports.hide); sozi.events.listen("framechange", onFrameChange); }); sozi-12.05.orig/player/js/framenumber.js0000664000000000000000000000364611752172636016740 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend events.js */ /*global module:true sozi:true */ module("sozi.framenumber", function (exports) { var window = this, document = window.document, group, text, circle, textNode, SVG_NS = "http://www.w3.org/2000/svg"; function adjust() { var textBBox = text.getBBox(), d = Math.max(textBBox.width, textBBox.height) * 0.75, t = d * 1.25; circle.setAttribute("r", d); group.setAttribute("transform", "translate(" + t + "," + t + ")"); } function onDisplayReady() { group = document.createElementNS(SVG_NS, "g"); text = document.createElementNS(SVG_NS, "text"); circle = document.createElementNS(SVG_NS, "circle"); group.setAttribute("id", "sozi-framenumber"); circle.setAttribute("cx", 0); circle.setAttribute("cy", 0); group.appendChild(circle); textNode = document.createTextNode(sozi.location.getFrameIndex() + 1); text.setAttribute("text-anchor", "middle"); text.setAttribute("dominant-baseline", "central"); text.setAttribute("x", 0); text.setAttribute("y", 0); text.appendChild(textNode); group.appendChild(text); document.documentElement.appendChild(group); adjust(); } function onFrameChange(index) { textNode.nodeValue = index + 1; } sozi.events.listen("displayready", onDisplayReady); sozi.events.listen("framechange", onFrameChange); }); sozi-12.05.orig/player/js/location.js0000664000000000000000000000514311752172636016237 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend events.js */ /*global module:true sozi:true */ module("sozi.location", function (exports) { var window = this, changedFromWithin = false; /* * Returns the frame index given in the URL hash. * * In the URL, the frame index starts a 1. * This method converts it into a 0-based index. * * If the URL hash is not a positive integer, then 0 is returned. * It the URL hash is an integer greater than the last frame index, then * the last frame index is returned. */ exports.getFrameIndex = function () { var index = window.location.hash ? parseInt(window.location.hash.slice(1), 10) - 1 : 0; if (isNaN(index) || index < 0) { return 0; } else if (index >= sozi.document.frames.length) { return sozi.document.frames.length - 1; } else { return index; } }; /* * Event handler: hash change. * * This function is called when the URL hash is changed. * If the hash was changed manually in the address bar, and if it corresponds to * a valid frame number, then the presentation moves to that frame. * * The hashchange event can be triggered externally, by the user modifying the URL, * or internally, by the script modifying window.location.hash. */ function onHashChange() { var index = exports.getFrameIndex(); if (!changedFromWithin) { sozi.player.moveToFrame(index); } changedFromWithin = false; } /* * Event handler: frame change. * * This function is called when the presentation has reached a * new frame. * The URL hash is changed based on the provided frame index. */ function onFrameChange(index) { changedFromWithin = true; window.location.hash = "#" + (index + 1); } /* * Event handler: document load. * * This function registers the "framechange" handler. */ function onLoad() { sozi.events.listen("framechange", onFrameChange); } window.addEventListener("hashchange", onHashChange, false); window.addEventListener("load", onLoad, false); }); sozi-12.05.orig/player/js/module.js0000664000000000000000000000033211752172636015707 0ustar rootroot function module(path, body) { var current = this; path.split(".").forEach(function (name) { if (typeof current[name] === "undefined") { current[name] = {}; } current = current[name]; }); body(current); } sozi-12.05.orig/player/js/player.js0000664000000000000000000003400211752172636015717 0ustar rootroot/* * Sozi - A presentation tool using the SVG standard * * Copyright (C) 2010-2012 Guillaume Savaton * * This program is dual licensed under the terms of the MIT license * or the GNU General Public License (GPL) version 3. * A copy of both licenses is provided in the doc/ folder of the * official release of Sozi. * * See http://sozi.baierouge.fr/wiki/en:license for details. * * @depend module.js * @depend events.js * @depend animation.js * @depend display.js */ /*global module:true sozi:true */ module("sozi.player", function (exports) { var display = sozi.display, window = this, animator, nextFrameTimeout, DEFAULT_DURATION_MS = 500, DEFAULT_ZOOM_PERCENT = -10, DEFAULT_PROFILE = "linear", sourceFrameIndex = 0, currentFrameIndex = 0, playing = false, waiting = false; /* * Event handler: animation step. * * This method is called periodically by animator after the animation * has been started, and until the animation time is elapsed. * * Parameter data provides the following information: * - initialState and finalState contain the geometrical properties of the display * at the start and end of the animation. * - profile is a reference to the speed profile function to use. * - zoomWidth and zoomHeight are the parameters of the zooming polynomial if the current * animation has a non-zero zooming effect. * * Parameter progress is a float number between 0 (start of the animation) * and 1 (end of the animation). */ function onAnimationStep(progress, data) { var profileProgress, profileRemaining, idLayer, lg, attr, ps; for (idLayer in data) { if (data.hasOwnProperty(idLayer)) { lg = display.layers[idLayer].geometry; profileProgress = data[idLayer].profile(progress); profileRemaining = 1 - profileProgress; for (attr in data[idLayer].initialState) { if (data[idLayer].initialState.hasOwnProperty(attr)) { if (typeof data[idLayer].initialState[attr] === "number" && typeof data[idLayer].finalState[attr] === "number") { lg[attr] = data[idLayer].finalState[attr] * profileProgress + data[idLayer].initialState[attr] * profileRemaining; } } } if (data[idLayer].zoomWidth && data[idLayer].zoomWidth.k !== 0) { ps = progress - data[idLayer].zoomWidth.ts; lg.width = data[idLayer].zoomWidth.k * ps * ps + data[idLayer].zoomWidth.ss; } if (data[idLayer].zoomHeight && data[idLayer].zoomHeight.k !== 0) { ps = progress - data[idLayer].zoomHeight.ts; lg.height = data[idLayer].zoomHeight.k * ps * ps + data[idLayer].zoomHeight.ss; } lg.clip = data[idLayer].finalState.clip; } } display.update(); } /* * Starts waiting before moving to the next frame. * * It the current frame has a timeout set, this method * will register a timer to move to the next frame automatically * after the specified time. * * If the current frame is the last, the presentation will * move to the first frame. */ function waitTimeout() { var index; if (sozi.document.frames[currentFrameIndex].timeoutEnable) { waiting = true; index = (currentFrameIndex + 1) % sozi.document.frames.length; nextFrameTimeout = window.setTimeout(function () { exports.moveToFrame(index); }, sozi.document.frames[currentFrameIndex].timeoutMs ); } } /* * Event handler: animation done. * * This method is called by animator when the current animation is finished. * * If the animation was a transition in the normal course of the presentation, * then we call the waitTimeout method to process the timeout property of the current frame. */ function onAnimationDone() { sourceFrameIndex = currentFrameIndex; if (playing) { waitTimeout(); } } /* * Starts the presentation from the given frame index (0-based). * * This method sets the "playing" flag, shows the desired frame * and calls waitTimeout. */ exports.startFromIndex = function (index) { playing = true; waiting = false; sourceFrameIndex = index; currentFrameIndex = index; display.showFrame(sozi.document.frames[index]); waitTimeout(); }; exports.restart = function () { exports.startFromIndex(currentFrameIndex); }; /* * Stops the presentation. * * This method clears the "playing". * If the presentation was in "waiting" mode due to a timeout * in the current frame, then it stops waiting. * The current animation is stopped in its current state. */ exports.stop = function () { animator.stop(); if (waiting) { window.clearTimeout(nextFrameTimeout); waiting = false; } playing = false; sourceFrameIndex = currentFrameIndex; }; function getZoomData(zoomPercent, s0, s1) { var result = { ss: ((zoomPercent < 0) ? Math.max(s0, s1) : Math.min(s0, s1)) * (100 - zoomPercent) / 100, ts: 0.5, k: 0 }, a, b, c, d, u, v; if (zoomPercent !== 0) { a = s0 - s1; b = s0 - result.ss; c = s1 - result.ss; if (a !== 0) { d = Math.sqrt(b * c); u = (b - d) / a; v = (b + d) / a; result.ts = (u > 0 && u <= 1) ? u : v; } result.k = b / result.ts / result.ts; } return result; } /* * Jump to a frame with the given index (0-based). * * This method does not animate the transition from the current * state of the display to the desired frame. * * The presentation is stopped: if a timeout has been set for the * target frame, it will be ignored. * * The URL hash is set to the given frame index (1-based). */ exports.jumpToFrame = function (index) { exports.stop(); sozi.events.fire("cleanup"); sourceFrameIndex = index; currentFrameIndex = index; display.showFrame(sozi.document.frames[index]); sozi.events.fire("framechange", index); }; /* * Returns an associative array where keys are layer names * and values are objects in the form { initialState: finalState: profile: zoomWidth: zoomHeight:} */ function getAnimationData(initialState, finalState, zoomPercent, profile) { var g, idLayer, zp, data = {}; for (idLayer in initialState.layers) { if (initialState.layers.hasOwnProperty(idLayer)) { data[idLayer] = { initialState: {}, finalState: {} }; data[idLayer].profile = profile || finalState.layers[idLayer].transitionProfile; // Copy all properties of given final state for (g in initialState.layers[idLayer].geometry) { if (initialState.layers[idLayer].geometry.hasOwnProperty(g)) { data[idLayer].initialState[g] = initialState.layers[idLayer].geometry[g]; // If the current layer is referenced in final state, copy the final properties // else, copy initial state to final state for the current layer. if (finalState.layers.hasOwnProperty(idLayer)) { data[idLayer].finalState[g] = finalState.layers[idLayer].geometry[g]; } else { data[idLayer].finalState[g] = initialState.layers[idLayer].geometry[g]; } } } // Keep the smallest angle difference between initial state and final state data[idLayer].initialState.rotate = (data[idLayer].initialState.rotate - 180) % 360 + 180; data[idLayer].finalState.rotate = (data[idLayer].finalState.rotate - 180) % 360 + 180; if (data[idLayer].finalState.rotate - data[idLayer].initialState.rotate > 180) { data[idLayer].finalState.rotate -= 360; } else if (data[idLayer].finalState.rotate - data[idLayer].initialState.rotate < -180) { data[idLayer].initialState.rotate -= 360; } zp = zoomPercent || finalState.layers[idLayer].transitionZoomPercent; if (zp && finalState.layers.hasOwnProperty(idLayer)) { data[idLayer].zoomWidth = getZoomData(zp, initialState.layers[idLayer].geometry.width, finalState.layers[idLayer].geometry.width); data[idLayer].zoomHeight = getZoomData(zp, initialState.layers[idLayer].geometry.height, finalState.layers[idLayer].geometry.height); } } } return data; } exports.previewFrame = function (index) { currentFrameIndex = index; animator.start(DEFAULT_DURATION_MS, getAnimationData(display, sozi.document.frames[index], DEFAULT_ZOOM_PERCENT, sozi.animation.profiles[DEFAULT_PROFILE])); sozi.events.fire("framechange", index); }; /* * Moves to a frame with the given index (0-based). * * This method animates the transition from the current * state of the display to the desired frame. * * If the given frame index corresponds to the next frame in the list, * the transition properties of the next frame are used. * Otherwise, default transition properties are used. * * The URL hash is set to the given frame index (1-based). */ exports.moveToFrame = function (index) { var durationMs, zoomPercent, profile; if (waiting) { window.clearTimeout(nextFrameTimeout); waiting = false; } if (index === (currentFrameIndex + 1) % sozi.document.frames.length) { durationMs = sozi.document.frames[index].transitionDurationMs; zoomPercent = undefined; // Set for each layer profile = undefined; // Set for each layer } else { durationMs = DEFAULT_DURATION_MS; zoomPercent = DEFAULT_ZOOM_PERCENT; profile = sozi.animation.profiles[DEFAULT_PROFILE]; } sozi.events.fire("cleanup"); playing = true; currentFrameIndex = index; animator.start(durationMs, getAnimationData(display, sozi.document.frames[index], zoomPercent, profile)); sozi.events.fire("framechange", index); }; /* * Moves to the first frame of the presentation. */ exports.moveToFirst = function () { exports.moveToFrame(0); }; /* * Jumps to the previous frame */ exports.jumpToPrevious = function () { var index = currentFrameIndex; if (!animator.started || sourceFrameIndex <= currentFrameIndex) { index -= 1; } if (index >= 0) { exports.jumpToFrame(index); } }; /* * Moves to the previous frame. */ exports.moveToPrevious = function () { var index, frame; for (index = currentFrameIndex - 1; index >= 0; index -= 1) { frame = sozi.document.frames[index]; if (!frame.timeoutEnable || frame.timeoutMs !== 0) { exports.moveToFrame(index); break; } } }; /* * Jumps to the next frame */ exports.jumpToNext = function () { var index = currentFrameIndex; if (!animator.started || sourceFrameIndex >= currentFrameIndex) { index += 1; } if (index < sozi.document.frames.length) { exports.jumpToFrame(index); } }; /* * Moves to the next frame. */ exports.moveToNext = function () { if (currentFrameIndex < sozi.document.frames.length - 1 || sozi.document.frames[currentFrameIndex].timeoutEnable) { exports.moveToFrame((currentFrameIndex + 1) % sozi.document.frames.length); } }; /* * Moves to the last frame of the presentation. */ exports.moveToLast = function () { exports.moveToFrame(sozi.document.frames.length - 1); }; /* * Restores the current frame. * * This method restores the display to fit the current frame, * e.g. after the display has been zoomed or dragged. */ exports.moveToCurrent = function () { exports.moveToFrame(currentFrameIndex); }; /* * Shows all the document in the browser window. */ exports.showAll = function () { exports.stop(); sozi.events.fire("cleanup"); animator.start(DEFAULT_DURATION_MS, getAnimationData(display, display.getDocumentGeometry(), DEFAULT_ZOOM_PERCENT, sozi.animation.profiles[DEFAULT_PROFILE] ) ); }; /* * Event handler: display ready. */ function onDisplayReady() { exports.startFromIndex(sozi.location.getFrameIndex()); // Hack to fix the blank screen bug in Chrome/Chromium // See https://github.com/senshu/Sozi/issues/109 window.setTimeout(display.update, 1); } animator = new sozi.animation.Animator(onAnimationStep, onAnimationDone); sozi.events.listen("displayready", onDisplayReady); }); sozi-12.05.orig/player/js/sozi.js0000664000000000000000000000025611752172636015413 0ustar rootroot/* @depend framenumber.js @depend framelist.js @depend actions.js @depend player.js @depend display.js @depend document.js @depend location.js */ sozi-12.05.orig/player/tools/0000775000000000000000000000000011752172636014612 5ustar rootrootsozi-12.05.orig/player/tools/header0000775000000000000000000000116211752172636015770 0ustar rootroot#!/bin/sh header_file=$1 header_name=`basename $1 | sed -e 's/\./_/g'` shift echo "#ifndef __${header_name}__" > ${header_file} echo "#define __${header_name}__" >> ${header_file} echo "" >> ${header_file} while [ "$1" ]; do var_name=`basename $1 | sed -e 's/\./_/g'` echo "static const char ${var_name}[] =" >> ${header_file} # FIXME : certainly can be improved (try sed -e 's/.\{76\}/&"\n"/g' ?) cat $1 | tr -d '\n' | fold | sed -e 's/"/\\"/g' -e 's/^/\"/g;s/$/\"/g' >> ${header_file} echo ";" >> ${header_file} echo "" >> ${header_file} shift done echo "#endif /* __sozi_h__ */" >> ${header_file} sozi-12.05.orig/player/tools/minifier0000775000000000000000000000267411752172636016353 0ustar rootroot#!/bin/sh # This tools allow to wrap call a minifier and to format its output # Usage : # ./minifier minifier_path output_file input_file_1 [input_file_2 ... input_file_n] # Arguments # minifier path is the path to the minifier to use # output_file is the resulting file # input_file_* are the input files # # first argument is the minifier minifier=$1 shift # second argument is the output filename output=$1 shift # others arguments are the input filenames inputs=$@ # the last input is the only one that should be taken eval "last_input=\${$#}" # the input filetype input_ext=${inputs##*.} echo -n "Will minify (${inputs}) into ${output} with " case $minifier in *yuicompressor*) echo "yuicompressor (${minifier})" tmp_1="tmp_1.${input_ext}" cat ${inputs} > ${tmp_1} java -jar ${minifier} -o ${output} ${tmp_1} rm ${tmp_1} ;; *juicer*) echo "juicer (${minifier}) (last_input=$last_input)" ${minifier} merge --skip-verification --force --output ${output} ${last_input} ;; *) echo "sed" cat ${inputs} | \ sed \ -e "s|/\*\(\\\\\)\?\*/|/~\1~/|g" \ -e "s|/\*[^*]*\*\+\([^/][^*]*\*\+\)*/||g" \ -e "s|\([^:/]\)//.*$|\1|" \ -e "s|^//.*$||" \ | \ tr '\n' ' ' \ | \ sed \ -e "s|/\*[^*]*\*\+\([^/][^*]*\*\+\)*/||g" \ -e "s|/\~\(\\\\\)\?\~/|/*\1*/|g" \ -e "s|\s\+| |g" \ -e "s| \([{;:,]\)|\1|g" \ -e "s|\([{;:,]\) |\1|g" \ > ${output} ;; esac sozi-12.05.orig/samples/0000775000000000000000000000000011752172636013622 5ustar rootrootsozi-12.05.orig/samples/bounce.svg0000664000000000000000000024632311752172636015630 0ustar rootroot image/svg+xml sozi-12.05.orig/samples/ceci-nest-pas-un-diaporama.fast.svg0000664000000000000000000017772111752172636022324 0ustar rootroot image/svg+xml sozi-12.05.orig/samples/ceci-nest-pas-un-diaporama.html0000664000000000000000000000161411752172636021520 0ustar rootroot Sozi presentation in an iframe

Sozi presentation in an iframe

Sozi is a small program that can play animated presentations.

Unlike in most presentation applications, a Sozi document is not organised as a slideshow, but rather as a poster where the content of your presentation can be freely laid out. Playing such a presentation consists in a series of translations, zooms and rotations that allow to focus on the elements you want to show.

Sozi is based on open standards. It is free software distributed according to the terms of the GPL 3.0.

sozi-12.05.orig/samples/ceci-nest-pas-un-diaporama.svg0000664000000000000000000012646611752172636021370 0ustar rootroot image/svg+xml Ceci n'est pas un diaporama Ceci est sozi-12.05.orig/samples/layers-demo.svg0000664000000000000000000034667611752172636016612 0ustar rootroot image/svg+xml sozi-12.05.orig/samples/layers.svg0000664000000000000000000027205111752172636015651 0ustar rootroot image/svg+xml sozi-12.05.orig/samples/not-only-rect.svg0000664000000000000000000005573211752172636017071 0ustar rootroot image/svg+xml Bla Bla Baz Baz sozi-12.05.orig/samples/show-hide-objects.svg0000664000000000000000000006071211752172636017667 0ustar rootroot image/svg+xml First Second Third sozi-12.05.orig/samples/star.svg0000664000000000000000000007017111752172636015322 0ustar rootroot image/svg+xml 1 2 3 4 5 6 sozi-12.05.orig/samples/this-is-not-a-slideshow.fast.svg0000664000000000000000000016436211752172636021706 0ustar rootroot image/svg+xml sozi-12.05.orig/samples/this-is-not-a-slideshow.svg0000664000000000000000000012700711752172636020745 0ustar rootroot image/svg+xml This is not a slideshow This is sozi-12.05.orig/samples/transition-profiles.svg0000664000000000000000000011371711752172636020370 0ustar rootroot image/svg+xml Linear Accelerate Strong accelerate Decelerate Strong decelerate Accelerate-decelerate Strong accelerate-decelerate Decelerate-accelerate Strong decelerate-accelerate sozi-12.05.orig/samples/tutorial-complete.svg0000664000000000000000000006363411752172636020030 0ustar rootroot image/svg+xml 1 2 3 4 sozi-12.05.orig/samples/tutorial.svg0000664000000000000000000001363711752172636016220 0ustar rootroot image/svg+xml 1 2 3 4