pax_global_header00006660000000000000000000000064144013222360014507gustar00rootroot0000000000000052 comment=02914797f47d26c4098f4a3a945716b13998a8cc fraqtive-0.4.8.1/000077500000000000000000000000001440132223600135005ustar00rootroot00000000000000fraqtive-0.4.8.1/.gitignore000066400000000000000000000002761440132223600154750ustar00rootroot00000000000000debug release src/fraqtive_pch.h.cpp src/fraqtive.vcxproj src/fraqtive.vcxproj.filters src/fraqtive.vcxproj.user tmp .qmake.stash config.pri configure-msvc.bat fraqtive.sln fraqtive.v12.suo fraqtive-0.4.8.1/COPYING000066400000000000000000001045131440132223600145370ustar00rootroot00000000000000 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 . fraqtive-0.4.8.1/ChangeLog000066400000000000000000000033161440132223600152550ustar00rootroot000000000000000.4.8 (2015-01-29) * added multi-sampling option when generating images * fixed location of data files on Windows with Qt5 0.4.7 (2015-01-20) * fixed compatibility with Qt5 * increased the maximum size of generated images 0.4.6 (2012-12-04) * generating series of images * fixed navigation at high zoom levels * increased the maximum number of iterations * added the tool strip and other UI improvements 0.4.5 (2009-12-18) * added: generating images of arbitrary size * added: handling 4th and 5th mouse buttons * fixed: compatibility with Qt 4.6 * fixed: color mapping in 3D mode * fixed: updating Julia preview when navigating 0.4.4 (2008-07-28) * updated version of the Windows Modern Style * various UI improvements 0.4.3 (2008-05-12) * added: color and mesh animation * fixed: compatibility with Qt 4.4 * fixed: inverted mouse wheel operations * fixed: losing position on multi-core processors * fixed: install image format plugins on Windows 0.4.2 (2008-04-29) * added: mesh view * added: mesh advanced settings * added: copy and save mesh image 0.4.1 (2008-04-14) * added: bookmarks and color presets * added: copy and save image * added: full screen mode * fixed: crash on multi-core processors * fixed: compilation using GCC 3.4 and MinGW * fixed: compilation on MIPS and ARM platforms 0.4.0 (2008-03-25) * created new fractal generator engine * redesigned and rewritten user interface using Qt4 0.3.1 (2005-09-07) * minor improvements and bug fixes 0.3.0 (2005-07-04) * ported to KDE3 0.2.1 (2005-02-11) * minor improvements and bug fixes 0.2.0 (2005-01-24) * initial Qt3 version fraqtive-0.4.8.1/INSTALL000066400000000000000000000041131440132223600145300ustar00rootroot00000000000000Requirements ============ Requirements: * Qt 4.6 or newer (http://qt-project.org/) The program can be built using the standard 'qmake' tool from Qt. Simple configure scripts are available for both Linux and Windows which create a configuration file and run qmake with appropriate parameters. See detailed instructions below. Linux ===== To compile the program you will need a C++ compiler (preferably gcc) and headers for the Qt library (if you use binary packages, make sure you have the appropriate 'devel' package installed). The typical procedure of building and installing the program is: $ ./configure $ make # make install Additional options that can be passed to the configure script: -prefix DIR Location where the package will be installed (default is '/usr/local'). -qmake PATH Full path to the 'qmake' tool (required if it cannot be found automatically). -debug Build with debugging symbols. -no-sse2 Compile without using SSE2 instructions (by default SSE2 is enabled). Windows ======= You must have the open source edition of Qt installed. The program can be compiled using either the MinGW compiler or Microsoft Visual C++. If you are using MinGW, open the Qt Command Prompt. Go to the directory where you have unpacked Fraqtive and run: > configure.bat > mingw32-make If you are using Microsoft Visual C++, open the Visual Studio Command Prompt. Make sure that QTDIR is set to the path where Qt was installed. Go to the directory where you have unpacked Fraqtive and run: > set QTDIR=C:\path\to\qt > configure.bat > nmake Additional options that can be passed to the configure script: -prefix DIR The location where the package will be installed (default is 'C:\Program Files\Fraqtive'). -debug Build with debugging symbols. -no-sse2 Compile without using SSE2 instructions (by default SSE2 is enabled except on MinGW where it's buggy). -msvc Generate a solution for Microsoft Visual Studio instead of Makefiles. fraqtive-0.4.8.1/README000066400000000000000000000025271440132223600143660ustar00rootroot00000000000000Fraqtive Version 0.4.8 (2015-01-29) Mandelbrot family fractal generator. Fraqtive is an open source, multi-platform generator of the Mandelbrot family fractals. It uses very fast algorithms supporting SSE2 and multi-core processors. It generates high quality anti-aliased images and renders 3D scenes using OpenGL. It allows real-time navigation and dynamic generation of the Julia fractal preview. Copyrights ========== Copyright (C) 2004-2015 Michał Męciński Icons based on the KDE Crystal theme copyright (C) 2002 and following years KDE Artists License ======= 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 . Resources ========= Website http://fraqtive.mimec.org/ Forum http://fraqtive.mimec.org/forum/general Bugs & Requests http://fraqtive.mimec.org/forum/tracker fraqtive-0.4.8.1/configure000077500000000000000000000045711440132223600154160ustar00rootroot00000000000000#! /bin/sh prefix=/usr/local config=release sse2=sse2 QMAKE= usage="Usage: configure [-prefix DIR] [-qmake PATH] [-debug] Options: -prefix DIR Set the instalation directory to DIR (default: /usr/local) -qmake PATH Full path to the 'qmake' program (default: autodetect) -debug Build with debugging symbols -no-sse2 Do not compile with use of SSE2 instructions " while test $# -gt 0; do case $1 in -prefix ) prefix=$2 shift ; shift ;; -qmake ) QMAKE=$2 shift; shift ;; -debug ) config=debug shift ;; -no-sse2 ) sse2=no-sse2 shift ;; -help | --help ) echo "$usage" exit ;; * ) echo "*** ERROR: Unrecognized option '$1'" >&2 echo "$usage" exit 1 ;; esac done echo "Testing for qmake..." paths= if test -n "$QMAKE"; then if test -x "$QMAKE"; then paths=$QMAKE else echo "*** ERROR: '$QMAKE' is not an executable program." >&2 exit 1 fi else for i in qmake qmake-qt4; do if which $i >/dev/null 2>/dev/null; then paths="$paths `which $i`" fi if test -n "$QTDIR"; then if test -x "$QTDIR/bin/$i"; then paths="$paths $QTDIR/bin/$i" fi fi done fi if test -z "$paths"; then echo "*** ERROR: Cannot find 'qmake' in your PATH." >&2 exit 1 fi QMAKE= for i in $paths; do version=`$i -query QT_VERSION` if test "$version" != "**Unknown**"; then major=`echo $version | sed -e "s/\([0-9][0-9]*\).*/\1/"` minor=`echo $version | sed -e "s/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/"` if test $major -eq 5; then QMAKE=$i break fi fi done if test -z "$QMAKE"; then echo "*** ERROR: Cannot find 'qmake' from Qt 5." >&2 exit 1 fi echo "Using $QMAKE (Qt $version)" if test -f fraqtive.pro; then PROJECT=fraqtive.pro elif test -f ../fraqtive.pro; then PROJECT=../fraqtive.pro else echo "*** ERROR: Cannot find 'fraqtive.pro' in current or parent directory." >&2 exit 1 fi echo "Writing configuration file..." echo "# this file was generated by configure" >config.pri echo "CONFIG += $config $sse2" >>config.pri echo "PREFIX = $prefix" >>config.pri echo "Generating Makefiles..." if $QMAKE -recursive $PROJECT; then echo echo "Configure finished. Run 'make' now." echo else echo "*** ERROR: Running 'qmake' failed." >&2 exit 1 fi fraqtive-0.4.8.1/configure.bat000066400000000000000000000040711440132223600161530ustar00rootroot00000000000000@echo off set prefix="C:\Program Files\Fraqtive" set config=release set sse2=sse2 set msvc=no if exist .\fraqtive.pro goto arg_loop echo *** ERROR: cannot find project file in current directory. goto end :arg_loop if "%1" == "" goto arg_done if "%1" == "-prefix" goto arg_prefix if "%1" == "-debug" goto arg_debug if "%1" == "-no-sse2" goto arg_nosse2 if "%1" == "-msvc" goto arg_msvc if "%1" == "-help" goto show_usage if "%1" == "--help" goto show_usage if "%1" == "/?" goto show_usage echo *** ERROR: Unrecognized option '%1' goto show_usage :arg_prefix set prefix=%2 shift goto arg_next :arg_debug set config=debug goto arg_next :arg_nosse2 set sse2=no-sse2 goto arg_next :arg_msvc set msvc=yes goto arg_next :arg_next shift goto arg_loop :show_usage echo Usage: configure [-prefix DIR] [-debug] [-msvc] echo. echo Options: echo. echo -prefix DIR Set the instalation directory to DIR echo (default: C:\Program Files\Fraqtive) echo -debug Build with debugging symbols echo -no-sse2 Do not compile with use of SSE2 instructions echo -msvc Generate Visual Studio solution goto end :arg_done echo Testing for qmake... set QMAKE= qmake -v >nul 2>nul if errorlevel 1 goto test_qtdir set QMAKE=qmake goto qmake_found :test_qtdir if "%QTDIR%" == "" goto no_qmake "%QTDIR%\bin\qmake" -v >nul 2>nul if errorlevel 1 goto no_qmake set QMAKE=%QTDIR%\bin\qmake goto qmake_found :no_qmake echo *** ERROR: Cannot find 'qmake' in your PATH. goto end :qmake_found echo Writing configuration file... echo # this file was generated by configure.bat >config.pri echo CONFIG += %config% %sse2% >>config.pri echo PREFIX = %prefix:\=\\% >>config.pri if "%msvc%" == "yes" goto gen_msvc echo Generating Makefiles... "%QMAKE%" -recursive if errorlevel 1 goto qmake_failed echo. echo Configure finished. Run 'make' or 'nmake' now. goto end :gen_msvc echo Generating Visual Studio solution... "%QMAKE%" -tp vc -recursive if errorlevel 1 goto qmake_failed echo. echo Configure finished. goto end :qmake_failed echo *** ERROR: Running 'qmake' failed. :end fraqtive-0.4.8.1/fraqtive.pro000066400000000000000000000000701440132223600160400ustar00rootroot00000000000000include( config.pri ) TEMPLATE = subdirs SUBDIRS = src fraqtive-0.4.8.1/installer/000077500000000000000000000000001440132223600154755ustar00rootroot00000000000000fraqtive-0.4.8.1/installer/build.bat000066400000000000000000000034761440132223600172760ustar00rootroot00000000000000@echo off if "%1" == "" goto usage set VERSION=0.4.8 set BUILDVERSION=0.4.8.5508 set NSISDIR=C:\Program Files (x86)\NSIS\Unicode if not %1 == x86 goto elsex64 set BUILDDIR=D:\Release\fraqtive-x86 set QTDIR=D:\Qt5\x86 set VCRTDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT set ARCHITECTURE=win_x86 set SUFFIX= goto endopt :elsex64 if not %1 == x64 goto usage set BUILDDIR=D:\Release\fraqtive-x64 set QTDIR=D:\Qt5\x64 set VCRTDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.CRT set ARCHITECTURE=win_x64 set SUFFIX= (64-bit) goto endopt :usage echo usage: build.bat x86^|x64 goto :eof :endopt call "%QTDIR%\bin\qtvars.bat" vsvars if not exist "%BUILDDIR%" mkdir "%BUILDDIR%" echo. echo Exporting... echo. svn export --quiet --force .. "%BUILDDIR%" pushd "%BUILDDIR%" call configure.bat nmake release if errorlevel 1 goto cleanup call ..\sign.bat release\fraqtive.exe echo. echo Creating uninstaller... echo. "%NSISDIR%\makensis.exe" /DINNER "/DQTDIR=%QTDIR%" "/DVCRTDIR=%VCRTDIR%" "/DVERSION=%VERSION%" "/DBUILDVERSION=%BUILDVERSION%" "/DARCHITECTURE=%ARCHITECTURE%" "/DSUFFIX=%SUFFIX%" /V2 installer\fraqtive.nsi if errorlevel 1 goto cleanup "%TEMP%\innerinst.exe" call ..\sign.bat "%TEMP%\uninstall.exe" echo. echo Creating installer... echo. "%NSISDIR%\makensis.exe" "/DQTDIR=%QTDIR%" "/DVCRTDIR=%VCRTDIR%" "/DVERSION=%VERSION%" "/DBUILDVERSION=%BUILDVERSION%" "/DARCHITECTURE=%ARCHITECTURE%" "/DSUFFIX=%SUFFIX%" /V2 installer\fraqtive.nsi if errorlevel 1 goto cleanup call ..\sign.bat "installer\fraqtive-%VERSION%-%ARCHITECTURE%.exe" if not %1 == x86 goto cleanup :cleanup del /q /f "%TEMP%\innerinst.exe" del /q /f "%TEMP%\uninstall.exe" popd fraqtive-0.4.8.1/installer/fraqtive.nsi000066400000000000000000000140271440132223600200350ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ !define SRCDIR ".." !define BUILDDIR "..\release" !define UNINST_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Fraqtive" !include "MUI2.nsh" !include "languages\fraqtive_en.nsh" !ifdef INNER SetCompress off OutFile "$%TEMP%\innerinst.exe" !else !verbose 4 SetCompressor /SOLID lzma SetCompressorDictSize 32 OutFile "fraqtive-${VERSION}-${ARCHITECTURE}.exe" !endif !define MULTIUSER_EXECUTIONLEVEL "Highest" !define MULTIUSER_MUI !define MULTIUSER_INSTALLMODE_COMMANDLINE !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINST_KEY}" !define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "UninstallString" !define MULTIUSER_INSTALLMODE_INSTDIR "Fraqtive" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${UNINST_KEY}" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallLocation" !if ${ARCHITECTURE} == "win_x64" !define MULTIUSER_USE_PROGRAMFILES64 !endif !ifndef INNER !define MULTIUSER_NOUNINSTALL !endif !include "include\multiuser64.nsh" Name "$(NAME)" !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-blue.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-blue.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "images\wizard.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "images\wizard.bmp" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "images\header.bmp" !define MUI_HEADERIMAGE_RIGHT !define MUI_WELCOMEPAGE_TITLE "$(TITLE)" !define MUI_WELCOMEPAGE_TEXT "$(WELCOME_TEXT)" !insertmacro MUI_PAGE_WELCOME !define MUI_LICENSEPAGE_CHECKBOX !insertmacro MUI_PAGE_LICENSE "${SRCDIR}\COPYING" !insertmacro MULTIUSER_PAGE_INSTALLMODE !insertmacro MUI_PAGE_DIRECTORY ShowInstDetails nevershow !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_TITLE "$(TITLE)" !insertmacro MUI_PAGE_FINISH !ifdef INNER !define MUI_WELCOMEPAGE_TITLE "$(TITLE)" !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM ShowUninstDetails nevershow !insertmacro MUI_UNPAGE_INSTFILES !define MUI_FINISHPAGE_TITLE "$(TITLE)" !insertmacro MUI_UNPAGE_FINISH !endif !insertmacro MUI_LANGUAGE "English" VIProductVersion "${BUILDVERSION}" VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Michał Męciński" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Fraqtive Setup" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 2004-2015 Michał Męciński" VIAddVersionKey /LANG=${LANG_ENGLISH} "OriginalFilename" "fraqtive-${VERSION}-${ARCHITECTURE}.exe" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Fraqtive" VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${VERSION}" Function .onInit !if ${ARCHITECTURE} == "win_x64" SetRegView 64 !endif !ifdef INNER WriteUninstaller "$%TEMP%\uninstall.exe" Quit !endif !insertmacro MULTIUSER_INIT FunctionEnd Section SetOutPath "$INSTDIR" File "${SRCDIR}\ChangeLog" File "${SRCDIR}\COPYING" File "${SRCDIR}\README" SetOutPath "$INSTDIR\bin" Delete "$INSTDIR\bin\*.*" File "${BUILDDIR}\fraqtive.exe" File "${VCRTDIR}\msvcp100.dll" File "${VCRTDIR}\msvcr100.dll" File "qt.conf" File "${QTDIR}\bin\Qt5Core.dll" File "${QTDIR}\bin\Qt5Gui.dll" File "${QTDIR}\bin\Qt5OpenGL.dll" File "${QTDIR}\bin\Qt5Widgets.dll" File "${QTDIR}\bin\Qt5Xml.dll" SetOutPath "$INSTDIR\plugins\imageformats" File "${QTDIR}\plugins\imageformats\qjpeg.dll" File "${QTDIR}\plugins\imageformats\qtiff.dll" SetOutPath "$INSTDIR\plugins\platforms" File "${QTDIR}\plugins\platforms\qwindows.dll" SetOutPath "$INSTDIR\bin" CreateShortCut "$SMPROGRAMS\Fraqtive.lnk" "$INSTDIR\bin\fraqtive.exe" CreateShortCut "$DESKTOP\Fraqtive.lnk" "$INSTDIR\bin\fraqtive.exe" WriteRegStr SHCTX "${UNINST_KEY}" "DisplayIcon" '"$INSTDIR\bin\fraqtive.exe"' WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "Fraqtive ${VERSION}${SUFFIX}" WriteRegStr SHCTX "${UNINST_KEY}" "DisplayVersion" "${VERSION}" WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe" /$MultiUser.InstallMode' WriteRegStr SHCTX "${UNINST_KEY}" "InstallLocation" "$INSTDIR" WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "Michał Męciński" WriteRegStr SHCTX "${UNINST_KEY}" "HelpLink" "http://fraqtive.mimec.org" WriteRegStr SHCTX "${UNINST_KEY}" "URLInfoAbout" "http://fraqtive.mimec.org" WriteRegStr SHCTX "${UNINST_KEY}" "URLUpdateInfo" "http://fraqtive.mimec.org/downloads" WriteRegDWORD SHCTX "${UNINST_KEY}" "NoModify" 1 WriteRegDWORD SHCTX "${UNINST_KEY}" "NoRepair" 1 !ifndef INNER SetOutPath "$INSTDIR" File "$%TEMP%\uninstall.exe" !endif SectionEnd !ifdef INNER Function un.onInit !if ${ARCHITECTURE} == "win_x64" SetRegView 64 !endif !insertmacro MULTIUSER_UNINIT FunctionEnd Section "Uninstall" DeleteRegKey SHCTX "${UNINST_KEY}" Delete "$SMPROGRAMS\Fraqtive.lnk" Delete "$DESKTOP\Fraqtive.lnk" Delete "$INSTDIR\ChangeLog" Delete "$INSTDIR\COPYING" Delete "$INSTDIR\README" RMDir /r "$INSTDIR\bin" RMDir /r "$INSTDIR\plugins" Delete "$INSTDIR\uninstall.exe" RMDir "$INSTDIR" SectionEnd !endif fraqtive-0.4.8.1/installer/images/000077500000000000000000000000001440132223600167425ustar00rootroot00000000000000fraqtive-0.4.8.1/installer/images/header.bmp000066400000000000000000000623321440132223600207000ustar00rootroot00000000000000BMd6(9d  ¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿ƴ¿¿aaabbcceefbbddeefghijkklmnnpppmqqqqmmponmkjhgfedפ¿aabcccefffddeefghijkkmmnopqmqtnqqrvpnqqponlkihfe٤¿abcceefbbddefghijkkmnnoppqqnprtvxyxusvnmqpnmkihfڤ¿bcceeffddeeghhjkkmnnoppqqnpqsvy}{yurpnmpnmkjhܤ¿cceefhddefghikklmnoppqqtprrtvz}{vtvnqqomkjߤ¿ceffbdeeghijklmnoppmqtpvrtvxz}{xtqtmpomkड¿effbdefghikkmnnpqmmttqrtuxy{{xtrpqpom⤡¿fbbdefhhjklnnpqqqttqrstvyz}{xurpqqn䤡¿bbdefhijkmnopqqntpqrtvxz{ԑo{yvrpmp椡¿bdefhiklmnpqqqnpqrtuxy{}žgcYLIKܤ}zvrtq夡¿defhiklnopqqttqrtuvyz{v?@??@?IEGҥzuqt褡¿efhikmnoqqntvrtuvyz{}?@??@?^ZPytp뤡¿fhikmnppqtprtvxyz{}ƱTPKEC?|qȱ{vrꤡ¿hikmnpqqtvsuxz{}^VOyykADA?@??@??@??@??@??@?@AGWVO޷yt줡¿ikmnpqqnqtvy{TPKIEG?@??@??@??@??@??@??@??@??@??@?IEGtpe?@?zu¿klnqmnprtvz}ԌvEC??@??@??@??@??@??@??@??@??@??@??@??@??@?s{v嵐¿lnpmnprtvz}`\VADA?@??@??@??@??@??@??@??@??@??@??@??@??@??@?IGA}x񤡢¿npmtqruxz}寭MKG?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?ttly򤡢¿pqtqsvy{}iha?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?EC?z¿qtrtvz{ҺhbTa`YrȸEC??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?ADA̾z¿nqux{IGA?@??@??@??@?nk`ۙ?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?ADAz¿quz}͵EC??@??@??@??@??@??@?t}l?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?NMIՕz¿t{͵?@??@??@??@??@??@??@?EC?bZS?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?|z¿yܴnk`ADASNH?@??@??@??@??@??@??@??@?ADA?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?s}zz¿xۀ|qIGA^VO?@??@??@??@??@??@??@??@?ADA?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?\b_z¿tzџ?@??@??@??@??@??@??@?MKGhbT?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?ttlz¿pty}ҺQPM?@??@??@??@??@??@?u?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?IGAЕz¿qqtxz}ͱEC??@??@??@?EC?p壥?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?ADAz¿pnqsvy{}wgtpeɼEC??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?EC?Ϩz¿oqnpruxz}tpe?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?IGAz¿npqnprtvz{ıTSP?@??@??@??@??@??@??@??@??@??@??@??@??@??@??@??@?zy򤡢¿lnpqtprtvy{nk`IGA?@??@??@??@??@??@??@??@??@??@??@??@??@??@?MKGϾ}x񤡢¿jlnpqqtqtvy{奡MKG?@??@??@??@??@??@??@??@??@??@??@??@??@?yyk٤{v嵐¿hklnpqqtvsux{}ıIGATPK?@??@??@??@??@??@??@??@??@??@?QPMzEC?zu¿giklnppqnqrtvy{{}˶xqdҺNMIADA?@??@??@??@??@?MKG`\VϾxs뤡¿fhiklnoqqtpqsuvyz{}ʬPPG?@?v{vq줡¿efhiklnopmqnqrtuvxz{}?@??@?TPKݰytp뤡¿defhiklnnpqqtnvrtuvxz{}v?@??@?LIKХzurn褡¿bdefhikkmnoqmqtpvrtuvyz}Ҷ}lNMIܤ}zurnm椡¿fbdefhhjkmnnppqqntvrtuxy{}٥{yurtqp椡¿ffbdefghjklmnopqqnnpqrtvxz{{xtrnqqn䤡¿effbdeeghikkmnnppqqntpqstvy{}zxtqtqqnm⤡¿ceefhddefhhjklmnnpqqqntqrtuxz}zvtvnqqnmkड¿cceeffddefghijklmnopqqqttqrtvy}zvsqtqpnmkiޭbcceefbbdeefhhikklmnopqmqtpvrux{}zxtrpqqpnmkih¿abccceffbddefghhikklmnopqqqtprsuvvvtrptqqonlkihfaabbcceeffbddefghhikklmnnppqqnntqqpntqqpnmkjhhfeaaabbcceeffhddeefghhijklmnnopqqmqqqqqpnnlkihgeedfraqtive-0.4.8.1/installer/images/wizard.bmp000066400000000000000000004556561440132223600207670ustar00rootroot00000000000000BM[6(:x[  ĿÿÿĽĽþúºĽĽýÿĽľľľľĿľĿÿǿȾŻź``aaaabba_}aa_~abccbcddddbdecdbdcdeefffggggffghihjjijjjkkklkjlmmnmmmmnmmnnmlmmllklkkjjiiihhhhfggffffffӟ`aaaabbbb`cb_~bc`b`ddddeeeefecdegfdfggggggghiijjjkjkkkkllmlmmmnmnnmoooononnonnmmlllkkjjiiiihhgggfffffԟ`|aaabbbab`~ba_bcccddddedeeffdbcgggggghhgefhijjkkkkkkkkllmmmmnnmnpppppppppppoonnnmmlllkkjiiiihhgggffff՟_|a~aabbbb_~_^}]~_b`deddeeeacecffcfghhhhhhghhhijkkklllljllmmnnooopppqrrqqqqqrrrqpoononmmllkjijiiihhhggfff՟a`aaabbbbba^~^~a`dedeeeddaeffebfghhhhhhhiiijkkllllljmmmnnnooppqrrsstttttssssrqqqpoonnmllkkkjiiiihhgggf֟aaaaabb_ccaa`bcdeeeefebedffcccgihhfiiiijjkklllllmmmnnnoopqqrrsttuvvvvvvvttrssrqqponnnmlkkkjjiiihhgggןaaaabbbccc_cdbbbdedefeffgggfeeghhgiiijijjkllmmnmnmnnoppqqqrstuvwwxyyxwyxwvuuutsrqqponmmmlkkkjiiihhgg؟aaabbcc_cccbdddbdeeeeffghhhhfhhfggfjjjjjkkljmmnnnnoopqqqrstuuvwyzz||}|{zzxwwvutsrqqponnnmlklkjiiihhgٟabbbbcbbbcddeeedeeefeffghhhhhfhghgijjjkkllllmmnnoopppqrsstuuwxy{{~~~}{zyxwvttsrqpponnmlllkjiiihhڟabbbcc_adddeeeeeeeefedgghhhfhjijjjjjkklklmmmnnoooppqrrsttuvwyy{}}|zywvutsrqqponnmmllkjiiih۟bbabbbcccaeedeeeefeefgegehhfijjjkkkkllllmmnnnooppqrrsstuvwxyz|}}{ywwutsrqqpoonnmllkjiii۟babbbccddbdeebeffeffghheghhfgikkkkllllmmnnoooppqrrrsttuvwxyz|}}{zxwvttsrqpponnmllkjiiܟbbbbcccdddbadcffefffgghhijjjkklkllllmmnnnnoopqqrrsstuuvwxy{}~}|zxwvttsrqqpoonmllkjiݟbbbcccdddaa`defeffggghhiijjjklllklmmnnnnoopqqrrrstuvvwxyzz}~}|zywvutsrrqpoonmllkjޟbbcbcccdd``dbefffgggghijjjjhhllmmnnooooopqqqrrstuuuvxyyz{|~}|zywvutsrrqpoonmllkߟbbbbcccddaddbeffffgghhijjkkhhlmnnnoppoppqqqrsttuuvwxyy{||~}|zywwutsrrqpoonllkbbbcccdddcedeeffgghhiijjklkiimnonnppqpqqqrssttuvwxxyz{|}~}|zyxwuttrrqponmll៟bbcccdddeedeeffgghhiijkklmmimooolopqrrqrssttuvwwxyz{{|~}|zyxwvttrrqponml៟bcccdddeeeeeffgghhhijkklmnnkopppopqqqrrstttuvwxxy{{|}Χڼ}}{zxwvutrrqoonm⟟cccdddddeeeffgghhhijjklmnnnooqppqqrrrstttuvwwxyzz|}~Էmk_wuj~}{zyxvutrrpoom㟟ccdddddeeeffggghiijjkllmnopppqqoqrrssttuvvwxyzz{|~~ױԪȢ`aYJKGUVR¦~|{yxvusrqpon㟟cdddddeeefgggghiijkkklmmoppoprqrrststuvvvwxyz{|}~ݽwveUUMIKF?@>JKF^\TŸ~}zyxvusrqoo䟟dddddeeeffgghhiijjkklmmnppppqqrstttuvvvwxyyz{|}~Ϻ\YR?@>?@>?@>?@>HEA[TMɻ}{ywutrrpo䟟eeedeeefffghhijjjkklmnnoqrqorssstuvvvwxyyz{|}}ॉxZSL?@>?@>?@>?@>?@>WVP~~v}{xwusrqp域eeeeeeeffghhijjjkllmmnoprrrrsstuvuvwxxyz{||}~`VNEB??@>?@>?@>GEI_[\Ʊ|zxvusrp柟eedeefffghhiijjklmmmnopqqrrstuuvvwxxyz{||}~ƤnUWKCH@?@>JIE^ZZɬ~{ywutrq矟ebeefffghhiijkkllmnnoppqrstuuvwwwxyz{||}~έԱίyvǵu\CH@>@>JIEŸ߾̻|zxvusr矟eeefffghhiijklllmnoppqqrstuvwwxyyz{{|}~窛ܿßx~m]`cYVXOUZRY`TNTICH@?@=JIEUUN`aZff`qnrmĵxpkhb~~{xwutr矟fffffghhiijkkllmnoppqrsttuwwxyz{{|}}~~߽˾{m^wzp˚\`QVQIKKFJKF>@=>@=?@=>@=?@>>@>?@>?@>?@>GC@GC@ROJQNJ|`SZZNٻ|zxuts蟟ffffghhiijkllmmnoppqrssuvvxyz{|}}~~瓇zmcWSKCa`ZhtfOWLEKA>@=>@=>@=>@=>@>?@=?@>>@>?@>?@>?@>?@>?@>?@>?@>EB?EB?SWLyiz|x̝~ڰʧ}{xvus韟effghhhijkllmnooopqrstuvwyy{|}ԵjQOIKMJm`KNK>@=>@=>@=>@=>@=>@=>@=>@=?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>CH@DKAXbVf`X[NFnWKȑp~{ywut韟ffgghhijkklmnoopqrrstuvxyz|}̳]ZRBBFCBFCBF>@=>@=>@=>@=>@=>@=>@=>@>>@=?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>IKHJKHJKH?@?VJDoд|zxut꟟ffghhijjklmnoopqrrstvvxy{|~̧žTVP>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=?@>?@=?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>UQMt}{xvu꟟fgghijkklmnnopqqrstuvxy{|ѽԶѻx_WNIKF>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=>@=>@=>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>YZWý~{ywu꟟gghijjklmnnopqqrtuuvxy{|ݘwuiZu`YSLHD?>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@=?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@>RWUöƬ~{ywu럟ghijjklmnnopqqsttuwxy{|~£_TNDB>EB>>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@?IKIkf]ջ~|zxu럟hhijklmnnopqrsttvwxy{|~Ϻ`YQ>@<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@?VTNַ|zxv쟟hijjlmnnoqqrstuvwxy{|~ֲ̥ȫURM>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@?JMJ[cTuxnҭ}{xv쟟ijjkmnnopqrttuwwxz{|~ѯ]UIIHB>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@>?@>@A?JMJkne}{xw쟟ijklmnopqsttvwxyz{}~ɶžkj\JHB>@<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@?UVT~{xw쟟jklmnopqstuvwxz{|}~ś~uѼɭeh]de]Ƽ|vǬUSJ>?<>@<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@?`a]~{ywퟟjlmnoprstvwxyz{}}twhkf^hhcTVNHJDHKETTLTUL`bVik`IJE>?<>?<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@?VVRɹ~{ywퟟkmmoprstvwyy{|}SRPGFGGFG=?<=?;=?<=?<=??<>?<>@=>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@=>@>>@>>@>?@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@?VWQnxu~{ywퟟlmoprsuvxy{|}ٷƒ[bSHJC=?;=?<=?;=?;=?<=?<=?<=?<>A?<>?<>?<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@??@?UQKî~{yxퟟlnorsuwy{|~w}kXZJEJ?=?;=?;=?<=?;=?<=?<=?<=?<=?<=?<>?@<>@<>?<>?<>?<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@>?@>?@?_]V~{yxퟟmoqsuxy{~ͶGJD=?;=?;=?;=?<=?<=?<=?;=?<=?<=?<=?<=??<>?<>?<>?<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@>?@??@??@?_ZRĶ}{yxퟟnprux{}hn]GJC=?;=?;=?;=?;=?;=?<=?<=?<=?<=?<=?<=?<=??<>?<>?<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@>?@?GB@ca]}{yxퟟoqtx~ӪٵʤШRVJ=?;=?;=?;=?;=?<=?;=?<=?<=?<=?<=?<=?<=?<=?<=?<>?<>?<>?<>?<>?<>?<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@=>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>JKHYYV}{yxퟟorv}ƮkeT__S^`PRVIFJA=?;=?;=?;=?;=?<=?;=?<=?;=?<=?<=?<=?<=?<=?<=?<=?<>?<>?<>?<>?=>@<>@=>@<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@=>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>HKJ[a`̾}{yxퟟpswѐyYaMHG?=?;=?;=?;=?;=?;=?;=?;=?<=?;=?;=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<>?<>?<>?<>@<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>RWUǷ}{yxퟟpsw~{ѐyYbMHG>=?;=?;=?;=?;=?;=?;=?;=?<=?;=?;=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<>?<>?<>?=>@=>?<>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@?RWUǷ}{yxퟟoru{퀷ǭkcQ`^P^`PRVIFJA=?;=?;=?;=?<=?;=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<>?<>?<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@?HKJ[a`̾}{yxퟟnqtx{ЧʞʤШRVI=?;=?;=?;=?;=?<=?<=?;=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<=?<>?<>?=>?=>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@??@??@?JKHYYV}{yxퟟnprux{}߸gm]GJC=?;=?;=?;=?;=?<=?;=?<=?<=?<=?<=?<=?<=??<>?<>?<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=?@>?@>?@>?@>?@>?@>?@>?@>?@??@>?@??@??@??@??@?GB@ca]}{yxퟟmoqsvxy{~ͶGJC=?;=?;=?;=?;=?<=?<=?<=?<=?<=?<=?<=??<=?<=?<>?<>?=>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=>@>>@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@??@??@?@@??@??@?_ZRʿ}{yxퟟlnorsuwxz|~w}jYZJEJ@=?;=?;=?<=?<=?<=?;=?<=?<=?<=?<>?@<=?<=?<=?<>?<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@>>@=?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@??@??@?@@?@@?_\VŦť~{yxퟟlmoprsuvxy{|}ܷƒ[bRHJC=?;=?<=?<=?<=?<=?<=?<=?<>A?<=?=>?=>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@?????>>@??@@??@??@?UPK¢ׯ~{yxퟟklmoprrtuwyy{|}SROFFFFFF=?;=?<=?<=?<=??<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=?@=?@=?@>?@>?@>?@>?@>?@>?@>????@????????????@??????>?????UVQoxm~{yxퟟjllnoprrtuvxyz{}}vwfjf^hhcSVNHJDHKDTTKTUK`bVik`IJE=?<=?=>?=>?<>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=?@=>@>?@>?@>?@>?@>?@>?@>?@>?@>????????@??@??@??@??@?>???>?>?UUR˲ȱ~{ywퟟikllnopqrsuvwxyz|}~ś~uѻɬeh]de]Ƽ|vǬUSJ=?<=?<>?=>?=>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=?@=?@=>@>?@>?@>?@>?@>?@>?@>?@>>??@@?@????????@??@?@@????????`a^~{ywퟟijklmnnpqsstvvxyz{}~ȶžkj\IHB>?=>?<>?=>?=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=>@=?@=>@=?@>?@>?@>?@>?@>?@>?@>?@>???????>??>?@?@@@?@@?@@????UVT~{xw쟟iijklmnnpqrstuwwxzz|}Я]UIIHB>?=>?<>?=>@=>@=>@=>@=>@=>?>>?>>?>>@>>@>?@>>@>>@>>@>>@>?@>?@>?@>?@>?@>?@>?@>?@?>>>>????????@?@@@????@A?JMJlne}{xw쟟hhijklmnopqrssuvwxyz|~ֲ̤ǫURM>?<=?=>?=>@=>@=>@=>@=>?=>?=>>>??>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@????????>??>???@??@???JMJ[cUuxnҭ}{xv쟟ghhjkklmnooprsstvwxy{|~Ϲ`YQ=?==?=>?=>@=>@=>@=>@=>?=>>>===??>?@>??>?>??@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@???????????????@??@???VTNַ|zxv쟟ghhijkllmnoopqsttuwwyz|}£_TNDB>DB>>?=>@=>@=>@=>@=>?=>?=??>??>?@>?>??????>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@????>??@@?@????????HJJkf]ջ~|zxu럟fghhijkllmnoppqrstuvwyz|~ݗwuiZt`YSLGD?>@=>@=>@=>@=>@=>@=?@>???????>?>>??@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@>?@??@??@??@?@??>???>>QVUöƭ~{ywu럟efghhijkllmnoopqrstuvwyz|~ѽԶѻx_WNIKF>@=>@=>@=>?=>?>??????>>?????????>?@>?@?>???@>?@>?@>?@>?@>?@>?@??@??@?@@??@?>>???????YYVĽ~{ywu꟟eefghiijkllmnoppqrstuvwy{|}˧žTVP>@=>@=>@=>?=>>??>?????>??>??>?>>???????????@>?@>?@>?@>?@>???????@?@@?@?????>?>>>>>?>UPMt}{xvu꟟eeffghiijkllmnopqqrsstvwxz{}̳\ZRBBFBBFCBF>?=>?=>?>>=>>=?>=?>>???@???>???@??@??@>?@>?@>???>>>?>????@@??>?IIHIIHIJI?>?VIDoд|zxut꟟deefgghiijklmmnnopqqrstvwxy{|}~ԴjPOIKMJm`KNK>@=>@=>?>>>?==>??>>??????>?????@??@>?@>?@>?@??>????>>????DHADJBXaWf_Y[MGnVLɑq~{ywut韟ddeefgghiijklmmmnoppqrstuvwxz{||}~~蒇zmcWSJC``YhtfOWLEKA>?=??>??>>?>??>??>>=>???@??@???@??@>?@???????E@@EA@SVMyjz}y̝ڰʨ}{xvus韟ddeeefgghijjkllmmnopqqrsttvwxxyz{|||}~߼˾zm^wzp˚\`QVQIKKGJKF??>>>>?>?>>??>??>?@???@??@?GC@GC@RNJQMJ|_TZYOڻ|zwuts蟟cddeeefgghijjkklmmnoopqqrttuvwxxyyz{|}}~檛ܿßx~m^`cYVXOVYTY`UNSJCGA???JIEVUO`aZfe`rnqmöwqkgc~{xwutr矟ccddefffgghijjjklmmmnopqqrstuuvwwxyyz{|}~~έԱίywǶv]DHA???JIFŹ߾̼|zxvusr矟cccddefefgghijjjklmmmnoppqqrstuuvvwxyzz{|}~~ǥoUVLDHA??@JHF_Z[ʬ}{ywutrq矟bccdddeffggghiijjkklmnnnopqqrrstuuvvwxyzz{|}~~œ`VOFB@????>????GDJ_[]IJ|zxvusrp柟bbccdddefffgghiijjjklmmmnoopqrrrstuuvwwxyz{{|}~᥉yZSM?@?@??@?@??????VUQ~}w}zxwusrqp域bbbccdddeffggghhijjjkllmnnnoppqrrrstuuvvwxyz{{}~λ\XS@??@??@???>?HCA[SNɼ}zyvutrrpo䟟abbbccdddeffggghhijjjkklmmnonopqqrssstuuvwwxyz{|~ܽxvgVUNJJF>>>JJG]ZUž~}zyxvtsrqoo䟟abbbcccdddeefgfghhiijkkkllmnnopppqqrssttuvwxxyz{|}~ױԫʣabYJJHTTR~|{yxvusrqpon㟟bbbbcbccdddeeffggghiijjkkllmmnnopppqqrsstuuvwxxyz||}Էmk_xvj~}{zyxvutrrpoom㟟abbbbbccccddeeffggghhiijkklllmmnooppqqqrsttuuvwxyz{||~Χۻ}}{yxvvutrrqoonm⟟aabbbbccccdddeefffggghiijjkklllmmnoopqqqrrstuuvwxyyz{|}~}|zyxwvttrrqponml៟aaabbbbcccddddeeffgggghhiijkklllmmnnoopqqqrrsttuvwxyyz|}}}|zyxwutsrrqponmll៟`aaabbbcccdccdddeeffgghghiijjkkllmmmnnoopqqqrssttvvwxyz{|}~}|zywwuusrrqpoonllk``aaabbbccccccdddeeffgghhhhiijjkklllmmnnopppqqrsttuvwxyz{{}~}|zywvutsrrqpoonmllkߟ```aaabbbcccccccddeeeffgghhhhiijjkklllmmnnoppqqrrstuuvwxyz{}~}|yywvutsrqqpoonmllkjޟ_```aaabbbbccccccdddeeffgghhiiiijjjklllmmnnnoppqqrrstuvvwxz{}~}|yxwvttsrqqpoonmllkjiݟ__```aaabbbbccccdddddeeeffgghhiiiijjkkllmmmnnoopqqrrsstuvwxyz|~}{yxvvtssrqppoonmllkjiiܟ___```aaaabbbccccdddeddeeffggghhiiijjjkkllmmnnnoopqqrrstuvvwy{|~~|{xwvutsrqpponnnmllkjiii۟____```aaaabbbbcccddddeeefeffgghhhiiiijjkkllmmnnooopqqrsstuvwxz|~~}{zxwuussrqqponnmmllkjiiih۟____`````aaabbbbcccddddeeeeffffgghhiiijjjkkkllmmnnooopqrrsstvwxz{}~~}|zyxwvutssrqpponnmlllkjiiihhڡ______````aaaabbbccccdddeeeeffffggghhiiijjkjkkllmmnnooppqrsstuvwxy{{||{yyxvvuttrrqpponnnmlllkjiiihhg٧_____`````aaaaabbbbcccddddeeeefeffggghhiiijjkkkkllmmnoopppqrsttuvwxxyxxwwvuttsrqqpponnmmllkkjiiihhggز^______```a`aaaabbbbccccddddeeefffffggghhiiijjkkklllmmnnoppqqrrstuuuuuuutssrrqqpoonmnmlllkjjiiihhggg^^_____```aa``aaaabbbbcccddddeeeeefgffgghhhhiijjkkllllmmnnoopqqrqrrsssssrrqqqpoonnmmllkkjjiiiihhgggf^^^____````a``aaaaabbbbccccddddeeeffffggghhhhhiijjkkkllmmnmnnooppqqqqqqqpppoonnnmlmlkkjjjiiihhhggfff^^^^____`````````aaaabbbbccccddddeeeffffggghhhhiiijjjkklllmmnnnonooppppooonnnnmlllkkkjjiiiihhgggffff]^^^^_____```````aabaabbbbcccccddddeeeefffggghhhhiijjjjjkklllmmmnnnnnnnnmmnmmllkkkjjjjiiiihhgggfffff]]^^^^_____`````a`aaaabbbbbbcccccddddeeeefffggghhhiiiijjjkjkkkllllllmmmmmlllkkkkjjjjiihhhhhgggfffffffraqtive-0.4.8.1/installer/include/000077500000000000000000000000001440132223600171205ustar00rootroot00000000000000fraqtive-0.4.8.1/installer/include/multiuser64.nsh000066400000000000000000000333261440132223600220440ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * This file is based on MultiUser.nsh * Copyright (C) 2008-2009 Joost Verburg * * 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 . **************************************************************************/ !ifndef MULTIUSER_INCLUDED !define MULTIUSER_INCLUDED !verbose push !verbose 3 ;Standard NSIS header files !ifdef MULTIUSER_MUI !include MUI2.nsh !endif !include nsDialogs.nsh !include LogicLib.nsh !include WinVer.nsh !include FileFunc.nsh ;Variables Var MultiUser.Privileges Var MultiUser.InstallMode ;Command line installation mode setting !ifdef MULTIUSER_INSTALLMODE_COMMANDLINE !include StrFunc.nsh !ifndef StrStr_INCLUDED ${StrStr} !endif !ifndef MULTIUSER_NOUNINSTALL !ifndef UnStrStr_INCLUDED ${UnStrStr} !endif !endif Var MultiUser.Parameters Var MultiUser.Result !endif ;Installation folder stored in registry !ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME Var MultiUser.InstDir !endif !ifdef MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY & MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME Var MultiUser.DefaultKeyValue !endif ;Windows Vista UAC setting !if "${MULTIUSER_EXECUTIONLEVEL}" == Admin RequestExecutionLevel admin !define MULTIUSER_EXECUTIONLEVEL_ALLUSERS !else if "${MULTIUSER_EXECUTIONLEVEL}" == Power RequestExecutionLevel admin !define MULTIUSER_EXECUTIONLEVEL_ALLUSERS !else if "${MULTIUSER_EXECUTIONLEVEL}" == Highest RequestExecutionLevel highest !define MULTIUSER_EXECUTIONLEVEL_ALLUSERS !else RequestExecutionLevel user !endif /* Install modes */ !macro MULTIUSER_INSTALLMODE_ALLUSERS UNINSTALLER_PREFIX UNINSTALLER_FUNCPREFIX ;Install mode initialization - per-machine ${ifnot} ${IsNT} ${orif} $MultiUser.Privileges == "Admin" ${orif} $MultiUser.Privileges == "Power" StrCpy $MultiUser.InstallMode AllUsers SetShellVarContext all !if "${UNINSTALLER_PREFIX}" != UN ;Set default installation location for installer !ifdef MULTIUSER_INSTALLMODE_INSTDIR !ifdef MULTIUSER_USE_PROGRAMFILES64 StrCpy $INSTDIR "$PROGRAMFILES64\${MULTIUSER_INSTALLMODE_INSTDIR}" !else StrCpy $INSTDIR "$PROGRAMFILES\${MULTIUSER_INSTALLMODE_INSTDIR}" !endif !endif !endif !ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ReadRegStr $MultiUser.InstDir HKLM "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}" ${if} $MultiUser.InstDir != "" StrCpy $INSTDIR $MultiUser.InstDir ${endif} !endif !ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}" !endif ${endif} !macroend !macro MULTIUSER_INSTALLMODE_CURRENTUSER UNINSTALLER_PREFIX UNINSTALLER_FUNCPREFIX ;Install mode initialization - per-user ${if} ${IsNT} StrCpy $MultiUser.InstallMode CurrentUser SetShellVarContext current !if "${UNINSTALLER_PREFIX}" != UN ;Set default installation location for installer !ifdef MULTIUSER_INSTALLMODE_INSTDIR ${if} ${AtLeastWin2000} StrCpy $INSTDIR "$LOCALAPPDATA\${MULTIUSER_INSTALLMODE_INSTDIR}" ${else} !ifdef MULTIUSER_USE_PROGRAMFILES64 StrCpy $INSTDIR "$PROGRAMFILES64\${MULTIUSER_INSTALLMODE_INSTDIR}" !else StrCpy $INSTDIR "$PROGRAMFILES\${MULTIUSER_INSTALLMODE_INSTDIR}" !endif ${endif} !endif !endif !ifdef MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY & MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ReadRegStr $MultiUser.InstDir HKCU "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME}" ${if} $MultiUser.InstDir != "" StrCpy $INSTDIR $MultiUser.InstDir ${endif} !endif !ifdef MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION Call "${MULTIUSER_INSTALLMODE_${UNINSTALLER_PREFIX}FUNCTION}" !endif ${endif} !macroend Function MultiUser.InstallMode.AllUsers !insertmacro MULTIUSER_INSTALLMODE_ALLUSERS "" "" FunctionEnd Function MultiUser.InstallMode.CurrentUser !insertmacro MULTIUSER_INSTALLMODE_CURRENTUSER "" "" FunctionEnd !ifndef MULTIUSER_NOUNINSTALL Function un.MultiUser.InstallMode.AllUsers !insertmacro MULTIUSER_INSTALLMODE_ALLUSERS UN .un FunctionEnd Function un.MultiUser.InstallMode.CurrentUser !insertmacro MULTIUSER_INSTALLMODE_CURRENTUSER UN .un FunctionEnd !endif /* Installer/uninstaller initialization */ !macro MULTIUSER_INIT_QUIT UNINSTALLER_FUNCPREFIX !ifdef MULTIUSER_INIT_${UNINSTALLER_FUNCPREFIX}FUNCTIONQUIT Call "${MULTIUSER_INIT_${UNINSTALLER_FUNCPREFIX}FUCTIONQUIT} !else Quit !endif !macroend !macro MULTIUSER_INIT_TEXTS !ifndef MULTIUSER_INIT_TEXT_ADMINREQUIRED !define MULTIUSER_INIT_TEXT_ADMINREQUIRED "$(^Caption) requires administrator priviledges." !endif !ifndef MULTIUSER_INIT_TEXT_POWERREQUIRED !define MULTIUSER_INIT_TEXT_POWERREQUIRED "$(^Caption) requires at least Power User priviledges." !endif !ifndef MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE !define MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE "Your user account does not have sufficient privileges to install $(^Name) for all users of this compuetr." !endif !macroend !macro MULTIUSER_INIT_CHECKS UNINSTALLER_PREFIX UNINSTALLER_FUNCPREFIX ;Installer initialization - check privileges and set install mode !insertmacro MULTIUSER_INIT_TEXTS UserInfo::GetAccountType Pop $MultiUser.Privileges ${if} ${IsNT} ;Check privileges !if "${MULTIUSER_EXECUTIONLEVEL}" == Admin ${if} $MultiUser.Privileges != "Admin" MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}" !insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}" ${endif} !else if "${MULTIUSER_EXECUTIONLEVEL}" == Power ${if} $MultiUser.Privileges != "Power" ${andif} $MultiUser.Privileges != "Admin" ${if} ${AtMostWinXP} MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_POWERREQUIRED}" ${else} MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ADMINREQUIRED}" ${endif} !insertmacro MULTIUSER_INIT_QUIT "${UNINSTALLER_FUNCPREFIX}" ${endif} !endif !ifdef MULTIUSER_EXECUTIONLEVEL_ALLUSERS ;Default to per-machine installation if possible ${if} $MultiUser.Privileges == "Admin" ${orif} $MultiUser.Privileges == "Power" !ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers !else Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser !endif !ifdef MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY & MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME ;Set installation mode to setting from a previous installation !ifndef MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER ReadRegStr $MultiUser.DefaultKeyValue HKLM "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" ${if} $MultiUser.DefaultKeyValue == "" ReadRegStr $MultiUser.DefaultKeyValue HKCU "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" ${if} $MultiUser.DefaultKeyValue != "" Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser ${endif} ${endif} !else ReadRegStr $MultiUser.DefaultKeyValue HKCU "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" ${if} $MultiUser.DefaultKeyValue == "" ReadRegStr $MultiUser.DefaultKeyValue HKLM "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY}" "${MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME}" ${if} $MultiUser.DefaultKeyValue != "" Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers ${endif} ${endif} !endif !endif ${else} Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser ${endif} !else Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser !endif !ifdef MULTIUSER_INSTALLMODE_COMMANDLINE ;Check for install mode setting on command line ${${UNINSTALLER_FUNCPREFIX}GetParameters} $MultiUser.Parameters ${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/CurrentUser" ${if} $MultiUser.Result != "" Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.CurrentUser ${endif} ${${UNINSTALLER_PREFIX}StrStr} $MultiUser.Result $MultiUser.Parameters "/AllUsers" ${if} $MultiUser.Result != "" ${if} $MultiUser.Privileges == "Admin" ${orif} $MultiUser.Privileges == "Power" Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers ${else} MessageBox MB_OK|MB_ICONSTOP "${MULTIUSER_INIT_TEXT_ALLUSERSNOTPOSSIBLE}" ${endif} ${endif} !endif ${else} ;Not running Windows NT, per-user installation not supported Call ${UNINSTALLER_FUNCPREFIX}MultiUser.InstallMode.AllUsers ${endif} !macroend !macro MULTIUSER_INIT !verbose push !verbose 3 !insertmacro MULTIUSER_INIT_CHECKS "" "" !verbose pop !macroend !ifndef MULTIUSER_NOUNINSTALL !macro MULTIUSER_UNINIT !verbose push !verbose 3 !insertmacro MULTIUSER_INIT_CHECKS Un un. !verbose pop !macroend !endif /* Modern UI 2 page */ !ifdef MULTIUSER_MUI !macro MULTIUSER_INSTALLMODEPAGE_INTERFACE !ifndef MULTIUSER_INSTALLMODEPAGE_INTERFACE !define MULTIUSER_INSTALLMODEPAGE_INTERFACE Var MultiUser.InstallModePage Var MultiUser.InstallModePage.Text Var MultiUser.InstallModePage.AllUsers Var MultiUser.InstallModePage.CurrentUser Var MultiUser.InstallModePage.ReturnValue !endif !macroend !macro MULTIUSER_PAGEDECLARATION_INSTALLMODE !insertmacro MUI_SET MULTIUSER_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLMODEPAGE "" !insertmacro MULTIUSER_INSTALLMODEPAGE_INTERFACE !insertmacro MUI_DEFAULT MULTIUSER_INSTALLMODEPAGE_TEXT_TOP "$(MULTIUSER_INNERTEXT_INSTALLMODE_TOP)" !insertmacro MUI_DEFAULT MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS "$(MULTIUSER_INNERTEXT_INSTALLMODE_ALLUSERS)" !insertmacro MUI_DEFAULT MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER "$(MULTIUSER_INNERTEXT_INSTALLMODE_CURRENTUSER)" PageEx custom PageCallbacks MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} Caption " " PageExEnd !insertmacro MULTIUSER_FUNCTION_INSTALLMODEPAGE MultiUser.InstallModePre_${MUI_UNIQUEID} MultiUser.InstallModeLeave_${MUI_UNIQUEID} !undef MULTIUSER_INSTALLMODEPAGE_TEXT_TOP !undef MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS !undef MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER !macroend !macro MULTIUSER_PAGE_INSTALLMODE ;Modern UI page for install mode !verbose push !verbose 3 !ifndef MULTIUSER_EXECUTIONLEVEL_ALLUSERS !error "A mixed-mode installation requires MULTIUSER_EXECUTIONLEVEL to be set to Admin, Power or Highest." !endif !insertmacro MUI_PAGE_INIT !insertmacro MULTIUSER_PAGEDECLARATION_INSTALLMODE !verbose pop !macroend !macro MULTIUSER_FUNCTION_INSTALLMODEPAGE PRE LEAVE ;Page functions of Modern UI page Function "${PRE}" ${ifnot} ${IsNT} Abort ${endif} ${if} $MultiUser.Privileges != "Power" ${andif} $MultiUser.Privileges != "Admin" Abort ${endif} !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE !insertmacro MUI_HEADER_TEXT_PAGE $(MULTIUSER_TEXT_INSTALLMODE_TITLE) $(MULTIUSER_TEXT_INSTALLMODE_SUBTITLE) nsDialogs::Create 1018 Pop $MultiUser.InstallModePage ${NSD_CreateLabel} 0u 0u 300u 20u "${MULTIUSER_INSTALLMODEPAGE_TEXT_TOP}" Pop $MultiUser.InstallModePage.Text ${NSD_CreateRadioButton} 20u 50u 280u 10u "${MULTIUSER_INSTALLMODEPAGE_TEXT_ALLUSERS}" Pop $MultiUser.InstallModePage.AllUsers ${NSD_CreateRadioButton} 20u 70u 280u 10u "${MULTIUSER_INSTALLMODEPAGE_TEXT_CURRENTUSER}" Pop $MultiUser.InstallModePage.CurrentUser ${if} $MultiUser.InstallMode == "AllUsers" SendMessage $MultiUser.InstallModePage.AllUsers ${BM_SETCHECK} ${BST_CHECKED} 0 ${else} SendMessage $MultiUser.InstallModePage.CurrentUser ${BM_SETCHECK} ${BST_CHECKED} 0 ${endif} !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW nsDialogs::Show FunctionEnd Function "${LEAVE}" SendMessage $MultiUser.InstallModePage.AllUsers ${BM_GETCHECK} 0 0 $MultiUser.InstallModePage.ReturnValue ${if} $MultiUser.InstallModePage.ReturnValue = ${BST_CHECKED} Call MultiUser.InstallMode.AllUsers ${else} Call MultiUser.InstallMode.CurrentUser ${endif} !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE FunctionEnd !macroend !endif !verbose pop !endif fraqtive-0.4.8.1/installer/languages/000077500000000000000000000000001440132223600174435ustar00rootroot00000000000000fraqtive-0.4.8.1/installer/languages/fraqtive_en.nsh000066400000000000000000000007241440132223600224630ustar00rootroot00000000000000LangString NAME ${LANG_ENGLISH} "Fraqtive" LangString TITLE ${LANG_ENGLISH} "$(NAME) ${VERSION}" LangString WELCOME_TEXT ${LANG_ENGLISH} "This wizard will guide you through the installation of $(NAME).$\r$\n$\r$\nIf you are upgrading an existing installation of $(NAME), make sure it is not running.$\r$\n$\r$\nClick Next to continue." LangString FINISH_TEXT ${LANG_ENGLISH} "$(NAME) has been installed on your computer.$\r$\n$\r$\nClick Finish to close this wizard." fraqtive-0.4.8.1/installer/qt.conf000066400000000000000000000000331440132223600167640ustar00rootroot00000000000000[Paths] Plugins=../plugins fraqtive-0.4.8.1/src/000077500000000000000000000000001440132223600142675ustar00rootroot00000000000000fraqtive-0.4.8.1/src/aboutbox.cpp000066400000000000000000000125731440132223600166260ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "aboutbox.h" #include "iconloader.h" #include "xmlui/gradientwidget.h" #include #include #include #include #include AboutBox::AboutBox( const QString& title, const QString& message, QWidget* parent ) : QDialog( parent ) { setAttribute( Qt::WA_DeleteOnClose, true ); setWindowTitle( title ); QVBoxLayout* topLayout = new QVBoxLayout( this ); topLayout->setMargin( 0 ); topLayout->setSpacing( 0 ); XmlUi::GradientWidget* promptWidget = new XmlUi::GradientWidget( this ); topLayout->addWidget( promptWidget ); QHBoxLayout* promptLayout = new QHBoxLayout( promptWidget ); promptLayout->setSpacing( 10 ); QLabel* promptPixmap = new QLabel( promptWidget ); promptPixmap->setPixmap( QApplication::windowIcon().pixmap( QSize( 48, 48 ) ) ); promptLayout->addWidget( promptPixmap, 0, Qt::AlignTop | Qt::AlignLeft ); QLabel* promptLabel = new QLabel( promptWidget ); promptLabel->setWordWrap( true ); promptLabel->setText( message ); promptLabel->setMinimumWidth( 350 ); promptLayout->addWidget( promptLabel, 1, Qt::AlignTop ); QFrame* separator = new QFrame( this ); separator->setFrameStyle( QFrame::HLine | QFrame::Sunken ); topLayout->addWidget( separator ); QVBoxLayout* mainLayout = new QVBoxLayout(); mainLayout->setMargin( 9 ); mainLayout->setSpacing( 4 ); topLayout->addLayout( mainLayout ); AboutBoxScrollArea* scrollArea = new AboutBoxScrollArea( this ); mainLayout->addWidget( scrollArea ); scrollArea->setBackgroundRole( QPalette::Base ); m_sectionsWidget = new QWidget( scrollArea ); scrollArea->setWidget( m_sectionsWidget ); scrollArea->setWidgetResizable( true ); m_sectionsLayout = new QVBoxLayout( m_sectionsWidget ); m_sectionsLayout->setMargin( 6 ); m_sectionsLayout->setSpacing( 6 ); m_sectionsLayout->addStretch( 1 ); mainLayout->addSpacing( 7 ); QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Horizontal, this ); mainLayout->addWidget( buttonBox ); buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "&OK" ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); } AboutBox::~AboutBox() { } AboutBoxSection* AboutBox::addSection( const QPixmap& pixmap, const QString& message ) { AboutBoxSection* section = new AboutBoxSection( pixmap, message, m_sectionsWidget ); m_sectionsLayout->insertWidget( m_sectionsLayout->count() - 1, section ); return section; } AboutBoxSection::AboutBoxSection( const QPixmap& pixmap, const QString& message, QWidget* parent ) : QFrame( parent ), m_buttonsLayout( NULL ) { setFrameStyle( Box | Sunken ); initialize(); m_pixmapLabel->setPixmap( pixmap ); m_messageLabel->setText( message ); } AboutBoxSection::AboutBoxSection( Qt::WindowFlags flags ) : QFrame( NULL, flags ), m_buttonsLayout( NULL ) { initialize(); } void AboutBoxSection::initialize() { m_mainLayout = new QHBoxLayout( this ); m_mainLayout->setSpacing( 10 ); m_pixmapLabel = new QLabel( this ); m_mainLayout->addWidget( m_pixmapLabel, 0, Qt::AlignTop | Qt::AlignLeft ); m_messageLabel = new QLabel( this ); m_messageLabel->setWordWrap( true ); m_messageLabel->setOpenExternalLinks( true ); m_mainLayout->addWidget( m_messageLabel, 1, Qt::AlignTop ); } AboutBoxSection::~AboutBoxSection() { } void AboutBoxSection::setPixmap( const QPixmap& pixmap ) { m_pixmapLabel->setPixmap( pixmap ); } void AboutBoxSection::setMessage( const QString& message ) { m_messageLabel->setText( message ); } QPushButton* AboutBoxSection::addButton( const QString& text ) { if ( !m_buttonsLayout ) { m_buttonsLayout = new QHBoxLayout(); m_buttonsLayout->setSpacing( 6 ); m_mainLayout->addLayout( m_buttonsLayout ); } QPushButton* button = new QPushButton( text, this ); m_buttonsLayout->addWidget( button, 0, Qt::AlignBottom ); return button; } void AboutBoxSection::clearButtons() { if ( !m_buttonsLayout ) return; while ( m_buttonsLayout->count() > 0 ) delete m_buttonsLayout->itemAt( 0 )->widget(); delete m_buttonsLayout; m_buttonsLayout = NULL; } AboutBoxScrollArea::AboutBoxScrollArea( QWidget* parent ) : QScrollArea( parent ) { } AboutBoxScrollArea::~AboutBoxScrollArea() { } QSize AboutBoxScrollArea::sizeHint() const { int w = 475; int fw = frameWidth(); return QSize( w, widget()->heightForWidth( w - 2 * fw ) + 2 * fw ); } fraqtive-0.4.8.1/src/aboutbox.h000066400000000000000000000041231440132223600162630ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef ABOUTBOX_H #define ABOUTBOX_H #include #include #include class AboutBoxSection; class QBoxLayout; class QLabel; class AboutBox : public QDialog { Q_OBJECT public: AboutBox( const QString& title, const QString& message, QWidget* parent ); ~AboutBox(); public: AboutBoxSection* addSection( const QPixmap& pixmap, const QString& message ); private: QWidget* m_sectionsWidget; QBoxLayout* m_sectionsLayout; }; class AboutBoxSection : public QFrame { Q_OBJECT public: AboutBoxSection( const QPixmap& pixmap, const QString& message, QWidget* parent ); ~AboutBoxSection(); protected: AboutBoxSection( Qt::WindowFlags flags ); public: void setPixmap( const QPixmap& pixmap ); void setMessage( const QString& message ); QPushButton* addButton( const QString& text ); void clearButtons(); private: void initialize(); private: QBoxLayout* m_mainLayout; QBoxLayout* m_buttonsLayout; QLabel* m_pixmapLabel; QLabel* m_messageLabel; }; class AboutBoxScrollArea : public QScrollArea { Q_OBJECT public: AboutBoxScrollArea( QWidget* parent ); ~AboutBoxScrollArea(); public: // overrides QSize sizeHint() const; }; #endif fraqtive-0.4.8.1/src/abstractjobprovider.h000066400000000000000000000021621440132223600205120ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef ABSTRACTJOBPROVIDER_H #define ABSTRACTJOBPROVIDER_H class AbstractJobProvider { public: AbstractJobProvider() { } virtual ~AbstractJobProvider() { } public: virtual int priority() const = 0; virtual void executeJob() = 0; }; #endif fraqtive-0.4.8.1/src/abstractview.h000066400000000000000000000035731440132223600171460ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef ABSTRACTVIEW_H #define ABSTRACTVIEW_H class QColor; class QTransform; class FractalData; class Gradient; class ColorMapping; class ViewSettings; class AnimationState; class AbstractView { public: AbstractView() { } virtual ~AbstractView() { } public: virtual void clearView() = 0; virtual void transformView( const QTransform& transform ) = 0; virtual void initialUpdate( const FractalData* data ) = 0; virtual void partialUpdate( const FractalData* data ) = 0; virtual void fullUpdate( const FractalData* data ) = 0; virtual void setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ) = 0; virtual void setGradient( const Gradient& gradient ) = 0; virtual void setBackgroundColor( const QColor& color ) = 0; virtual void setColorMapping( const ColorMapping& mapping ) = 0; virtual void setViewSettings( const ViewSettings& settings ) = 0; virtual void setAnimationState( const AnimationState& state ) = 0; }; #endif fraqtive-0.4.8.1/src/advancedsettingspage.cpp000066400000000000000000000156501440132223600211650ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "advancedsettingspage.h" #include #include "fractalmodel.h" AdvancedSettingsPage::AdvancedSettingsPage( QWidget* parent ) : QWidget( parent ), m_model( NULL ), m_loading( false ) { m_ui.setupUi( this ); m_ui.sliderDepth->setScaledRange( 1.5, 4.0 ); m_ui.sliderDetail->setScaledRange( 3.0, 0.0 ); m_ui.sliderHeight->setScaledRange( 0.02, 0.42 ); m_ui.sliderZoom->setScaledRange( 45.0, 10.0 ); } AdvancedSettingsPage::~AdvancedSettingsPage() { } void AdvancedSettingsPage::setModel( FractalModel* model ) { m_model = model; connect( m_model, SIGNAL( generatorSettingsChanged() ), this, SLOT( generatorSettingsChanged() ) ); connect( m_model, SIGNAL( viewSettingsChanged() ), this, SLOT( viewSettingsChanged() ) ); connect( m_model, SIGNAL( viewModeChanged() ), this, SLOT( viewModeChanged() ) ); } void AdvancedSettingsPage::on_sliderDepth_valueChanged() { saveGenerator(); } void AdvancedSettingsPage::on_sliderDetail_valueChanged() { saveGenerator(); } void AdvancedSettingsPage::on_radioAANone_clicked() { saveView(); } void AdvancedSettingsPage::on_radioAALow_clicked() { saveView(); } void AdvancedSettingsPage::on_radioAAMedium_clicked() { saveView(); } void AdvancedSettingsPage::on_radioAAHigh_clicked() { saveView(); } void AdvancedSettingsPage::on_radioResLow_clicked() { saveView(); } void AdvancedSettingsPage::on_radioResMedium_clicked() { saveView(); } void AdvancedSettingsPage::on_radioResHigh_clicked() { saveView(); } void AdvancedSettingsPage::on_radioResVHigh_clicked() { saveView(); } void AdvancedSettingsPage::on_sliderHeight_valueChanged() { saveView(); } void AdvancedSettingsPage::on_sliderZoom_valueChanged() { saveView(); } void AdvancedSettingsPage::on_buttonRestore_clicked() { m_model->loadDefaultGeneratorSettings(); m_model->loadDefaultViewSettings(); } void AdvancedSettingsPage::on_buttonStore_clicked() { if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Are you sure you want to store current advanced settings\nas the default settings?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok ) { m_model->saveDefaultGeneratorSettings(); m_model->saveDefaultViewSettings(); updateButtons(); } } void AdvancedSettingsPage::generatorSettingsChanged() { loadGenerator(); updateButtons(); } void AdvancedSettingsPage::viewSettingsChanged() { loadView(); updateButtons(); } void AdvancedSettingsPage::viewModeChanged() { bool isImage = ( m_model->viewMode() == ImageViewMode ); bool isMesh = ( m_model->viewMode() == MeshViewMode ); m_ui.radioAANone->setEnabled( isImage ); m_ui.radioAALow->setEnabled( isImage ); m_ui.radioAAMedium->setEnabled( isImage ); m_ui.radioAAHigh->setEnabled( isImage ); m_ui.sliderHeight->setEnabled( isMesh ); m_ui.sliderZoom->setEnabled( isMesh ); m_ui.radioResLow->setEnabled( isMesh ); m_ui.radioResMedium->setEnabled( isMesh ); m_ui.radioResHigh->setEnabled( isMesh ); m_ui.radioResVHigh->setEnabled( isMesh ); } void AdvancedSettingsPage::loadGenerator() { m_loading = true; GeneratorSettings settings = m_model->generatorSettings(); m_ui.sliderDepth->setScaledValue( settings.calculationDepth() ); m_ui.sliderDetail->setScaledValue( settings.detailThreshold() ); m_loading = false; } void AdvancedSettingsPage::saveGenerator() { if ( m_loading ) return; GeneratorSettings settings; settings.setCalculationDepth( m_ui.sliderDepth->scaledValue() ); settings.setDetailThreshold( m_ui.sliderDetail->scaledValue() ); m_model->setGeneratorSettings( settings ); } void AdvancedSettingsPage::loadView() { m_loading = true; ViewSettings settings = m_model->viewSettings(); switch ( settings.antiAliasing() ) { case NoAntiAliasing: m_ui.radioAANone->setChecked( true ); break; case LowAntiAliasing: m_ui.radioAALow->setChecked( true ); break; case MediumAntiAliasing: m_ui.radioAAMedium->setChecked( true ); break; case HighAntiAliasing: m_ui.radioAAHigh->setChecked( true ); break; } switch ( settings.meshResolution() ) { case LowResolution: m_ui.radioResLow->setChecked( true ); break; case MediumResolution: m_ui.radioResMedium->setChecked( true ); break; case HighResolution: m_ui.radioResHigh->setChecked( true ); break; case VeryHighResolution: m_ui.radioResVHigh->setChecked( true ); break; } m_ui.sliderHeight->setScaledValue( settings.heightScale() ); m_ui.sliderZoom->setScaledValue( settings.cameraZoom() ); m_loading = false; } void AdvancedSettingsPage::saveView() { if ( m_loading ) return; ViewSettings settings; if ( m_ui.radioAANone->isChecked() ) settings.setAntiAliasing( NoAntiAliasing ); if ( m_ui.radioAALow->isChecked() ) settings.setAntiAliasing( LowAntiAliasing ); if ( m_ui.radioAAMedium->isChecked() ) settings.setAntiAliasing( MediumAntiAliasing ); if ( m_ui.radioAAHigh->isChecked() ) settings.setAntiAliasing( HighAntiAliasing ); if ( m_ui.radioResLow->isChecked() ) settings.setMeshResolution( LowResolution ); if ( m_ui.radioResMedium->isChecked() ) settings.setMeshResolution( MediumResolution ); if ( m_ui.radioResHigh->isChecked() ) settings.setMeshResolution( HighResolution ); if ( m_ui.radioResVHigh->isChecked() ) settings.setMeshResolution( VeryHighResolution ); settings.setHeightScale( m_ui.sliderHeight->scaledValue() ); settings.setCameraZoom( m_ui.sliderZoom->scaledValue() ); m_model->setViewSettings( settings ); } void AdvancedSettingsPage::updateButtons() { bool enabled = !m_model->hasDefaultGeneratorSettings() || !m_model->hasDefaultViewSettings(); m_ui.buttonRestore->setEnabled( enabled ); m_ui.buttonStore->setEnabled( enabled ); } fraqtive-0.4.8.1/src/advancedsettingspage.h000066400000000000000000000040441440132223600206250ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef ADVANCEDSETTINGSPAGE_H #define ADVANCEDSETTINGSPAGE_H #include #include "ui_advancedsettingspage.h" class FractalModel; class AdvancedSettingsPage : public QWidget { Q_OBJECT public: AdvancedSettingsPage( QWidget* parent ); ~AdvancedSettingsPage(); public: void setModel( FractalModel* model ); private slots: void on_sliderDepth_valueChanged(); void on_sliderDetail_valueChanged(); void on_radioAANone_clicked(); void on_radioAALow_clicked(); void on_radioAAMedium_clicked(); void on_radioAAHigh_clicked(); void on_radioResLow_clicked(); void on_radioResMedium_clicked(); void on_radioResHigh_clicked(); void on_radioResVHigh_clicked(); void on_sliderHeight_valueChanged(); void on_sliderZoom_valueChanged(); void on_buttonRestore_clicked(); void on_buttonStore_clicked(); void generatorSettingsChanged(); void viewSettingsChanged(); void viewModeChanged(); private: void loadGenerator(); void saveGenerator(); void loadView(); void saveView(); void updateButtons(); private: Ui::AdvancedSettingsPage m_ui; FractalModel* m_model; bool m_loading; }; #endif fraqtive-0.4.8.1/src/advancedsettingspage.ui000066400000000000000000000202411440132223600210100ustar00rootroot00000000000000 AdvancedSettingsPage 0 0 300 400 Advanced Settings Calculation Depth 100 Qt::Horizontal QSlider::TicksBelow 10 Detail Level 100 Qt::Horizontal QSlider::TicksBelow 10 Image Anti-Aliasing Qt::Horizontal 51 20 QFrame::NoFrame 4 0 0 0 0 None true Low Medium High Mesh Resolution Qt::Horizontal 40 20 QFrame::NoFrame 4 0 0 0 0 Low true Medium High Very High Mesh Height Scale 100 Qt::Horizontal QSlider::TicksBelow 10 Camera Zoom 100 Qt::Horizontal QSlider::TicksBelow 10 Default Settings Qt::Horizontal 40 20 Restore Store Qt::Vertical 20 28 DoubleSlider QSlider
doubleslider.h
sliderDepth
fraqtive-0.4.8.1/src/animationpage.cpp000066400000000000000000000067311440132223600176160ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "animationpage.h" #include "fractalmodel.h" AnimationPage::AnimationPage( QWidget* parent ) : QWidget( parent ), m_model( NULL ), m_loading( false ) { m_ui.setupUi( this ); m_ui.sliderScrolling->setScaledRange( -0.5, 0.5 ); m_ui.sliderRotation->setScaledRange( -0.25, 0.25 ); } AnimationPage::~AnimationPage() { } void AnimationPage::setModel( FractalModel* model ) { m_model = model; connect( m_model, SIGNAL( animationSettingsChanged() ), this, SLOT( animationSettingsChanged() ) ); connect( m_model, SIGNAL( viewModeChanged() ), this, SLOT( viewModeChanged() ) ); } void AnimationPage::on_sliderScrolling_valueChanged() { saveSettings(); updateButtons(); } void AnimationPage::on_sliderRotation_valueChanged() { saveSettings(); updateButtons(); } void AnimationPage::on_stopScrolling_clicked() { AnimationSettings settings = m_model->animationSettings(); settings.setScrollingEnabled( false ); settings.setScrollingSpeed( 0.0 ); m_model->setAnimationSettings( settings ); } void AnimationPage::on_stopRotation_clicked() { AnimationSettings settings = m_model->animationSettings(); settings.setRotationEnabled( false ); settings.setRotationSpeed( 0.0 ); m_model->setAnimationSettings( settings ); } void AnimationPage::animationSettingsChanged() { loadSettings(); } void AnimationPage::viewModeChanged() { m_ui.sliderRotation->setEnabled( m_model->viewMode() == MeshViewMode ); updateButtons(); } void AnimationPage::updateButtons() { AnimationSettings settings = m_model->animationSettings(); m_ui.stopScrolling->setEnabled( settings.isScrollingEnabled() ); if ( m_model->viewMode() == MeshViewMode ) m_ui.stopRotation->setEnabled( settings.isRotationEnabled() ); else m_ui.stopRotation->setEnabled( false ); } void AnimationPage::loadSettings() { m_loading = true; AnimationSettings settings = m_model->animationSettings(); m_ui.sliderScrolling->setScaledValue( settings.scrollingSpeed() ); m_ui.sliderRotation->setScaledValue( settings.rotationSpeed() ); m_loading = false; } void AnimationPage::saveSettings() { if ( m_loading ) return; AnimationSettings settings = m_model->animationSettings(); settings.setScrollingSpeed( m_ui.sliderScrolling->scaledValue() ); settings.setRotationSpeed( m_ui.sliderRotation->scaledValue() ); if ( settings.scrollingSpeed() != 0.0 ) settings.setScrollingEnabled( true ); if ( settings.rotationSpeed() != 0.0 ) settings.setRotationEnabled( true ); m_model->setAnimationSettings( settings ); } fraqtive-0.4.8.1/src/animationpage.h000066400000000000000000000030761440132223600172620ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef ANIMATIONPAGE_H #define ANIMATIONPAGE_H #include #include "ui_animationpage.h" class FractalModel; class AnimationPage : public QWidget { Q_OBJECT public: AnimationPage( QWidget* parent ); ~AnimationPage(); public: void setModel( FractalModel* model ); private slots: void on_sliderScrolling_valueChanged(); void on_sliderRotation_valueChanged(); void on_stopScrolling_clicked(); void on_stopRotation_clicked(); void animationSettingsChanged(); void viewModeChanged(); private: void loadSettings(); void saveSettings(); void updateButtons(); private: Ui::AnimationPage m_ui; FractalModel* m_model; bool m_loading; }; #endif fraqtive-0.4.8.1/src/animationpage.ui000066400000000000000000000064231440132223600174470ustar00rootroot00000000000000 AnimationPage 0 0 300 400 Animation Color Scrolling 1 0 -100 100 Qt::Horizontal QSlider::TicksBelow 20 Stop Mesh Rotation 1 0 -100 100 Qt::Horizontal QSlider::TicksBelow 20 Stop Qt::Vertical 20 40 DoubleSlider QSlider
doubleslider.h
sliderScrolling stopScrolling sliderRotation stopRotation
fraqtive-0.4.8.1/src/bookmarklistview.cpp000066400000000000000000000076471440132223600204050ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "bookmarklistview.h" #include #include #include #include "bookmarkmodel.h" #include "renamedialog.h" BookmarkListView::BookmarkListView( QWidget* parent ) : QListView( parent ) { setViewMode( QListView::IconMode ); setFlow( QListView::LeftToRight ); setMovement( QListView::Static ); setResizeMode( QListView::Adjust ); setWrapping( true ); setIconSize( QSize( 48, 48 ) ); setSpacing( 6 ); setWordWrap( true ); setModel( new BookmarkModel( this ) ); } BookmarkListView::~BookmarkListView() { } void BookmarkListView::setMap( BookmarkMap* map ) { ( (BookmarkModel*)model() )->setMap( map ); } void BookmarkListView::setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ) { BookmarkModel* bookmarkModel = (BookmarkModel*)model(); bookmarkModel->setColorSettings( gradient, backgroundColor, mapping ); bookmarkModel->continueGeneration(); } void BookmarkListView::contextMenuEvent( QContextMenuEvent* e ) { QModelIndexList selection = selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QMenu menu( this ); menu.addAction( QIcon( ":/icons/rename-16.png" ), tr( "&Rename" ), this, SLOT( renameItem() ) ); menu.addAction( QIcon( ":/icons/delete-16.png" ), tr( "&Delete" ), this, SLOT( deleteItem() ) ); menu.exec( e->globalPos() ); } } void BookmarkListView::renameItem() { QModelIndexList selection = selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { BookmarkModel* bookmarkModel = (BookmarkModel*)model(); BookmarkMap* map = bookmarkModel->map(); QString name = model()->data( selection[ 0 ] ).toString(); RenameDialog dialog( RenameDialog::BookmarkMode, name, this ); dialog.setExistingNames( map->keys() ); if ( dialog.exec() == QDialog::Accepted ) { bookmarkModel->abortGeneration(); Bookmark bookmark = map->take( name ); map->insert( dialog.name(), bookmark ); bookmarkModel->invalidateBookmark( name ); bookmarkModel->invalidateBookmark( dialog.name() ); bookmarkModel->update(); bookmarkModel->continueGeneration(); } } } void BookmarkListView::deleteItem() { QModelIndexList selection = selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = model()->data( selection[ 0 ] ).toString(); if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Are you sure you want to delete bookmark
named %1?
" ).arg( name ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok ) { BookmarkModel* bookmarkModel = (BookmarkModel*)model(); bookmarkModel->abortGeneration(); BookmarkMap* map = bookmarkModel->map(); map->remove( name ); bookmarkModel->invalidateBookmark( name ); bookmarkModel->update(); bookmarkModel->continueGeneration(); } } } fraqtive-0.4.8.1/src/bookmarklistview.h000066400000000000000000000026171440132223600200420ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef BOOKMARKLISTVIEW_H #define BOOKMARKLISTVIEW_H #include #include "datastructures.h" class BookmarkListView : public QListView { Q_OBJECT public: BookmarkListView( QWidget* parent ); ~BookmarkListView(); public: void setMap( BookmarkMap* map ); void setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ); protected: // overrides void contextMenuEvent( QContextMenuEvent* e ); private slots: void renameItem(); void deleteItem(); }; #endif fraqtive-0.4.8.1/src/bookmarkmodel.cpp000066400000000000000000000205241440132223600176240ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "bookmarkmodel.h" #include #ifndef M_PI # define M_PI 3.14159265358979323846 #endif #include #include #include #include "fraqtiveapplication.h" #include "fractaldata.h" #include "jobscheduler.h" #include "datafunctions.h" Q_DECLARE_METATYPE( QModelIndex ) BookmarkModel::BookmarkModel( QObject* parent ) : QAbstractListModel( parent ), m_gradientCache( NULL ), m_enabled( false ), m_activeJobs( 0 ) { qRegisterMetaType(); } BookmarkModel::~BookmarkModel() { QMutexLocker locker( &m_mutex ); cancelJobs(); while ( m_activeJobs > 0 ) m_allJobsDone.wait( &m_mutex ); delete[] m_gradientCache; } void BookmarkModel::setMap( BookmarkMap* map ) { m_map = map; update(); m_enabled = true; m_queue = m_keys; } static const int GradientSize = 16384; void BookmarkModel::setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ) { QMutexLocker locker( &m_mutex ); cancelJobs(); if ( !m_gradientCache ) m_gradientCache = new QRgb[ GradientSize ]; DataFunctions::fillGradientCache( gradient, m_gradientCache, GradientSize ); m_backgroundColor = backgroundColor; m_colorMapping = mapping; } void BookmarkModel::abortGeneration() { QMutexLocker locker( &m_mutex ); m_enabled = false; cancelJobs(); } void BookmarkModel::continueGeneration() { QMutexLocker locker( &m_mutex ); m_enabled = true; addJobs(); } void BookmarkModel::invalidateBookmark( const QString& name ) { QMutexLocker locker( &m_mutex ); m_images.remove( name ); if ( !m_queue.contains( name ) ) { m_queue.append( name ); addJobs( 1 ); } } static bool localeAwareLessThan( const QString& s1, const QString& s2 ) { return QString::localeAwareCompare( s1, s2 ) < 0; } void BookmarkModel::update() { QMutexLocker locker( &m_mutex ); cancelJobs(); beginResetModel(); m_keys = m_map->keys(); qSort( m_keys.begin(), m_keys.end(), localeAwareLessThan ); endResetModel(); } int BookmarkModel::rowCount( const QModelIndex& parent ) const { if ( !parent.isValid() ) return m_keys.count(); return 0; } QVariant BookmarkModel::data( const QModelIndex& index, int role ) const { if ( role == Qt::DisplayRole ) return m_keys.at( index.row() ); if ( role == Qt::DecorationRole ) { QMutexLocker locker( &m_mutex ); QString name = m_keys.at( index.row() ); QPixmap pixmap; if ( m_images.contains( name ) ) { pixmap = QPixmap::fromImage( m_images.value( name ) ); } else { pixmap = QPixmap( 48, 48 ); pixmap.fill( QApplication::palette().color( QPalette::Disabled, QPalette::Window ) ); } locker.unlock(); QPainter painter( &pixmap ); QPixmap pixmap2 = pixmap; QPainter painter2( &pixmap2 ); painter.setPen( QApplication::palette().color( QPalette::Dark ) ); painter.drawRect( pixmap.rect().adjusted( 0, 0, -1, -1 ) ); painter2.setPen( QApplication::palette().color( QPalette::Highlight ) ); painter2.drawRect( pixmap.rect().adjusted( 0, 0, -1, -1 ) ); painter2.drawRect( pixmap.rect().adjusted( 1, 1, -2, -2 ) ); QIcon icon; icon.addPixmap( pixmap, QIcon::Normal ); icon.addPixmap( pixmap2, QIcon::Selected ); return icon; } return QVariant(); } int BookmarkModel::priority() const { return 1; } static int roundToCellSize( int size ) { // round up to nearest N * CellSize + 1 return ( ( size - 1 + GeneratorCore::CellSize - 1 ) / GeneratorCore::CellSize ) * GeneratorCore::CellSize + 1; } void BookmarkModel::executeJob() { QMutexLocker locker( &m_mutex ); if ( !m_enabled || m_queue.isEmpty() ) { finishJob(); return; } QString name = m_queue.takeFirst(); if ( !m_map->contains( name ) ) { finishJob(); return; } Bookmark bookmark = m_map->value( name ); locker.unlock(); const int imageSize = 48; const int bufferSize = roundToCellSize( imageSize + 2 ); // 2 pixel margin for anti-aliasing double* buffer = new double[ bufferSize * bufferSize ]; calculate( bookmark, buffer, QSize( bufferSize, bufferSize ), QSize( imageSize, imageSize ) ); FractalData data; data.transferBuffer( buffer, bufferSize, QSize( imageSize, imageSize ) ); QImage image( imageSize, imageSize, QImage::Format_RGB32 ); ViewSettings settings = DataFunctions::defaultViewSettings(); DataFunctions::ColorMapper mapper( m_gradientCache, GradientSize, m_backgroundColor.rgb(), m_colorMapping ); DataFunctions::drawImage( image, &data, image.rect(), mapper, settings.antiAliasing() ); locker.relock(); if ( m_queue.contains( name ) ) { finishJob(); return; } m_images.insert( name, image ); int row = m_keys.indexOf( name ); if ( row >= 0 ) emit dataChanged( index( row ), index( row ) ); finishJob(); } void BookmarkModel::calculate( const Bookmark& bookmark, double* buffer, const QSize& size, const QSize& resolution ) { GeneratorCore::Input input; Position position = bookmark.position(); double scale = pow( 10.0, -position.zoomFactor() ) / (double)resolution.height(); double sa = scale * sin( position.angle() * M_PI / 180.0 ); double ca = scale * cos( position.angle() * M_PI / 180.0 ); double offsetX = -(double)resolution.width() / 2.0 - 0.5; double offsetY = -(double)resolution.height() / 2.0 - 0.5; input.m_sa = sa; input.m_ca = ca; input.m_x = position.center().x() + ca * offsetX + sa * offsetY; input.m_y = position.center().y() - sa * offsetX + ca * offsetY; GeneratorCore::Output output; output.m_buffer = buffer; output.m_width = size.width(); output.m_height = size.height(); output.m_stride = size.width(); GeneratorSettings settings = DataFunctions::defaultGeneratorSettings(); int maxIterations = (int)( pow( 10.0, settings.calculationDepth() ) * qMax( 1.0, 1.45 + position.zoomFactor() ) ); double threshold = settings.detailThreshold(); #if defined( HAVE_SSE2 ) GeneratorCore::FunctorSSE2* functorSSE2 = DataFunctions::createFunctorSSE2( bookmark.fractalType() ); if ( functorSSE2 ) { GeneratorCore::generatePreviewSSE2( input, output, functorSSE2, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetailsSSE2( input, output, functorSSE2, maxIterations, threshold ); delete functorSSE2; return; } #endif GeneratorCore::Functor* functor = DataFunctions::createFunctor( bookmark.fractalType() ); if ( functor ) { GeneratorCore::generatePreview( input, output, functor, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetails( input, output, functor, maxIterations, threshold ); delete functor; } } void BookmarkModel::addJobs( int count /*= -1*/ ) { if ( count < 0 ) count = m_queue.count(); if ( count > 0 ) { fraqtive()->jobScheduler()->addJobs( this, count ); m_activeJobs += count; } } void BookmarkModel::cancelJobs() { int count = fraqtive()->jobScheduler()->cancelAllJobs( this ); m_activeJobs -= count; if ( m_activeJobs == 0 ) m_allJobsDone.wakeAll(); } void BookmarkModel::finishJob() { m_activeJobs--; if ( m_activeJobs == 0 ) m_allJobsDone.wakeAll(); } fraqtive-0.4.8.1/src/bookmarkmodel.h000066400000000000000000000044561440132223600172770ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef BOOKMARKMODEL_H #define BOOKMARKMODEL_H #include #include #include #include #include "abstractjobprovider.h" #include "datastructures.h" class BookmarkModel : public QAbstractListModel, public AbstractJobProvider { Q_OBJECT public: BookmarkModel( QObject* parent ); ~BookmarkModel(); public: void setMap( BookmarkMap* map ); BookmarkMap* map() const { return m_map; } void setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ); void abortGeneration(); void continueGeneration(); void invalidateBookmark( const QString& name ); void update(); public: // overrides int rowCount( const QModelIndex& parent ) const; QVariant data( const QModelIndex& index, int role ) const; public: // AbstractJobProvider implementation int priority() const; void executeJob(); private: void calculate( const Bookmark& bookmark, double* buffer, const QSize& size, const QSize& resolution ); void addJobs( int count = -1 ); void cancelJobs(); void finishJob(); private: BookmarkMap* m_map; QRgb* m_gradientCache; QColor m_backgroundColor; ColorMapping m_colorMapping; mutable QMutex m_mutex; QStringList m_keys; QMap m_images; bool m_enabled; QStringList m_queue; int m_activeJobs; QWaitCondition m_allJobsDone; }; #endif fraqtive-0.4.8.1/src/colorsettingspage.cpp000066400000000000000000000113141440132223600205270ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "colorsettingspage.h" #include #include #include "fractalmodel.h" #include "gradientdialog.h" #include "loadpresetdialog.h" #include "savepresetdialog.h" #include "datafunctions.h" ColorSettingsPage::ColorSettingsPage( QWidget* parent ) : QWidget( parent ), m_model( NULL ) { m_ui.setupUi( this ); m_ui.sliderScale->setScaledRange( 0.02, 0.2 ); m_ui.sliderOffset->setScaledRange( 0.0, 1.0 ); } ColorSettingsPage::~ColorSettingsPage() { } void ColorSettingsPage::setModel( FractalModel* model ) { m_model = model; connect( model, SIGNAL( gradientChanged() ), this, SLOT( gradientChanged() ) ); connect( model, SIGNAL( backgroundColorChanged() ), this, SLOT( backgroundColorChanged() ) ); connect( model, SIGNAL( colorMappingChanged() ), this, SLOT( colorMappingChanged() ) ); } void ColorSettingsPage::on_buttonBackground_clicked() { QColor color = QColorDialog::getColor( m_model->backgroundColor(), this ); if ( color.isValid() ) m_model->setBackgroundColor( color ); } void ColorSettingsPage::on_buttonGradient_clicked() { GradientDialog dialog( this ); dialog.setGradient( m_model->gradient() ); connect( &dialog, SIGNAL( applyGradient( const Gradient& ) ), this, SLOT( applyGradient( const Gradient& ) ) ); dialog.exec(); } void ColorSettingsPage::applyGradient( const Gradient& gradient ) { m_model->setGradient( gradient ); } void ColorSettingsPage::on_sliderScale_valueChanged() { saveMapping(); } void ColorSettingsPage::on_sliderOffset_valueChanged() { saveMapping(); } void ColorSettingsPage::on_checkMirrored_toggled() { saveMapping(); } void ColorSettingsPage::on_checkReversed_toggled() { saveMapping(); } void ColorSettingsPage::on_buttonRestore_clicked() { m_model->loadDefaultColorSettings(); } void ColorSettingsPage::on_buttonStore_clicked() { if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Are you sure you want to store current color settings\nas the default settings?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok ) { m_model->saveDefaultColorSettings(); updateButtons(); } } void ColorSettingsPage::on_buttonLoad_clicked() { LoadPresetDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void ColorSettingsPage::on_buttonSave_clicked() { SavePresetDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void ColorSettingsPage::gradientChanged() { loadGradient(); updateButtons(); } void ColorSettingsPage::backgroundColorChanged() { loadBackground(); updateButtons(); } void ColorSettingsPage::colorMappingChanged() { loadMapping(); updateButtons(); } void ColorSettingsPage::loadBackground() { m_ui.widgetBackground->setBackgroundColor( m_model->backgroundColor() ); } void ColorSettingsPage::loadGradient() { QGradientStops stops = DataFunctions::calculateGradientStops( m_model->gradient() ); m_ui.widgetGradient->setGradientStops( stops ); } void ColorSettingsPage::loadMapping() { ColorMapping mapping = m_model->colorMapping(); m_ui.sliderScale->setScaledValue( mapping.scale() ); m_ui.sliderOffset->setScaledValue( mapping.offset() ); m_ui.checkMirrored->setChecked( mapping.isMirrored() ); m_ui.checkReversed->setChecked( mapping.isReversed() ); } void ColorSettingsPage::saveMapping() { ColorMapping mapping; mapping.setScale( m_ui.sliderScale->scaledValue() ); mapping.setOffset( m_ui.sliderOffset->scaledValue() ); mapping.setMirrored( m_ui.checkMirrored->isChecked() ); mapping.setReversed( m_ui.checkReversed->isChecked() ); m_model->setColorMapping( mapping ); } void ColorSettingsPage::updateButtons() { bool enabled = !m_model->hasDefaultColorSettings(); m_ui.buttonRestore->setEnabled( enabled ); m_ui.buttonStore->setEnabled( enabled ); } fraqtive-0.4.8.1/src/colorsettingspage.h000066400000000000000000000036611440132223600202020ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef COLORSETTINGSPAGE_H #define COLORSETTINGSPAGE_H #include #include "ui_colorsettingspage.h" class FractalModel; class Gradient; class ColorSettingsPage : public QWidget { Q_OBJECT public: ColorSettingsPage( QWidget* parent ); ~ColorSettingsPage(); public: void setModel( FractalModel* model ); private slots: void on_buttonBackground_clicked(); void on_buttonGradient_clicked(); void on_sliderScale_valueChanged(); void on_sliderOffset_valueChanged(); void on_checkMirrored_toggled(); void on_checkReversed_toggled(); void on_buttonRestore_clicked(); void on_buttonStore_clicked(); void on_buttonLoad_clicked(); void on_buttonSave_clicked(); void gradientChanged(); void backgroundColorChanged(); void colorMappingChanged(); void applyGradient( const Gradient& gradient ); private: void loadBackground(); void loadGradient(); void loadMapping(); void saveMapping(); void updateButtons(); private: Ui::ColorSettingsPage m_ui; FractalModel* m_model; }; #endif fraqtive-0.4.8.1/src/colorsettingspage.ui000066400000000000000000000133621440132223600203670ustar00rootroot00000000000000 ColorSettingsPage 0 0 300 400 Color Settings Background Color ... Color Gradient ... Gradient Options Qt::Horizontal 40 20 Mirrored Reversed Mapping Scale 100 Qt::Horizontal QSlider::TicksBelow 10 Mapping Offset 100 Qt::Horizontal QSlider::TicksBelow 10 Default Settings Qt::Horizontal 40 20 Restore Store Color Presets Qt::Horizontal 84 25 Load... Save... Qt::Vertical 20 21 ColorWidget QWidget
colorwidget.h
1
DoubleSlider QSlider
doubleslider.h
fraqtive-0.4.8.1/src/colorwidget.cpp000066400000000000000000000033371440132223600173230ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "colorwidget.h" #include #include ColorWidget::ColorWidget( QWidget* parent ) : QWidget( parent ) { } ColorWidget::~ColorWidget() { } void ColorWidget::setBackgroundColor( const QColor& color ) { m_color = color; m_stops.clear(); update(); } void ColorWidget::setGradientStops( const QGradientStops& stops ) { m_color = QColor(); m_stops = stops; update(); } void ColorWidget::paintEvent( QPaintEvent* e ) { QPainter painter( this ); QRect rect = e->rect().adjusted( 0, 2, 0, -2 ); if ( m_color.isValid() ) { painter.setBrush( m_color ); } else if ( !m_stops.isEmpty() ) { QLinearGradient gradient( rect.topLeft(), rect.topRight() ); gradient.setStops( m_stops ); painter.setBrush( gradient ); } painter.setPen( Qt::NoPen ); painter.drawRect( rect ); } fraqtive-0.4.8.1/src/colorwidget.h000066400000000000000000000024351440132223600167660ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef COLORWIDGET_H #define COLORWIDGET_H #include class ColorWidget : public QWidget { Q_OBJECT public: ColorWidget( QWidget* parent ); ~ColorWidget(); public: void setBackgroundColor( const QColor& color ); void setGradientStops( const QGradientStops& stops ); protected: // overrides void paintEvent( QPaintEvent* e ); private: QColor m_color; QGradientStops m_stops; }; #endif fraqtive-0.4.8.1/src/configurationdata.cpp000066400000000000000000000115411440132223600204760ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "configurationdata.h" #if defined( Q_OS_WIN ) #ifndef _WIN32_IE #define _WIN32_IE 0x0400 #endif #include #endif #include #include #include ConfigurationData::ConfigurationData() { QString homePath = QDir::homePath(); #if defined( Q_OS_WIN ) TCHAR appDataPath[ MAX_PATH ]; if ( SHGetSpecialFolderPath( 0, appDataPath, CSIDL_APPDATA, FALSE ) ) m_dataPath = QDir::fromNativeSeparators( QString::fromUtf16( (ushort*)appDataPath ) ); if ( m_dataPath.isEmpty() ) m_dataPath = homePath; m_dataPath += "/Fraqtive"; #else char* dataHome = getenv( "XDG_DATA_HOME" ); if ( dataHome ) { if ( dataHome[ 0 ] == '/' ) m_dataPath = dataHome; else m_dataPath = homePath + '/' + dataHome; } else { m_dataPath = homePath + "/.local/share"; } m_dataPath += "/fraqtive"; #endif } ConfigurationData::~ConfigurationData() { } bool ConfigurationData::contains( const QString& key ) const { return m_data.contains( key ); } void ConfigurationData::setValue( const QString& key, const QVariant& value ) { m_data[ key ] = value; } QVariant ConfigurationData::value( const QString& key, const QVariant& defaultValue /*= QVariant()*/ ) const { QVariantMap::const_iterator it = m_data.find( key ); if ( it == m_data.end() ) return defaultValue; return it.value(); } void ConfigurationData::readConfiguration() { QFile file; QDataStream stream; if ( readFile( &file, &stream, "config.dat" ) ) stream >> m_data; if ( readFile( &file, &stream, "bookmarks.dat" ) ) stream >> m_bookmarks; if ( readFile( &file, &stream, "presets.dat" ) ) stream >> m_userPresets; if ( readFile( &file, &stream, ":/data/presets.dat" ) ) stream >> m_defaultPresets; } bool ConfigurationData::readFile( QFile* file, QDataStream* stream, const QString& fileName ) { QString path; if ( QDir::isRelativePath( fileName ) ) path = locateDataFile( fileName ); else path = fileName; file->close(); file->setFileName( path ); if ( !file->open( QIODevice::ReadOnly ) ) return false; stream->setDevice( file ); stream->setVersion( QDataStream::Qt_4_2 ); qint32 version; *stream >> version; if ( version < 1 || version > 2 ) return false; m_dataVersion = version; return true; } void ConfigurationData::writeConfiguration() { QFile file; QDataStream stream; if ( writeFile( &file, &stream, "config.dat" ) ) stream << m_data; if ( writeFile( &file, &stream, "bookmarks.dat" ) ) stream << m_bookmarks; if ( writeFile( &file, &stream, "presets.dat" ) ) stream << m_userPresets; } bool ConfigurationData::writeFile( QFile* file, QDataStream* stream, const QString& fileName ) { QString path; if ( QDir::isRelativePath( fileName ) ) path = locateDataFile( fileName ); else path = fileName; file->close(); file->setFileName( path ); if ( !file->open( QIODevice::WriteOnly ) ) return false; stream->setDevice( file ); stream->setVersion( QDataStream::Qt_4_2 ); // increment version when adding / modifying fields m_dataVersion = 2; *stream << (qint32)m_dataVersion; return true; } QString ConfigurationData::locateDataFile( const QString& name ) { QString path = m_dataPath + '/' + name; checkAccess( path ); return path; } bool ConfigurationData::checkAccess( const QString& path ) { QFileInfo fileInfo( path ); if ( fileInfo.exists() ) return fileInfo.isReadable(); QDir dir = QDir::root(); QStringList pathParts = path.split( '/', QString::SkipEmptyParts ); for ( int i = 0; i < pathParts.size() - 1; i++ ) { const QString& part = pathParts.at( i ); if ( dir.cd( part ) ) continue; if ( dir.mkdir( part ) && dir.cd( part ) ) continue; return false; } return true; } fraqtive-0.4.8.1/src/configurationdata.h000066400000000000000000000043021440132223600201400ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef CONFIGURATIONDATA_H #define CONFIGURATIONDATA_H #include class QFile; #include "datastructures.h" class ConfigurationData { public: ConfigurationData(); ~ConfigurationData(); public: bool contains( const QString& key ) const; void setValue( const QString& key, const QVariant& value ); QVariant value( const QString& key, const QVariant& defaultValue = QVariant() ) const; BookmarkMap* bookmarks() { return &m_bookmarks; } const BookmarkMap* bookmarks() const { return &m_bookmarks; } PresetMap* defaultPresets() { return &m_defaultPresets; } const PresetMap* defaultPresets() const { return &m_defaultPresets; } PresetMap* userPresets() { return &m_userPresets; } const PresetMap* userPresets() const { return &m_userPresets; } void readConfiguration(); void writeConfiguration(); int dataVersion() const { return m_dataVersion; } private: bool readFile( QFile* file, QDataStream* stream, const QString& path ); bool writeFile( QFile* file, QDataStream* stream, const QString& path ); QString locateDataFile( const QString& name ); bool checkAccess( const QString& path ); private: QString m_dataPath; QVariantMap m_data; BookmarkMap m_bookmarks; PresetMap m_defaultPresets; PresetMap m_userPresets; int m_dataVersion; }; #endif fraqtive-0.4.8.1/src/data.qrc000066400000000000000000000001241440132223600157040ustar00rootroot00000000000000 data/presets.dat fraqtive-0.4.8.1/src/data/000077500000000000000000000000001440132223600152005ustar00rootroot00000000000000fraqtive-0.4.8.1/src/data/presets.dat000066400000000000000000000115431440132223600173630ustar00rootroot00000000000000Tricolor 3?3H>??UUUUUU??s??Z*U?qq??KT??s??Z*U?KU????tj~Tricolor 2?P~뵿?]?u???^(??'H5x??3H>??UUUUUU? ??P~뵿?]?u???tj~Tricolor 1?3H>??UUUUUU??KT??s??Z*U??UUUUUU? mK???tj~ Sunset?_`????? ?88????UUUUUU?? ??hh???l Summer?_`??Xyt?o[????; l^pd????PHStripes 2?? ?c/?=@d'?l[-?٧<4?; l^pd????PHStripes 1 ?<4??#?=@d'??م6%?`SE??=@d'?a_; l?qr?<4? ?c/?=@d'?l[-?م6%?; l^. **************************************************************************/ #include "datafunctions.h" #include "fractaldata.h" #include namespace DataFunctions { Position defaultPosition( const FractalType& type ) { Position position; position.setZoomFactor( -0.45 ); if ( type.fractal() == MandelbrotFractal && type.exponentType() == IntegralExponent ) { if ( type.variant() == GeneratorCore::NormalVariant && type.integralExponent() == 2 ) { position.setCenter( QPointF( -0.7, 0 ) ); } else if ( type.variant() == GeneratorCore::NormalVariant && type.integralExponent() == 4 ) { position.setCenter( QPointF( -0.2, 0 ) ); } else if ( type.variant() == GeneratorCore::ConjugateVariant && type.integralExponent() == 2 ) { position.setCenter( QPointF( -0.3, 0 ) ); position.setZoomFactor( -0.6 ); } else if ( type.variant() == GeneratorCore::AbsoluteVariant && type.integralExponent() == 2 ) { position.setCenter( QPointF( -0.5, -0.5 ) ); position.setZoomFactor( -0.5 ); } else if ( type.variant() == GeneratorCore::AbsoluteVariant && type.integralExponent() == 3 ) { position.setCenter( QPointF( -0.15, 0.15 ) ); } else if ( type.variant() == GeneratorCore::AbsoluteImVariant && type.integralExponent() == 2 ) { position.setCenter( QPointF( -0.5, 0 ) ); position.setZoomFactor( -0.5 ); } else if ( type.variant() == GeneratorCore::AbsoluteImVariant && type.integralExponent() == 3 ) { position.setCenter( QPointF( 0, 0.15 ) ); } } return position; } Gradient defaultGradient() { QPolygonF red; red.append( QPointF( 0.0, 0.0 ) ); red.append( QPointF( 0.1667, 1.0 ) ); red.append( QPointF( 0.5, 0.0 ) ); red.append( QPointF( 0.8333, 1.0 ) ); red.append( QPointF( 1.0, 0.0 ) ); QPolygonF green; green.append( QPointF( 0.0, 0.0 ) ); green.append( QPointF( 0.25, 1.0 ) ); green.append( QPointF( 0.5, 0.0 ) ); green.append( QPointF( 0.6667, 1.0 ) ); green.append( QPointF( 1.0, 0.0 ) ); QPolygonF blue; blue.append( QPointF( 0.0, 0.0 ) ); blue.append( QPointF( 0.3333, 1.0 ) ); blue.append( QPointF( 0.5, 0.0 ) ); blue.append( QPointF( 0.75, 1.0 ) ); blue.append( QPointF( 1.0, 0.0 ) ); Gradient gradient; gradient.setRed( red ); gradient.setGreen( green ); gradient.setBlue( blue ); return gradient; } ColorMapping defaultColorMapping() { ColorMapping mapping; mapping.setScale( 0.056 ); return mapping; } GeneratorSettings defaultGeneratorSettings() { GeneratorSettings settings; settings.setCalculationDepth( 2.5 ); settings.setDetailThreshold( 0.9 ); return settings; } ViewSettings defaultViewSettings() { ViewSettings settings; settings.setAntiAliasing( MediumAntiAliasing ); settings.setMeshResolution( MediumResolution ); settings.setHeightScale( 0.14 ); settings.setCameraZoom( 24.0 ); return settings; } static QPolygonF interpolateCubic( const QPolygonF& polygon ) { QPolygonF interpolated; if ( !polygon.isEmpty() ) interpolated.append( polygon.first() ); for ( int i = 1; i < polygon.count(); i++ ) { QPointF p1 = polygon.at( i - 1 ); QPointF p2 = polygon.at( i ); if ( ( p2.x() - p1.x() ) > 0.03 ) { QPainterPath path; path.moveTo( p1 ); path.cubicTo( ( p1.x() + p2.x() ) / 2, p1.y(), ( p1.x() + p2.x() ) / 2, p2.y(), p2.x(), p2.y() ); int segments = qBound( 1, qRound( ( p2.x() - p1.x() ) * 50.0 ), 10 ); for ( int j = 1; j <= segments; j++ ) { QPointF point = path.pointAtPercent( (double)j / (double)segments ); interpolated.append( point ); } } else { interpolated.append( p2 ); } } return interpolated; } static double lerp( const QPolygonF& points, int index, double x ) { QLineF line( points.at( index - 1 ), points.at( index ) ); if ( line.dx() == 0.0 ) return line.y2(); return line.y1() + line.dy() * ( x - line.x1() ) / line.dx(); } static QGradientStop makeStop( double x, double ry, double gy, double by ) { return QGradientStop( x, QColor( qRound( 255.0 * ry ), qRound( 255.0 * gy ), qRound( 255.0 * by ) ) ); } QGradientStops calculateGradientStops( const Gradient& gradient ) { QPolygonF red = interpolateCubic( gradient.red() ); QPolygonF green = interpolateCubic( gradient.green() ); QPolygonF blue = interpolateCubic( gradient.blue() ); QGradientStops stops; if ( red.isEmpty() || green.isEmpty() || blue.isEmpty() ) return stops; stops.append( makeStop( 0.0, red.first().y(), green.first().y(), blue.first().y() ) ); double x = 0.0; int ri = 1, gi = 1, bi = 1; while ( ri < red.count() && gi < green.count() && bi < blue.count() ) { double rx = red.at( ri ).x(); double gx = green.at( gi ).x(); double bx = blue.at( bi ).x(); x = qMin( qMin( rx, gx ), bx ); stops.append( makeStop( x, lerp( red, ri, x ), lerp( green, gi, x ), lerp( blue, bi, x ) ) ); if ( rx == x ) ri++; if ( gx == x ) gi++; if ( bx == x ) bi++; } return stops; } void fillGradientCache( const Gradient& gradient, QRgb* cache, int size ) { if ( gradient.isEmpty() ) { for ( int i = 0; i < size; i++ ) cache[ i ] = qRgb( 0, 0, 0 ); return; } QPolygonF red = interpolateCubic( gradient.red() ); QPolygonF green = interpolateCubic( gradient.green() ); QPolygonF blue = interpolateCubic( gradient.blue() ); int ri = 1, gi = 1, bi = 1; for ( int i = 0; i < size; i++ ) { double x = (double)i / (double)( size - 1 ); while ( red.at( ri ).x() < x ) ri++; while ( green.at( gi ).x() < x ) gi++; while ( blue.at( bi ).x() < x ) bi++; double ry = lerp( red, ri, x ); double gy = lerp( green, gi, x ); double by = lerp( blue, bi, x ); cache[ i ] = qRgb( qRound( 255.0 * ry ), qRound( 255.0 * gy ), qRound( 255.0 * by ) ); } } ColorMapper::ColorMapper( const QRgb* gradientCache, int gradientSize, QRgb backgroundColor, const ColorMapping& mapping ) : m_gradientCache( gradientCache ), m_gradientSize( gradientSize ), m_backgroundColor( backgroundColor ), m_mapping( mapping ) { } QRgb ColorMapper::map( double value ) const { if ( value == 0.0 ) return m_backgroundColor; int index; if ( m_mapping.isMirrored() ) { int scaled = (int)( ( m_mapping.scale() * value + 2 * m_mapping.offset() ) * m_gradientSize ); index = scaled % ( 2 * m_gradientSize ); if ( index >= m_gradientSize ) index = 2 * m_gradientSize - index - 1; } else { int scaled = (int)( ( m_mapping.scale() * value + m_mapping.offset() ) * m_gradientSize ); index = scaled % m_gradientSize; } if ( m_mapping.isReversed() ) index = m_gradientSize - index - 1; return m_gradientCache[ index ]; } template static inline QRgb maskedSum( QRgb color[ 3 ][ 3 ], int mask ) { QRgb middle = ( color[ 1 ][ 1 ] & mask ); QRgb sides = ( color[ 0 ][ 1 ] & mask ) + ( color[ 2 ][ 1 ] & mask ) + ( color[ 1 ][ 0 ] & mask ) + ( color[ 1 ][ 2 ] & mask ); QRgb corners = ( color[ 0 ][ 0 ] & mask ) + ( color[ 2 ][ 0 ] & mask ) + ( color[ 0 ][ 2 ] & mask ) + ( color[ 2 ][ 2 ] & mask ); return A * middle + B * sides + C * corners; } template static inline QRgb calcAntiAliased( QRgb color[ 3 ][ 3 ] ) { QRgb sum = maskedSum( color, 0xf0f0f0 ); QRgb carry = maskedSum( color, 0x0f0f0f ) & 0xf0f0f0; return ( ( sum + carry ) >> 4 ) | 0xff000000; } template static void drawAntiAliased( QImage& image, const QPoint& point, const FractalData* data, const QRect& region, const ColorMapper& mapper ) { QRgb color[ 3 ][ 3 ]; int stride = data->stride(); int width = region.width(); for ( int y = 0; y < region.height(); y++ ) { const double* src = data->buffer() + ( y + region.top() ) * stride + region.left() ; QRgb* dest = reinterpret_cast( image.scanLine( y + point.y() ) ) + point.x(); for ( int i = 0; i < 3; i++ ) { color[ i ][ 1 ] = mapper.map( src[ i * stride ] ); color[ i ][ 2 ] = mapper.map( src[ i * stride + 1 ] ); } for ( int x = 0; x < width; x++ ) { for ( int i = 0; i < 3; i++ ) { color[ i ][ 0 ] = color[ i ][ 1 ]; color[ i ][ 1 ] = color[ i ][ 2 ]; color[ i ][ 2 ] = mapper.map( src[ i * stride + x + 2 ] ); } dest[ x ] = calcAntiAliased( color ); } } } void drawImage( QImage& image, const FractalData* data, const QRect& region, const ColorMapper& mapper, AntiAliasing antiAliasing ) { drawImage( image, region.topLeft(), data, region, mapper, antiAliasing ); } void drawImage( QImage& image, const QPoint& point, const FractalData* data, const QRect& region, const ColorMapper& mapper, AntiAliasing antiAliasing ) { switch ( antiAliasing ) { case NoAntiAliasing: drawAntiAliased<16, 0, 0>( image, point, data, region, mapper ); break; case LowAntiAliasing: drawAntiAliased<12, 1, 0>( image, point, data, region, mapper ); break; case MediumAntiAliasing: drawAntiAliased<8, 1, 1>( image, point, data, region, mapper ); break; case HighAntiAliasing: drawAntiAliased<4, 2, 1>( image, point, data, region, mapper ); break; } } GeneratorCore::Functor* createFunctor( const FractalType& type ) { switch ( type.exponentType() ) { case IntegralExponent: if ( type.fractal() == MandelbrotFractal ) { return GeneratorCore::createMandelbrotFastFunctor( type.integralExponent(), type.variant() ); } else { return GeneratorCore::createJuliaFastFunctor( type.parameter().x(), type.parameter().y(), type.integralExponent(), type.variant() ); } break; case RealExponent: if ( type.fractal() == MandelbrotFractal ) { return GeneratorCore::createMandelbrotFunctor( type.realExponent(), type.variant() ); } else if ( type.fractal() == JuliaFractal ) { return GeneratorCore::createJuliaFunctor( type.parameter().x(), type.parameter().y(), type.realExponent(), type.variant() ); } break; } return NULL; } #if defined( HAVE_SSE2 ) GeneratorCore::FunctorSSE2* createFunctorSSE2( const FractalType& type ) { switch ( type.exponentType() ) { case IntegralExponent: if ( GeneratorCore::isSSE2Available() ) { if ( type.fractal() == MandelbrotFractal ) { return GeneratorCore::createMandelbrotFunctorSSE2( type.integralExponent(), type.variant() ); } else if ( type.fractal() == JuliaFractal ) { return GeneratorCore::createJuliaFunctorSSE2( type.parameter().x(), type.parameter().y(), type.integralExponent(), type.variant() ); } } break; default: break; } return NULL; } #endif } // namespace DataFunctions fraqtive-0.4.8.1/src/datafunctions.h000066400000000000000000000042501440132223600173030ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef DATAFUNCTIONS_H #define DATAFUNCTIONS_H #include #include "datastructures.h" #include "generatorcore.h" class FractalData; namespace DataFunctions { Position defaultPosition( const FractalType& type ); Gradient defaultGradient(); ColorMapping defaultColorMapping(); GeneratorSettings defaultGeneratorSettings(); ViewSettings defaultViewSettings(); QGradientStops calculateGradientStops( const Gradient& gradient ); void fillGradientCache( const Gradient& gradient, QRgb* cache, int size ); class ColorMapper { public: ColorMapper( const QRgb* gradientCache, int gradientSize, QRgb backgroundColor, const ColorMapping& mapping ); public: QRgb map( double value ) const; private: const QRgb* m_gradientCache; int m_gradientSize; QRgb m_backgroundColor; ColorMapping m_mapping; }; void drawImage( QImage& image, const FractalData* data, const QRect& region, const ColorMapper& mapper, AntiAliasing antiAliasing ); void drawImage( QImage& image, const QPoint& point, const FractalData* data, const QRect& region, const ColorMapper& mapper, AntiAliasing antiAliasing ); GeneratorCore::Functor* createFunctor( const FractalType& type ); #if defined( HAVE_SSE2 ) GeneratorCore::FunctorSSE2* createFunctorSSE2( const FractalType& type ); #endif } // namespace DataFunctions #endif fraqtive-0.4.8.1/src/datastructures.cpp000066400000000000000000000133521440132223600200540ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "datastructures.h" #include "datafunctions.h" #include "fraqtiveapplication.h" #include "configurationdata.h" #include QDataStream& operator <<( QDataStream& stream, const FractalType& type ) { stream << (qint8)type.m_fractal; if ( type.m_fractal == JuliaFractal ) stream << type.m_parameter; stream << (qint8)type.m_exponentType; if ( type.m_exponentType == IntegralExponent ) stream << (qint8)type.m_integralExponent; else if ( type.m_exponentType == RealExponent ) stream << type.m_realExponent; stream << (qint8)type.m_variant; return stream; } QDataStream& operator >>( QDataStream& stream, FractalType& type ) { qint8 fractal, exponentType, exponent, variant; stream >> fractal; type.m_fractal = (Fractal)fractal; if ( fractal == JuliaFractal ) stream >> type.m_parameter; stream >> exponentType; type.m_exponentType = (ExponentType)exponentType; if ( exponentType == IntegralExponent ) { stream >> exponent; type.m_integralExponent = exponent; } else if ( exponentType == RealExponent ) { stream >> type.m_realExponent; } stream >> variant; type.m_variant = (GeneratorCore::Variant)variant; return stream; } QDataStream& operator <<( QDataStream& stream, const Position& position ) { return stream << position.m_center << position.m_zoomFactor << position.m_angle; } QDataStream& operator >>( QDataStream& stream, Position& position ) { return stream >> position.m_center >> position.m_zoomFactor >> position.m_angle; } bool Gradient::isEmpty() const { return m_red.isEmpty() || m_green.isEmpty() || m_blue.isEmpty(); } QDataStream& operator <<( QDataStream& stream, const Gradient& gradient ) { return stream << gradient.m_red << gradient.m_green << gradient.m_blue; } QDataStream& operator >>( QDataStream& stream, Gradient& gradient ) { return stream >> gradient.m_red >> gradient.m_green >> gradient.m_blue; } QDataStream& operator <<( QDataStream& stream, const ColorMapping& mapping ) { return stream << mapping.m_mirrored << mapping.m_reversed << mapping.m_scale << mapping.m_offset; } QDataStream& operator >>( QDataStream& stream, ColorMapping& mapping ) { return stream >> mapping.m_mirrored >> mapping.m_reversed >> mapping.m_scale >> mapping.m_offset; } QDataStream& operator <<( QDataStream& stream, const GeneratorSettings& settings ) { return stream << settings.m_calculationDepth << settings.m_detailThreshold; } QDataStream& operator >>( QDataStream& stream, GeneratorSettings& settings ) { return stream >> settings.m_calculationDepth >> settings.m_detailThreshold; } QDataStream& operator <<( QDataStream& stream, const ViewSettings& settings ) { return stream << (qint8)settings.m_antiAliasing << (qint8)settings.m_meshResolution << settings.m_heightScale << settings.m_cameraZoom; } QDataStream& operator >>( QDataStream& stream, ViewSettings& settings ) { int version = fraqtive()->configuration()->dataVersion(); if ( version < 2 ) settings = DataFunctions::defaultViewSettings(); qint8 antiAliasing; stream >> antiAliasing; settings.m_antiAliasing = (AntiAliasing)antiAliasing; if ( version >= 2 ) { qint8 resolution; stream >> resolution; settings.m_meshResolution = (Resolution)resolution; stream >> settings.m_heightScale >> settings.m_cameraZoom; } return stream; } QDataStream& operator <<( QDataStream& stream, const Bookmark& bookmark ) { return stream << bookmark.m_fractalType << bookmark.m_position; } QDataStream& operator >>( QDataStream& stream, Bookmark& bookmark ) { return stream >> bookmark.m_fractalType >> bookmark.m_position; } QDataStream& operator <<( QDataStream& stream, const Preset& preset ) { return stream << preset.m_gradient << preset.m_backgroundColor << preset.m_colorMapping; } QDataStream& operator >>( QDataStream& stream, Preset& preset ) { return stream >> preset.m_gradient >> preset.m_backgroundColor >> preset.m_colorMapping; } void registerDataStructures() { qRegisterMetaTypeStreamOperators( "FractalType" ); qRegisterMetaTypeStreamOperators( "Position" ); qRegisterMetaTypeStreamOperators( "Gradient" ); qRegisterMetaTypeStreamOperators( "ColorMapping" ); qRegisterMetaTypeStreamOperators( "GeneratorSettings" ); qRegisterMetaTypeStreamOperators( "ViewSettings" ); qRegisterMetaTypeStreamOperators( "Bookmark" ); qRegisterMetaTypeStreamOperators( "Preset" ); } fraqtive-0.4.8.1/src/datastructures.h000066400000000000000000000356571440132223600175350ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef DATASTRUCTURES_H #define DATASTRUCTURES_H #include #include #include #include "generatorcore.h" enum Fractal { MandelbrotFractal, JuliaFractal }; enum ExponentType { IntegralExponent, RealExponent }; class FractalType { public: FractalType(); public: void setFractal( Fractal fractal ) { m_fractal = fractal; } Fractal fractal() const { return m_fractal; } void setParameter( const QPointF& param ) { m_parameter = param; } QPointF parameter() const { return m_fractal == JuliaFractal ? m_parameter : QPointF(); } void setExponentType( ExponentType type ) { m_exponentType = type; } ExponentType exponentType() const { return m_exponentType; } void setIntegralExponent( int exponent ) { m_integralExponent = exponent; } int integralExponent() const { return m_exponentType == IntegralExponent ? m_integralExponent : 0; } void setRealExponent( double exponent ) { m_realExponent = exponent; } double realExponent() const { return m_exponentType == RealExponent ? m_realExponent : 0.0; } void setVariant( GeneratorCore::Variant variant ) { m_variant = variant; } GeneratorCore::Variant variant() const { return m_variant; } public: friend QDataStream& operator <<( QDataStream& stream, const FractalType& type ); friend QDataStream& operator >>( QDataStream& stream, FractalType& type ); friend bool operator ==( const FractalType& lhv, const FractalType& rhv ); friend bool operator !=( const FractalType& lhv, const FractalType& rhv ) { return !( lhv == rhv ); } private: Fractal m_fractal; QPointF m_parameter; ExponentType m_exponentType; int m_integralExponent; double m_realExponent; GeneratorCore::Variant m_variant; }; inline FractalType::FractalType() : m_fractal( MandelbrotFractal ), m_exponentType( IntegralExponent ), m_integralExponent( 0 ), m_realExponent( 0.0 ), m_variant( GeneratorCore::NormalVariant ) { } inline bool operator ==( const FractalType& lhv, const FractalType& rhv ) { return ( lhv.m_fractal == rhv.m_fractal ) && ( lhv.m_fractal != JuliaFractal || ( lhv.m_parameter.x() == rhv.m_parameter.x() && lhv.m_parameter.y() == rhv.m_parameter.y() ) ) // exact compare && ( lhv.m_exponentType == rhv.m_exponentType ) && ( lhv.m_exponentType != IntegralExponent || lhv.m_integralExponent == rhv.m_integralExponent ) && ( lhv.m_exponentType != RealExponent || qFuzzyCompare( lhv.m_realExponent, rhv.m_realExponent ) ) && ( lhv.m_variant == rhv.m_variant ); } Q_DECLARE_METATYPE( FractalType ) class Position { public: Position(); public: void setCenter( const QPointF& center ) { m_center = center; } QPointF center() const { return m_center; } void setZoomFactor( double factor ) { m_zoomFactor = factor; } double zoomFactor() const { return m_zoomFactor; } void setAngle( double angle ) { m_angle = angle; } double angle() const { return m_angle; } public: friend QDataStream& operator <<( QDataStream& stream, const Position& position ); friend QDataStream& operator >>( QDataStream& stream, Position& position ); friend bool operator ==( const Position& lhv, const Position& rhv ); friend bool operator !=( const Position& lhv, const Position& rhv ) { return !( lhv == rhv ); } private: QPointF m_center; double m_zoomFactor; // log10 double m_angle; // degrees }; inline Position::Position() : m_zoomFactor( 0.0 ), m_angle( 0.0 ) { } inline bool operator ==( const Position& lhv, const Position& rhv ) { return ( lhv.m_center.x() == rhv.m_center.x() && lhv.m_center.y() == rhv.m_center.y() ) // exact compare && qFuzzyCompare( lhv.m_zoomFactor, rhv.m_zoomFactor ) && qFuzzyCompare( lhv.m_angle, rhv.m_angle ); } Q_DECLARE_METATYPE( Position ) class Gradient { public: Gradient() { } Gradient( const QPolygonF& red, const QPolygonF& green, const QPolygonF& blue ); public: void setRed( const QPolygonF& red ) { m_red = red; } QPolygonF red() const { return m_red; } void setGreen( const QPolygonF& green ) { m_green = green; } QPolygonF green() const { return m_green; } void setBlue( const QPolygonF& blue ) { m_blue = blue; } QPolygonF blue() const { return m_blue; } bool isEmpty() const; public: friend QDataStream& operator <<( QDataStream& stream, const Gradient& gradient ); friend QDataStream& operator >>( QDataStream& stream, Gradient& gradient ); friend bool operator ==( const Gradient& lhv, const Gradient& rhv ); friend bool operator !=( const Gradient& lhv, const Gradient& rhv ) { return !( lhv == rhv ); } private: QPolygonF m_red; QPolygonF m_green; QPolygonF m_blue; }; inline Gradient::Gradient( const QPolygonF& red, const QPolygonF& green, const QPolygonF& blue ) : m_red( red ), m_green( green ), m_blue( blue ) { } inline bool operator ==( const Gradient& lhv, const Gradient& rhv ) { return ( lhv.m_red == rhv.m_red ) && ( lhv.m_green == rhv.m_green ) && ( lhv.m_blue == rhv.m_blue ); } Q_DECLARE_METATYPE( Gradient ) class ColorMapping { public: ColorMapping(); public: void setMirrored( bool mirrored ) { m_mirrored = mirrored; } bool isMirrored() const { return m_mirrored; } void setReversed( bool reversed ) { m_reversed = reversed; } bool isReversed() const { return m_reversed; } void setScale( double scale ) { m_scale = scale; } double scale() const { return m_scale; } void setOffset( double offset ) { m_offset = offset; } double offset() const { return m_offset; } public: friend QDataStream& operator <<( QDataStream& stream, const ColorMapping& mapping ); friend QDataStream& operator >>( QDataStream& stream, ColorMapping& mapping ); friend bool operator ==( const ColorMapping& lhv, const ColorMapping& rhv ); friend bool operator !=( const ColorMapping& lhv, const ColorMapping& rhv ) { return !( lhv == rhv ); } private: bool m_mirrored; bool m_reversed; double m_scale; double m_offset; }; inline ColorMapping::ColorMapping() : m_mirrored( false ), m_reversed( false ), m_scale( 0.0 ), m_offset( 0.0 ) { } inline bool operator ==( const ColorMapping& lhv, const ColorMapping& rhv ) { return ( lhv.m_mirrored == rhv.m_mirrored ) && ( lhv.m_reversed == rhv.m_reversed ) && qFuzzyCompare( lhv.m_scale, rhv.m_scale ) && qFuzzyCompare( lhv.m_offset, rhv.m_offset ); } Q_DECLARE_METATYPE( ColorMapping ) class GeneratorSettings { public: GeneratorSettings(); public: void setCalculationDepth( double depth ) { m_calculationDepth = depth; } double calculationDepth() const { return m_calculationDepth; } void setDetailThreshold( double threshold ) { m_detailThreshold = threshold; } double detailThreshold() const { return m_detailThreshold; } public: friend QDataStream& operator <<( QDataStream& stream, const GeneratorSettings& settings ); friend QDataStream& operator >>( QDataStream& stream, GeneratorSettings& settings ); friend bool operator ==( const GeneratorSettings& lhv, const GeneratorSettings& rhv ); friend bool operator !=( const GeneratorSettings& lhv, const GeneratorSettings& rhv ) { return !( lhv == rhv ); } private: double m_calculationDepth; double m_detailThreshold; }; inline GeneratorSettings::GeneratorSettings() : m_calculationDepth( 0.0 ), m_detailThreshold( 0.0 ) { } inline bool operator ==( const GeneratorSettings& lhv, const GeneratorSettings& rhv ) { return qFuzzyCompare( lhv.m_calculationDepth, rhv.m_calculationDepth ) && qFuzzyCompare( lhv.m_detailThreshold, rhv.m_detailThreshold ); } Q_DECLARE_METATYPE( GeneratorSettings ) enum AntiAliasing { NoAntiAliasing, LowAntiAliasing, MediumAntiAliasing, HighAntiAliasing }; enum Resolution { LowResolution, MediumResolution, HighResolution, VeryHighResolution }; class ViewSettings { public: ViewSettings(); public: void setAntiAliasing( AntiAliasing antiAliasing ) { m_antiAliasing = antiAliasing; } AntiAliasing antiAliasing() const { return m_antiAliasing; } void setMeshResolution( Resolution resolution ) { m_meshResolution = resolution; } Resolution meshResolution() const { return m_meshResolution; } void setHeightScale( double scale ) { m_heightScale = scale; } double heightScale() const { return m_heightScale; } void setCameraZoom( double Zoom ) { m_cameraZoom = Zoom; } double cameraZoom() const { return m_cameraZoom; } public: friend QDataStream& operator <<( QDataStream& stream, const ViewSettings& settings ); friend QDataStream& operator >>( QDataStream& stream, ViewSettings& settings ); friend bool operator ==( const ViewSettings& lhv, const ViewSettings& rhv ); friend bool operator !=( const ViewSettings& lhv, const ViewSettings& rhv ) { return !( lhv == rhv ); } private: AntiAliasing m_antiAliasing; Resolution m_meshResolution; double m_heightScale; double m_cameraZoom; // degrees }; inline ViewSettings::ViewSettings() : m_antiAliasing( NoAntiAliasing ), m_meshResolution( LowResolution ), m_heightScale( 0.0 ), m_cameraZoom( 0.0 ) { } inline bool operator ==( const ViewSettings& lhv, const ViewSettings& rhv ) { return lhv.m_antiAliasing == rhv.m_antiAliasing && lhv.m_meshResolution == rhv.m_meshResolution && qFuzzyCompare( lhv.m_heightScale, rhv.m_heightScale ) && qFuzzyCompare( lhv.m_cameraZoom, rhv.m_cameraZoom ); } Q_DECLARE_METATYPE( ViewSettings ) class Bookmark { public: Bookmark(); public: void setFractalType( const FractalType& type ) { m_fractalType = type; } FractalType fractalType() const { return m_fractalType; } void setPosition( const Position& position ) { m_position = position; } Position position() const { return m_position; } public: friend QDataStream& operator <<( QDataStream& stream, const Bookmark& bookmark ); friend QDataStream& operator >>( QDataStream& stream, Bookmark& bookmark ); friend bool operator ==( const Bookmark& lhv, const Bookmark& rhv ); friend bool operator !=( const Bookmark& lhv, const Bookmark& rhv ) { return !( lhv == rhv ); } private: FractalType m_fractalType; Position m_position; }; inline Bookmark::Bookmark() { } inline bool operator ==( const Bookmark& lhv, const Bookmark& rhv ) { return ( lhv.m_fractalType == rhv.m_fractalType ) && ( lhv.m_position == rhv.m_position ); } Q_DECLARE_METATYPE( Bookmark ) typedef QMap BookmarkMap; class Preset { public: Preset(); public: void setGradient( const Gradient& gradient ) { m_gradient = gradient; } Gradient gradient() const { return m_gradient; } void setBackgroundColor( const QColor& color ) { m_backgroundColor = color; } QColor backgroundColor() const { return m_backgroundColor; } void setColorMapping( const ColorMapping& mapping ) { m_colorMapping = mapping; } ColorMapping colorMapping() const { return m_colorMapping; } public: friend QDataStream& operator <<( QDataStream& stream, const Preset& preset ); friend QDataStream& operator >>( QDataStream& stream, Preset& preset ); friend bool operator ==( const Preset& lhv, const Preset& rhv ); friend bool operator !=( const Preset& lhv, const Preset& rhv ) { return !( lhv == rhv ); } private: Gradient m_gradient; QColor m_backgroundColor; ColorMapping m_colorMapping; }; inline Preset::Preset() { } inline bool operator ==( const Preset& lhv, const Preset& rhv ) { return ( lhv.m_gradient == rhv.m_gradient ) && ( lhv.m_backgroundColor == rhv.m_backgroundColor ) && ( lhv.m_colorMapping == rhv.m_colorMapping ); } Q_DECLARE_METATYPE( Preset ) typedef QMap PresetMap; class AnimationSettings { public: AnimationSettings(); public: void setScrollingEnabled( bool enabled ) { m_scrollingEnabled = enabled; } bool isScrollingEnabled() const { return m_scrollingEnabled; } void setScrollingSpeed( double speed ) { m_scrollingSpeed = speed; } double scrollingSpeed() const { return m_scrollingSpeed; } void setRotationEnabled( bool enabled ) { m_rotationEnabled = enabled; } bool isRotationEnabled() const { return m_rotationEnabled; } void setRotationSpeed( double speed ) { m_rotationSpeed = speed; } double rotationSpeed() const { return m_rotationSpeed; } public: friend bool operator ==( const AnimationSettings& lhv, const AnimationSettings& rhv ); friend bool operator !=( const AnimationSettings& lhv, const AnimationSettings& rhv ) { return !( lhv == rhv ); } private: bool m_scrollingEnabled; bool m_rotationEnabled; double m_scrollingSpeed; double m_rotationSpeed; }; inline AnimationSettings::AnimationSettings() : m_scrollingEnabled( false ), m_rotationEnabled( false ), m_scrollingSpeed( 0.0 ), m_rotationSpeed( 0.0 ) { } inline bool operator ==( const AnimationSettings& lhv, const AnimationSettings& rhv ) { return lhv.m_scrollingEnabled == rhv.m_scrollingEnabled && lhv.m_rotationEnabled == rhv.m_rotationEnabled && qFuzzyCompare( lhv.m_scrollingSpeed, rhv.m_scrollingSpeed ) && qFuzzyCompare( lhv.m_rotationSpeed, rhv.m_rotationSpeed ); } class AnimationState { public: AnimationState(); public: void setScrolling( double scrolling ) { m_scrolling = scrolling; } double scrolling() const { return m_scrolling; } void setRotation( double rotation ) { m_rotation = rotation; } double rotation() const { return m_rotation; } public: friend bool operator ==( const AnimationState& lhv, const AnimationState& rhv ); friend bool operator !=( const AnimationState& lhv, const AnimationState& rhv ) { return !( lhv == rhv ); } private: double m_scrolling; double m_rotation; }; inline AnimationState::AnimationState() : m_scrolling( 0.0 ), m_rotation( 0.0 ) { } inline bool operator ==( const AnimationState& lhv, const AnimationState& rhv ) { return qFuzzyCompare( lhv.m_scrolling, rhv.m_scrolling ) && qFuzzyCompare( lhv.m_rotation, rhv.m_rotation ); } void registerDataStructures(); #endif fraqtive-0.4.8.1/src/doubleedit.cpp000066400000000000000000000046371440132223600171250ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "doubleedit.h" #include DoubleEdit::DoubleEdit( QWidget* parent ) : QLineEdit( parent ), m_value( 0.0 ), m_minimum( -10.0 ), m_maximum( 10.0 ) { setValidator( new QDoubleValidator( this ) ); connect( this, SIGNAL( textChanged( const QString& ) ), this, SLOT( on_textChanged( const QString& ) ) ); } DoubleEdit::~DoubleEdit() { } void DoubleEdit::setRange( double min, double max ) { m_minimum = min; m_maximum = max; setValue( m_value ); } void DoubleEdit::setValue( double value ) { value = qBound( m_minimum, m_maximum, value ); if ( m_value != value || text().isEmpty() ) { internalSetValue( value ); setText( QString::number( m_value, 'g', 14 ) ); } } void DoubleEdit::focusOutEvent( QFocusEvent* e ) { if ( !isReadOnly() ) { if ( hasAcceptableInput() ) { double value = text().toDouble(); if ( value < m_minimum ) internalSetValue( m_minimum ); else if ( value > m_maximum ) internalSetValue( m_maximum ); } setText( QString::number( m_value, 'g', 14 ) ); } QLineEdit::focusOutEvent( e ); } void DoubleEdit::on_textChanged( const QString& text ) { if ( hasAcceptableInput() ) { double value = text.toDouble(); if ( value >= m_minimum && value <= m_maximum ) internalSetValue( value ); } } void DoubleEdit::internalSetValue( double value ) { if ( m_value != value ) { m_value = value; emit valueChanged( value ); } } fraqtive-0.4.8.1/src/doubleedit.h000066400000000000000000000027461440132223600165710ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef DOUBLEEDIT_H #define DOUBLEEDIT_H #include class DoubleEdit : public QLineEdit { Q_OBJECT public: DoubleEdit( QWidget* parent ); ~DoubleEdit(); public: void setRange( double min, double max ); void setValue( double value ); double value() const { return m_value; } signals: void valueChanged( double value ); protected: // overrides void focusOutEvent( QFocusEvent* e ); private slots: void on_textChanged( const QString& text ); private: void internalSetValue( double value ); private: double m_value; double m_minimum; double m_maximum; }; #endif fraqtive-0.4.8.1/src/doubleslider.cpp000066400000000000000000000027401440132223600174530ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "doubleslider.h" DoubleSlider::DoubleSlider( QWidget* parent ) : QSlider( parent ), m_minimum( 0.0 ), m_maximum( 1.0 ) { } DoubleSlider::~DoubleSlider() { } void DoubleSlider::setScaledRange( double min, double max ) { m_minimum = min; m_maximum = max; } void DoubleSlider::setScaledValue( double value ) { setValue( minimum() + (int)( ( value - m_minimum ) / ( m_maximum - m_minimum ) * ( maximum() - minimum() ) + 0.5 ) ); } double DoubleSlider::scaledValue() const { return m_minimum + ( m_maximum - m_minimum ) * (double)( value() - minimum() ) / (double)( maximum() - minimum() ); } fraqtive-0.4.8.1/src/doubleslider.h000066400000000000000000000023551440132223600171220ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef DOUBLESLIDER_H #define DOUBLESLIDER_H #include class DoubleSlider : public QSlider { Q_OBJECT public: DoubleSlider( QWidget* parent ); ~DoubleSlider(); public: void setScaledRange( double min, double max ); void setScaledValue( double value ); double scaledValue() const; private: double m_minimum; double m_maximum; }; #endif fraqtive-0.4.8.1/src/fractaldata.cpp000066400000000000000000000036761440132223600172550ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fractaldata.h" FractalData::FractalData() : m_buffer( NULL ), m_owner( false ), m_stride( 0 ) { } FractalData::~FractalData() { if ( m_owner ) delete[] m_buffer; } void FractalData::clear() { if ( m_owner ) delete[] m_buffer; m_buffer = NULL; m_owner = false; m_stride = 0; m_size = QSize(); m_validRegions.clear(); } void FractalData::setBuffer( double* buffer, int stride, const QSize& size ) { if ( m_owner ) delete[] m_buffer; m_buffer = buffer; m_owner = false; m_stride = stride; m_size = size; m_validRegions.clear(); } void FractalData::transferBuffer( double* buffer, int stride, const QSize& size ) { if ( m_owner ) delete[] m_buffer; m_buffer = buffer; m_owner = true; m_stride = stride; m_size = size; m_validRegions.clear(); } void FractalData::setValidRegion( const QRect& region ) { m_validRegions.clear(); m_validRegions.append( region ); } void FractalData::setValidRegions( const QList& regions ) { m_validRegions = regions; } fraqtive-0.4.8.1/src/fractaldata.h000066400000000000000000000032211440132223600167040ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRACTALDATA_H #define FRACTALDATA_H #include "datastructures.h" class FractalData { public: FractalData(); ~FractalData(); public: void clear(); void setBuffer( double* buffer, int stride, const QSize& size ); void transferBuffer( double* buffer, int stride, const QSize& size ); bool isEmpty() const { return !m_buffer; } const double* buffer() const { return m_buffer; } int stride() const { return m_stride; } QSize size() const { return m_size; } void setValidRegion( const QRect& region ); void setValidRegions( const QList& regions ); QList validRegions() const { return m_validRegions; } private: double* m_buffer; bool m_owner; int m_stride; QSize m_size; QList m_validRegions; }; #endif fraqtive-0.4.8.1/src/fractalgenerator.cpp000066400000000000000000000257521440132223600203310ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fractalgenerator.h" #include #ifndef M_PI # define M_PI 3.14159265358979323846 #endif #include "fraqtiveapplication.h" #include "fractaldata.h" #include "jobscheduler.h" #include "datafunctions.h" FractalGenerator::FractalGenerator( QObject* parent ) : QObject( parent ), m_preview( false ), m_priority( 0 ), m_receiver( NULL ), m_enabled( false ), m_functor( NULL ), #if defined( HAVE_SSE2 ) m_functorSSE2( NULL ), #endif m_buffer( NULL ), m_activeJobs( 0 ), m_pending( false ), m_update( NoUpdate ), m_previewBuffer( NULL ) { } FractalGenerator::~FractalGenerator() { QMutexLocker locker( &m_mutex ); cancelJobs(); m_enabled = false; while ( m_activeJobs > 0 ) m_allJobsDone.wait( &m_mutex ); delete m_functor; #if defined( HAVE_SSE2 ) delete m_functorSSE2; #endif delete[] m_buffer; delete[] m_previewBuffer; } void FractalGenerator::setPreviewMode( bool preview ) { m_preview = preview; } void FractalGenerator::setPriority( int priority ) { m_priority = priority; } void FractalGenerator::setReceiver( QObject* receiver ) { m_receiver = receiver; } void FractalGenerator::setEnabled( bool enabled ) { QMutexLocker locker( &m_mutex ); if ( enabled != m_enabled ) { m_enabled = enabled; if ( enabled ) handleState(); else cancelJobs(); } } void FractalGenerator::setParameters( const FractalType& type, const Position& position ) { QMutexLocker locker( &m_mutex ); m_pendingType = type; m_pendingPosition = position; m_pending = true; if ( !m_preview ) reset(); handleState(); } void FractalGenerator::setFractalType( const FractalType& type ) { QMutexLocker locker( &m_mutex ); m_pendingType = type; m_pending = true; if ( !m_preview ) reset(); handleState(); } void FractalGenerator::setPosition( const Position& position ) { QMutexLocker locker( &m_mutex ); m_pendingPosition = position; m_pending = true; if ( !m_preview ) reset(); handleState(); } void FractalGenerator::setGeneratorSettings( const GeneratorSettings& settings ) { QMutexLocker locker( &m_mutex ); m_pendingSettings = settings; m_pending = true; if ( !m_preview ) reset(); handleState(); } static const int CellsPerRegion = 8; static const int RegionSize = CellsPerRegion * GeneratorCore::CellSize + 1; static int roundToCellSize( int size ) { // round up to nearest N * CellSize + 1 return ( ( size - 1 + GeneratorCore::CellSize - 1 ) / GeneratorCore::CellSize ) * GeneratorCore::CellSize + 1; } void FractalGenerator::setResolution( const QSize& resolution ) { QMutexLocker locker( &m_mutex ); int fullRegions = resolution.height() / RegionSize; int remainder = resolution.height() - fullRegions * RegionSize; int width = roundToCellSize( resolution.width() ); int height = fullRegions * RegionSize; if ( remainder > 0 ) height += roundToCellSize( remainder ); m_pendingResolution = resolution; m_pendingBufferSize = QSize( width, height ); m_pending = true; reset(); handleState(); } int FractalGenerator::maximumIterations() const { return (int)( pow( 10.0, m_settings.calculationDepth() ) * qMax( 1.0, 1.45 + m_position.zoomFactor() ) ); } FractalGenerator::UpdateStatus FractalGenerator::updateData( FractalData* data ) { QMutexLocker locker( &m_mutex ); UpdateStatus update = m_update; m_update = NoUpdate; switch ( update ) { case InitialUpdate: data->setBuffer( m_buffer, m_bufferSize.width(), m_resolution ); data->setValidRegions( m_validRegions ); break; case PartialUpdate: if ( data->isEmpty() ) return NoUpdate; data->setValidRegions( m_validRegions ); break; case FullUpdate: data->transferBuffer( m_previewBuffer, m_bufferSize.width(), m_resolution ); m_previewBuffer = NULL; data->setValidRegion( QRect( QPoint( 0, 0 ), m_resolution ) ); break; case ClearUpdate: data->clear(); break; default: break; } return update; } int FractalGenerator::priority() const { return m_priority; } void FractalGenerator::executeJob() { QMutexLocker locker( &m_mutex ); if ( m_enabled && m_regions.count() > 0 ) calculateRegion( m_regions.takeFirst() ); finishJob(); handleState(); } void FractalGenerator::calculateRegion( const QRect& region ) { GeneratorCore::Input input; calculateInput( &input, region ); GeneratorCore::Output output; calculateOutput( &output, region ); int maxIterations = maximumIterations(); double threshold = m_settings.detailThreshold(); m_mutex.unlock(); #if defined( HAVE_SSE2 ) if ( m_functorSSE2 ) { GeneratorCore::generatePreviewSSE2( input, output, m_functorSSE2, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetailsSSE2( input, output, m_functorSSE2, maxIterations, threshold ); } else #endif if ( m_functor ) { GeneratorCore::generatePreview( input, output, m_functor, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetails( input, output, m_functor, maxIterations, threshold ); } m_mutex.lock(); appendValidRegion( region ); if ( !m_preview && m_update == NoUpdate ) postUpdate( PartialUpdate ); } void FractalGenerator::reset() { m_update = ClearUpdate; cancelJobs(); } void FractalGenerator::handleState() { if ( m_activeJobs > 0 || !m_enabled || m_pendingResolution.isEmpty() ) return; if ( !m_regions.isEmpty() && !m_pending ) { addJobs(); return; } if ( m_preview && m_buffer && m_regions.isEmpty() && m_resolution == m_pendingResolution ) { delete[] m_previewBuffer; m_previewBuffer = m_buffer; m_buffer = NULL; postUpdate( FullUpdate ); } if ( m_pending ) { if ( m_buffer && m_bufferSize != m_pendingBufferSize ) { delete[] m_buffer; m_buffer = NULL; } m_type = m_pendingType; m_position = m_pendingPosition; m_settings = m_pendingSettings; m_resolution = m_pendingResolution; m_bufferSize = m_pendingBufferSize; m_pending = false; if ( !m_buffer ) m_buffer = new double[ m_bufferSize.width() * m_bufferSize.height() ]; createFunctor(); if ( !m_preview ) postUpdate( InitialUpdate ); m_validRegions.clear(); splitRegions(); addJobs(); } } void FractalGenerator::createFunctor() { delete m_functor; m_functor = NULL; #if defined( HAVE_SSE2 ) delete m_functorSSE2; m_functorSSE2 = DataFunctions::createFunctorSSE2( m_type ); if ( m_functorSSE2 != NULL ) return; #endif m_functor = DataFunctions::createFunctor( m_type ); } void FractalGenerator::splitRegions() { m_regions.clear(); int fullRegions = m_bufferSize.height() / RegionSize; int remainder = m_bufferSize.height() - fullRegions * RegionSize; for ( int i = 0; i < fullRegions; i++ ) { QRect region( 0, i * RegionSize, m_bufferSize.width(), RegionSize ); m_regions.append( region ); } if ( remainder > 0 ) { QRect region( 0, fullRegions * RegionSize, m_bufferSize.width(), remainder ); m_regions.append( region ); } } void FractalGenerator::calculateInput( GeneratorCore::Input* input, const QRect& region ) { double scale = pow( 10.0, -m_position.zoomFactor() ) / (double)m_resolution.height(); double sa = scale * sin( m_position.angle() * M_PI / 180.0 ); double ca = scale * cos( m_position.angle() * M_PI / 180.0 ); double offsetX = (double)region.left() - (double)m_resolution.width() / 2.0 - 0.5; double offsetY = (double)region.top() - (double)m_resolution.height() / 2.0 - 0.5; input->m_sa = sa; input->m_ca = ca; input->m_x = m_position.center().x() + ca * offsetX + sa * offsetY; input->m_y = m_position.center().y() - sa * offsetX + ca * offsetY; } void FractalGenerator::calculateOutput( GeneratorCore::Output* output, const QRect& region ) { output->m_buffer = m_buffer + region.top() * m_bufferSize.width() + region.left(); output->m_stride = m_bufferSize.width(); output->m_width = region.width(); output->m_height = region.height(); } void FractalGenerator::addJobs() { int count = m_regions.count(); if ( count > 0 ) { fraqtive()->jobScheduler()->addJobs( this, count ); m_activeJobs += count; } } void FractalGenerator::cancelJobs() { int count = fraqtive()->jobScheduler()->cancelAllJobs( this ); m_activeJobs -= count; if ( m_activeJobs == 0 ) m_allJobsDone.wakeAll(); } void FractalGenerator::finishJob() { m_activeJobs--; if ( m_activeJobs == 0 ) m_allJobsDone.wakeAll(); } void FractalGenerator::appendValidRegion( const QRect& region ) { QRect clipped = region.intersected( QRect( QPoint( 0, 0 ), m_resolution ) ); if ( clipped.isEmpty() ) return; for ( int i = 0; i < m_validRegions.count(); i++ ) { if ( m_validRegions[ i ].bottom() + 1 == clipped.top() ) { if ( i + 1 < m_validRegions.count() && m_validRegions[ i + 1 ].top() == clipped.bottom() + 1 ) m_validRegions[ i ].setBottom( m_validRegions.takeAt( i + 1 ).bottom() ); else m_validRegions[ i ].setBottom( clipped.bottom() ); return; } if ( m_validRegions[ i ].top() == clipped.bottom() + 1 ) { m_validRegions[ i ].setTop( clipped.top() ); return; } if ( m_validRegions[ i ].top() > clipped.top() ) { m_validRegions.insert( i, clipped ); return; } } m_validRegions.append( clipped ); } void FractalGenerator::postUpdate( UpdateStatus update ) { m_update = update; if ( m_receiver ) QApplication::postEvent( m_receiver, new QEvent( UpdateEvent ) ); } fraqtive-0.4.8.1/src/fractalgenerator.h000066400000000000000000000066231440132223600177720ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRACTALGENERATOR_H #define FRACTALGENERATOR_H #include #include #include #include #include "abstractjobprovider.h" #include "datastructures.h" #include "generatorcore.h" class FractalData; class FractalGenerator : public QObject, public AbstractJobProvider { Q_OBJECT public: enum UpdateStatus { NoUpdate, InitialUpdate, PartialUpdate, FullUpdate, ClearUpdate }; static const QEvent::Type UpdateEvent = static_cast( QEvent::User + 1 ); public: FractalGenerator( QObject* parent ); ~FractalGenerator(); public: void setPreviewMode( bool preview ); void setPriority( int priority ); void setReceiver( QObject* receiver ); void setEnabled( bool enabled ); void setParameters( const FractalType& type, const Position& position ); void setFractalType( const FractalType& type ); void setPosition( const Position& position ); void setGeneratorSettings( const GeneratorSettings& settings ); void setResolution( const QSize& resolution ); QSize resolution() const { return m_resolution; } int maximumIterations() const; UpdateStatus updateData( FractalData* data ); public: // AbstractJobProvider implementation int priority() const; void executeJob(); private: void calculateRegion( const QRect& region ); void reset(); void handleState(); void createFunctor(); void splitRegions(); void calculateInput( GeneratorCore::Input* input, const QRect& region ); void calculateOutput( GeneratorCore::Output* output, const QRect& region ); void addJobs(); void cancelJobs(); void finishJob(); void appendValidRegion( const QRect& region ); void postUpdate( UpdateStatus update ); private: bool m_preview; int m_priority; QObject* m_receiver; QMutex m_mutex; bool m_enabled; FractalType m_type; Position m_position; GeneratorSettings m_settings; QSize m_resolution; QSize m_bufferSize; GeneratorCore::Functor* m_functor; #if defined( HAVE_SSE2 ) GeneratorCore::FunctorSSE2* m_functorSSE2; #endif double* m_buffer; QList m_regions; int m_activeJobs; QWaitCondition m_allJobsDone; bool m_pending; FractalType m_pendingType; Position m_pendingPosition; GeneratorSettings m_pendingSettings; QSize m_pendingResolution; QSize m_pendingBufferSize; UpdateStatus m_update; QList m_validRegions; double* m_previewBuffer; }; #endif fraqtive-0.4.8.1/src/fractalmodel.cpp000066400000000000000000000325471440132223600174430ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fractalmodel.h" #include #include "fractalpresenter.h" #include "datafunctions.h" #include "fraqtiveapplication.h" #include "configurationdata.h" static void initializeDefaultSettings() { static bool initialized = false; if ( !initialized ) { ConfigurationData* config = fraqtive()->configuration(); if ( !config->contains( "Gradient" ) ) config->setValue( "Gradient", QVariant::fromValue( DataFunctions::defaultGradient() ) ); if ( !config->contains( "Background" ) ) config->setValue( "Background", QColor( Qt::black ) ); if ( !config->contains( "ColorMapping" ) ) config->setValue( "ColorMapping", QVariant::fromValue( DataFunctions::defaultColorMapping() ) ); if ( !config->contains( "GeneratorSettings" ) ) config->setValue( "GeneratorSettings", QVariant::fromValue( DataFunctions::defaultGeneratorSettings() ) ); if ( !config->contains( "ViewSettings" ) ) config->setValue( "ViewSettings", QVariant::fromValue( DataFunctions::defaultViewSettings() ) ); initialized = true; } } FractalModel::FractalModel( QObject* parent ) : QObject( parent ), m_previewPresenter( NULL ), m_enabled( false ), m_tracking( false ), m_hovering( false ), m_navigation( false ), m_viewMode( NoViewMode ) { initializeDefaultSettings(); m_presenter = new FractalPresenter( this ); m_presenter->setModel( this ); m_timer = new QTimer( this ); m_timer->setInterval( 50 ); connect( m_timer, SIGNAL( timeout() ), this, SLOT( animate() ) ); } FractalModel::~FractalModel() { } void FractalModel::setPreviewPresenter( FractalPresenter* presenter ) { m_previewPresenter = presenter; } void FractalModel::setEnabled( bool enabled ) { if ( m_enabled != enabled ) { m_enabled = enabled; m_presenter->setEnabled( enabled ); } } void FractalModel::setParameters( const FractalType& type, const Position& position ) { if ( m_fractalType != type || m_position != position ) { storeParameters(); setParametersInternal( type, position ); } } void FractalModel::storeParameters() { if ( m_navigation ) { Navigation navigation = { m_fractalType, m_position }; m_navigationBackward.prepend( navigation ); while ( m_navigationBackward.count() > 100 ) m_navigationBackward.removeLast(); m_navigationForward.clear(); emit navigationChanged(); } } void FractalModel::setParametersInternal( const FractalType& type, const Position& position ) { m_fractalType = type; m_position = position; m_presenter->setParameters( type, position ); emit fractalTypeChanged(); emit positionChanged(); } void FractalModel::setFractalType( const FractalType& type ) { if ( m_fractalType != type ) { storeParameters(); m_fractalType = type; m_presenter->setFractalType( type ); emit fractalTypeChanged(); } } void FractalModel::setPosition( const Position& position ) { if ( m_position != position ) { storeParameters(); m_position = position; m_presenter->setPosition( position ); emit positionChanged(); } } void FractalModel::setDefaultPosition() { setPosition( DataFunctions::defaultPosition( m_fractalType ) ); } bool FractalModel::hasDefaultPosition() const { return m_position == DataFunctions::defaultPosition( m_fractalType ); } void FractalModel::setTrackingPosition( const Position& position ) { if ( !m_tracking || m_trackingPosition != position ) { m_tracking = true; m_trackingPosition = position; emit trackingChanged(); } } void FractalModel::clearTracking() { if ( m_tracking ) { m_tracking = false; emit trackingChanged(); } } void FractalModel::setHoveringParameters( const FractalType& type, const Position& position ) { if ( !m_hovering || m_hoveringFractalType != type || m_hoveringPosition != position ) { m_hovering = true; m_hoveringFractalType = type; m_hoveringPosition = position; if ( m_previewPresenter ) { m_previewPresenter->setParameters( type, position ); m_previewPresenter->setEnabled( true ); } emit hoveringChanged(); } } void FractalModel::clearHovering() { if ( m_hovering ) { m_hovering = false; if ( m_previewPresenter ) m_previewPresenter->setEnabled( false ); emit hoveringChanged(); } } void FractalModel::setNavigationEnabled( bool enable ) { if ( m_navigation != enable ) { m_navigation = enable; m_navigationBackward.clear(); m_navigationForward.clear(); emit navigationChanged(); } } bool FractalModel::canNavigateBackward() const { return m_navigation && !m_navigationBackward.isEmpty(); } bool FractalModel::canNavigateForward() const { return m_navigation && !m_navigationForward.isEmpty(); } void FractalModel::navigateBackward() { Navigation newNavigation = m_navigationBackward.takeFirst(); Navigation navigation = { m_fractalType, m_position }; m_navigationForward.prepend( navigation ); emit navigationChanged(); setParametersInternal( newNavigation.m_type, newNavigation.m_position ); } void FractalModel::navigateForward() { Navigation newNavigation = m_navigationForward.takeFirst(); Navigation navigation = { m_fractalType, m_position }; m_navigationBackward.prepend( navigation ); emit navigationChanged(); setParametersInternal( newNavigation.m_type, newNavigation.m_position ); } void FractalModel::setColorSettings( const Gradient& gradient, const QColor& backround, const ColorMapping& mapping ) { if ( m_gradient != gradient || m_backgroundColor != backround || m_colorMapping != mapping ) { m_gradient = gradient; m_backgroundColor = backround; m_colorMapping = mapping; m_presenter->setColorSettings( gradient, backround, mapping ); if ( m_previewPresenter ) m_previewPresenter->setColorSettings( gradient, backround, mapping ); emit gradientChanged(); emit backgroundColorChanged(); emit colorMappingChanged(); } } void FractalModel::setGradient( const Gradient& gradient ) { if ( m_gradient != gradient ) { m_gradient = gradient; m_presenter->setGradient( gradient ); if ( m_previewPresenter ) m_previewPresenter->setGradient( gradient ); emit gradientChanged(); } } void FractalModel::setBackgroundColor( const QColor& color ) { if ( m_backgroundColor != color ) { m_backgroundColor = color; m_presenter->setBackgroundColor( color ); if ( m_previewPresenter ) m_previewPresenter->setBackgroundColor( color ); emit backgroundColorChanged(); } } void FractalModel::setColorMapping( const ColorMapping& mapping ) { if ( m_colorMapping != mapping ) { m_colorMapping = mapping; m_presenter->setColorMapping( mapping ); if ( m_previewPresenter ) m_previewPresenter->setColorMapping( mapping ); emit colorMappingChanged(); } } void FractalModel::setGeneratorSettings( const GeneratorSettings& settings ) { if ( m_generatorSettings != settings ) { m_generatorSettings = settings; m_presenter->setGeneratorSettings( settings ); if ( m_previewPresenter ) m_previewPresenter->setGeneratorSettings( settings ); emit generatorSettingsChanged(); } } void FractalModel::setViewSettings( const ViewSettings& settings ) { if ( m_viewSettings != settings ) { m_viewSettings = settings; m_presenter->setViewSettings( settings ); if ( m_previewPresenter ) m_previewPresenter->setViewSettings( settings ); emit viewSettingsChanged(); } } bool FractalModel::hasDefaultColorSettings() const { ConfigurationData* config = fraqtive()->configuration(); return config->value( "Gradient" ).value() == m_gradient && config->value( "Background" ).value() == m_backgroundColor && config->value( "ColorMapping" ).value() == m_colorMapping; } void FractalModel::saveDefaultColorSettings() const { ConfigurationData* config = fraqtive()->configuration(); config->setValue( "Gradient", QVariant::fromValue( m_gradient ) ); config->setValue( "Background", QVariant::fromValue( m_backgroundColor ) ); config->setValue( "ColorMapping", QVariant::fromValue( m_colorMapping ) ); } void FractalModel::loadDefaultColorSettings() { ConfigurationData* config = fraqtive()->configuration(); setColorSettings( config->value( "Gradient" ).value(), config->value( "Background" ).value(), config->value( "ColorMapping" ).value() ); } bool FractalModel::hasDefaultGeneratorSettings() const { ConfigurationData* config = fraqtive()->configuration(); return config->value( "GeneratorSettings" ).value() == m_generatorSettings; } void FractalModel::saveDefaultGeneratorSettings() const { ConfigurationData* config = fraqtive()->configuration(); config->setValue( "GeneratorSettings", QVariant::fromValue( m_generatorSettings ) ); } void FractalModel::loadDefaultGeneratorSettings() { ConfigurationData* config = fraqtive()->configuration(); setGeneratorSettings( config->value( "GeneratorSettings" ).value() ); } bool FractalModel::hasDefaultViewSettings() const { ConfigurationData* config = fraqtive()->configuration(); return config->value( "ViewSettings" ).value() == m_viewSettings; } void FractalModel::saveDefaultViewSettings() const { ConfigurationData* config = fraqtive()->configuration(); config->setValue( "ViewSettings", QVariant::fromValue( m_viewSettings ) ); } void FractalModel::loadDefaultViewSettings() { ConfigurationData* config = fraqtive()->configuration(); setViewSettings( config->value( "ViewSettings" ).value() ); } void FractalModel::setViewMode( ViewMode mode ) { if ( m_viewMode != mode ) { m_viewMode = mode; updateTimer(); emit viewModeChanged(); } } void FractalModel::setAnimationSettings( const AnimationSettings& settings ) { if ( m_animationSettings != settings ) { m_animationSettings = settings; updateTimer(); emit animationSettingsChanged(); } } void FractalModel::updateTimer() { AnimationState lastState = m_animationState; // reset state if animation was stopped if ( !m_animationSettings.isScrollingEnabled() ) m_animationState.setScrolling( 0.0 ); if ( !m_animationSettings.isRotationEnabled() ) m_animationState.setRotation( 0.0 ); if ( m_animationState != lastState ) { m_presenter->setAnimationState( m_animationState ); if ( m_previewPresenter ) m_previewPresenter->setAnimationState( m_animationState ); } bool isScrolling = ( m_animationSettings.isScrollingEnabled() && m_animationSettings.scrollingSpeed() != 0.0 ); bool isRotating = ( m_viewMode == MeshViewMode && m_animationSettings.isRotationEnabled() && m_animationSettings.rotationSpeed() != 0.0 ); // only enable timer if either animation is active if ( isScrolling || isRotating ) { if ( !m_timer->isActive() ) { m_time.start(); m_timer->start(); } } else { if ( m_timer->isActive() ) m_timer->stop(); } } static double adjustState( double value ) { while ( value > 1.0 ) value -= 1.0; while ( value < 0.0 ) value += 1.0; return value; } void FractalModel::animate() { int elapsed = m_time.restart(); // ignore large changes caused by time settings changes and wrapping at midnight if ( elapsed > 0 && elapsed < 5000 ) { if ( m_animationSettings.isScrollingEnabled() ) { double scrolling = m_animationState.scrolling() + 0.001 * elapsed * m_animationSettings.scrollingSpeed(); m_animationState.setScrolling( adjustState( scrolling ) ); } if ( m_viewMode == MeshViewMode && m_animationSettings.isRotationEnabled() ) { double rotation = m_animationState.rotation() + 0.001 * elapsed * m_animationSettings.rotationSpeed(); m_animationState.setRotation( adjustState( rotation ) ); } m_presenter->setAnimationState( m_animationState ); if ( m_previewPresenter ) m_previewPresenter->setAnimationState( m_animationState ); } } fraqtive-0.4.8.1/src/fractalmodel.h000066400000000000000000000126041440132223600171000ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRACTALMODEL_H #define FRACTALMODEL_H #include #include #include #include "datastructures.h" class QTimer; class FractalPresenter; enum ViewMode { NoViewMode, ImageViewMode, MeshViewMode }; class FractalModel : public QObject { Q_OBJECT public: FractalModel( QObject* parent ); ~FractalModel(); public: FractalPresenter* presenter() const { return m_presenter; } void setPreviewPresenter( FractalPresenter* presenter ); FractalPresenter* previewPresenter() const { return m_previewPresenter; } void setEnabled( bool enabled ); bool isEnabled() const { return m_enabled; } void setParameters( const FractalType& type, const Position& position ); void setFractalType( const FractalType& type ); FractalType fractalType() const { return m_fractalType; } void setPosition( const Position& position ); Position position() const { return m_position; } void setDefaultPosition(); bool hasDefaultPosition() const; void setTrackingPosition( const Position& position ); void clearTracking(); bool isTracking() const { return m_tracking; } Position trackingPosition() const { return m_trackingPosition; } void setHoveringParameters( const FractalType& type, const Position& position ); void clearHovering(); bool isHovering() const { return m_hovering; } FractalType hoveringFractalType() const { return m_hoveringFractalType; } Position hoveringPosition() const { return m_hoveringPosition; } void setNavigationEnabled( bool enable ); bool isNavigationEnabled() const { return m_navigation; } bool canNavigateBackward() const; bool canNavigateForward() const; void navigateBackward(); void navigateForward(); void setColorSettings( const Gradient& gradient, const QColor& backround, const ColorMapping& mapping ); void setGradient( const Gradient& gradient ); Gradient gradient() const { return m_gradient; } void setBackgroundColor( const QColor& color ); QColor backgroundColor() const { return m_backgroundColor; } void setColorMapping( const ColorMapping& mapping ); ColorMapping colorMapping() const { return m_colorMapping; } bool hasDefaultColorSettings() const; void saveDefaultColorSettings() const; void loadDefaultColorSettings(); void setGeneratorSettings( const GeneratorSettings& settings ); GeneratorSettings generatorSettings() const { return m_generatorSettings; } bool hasDefaultGeneratorSettings() const; void saveDefaultGeneratorSettings() const; void loadDefaultGeneratorSettings(); void setViewSettings( const ViewSettings& settings ); ViewSettings viewSettings() const { return m_viewSettings; } bool hasDefaultViewSettings() const; void saveDefaultViewSettings() const; void loadDefaultViewSettings(); void setViewMode( ViewMode mode ); ViewMode viewMode() const { return m_viewMode; } void setAnimationSettings( const AnimationSettings& settings ); AnimationSettings animationSettings() const { return m_animationSettings; } AnimationState animationState() const { return m_animationState; } signals: void fractalTypeChanged(); void positionChanged(); void trackingChanged(); void hoveringChanged(); void navigationChanged(); void gradientChanged(); void backgroundColorChanged(); void colorMappingChanged(); void generatorSettingsChanged(); void viewSettingsChanged(); void viewModeChanged(); void animationSettingsChanged(); private slots: void animate(); private: void storeParameters(); void setParametersInternal( const FractalType& type, const Position& position ); void updateTimer(); private: struct Navigation { FractalType m_type; Position m_position; }; private: FractalPresenter* m_presenter; FractalPresenter* m_previewPresenter; bool m_enabled; FractalType m_fractalType; Position m_position; bool m_tracking; Position m_trackingPosition; bool m_hovering; FractalType m_hoveringFractalType; Position m_hoveringPosition; bool m_navigation; QList m_navigationBackward; QList m_navigationForward; Gradient m_gradient; QColor m_backgroundColor; ColorMapping m_colorMapping; GeneratorSettings m_generatorSettings; ViewSettings m_viewSettings; ViewMode m_viewMode; AnimationSettings m_animationSettings; AnimationState m_animationState; QTimer* m_timer; QTime m_time; }; #endif fraqtive-0.4.8.1/src/fractalpresenter.cpp000066400000000000000000000241511440132223600203420ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fractalpresenter.h" #include #ifndef M_PI # define M_PI 3.14159265358979323846 #endif #include #include "fractalgenerator.h" #include "fractalmodel.h" #include "fractaldata.h" #include "abstractview.h" FractalPresenter::FractalPresenter( QObject* parent ) : QObject( parent ), m_model( NULL ), m_view( NULL ), m_preview( false ), m_enabled( false ) { m_generator = new FractalGenerator( this ); m_generator->setReceiver( this ); } FractalPresenter::~FractalPresenter() { } void FractalPresenter::setModel( FractalModel* model ) { m_model = model; } void FractalPresenter::setView( AbstractView* view ) { m_view = view; if ( m_model ) { m_view->setColorSettings( m_model->gradient(), m_model->backgroundColor(), m_model->colorMapping() ); m_view->setViewSettings( m_model->viewSettings() ); m_view->setAnimationState( m_model->animationState() ); } } void FractalPresenter::setPreviewMode( bool preview ) { if ( m_preview != preview ) { m_preview = preview; m_generator->setPreviewMode( preview ); } } void FractalPresenter::setPriority( int priority ) { m_generator->setPriority( priority ); } void FractalPresenter::setEnabled( bool enabled ) { if ( m_enabled != enabled ) { m_enabled = enabled; m_generator->setEnabled( enabled ); if ( !enabled ) m_view->clearView(); else m_view->initialUpdate( fractalData() ); } } void FractalPresenter::setParameters( const FractalType& type, const Position& position ) { if ( m_type != type ) { m_type = type; m_position = position; m_generator->setParameters( type, position ); if ( type.fractal() == JuliaFractal ) clearHovering(); } else { setPosition( position ); } } void FractalPresenter::setFractalType( const FractalType& type ) { if ( m_type != type ) { m_type = type; m_generator->setFractalType( type ); if ( type.fractal() == JuliaFractal ) clearHovering(); } } static QTransform preciselyInverted( const QTransform& transform ) { QTransform inverted; switch ( transform.type() ) { case QTransform::TxNone: break; case QTransform::TxTranslate: inverted.translate( -transform.dx(), -transform.dy() ); break; case QTransform::TxScale: inverted.scale( 1.0 / transform.m11(), 1.0 / transform.m22() ); inverted.translate( -transform.dx(), -transform.dy() ); break; default: inverted = transform.inverted(); } return inverted; } static QLineF preciselyMap( const QTransform& transform, const QLineF& line ) { qreal fx1 = line.x1(); qreal fy1 = line.y1(); qreal fx2 = line.x2(); qreal fy2 = line.y2(); qreal x1 = transform.m11() * fx1 + transform.m21() * fy1 + transform.dx(); qreal y1 = transform.m12() * fx1 + transform.m22() * fy1 + transform.dy(); qreal x2 = transform.m11() * fx2 + transform.m21() * fy2 + transform.dx(); qreal y2 = transform.m12() * fx2 + transform.m22() * fy2 + transform.dy(); return QLineF( x1, y1, x2, y2 ); } void FractalPresenter::setPosition( const Position& position ) { if ( m_position != position ) { if ( m_enabled && !m_preview ) { QTransform oldTransform = transformFromPosition( m_position ); QTransform newTransform = transformFromPosition( position ); QTransform difference = preciselyInverted( newTransform * preciselyInverted( oldTransform ) ); m_view->transformView( difference ); } m_position = position; m_generator->setPosition( position ); if ( m_model && m_model->isHovering() && !m_model->isTracking() ) setHoveringPoint( m_hoveringPoint ); } } void FractalPresenter::setColorSettings( const Gradient& gradient, const QColor& background, const ColorMapping& mapping ) { m_view->setColorSettings( gradient, background, mapping ); } void FractalPresenter::setGradient( const Gradient& gradient ) { m_view->setGradient( gradient ); } void FractalPresenter::setBackgroundColor( const QColor& color ) { m_view->setBackgroundColor( color ); } void FractalPresenter::setColorMapping( const ColorMapping& mapping ) { m_view->setColorMapping( mapping ); } void FractalPresenter::setGeneratorSettings( const GeneratorSettings& settings ) { m_generator->setGeneratorSettings( settings ); } void FractalPresenter::setViewSettings( const ViewSettings& settings ) { m_view->setViewSettings( settings ); } void FractalPresenter::setAnimationState( const AnimationState& state ) { m_view->setAnimationState( state ); } const FractalData* FractalPresenter::fractalData() { m_generator->updateData( &m_data ); return &m_data; } int FractalPresenter::maximumIterations() const { return m_generator->maximumIterations(); } void FractalPresenter::setResolution( const QSize& resolution ) { if ( m_resolution != resolution ) { m_resolution = resolution; m_generator->setResolution( resolution ); } } void FractalPresenter::setHoveringPoint( const QPointF& point ) { if ( m_model && m_model->fractalType().fractal() != JuliaFractal ) { m_hoveringPoint = point; m_model->setHoveringParameters( juliaType( point ), juliaPosition() ); } } void FractalPresenter::clearHovering() { if ( m_model ) m_model->clearHovering(); } void FractalPresenter::setTrackingTransform( const QTransform& transform ) { QTransform oldTransform = transformFromPosition( m_position ); QTransform newTransform = preciselyInverted( transform ) * oldTransform; Position position = positionFromTransform( newTransform ); m_model->setTrackingPosition( position ); } void FractalPresenter::clearTracking() { m_model->clearTracking(); } void FractalPresenter::changePosition( const QTransform& transform ) { QTransform oldTransform = transformFromPosition( m_position ); QTransform newTransform = preciselyInverted( transform ) * oldTransform; Position position = positionFromTransform( newTransform ); m_model->setPosition( position ); } void FractalPresenter::switchToJulia( const QPointF& point ) { if ( m_model && m_model->fractalType().fractal() != JuliaFractal ) m_model->setParameters( juliaType( point ), juliaPosition() ); } void FractalPresenter::adjustCameraZoom( double delta ) { ViewSettings settings = m_model->viewSettings(); double zoom = qBound( 10.0, settings.cameraZoom() + 3.5 * delta, 45.0 ); settings.setCameraZoom( zoom ); m_model->setViewSettings( settings ); } void FractalPresenter::navigateBackward() { if ( m_model && m_model->canNavigateBackward() ) m_model->navigateBackward(); } void FractalPresenter::navigateForward() { if ( m_model && m_model->canNavigateForward() ) m_model->navigateForward(); } void FractalPresenter::customEvent( QEvent* e ) { if ( e->type() == FractalGenerator::UpdateEvent && m_enabled ) { FractalGenerator::UpdateStatus status = m_generator->updateData( &m_data ); switch ( status ) { case FractalGenerator::InitialUpdate: m_view->initialUpdate( &m_data ); break; case FractalGenerator::PartialUpdate: m_view->partialUpdate( &m_data ); break; case FractalGenerator::FullUpdate: m_view->fullUpdate( &m_data ); break; default: break; } } } QTransform FractalPresenter::transformFromPosition( const Position& position ) { QPointF center( m_resolution.width() / 2.0, m_resolution.height() / 2.0 ); double scale = pow( 10.0, -position.zoomFactor() ) / m_resolution.height(); QTransform transform; transform.translate( position.center().x(), position.center().y() ); transform.rotate( -position.angle() ); transform.scale( scale, scale ); transform.translate( -center.x(), -center.y() ); return transform; } Position FractalPresenter::positionFromTransform( const QTransform& transform ) { QPointF center( m_resolution.width() / 2.0, m_resolution.height() / 2.0 ); QLineF line( center, QPointF( center.x() + m_resolution.height(), center.y() ) ); QLineF mapped = preciselyMap( transform, line ); Position position; position.setCenter( mapped.p1() ); position.setZoomFactor( -log10( mapped.length() ) ); position.setAngle( -atan2( mapped.dy(), mapped.dx() ) * 180.0 / M_PI ); if ( position.angle() < 0.0 ) position.setAngle( position.angle() + 360.0 ); return position; } FractalType FractalPresenter::juliaType( const QPointF& point ) { QTransform transform = transformFromPosition( m_position ); QPointF mapped = transform.map( point ); FractalType type = m_type; type.setFractal( JuliaFractal ); type.setParameter( mapped ); return type; } Position FractalPresenter::juliaPosition() { double exponent = m_type.exponentType() == IntegralExponent ? m_type.integralExponent() : m_type.realExponent(); double zoom = ( m_position.zoomFactor() + 0.45 ) / exponent - 0.45; Position position; position.setZoomFactor( zoom ); return position; } fraqtive-0.4.8.1/src/fractalpresenter.h000066400000000000000000000060771440132223600200160ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRACTALPRESENTER_H #define FRACTALPRESENTER_H #include #include "datastructures.h" #include "fractaldata.h" class FractalModel; class AbstractView; class FractalGenerator; class FractalData; class FractalPresenter : public QObject { Q_OBJECT public: FractalPresenter( QObject* parent ); ~FractalPresenter(); public: void setModel( FractalModel* model ); void setView( AbstractView* view ); void setPreviewMode( bool preview ); void setPriority( int priority ); void setEnabled( bool enabled ); void setParameters( const FractalType& type, const Position& position ); void setFractalType( const FractalType& type ); void setPosition( const Position& position ); void setColorSettings( const Gradient& gradient, const QColor& background, const ColorMapping& mapping ); void setGradient( const Gradient& gradient ); void setBackgroundColor( const QColor& color ); void setColorMapping( const ColorMapping& mapping ); void setGeneratorSettings( const GeneratorSettings& settings ); void setViewSettings( const ViewSettings& settings ); void setAnimationState( const AnimationState& state ); const FractalData* fractalData(); int maximumIterations() const; void setResolution( const QSize& resolution ); void setHoveringPoint( const QPointF& point ); void clearHovering(); void setTrackingTransform( const QTransform& transform ); void clearTracking(); void changePosition( const QTransform& transform ); void switchToJulia( const QPointF& point ); void adjustCameraZoom( double delta ); void navigateBackward(); void navigateForward(); protected: // overrides void customEvent( QEvent* e ); private: QTransform transformFromPosition( const Position& position ); Position positionFromTransform( const QTransform& transform ); FractalType juliaType( const QPointF& point ); Position juliaPosition(); private: FractalGenerator* m_generator; FractalModel* m_model; AbstractView* m_view; bool m_preview; bool m_enabled; FractalData m_data; FractalType m_type; Position m_position; QSize m_resolution; QPointF m_hoveringPoint; }; #endif fraqtive-0.4.8.1/src/fractaltypedialog.cpp000066400000000000000000000051061440132223600204730ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fractaltypedialog.h" #include "fractalpresenter.h" #include "fractalmodel.h" #include "imageview.h" #include "datafunctions.h" #include "iconloader.h" FractalTypeDialog::FractalTypeDialog( QWidget* parent, const FractalModel* model ) : QDialog( parent ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "edit", 22 ) ); m_ui.promptLabel->setText( tr( "Change the type and variant of the fractal:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); setFixedHeight( sizeHint().height() ); m_presenter = new FractalPresenter( this ); ImageView* view = new ImageView( m_ui.viewContainer, m_presenter ); m_ui.viewContainer->setView( view ); m_presenter->setView( view ); m_presenter->setPriority( 1 ); m_presenter->setParameters( fractalType(), position() ); m_presenter->setColorSettings( model->gradient(), model->backgroundColor(), model->colorMapping() ); m_presenter->setGeneratorSettings( model->generatorSettings() ); m_presenter->setViewSettings( model->viewSettings() ); setFractalType( model->fractalType() ); m_presenter->setEnabled( true ); } FractalTypeDialog::~FractalTypeDialog() { } void FractalTypeDialog::setFractalType( const FractalType& type ) { m_ui.fractalTypeWidget->setFractalType( type ); } FractalType FractalTypeDialog::fractalType() const { return m_ui.fractalTypeWidget->fractalType(); } Position FractalTypeDialog::position() const { return DataFunctions::defaultPosition( fractalType() ); } void FractalTypeDialog::on_fractalTypeWidget_fractalTypeChanged() { m_presenter->setParameters( fractalType(), position() ); } fraqtive-0.4.8.1/src/fractaltypedialog.h000066400000000000000000000026721440132223600201450ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRACTALTYPEDIALOG_H #define FRACTALTYPEDIALOG_H #include #include "ui_fractaltypedialog.h" #include "fractalpresenter.h" class FractalTypeDialog : public QDialog { Q_OBJECT public: FractalTypeDialog( QWidget* parent, const FractalModel* model ); ~FractalTypeDialog(); public: void setFractalType( const FractalType& type ); FractalType fractalType() const; Position position() const; private slots: void on_fractalTypeWidget_fractalTypeChanged(); private: Ui::FractalTypeDialog m_ui; FractalPresenter* m_presenter; }; #endif fraqtive-0.4.8.1/src/fractaltypedialog.ui000066400000000000000000000106331440132223600203270ustar00rootroot00000000000000 FractalTypeDialog 0 0 650 284 Change Fractal Type 0 0 10 true Qt::Horizontal 9 9 Preview 0 0 Qt::Vertical 20 0 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
ViewContainer QWidget
viewcontainer.h
1
FractalTypeWidget QWidget
fractaltypewidget.h
1
buttonBox accepted() FractalTypeDialog accept() 257 290 157 274 buttonBox rejected() FractalTypeDialog reject() 325 290 286 274
fraqtive-0.4.8.1/src/fractaltypewidget.cpp000066400000000000000000000130211440132223600205120ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fractaltypewidget.h" FractalTypeWidget::FractalTypeWidget( QWidget* parent ) : QWidget( parent ), m_loading( false ) { m_ui.setupUi( this ); saveData(); } FractalTypeWidget::~FractalTypeWidget() { } void FractalTypeWidget::setFractalType( const FractalType& type ) { if ( m_type != type ) { m_type = type; loadData(); emit fractalTypeChanged(); } } void FractalTypeWidget::on_radioMandelbrot_clicked() { saveData(); } void FractalTypeWidget::on_radioJulia_clicked() { saveData(); } void FractalTypeWidget::on_editJuliaX_valueChanged() { saveData(); } void FractalTypeWidget::on_editJuliaY_valueChanged() { saveData(); } void FractalTypeWidget::on_radioNormal_clicked() { saveData(); } void FractalTypeWidget::on_radioConjugate_clicked() { saveData(); } void FractalTypeWidget::on_radioAbsolute_clicked() { saveData(); } void FractalTypeWidget::on_radioAbsoluteIm_clicked() { saveData(); } void FractalTypeWidget::on_radioIntegral_clicked() { saveData(); } void FractalTypeWidget::on_radioReal_clicked() { saveData(); } void FractalTypeWidget::on_spinIntegral_valueChanged() { saveData(); } void FractalTypeWidget::on_spinReal_valueChanged() { saveData(); } void FractalTypeWidget::loadData() { m_loading = true; switch ( m_type.fractal() ) { case MandelbrotFractal: m_ui.radioMandelbrot->setChecked( true ); break; case JuliaFractal: m_ui.radioJulia->setChecked( true ); m_ui.editJuliaX->setValue( m_type.parameter().x() ); m_ui.editJuliaY->setValue( m_type.parameter().y() ); break; } switch ( m_type.variant() ) { case GeneratorCore::NormalVariant: m_ui.radioNormal->setChecked( true ); break; case GeneratorCore::ConjugateVariant: m_ui.radioConjugate->setChecked( true ); break; case GeneratorCore::AbsoluteVariant: m_ui.radioAbsolute->setChecked( true ); break; case GeneratorCore::AbsoluteImVariant: m_ui.radioAbsoluteIm->setChecked( true ); break; } switch ( m_type.exponentType() ) { case IntegralExponent: m_ui.radioIntegral->setChecked( true ); m_ui.spinIntegral->setValue( m_type.integralExponent() ); break; case RealExponent: m_ui.radioReal->setChecked( true ); m_ui.spinReal->setValue( m_type.realExponent() ); break; } m_loading = false; } void FractalTypeWidget::saveData() { if ( m_loading ) return; if ( m_ui.radioMandelbrot->isChecked() ) { m_type.setFractal( MandelbrotFractal ); } else if ( m_ui.radioJulia->isChecked() ) { m_type.setFractal( JuliaFractal ); m_type.setParameter( QPointF( m_ui.editJuliaX->value(), m_ui.editJuliaY->value() ) ); } if ( m_ui.radioNormal->isChecked() ) m_type.setVariant( GeneratorCore::NormalVariant ); else if ( m_ui.radioConjugate->isChecked() ) m_type.setVariant( GeneratorCore::ConjugateVariant ); else if ( m_ui.radioAbsolute->isChecked() ) m_type.setVariant( GeneratorCore::AbsoluteVariant ); else if ( m_ui.radioAbsoluteIm->isChecked() ) m_type.setVariant( GeneratorCore::AbsoluteImVariant ); if ( m_ui.radioIntegral->isChecked() ) { m_type.setExponentType( IntegralExponent ); m_type.setIntegralExponent( m_ui.spinIntegral->value() ); } else if ( m_ui.radioReal->isChecked() ) { m_type.setExponentType( RealExponent ); m_type.setRealExponent( m_ui.spinReal->value() ); } QString variable; switch ( m_type.variant() ) { case GeneratorCore::NormalVariant: variable = "Zn"; break; case GeneratorCore::ConjugateVariant: variable = "Zn"; break; case GeneratorCore::AbsoluteVariant: variable = "(|Re(Zn)|+i|Im(Zn)|)"; break; case GeneratorCore::AbsoluteImVariant: variable = "(Re(Zn)+i|Im(Zn)|)"; break; } QString exponent; switch ( m_type.exponentType() ) { case IntegralExponent: exponent = QString::number( m_type.integralExponent() ); break; case RealExponent: exponent = QString::number( m_type.realExponent(), 'g', 4 ); break; } m_ui.valueFormula->setText( QString( "Zn+1 = %1%2 + C" ).arg( variable, exponent ) ); emit fractalTypeChanged(); } fraqtive-0.4.8.1/src/fractaltypewidget.h000066400000000000000000000036021440132223600201630ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRACTALTYPEWIDGET_H #define FRACTALTYPEWIDGET_H #include #include "ui_fractaltypewidget.h" #include "datastructures.h" class FractalTypeWidget : public QWidget { Q_OBJECT public: FractalTypeWidget( QWidget* parent ); ~FractalTypeWidget(); public: void setFractalType( const FractalType& type ); FractalType fractalType() const { return m_type; } signals: void fractalTypeChanged(); private slots: void on_radioMandelbrot_clicked(); void on_radioJulia_clicked(); void on_editJuliaX_valueChanged(); void on_editJuliaY_valueChanged(); void on_radioNormal_clicked(); void on_radioConjugate_clicked(); void on_radioAbsolute_clicked(); void on_radioAbsoluteIm_clicked(); void on_radioIntegral_clicked(); void on_radioReal_clicked(); void on_spinIntegral_valueChanged(); void on_spinReal_valueChanged(); private: void loadData(); void saveData(); private: Ui::FractalTypeWidget m_ui; FractalType m_type; bool m_loading; }; #endif fraqtive-0.4.8.1/src/fractaltypewidget.ui000066400000000000000000000234571440132223600203630ustar00rootroot00000000000000 FractalTypeWidget 0 0 400 250 0 9 Fractal Set Mandelbrot true Julia X: false 0 0 0.5 Qt::Horizontal QSizePolicy::Fixed 10 20 Y: false 0 0 0.5 Qt::Horizontal 0 20 1 0 Variant Normal true Conjugate Absolute Absolute Im. 1 0 Exponent 1 0 Integral true 2 6 1 0 Real false 1.000000000000000 20.000000000000000 0.100000000000000 2.500000000000000 Qt::Vertical 20 0 Qt::Vertical 20 0 Formula: 1 0 Qt::RichText DoubleEdit QLineEdit
doubleedit.h
radioMandelbrot radioJulia editJuliaX editJuliaY radioJulia toggled(bool) editJuliaX setEnabled(bool) 87 69 162 68 radioJulia toggled(bool) editJuliaY setEnabled(bool) 37 67 305 69 radioIntegral toggled(bool) spinIntegral setEnabled(bool) 264 119 358 123 radioReal toggled(bool) spinReal setEnabled(bool) 249 146 354 148
fraqtive-0.4.8.1/src/fraqtive.1000066400000000000000000000015051440132223600161730ustar00rootroot00000000000000.TH "FRAQTIVE" "1" .SH NAME fraqtive \- draws Mandelbrot and Julia fractals .SH DESCRIPTION Fraqtive is a program for drawing Mandelbrot and Julia fractals. It uses a very fast algorithm and generates high quality, smooth images. It is fully interactive, allowing for real\-time mouse navigation and dynamic generation of the Julia fractal preview. OpenGL\-rendered 3D view of the fractals is also supported. .SH OPTIONS Since version 0.4.0 fraqtive does not provide anymore any command line options. You can just start it with \"fraqtive\". .SH AUTHOR This manual page was written by Patrick Matth\[:a]i for fraqtive. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. fraqtive-0.4.8.1/src/fraqtive.desktop000066400000000000000000000002731440132223600175050ustar00rootroot00000000000000[Desktop Entry] Type=Application Name=Fraqtive GenericName=Fractal Generator Comment=Mandelbrot family fractal generator Icon=fraqtive Exec=fraqtive Categories=Qt;Education;Science;Math; fraqtive-0.4.8.1/src/fraqtive.ico000066400000000000000000001641201440132223600166100ustar00rootroot00000000000000hF 00VR(    "!./'7918;3AF>ah\ej[aj_0Y0Z1]1]3`luj3`nvhjvl3a3b4c4c5e5e5f6f6g6g6h7i7i8jc}8k8k9l9ld9m:n:n:o;o;pt>u?u|?v{?w?w@w@x@xAyB{B{C|vC}D}D~EFFFGGGHHIJJK}KMMMNOOPPQQRSRTSTpTUWVWVrWWWZYZ][[\\`beghiolokstqsx{wyz|{|}#)/6:DLUYL?6* %,5:ELYdqWG8!'09BKSalp[H(25*( @     ! % &&+%'%!('++ 2-3.!/.$43)FB,JE7JNFUQ<QQENRJQVG\XB_eUjfPefSokUgm^,X.Zlrb0]1^2_3`4avy^/b6c1e2f|d4h5i6j7k8l|r9m:n;or?s}|@tAu|Av@xwBz={C{>|D|?}E}@~F~GHBICDDEFGHIJKLMNOPQSUUWXZ[[\]^_e`fhcik­kðlīnļopȶqqrxsθu|wx~ڼ''**,0.113578;<;751(*+,.113568;=?HJLRRWWg^]WNNH?<85*+-.12368;==?HJNNNW`hyylf]WRK>;9,..12579;>AKJLPNW^ciq|g`WNJH9-01358;?JNNW^ggilqyz& IÆf\7>HJNSWbhlpquw o^9HLNW^glv$qeKKNW]efrȬ:)|gNNWaflqn wfPWcior~/ Fj|hWeo~Ņ!tfiygi~% }tfWgoy|ȍ#yhL\Wgoqy4dz{fHPZg^iy|«yhAKMW\ghq¢ICug=AJPS]ghy~:ya9=ADLXWagilqq| $mb69=HAJXZ`ggholq|@")d~gW169=>KENWW\gghmy~UmgV2569=?K?KQWWWbaiyyypmcWL,1188<=HKAEJXYaghoyiaWPH>=(*,011581==>HKKGPNWagyyigWQKHAG7(**,.021168;=>AGJKOQZ^`[VOKH?<<1'(**+-.023568;<>ABEJLLLLJEA=;732(0`         ))$.$-,"7.'/*50"87-?:,FA3LB1GF<ZK5LL:SO:VQBYU@ESO`VDWWE\VHUZQf[Ib^H_`NlcIijW-Y0]mscyt^2_3`4a/b}z\wxe0c6czd1e2f}b3g4h5iyof6j7kel8l9m:ni;omr?sz@tAuAvAyBQ>FIFIRRQYWW^W^^W^WWVQJJHDB>4:)***-0/36474:>4BCDDFHIMRRVW^W^^dpppe^\WVVRFHCB>:***-///4477;>9Q?FFHOPRVVY^a^^pk||rkp^aWTQHPCC>**../3477:;?BDFHFIORRYWWbW^^ipx~~^p^WYROFBC*-/36477??B?DHFJQQVTWW^aa^pet|ٻp^^^WWRJQ?-//444:;C9DCOJKRR\WW^^d^^knt~~۴~ppp^^ZRPO/4467:>?CCCJMQTYVWW^^^^pprxxଐ~r^p^WWQK0777;BBCFCOPRVWWW^^b^pppox~$פ|xpp^[ZO444;>9HDHORVVW^Wb^^p^pt|~q2ʴ~|o^pWV:::>BDHHPRVVW^W^h^ppot|~%~rb^W44>?FHJPVVWY^^bp^poxx~͵@DZ~ph\77:OFJRRWW^^p^ppotx~~۲ە2+ <泅te^>BQ9QRVW^^ap^ttx~}w s j|pbBDDORWWWb^hoo~~ך l~peDDPRYW^a^mrx$!riDJRTW^^^iox~ͥͮzիtpPRVV^^hprx~U`Ñ~nRWW^p^prx~v|pVW^e^xx|}E =~oY\hpox~y+cxp^pox~%~o^r~Ɇ(#~pmݰ xop˷~p^~~1ȗ|oWp^x|~ ,!xpV^pept~"GL~oMX_Wpprt}ܞs8u|pQMVaaiipt~տSȑ~oJMPa^^^ppr~ۻ۴ &ӑ~pHHPNWaddept~̞ǪxmCDQNRTW^^pktxAthBFHHQOVZ\bpep~~܀  &l~pe4BDDQNRR[a^^ppott~~|ڈ( Ɠޑ~id:>BDHIHQRYaaabpkpt|~~ךgS %{ӴӫtpZ::>BDCPQOTVW^^p^pp^rx|~5 ҷxme\4;?BCDHOHJPQZ\^abepempx~'~ppWZ3744>BDFFPQQVVZZ^bbapppt~~ fг~tpp^YT/477:?CDFIHOJKVV\W^bp^ppm|~=xppe^[QN//347?4?CDDOIQQRRTZ^^Wp^ppt|~ઑ~~npea\NQO-//34:7??CDFIJOIPRVZ\^abhpit}~ӳ~ppb^WQQOH*..-474?4>?CDHICQHNRNTZ^a^dp^t~Ӫ~mpb^\TPOIF**.0./347:??CCFHOQQHPPYY\abdphx~trp^^VTNKOCB****.00467?4BBBDFDOFQQJNQV^^ahpr|~~ppp^\VQQKIFB>))**-./.444:?4C?BDFHOHQQORVW^^bepiie^WYQQMJHDBB;))****..003744:>>?BDFHFOORQQTTZ\]]ZZTTQQOIFC??;4))))***-.//43677:;>?BCFHIJKMNRRTVVVRRNKJHDB?;773PNG  IHDR\rf IDATxy%G]ssudML .zE+( wqa7׋ \Ye d&df9[w9$o9_jig^UGC a_^'nMmq.jp#]$4MO&z"I?OƦ^P6K4]< ^L>LO)@,'9Z׼2!1e$vulvZαm^Ϝ7xUS+(F0|M'ĘMF=SPpZ7א*rzxT*2Q]!tB JoϷOBRq[I+Qݕ(eB]LOnhS_K $>hNRqa oLf8?{_VCMn*JU5r T]WS5 m޸qM ԍq0 f{+Ӂq"y~߻牆=>'!ذ̏Ns +he ޠv`T{f¶w&~l]"B .͆%)\ q?|>N#|4|ڳ.+# 5m\TJ[K?Kޘ&X@8h lU~+Άa8ZV  !e@ λEa {]{ *DhLߛ1ƒyvc~\[,U lIP>;gg`qSzӿjI*' Ya` XCc c9!5lc 4 |C`=^(ܹ4jqKwO8\P7(~XZ|07w\{8CX,'7Ȧ6oji4&k Z@XvJ`j@ úpӫXO?h?%8p>p8]k 7!gUlUL{UT_ۤ86}lڽt x{m@$0BOA#8glP` Eviṡxu0aW O | 37_k{jk*B(:7pb^&̀1Po{Ax{ ~ul_ Mn5Aކ];? hj*{*7^ ~Wo][ShF Lۍ#+n |J7! p~iQ#{ ߿t/9!`A/@DWʲ_b爼< s-k*: 4 _¥%CcSh@6-&&d+ z)_/SNҬ~~&3ߔiO|""nls/RK 7"IIb%B,Gy22rsUW,Z(@PB ʟ0ڃzzȪkhL !(pc&`A7 @+~^h/$ $5  _^S@Dh%Nj!EQ~ اY~C.*! M XTjHz ( mѝ-ZI+`7,@㚀 ]4b?Z߉Wl(paB=?[(8@z_j0}8*o%ș6ՂbiF%%P& 2*[U@ e9Uި iGf LhXƽ D :KMcBB &W}nw;Z?0Jv rΧnUJŐ$  9r'=$MP! Bts@k(a7h v3aqTg$B]~3lyReZ?>n9{*X q/:elNj#,˟yNJT JYl M2 m,H,%T&3VX#)ʊ^ctO 3Tj?ֲ9`îwA|~Cu@jB#xZpn_uVs1%NwoS@}:u`v (J!`cҫʚ2buIDHFB/ÈL2Y xBe2*Ԫz v62w/4YK!?5!PKo(z i68a N~u;M3Ɓݭ㱵u>_SZ?f5 (2Ž>˷ۙlYV2I9"Pi-\"!nOj0K`T{_?FW:L38f`M/j|S\ = TSm7ZߜTչӚ!$I^W&HCV~*5\JӃ@9@KáB)m  hDra`!{3ڝ:V \u A!06Mq7~P5oBÃ^j~KK h[heJR$j ^ e=̫ x4*/㕨(.JS*'OS(-zEZ9 `(.8h] qڍ&`yĠqw)_$ Erpq |0rsABv|  ^*;@Bg;2rv<>(*j\ɲ砍LJ:rKѥHYtI^`D)-UGz,Եzs.|!Ep?uvutÇL)om |ʹǍ_Y{k/=7 AX9CĨxLl_|@ %(ǓةNW艹[9Y#,ya.S=0V~_0a`p['hh"B+nL zci:]@+%~^CP׆&p~g(~6`AM^C4A5MXY[AOS Id>$G `=E'te+j ie, v(R.u} [wt%zʱ֪S Uc 9ׇۍ}Z߇<fӄ͙ޅށ\5us#,lu+| 5eZYN*G)2#eĿ~.O8"a$̫eZy$d6oC ChFP%ɪ*OA!]{V" aG Btғ^3WM pÄjtqp/80>|?|Pc5 ˪Z`&\@o(юvT;rdQʢYV)AJ!-cM&i4uBOHB]1#@ln pL {M<4X(6_ _3`  y<*q~kaϨZ^ 4JE/ـQ Q2) IJrb5*P6j ʡò4`m!`X+5 ] j!ӁUЏߋ7K04)L#SmDZmg utZ@soWp vmW~"s\0bTbE-r5PD=ICy5݀C,l *G#\] fa!u߄/}>U`j8oyg]* =Z;T q~_{ajxV`΄s7ob˵KЉ_d y%gȣ OP*K@D(L =P)'UMD{ א wطABnòLVt\8]ȫOcTC |ߏgj 5P}]ˇ%̵ֱ>B$EKEI~@*e\KP e,r<0L%{qDͰ@9ZZQ3㲖WJA@i07 zo,:yq*iQ=2 %܏Uk,?ls65V׆`翺v`{ ڀ5_}> k΅s:v@Oeet"8)VI5vq,% Q2F%39dk# yڏ7D{X\8$T̪z7JT\\DQo@\cGX0Ϥ1N(n,dB]_XqyJW-UB6P\UN:}-"D-o߆*{ px=73Nw}ngJ=g[8j[(W6iglf5WhQQj͑&QƟz(ǎ&Wٷ'B%s͹ Z&Q>Inn"HisUƜ2Z/#_X*NLYu.tknih]; VCLG8qN497X{͈p&{$t/Msl=Fwyn5PU"kv(-8jK_XՆV %B];0vfF'!*JHYR!-Z<^"6VWHShry\6!R8@{UрV陁e-[!//QtRoךVy0D(jzK;Srj Dᄎwkp>?OoZk~5ȭcCr3O4;Э0`N_icDBu9T]Ҹzj+"ŊY6PQTΐFmRv,rl($ 9ʹEDKP2B@Ņ!p$:˹_#QZ%U7= EEu`$cUyMFA}nMH(? ] L- BB 燙޺vZ_tk~o$QI6kj%y 96ceh8o, lp#EVm3q5s1Hiv1C:.dG9y:6A,ff A3 @ )z6rxk i@F}Ug?˳}@Q?mw80&m!tݧSB,׵[kJȢ>xo{̷2p?E;7dD{WRbtc]W̻W~ױ|bD;rg}&D*/H2%GEJC"mTe) A?7Q¯]8ZVοg,V4#2. ~?r*!xv5-HuOZ/(l&`ju>>ӺM?#!?Yzn 5q3 ;ٱs sHh$+'oT O{>|Ӯd9"tw TH0"A囌r $DR@zw8=@C IDATwً@ UOC (5Mv!PכfelAo_=mm/&aZ17FC[ |Y_Sߜm!\ @WP#8CQv8ZO~8ZefcOg;7~ՃNJ}ǫʠG< _"cH] wq)L4Մ$"쑄f y.!L v_ ߱&UT8-xÐpᦃ{`5z>u?tMij (>ƀӬ3DZBUbNG)^ư?OIsD5-m~bGy~N;?q>v;}3jh@l=e G nboV&T_*}fA a3`gAPvL8?=ogZ?E .BAk44 W#9u;o~@ g2-E\v/vj ~mS9k+~QYvtKS:lXQXO/@1%X\Ű`@ els6t[_tD87_7j^S  f7ZBܥo=oCvX_Xafvٵt ڌ.Y]0luɣy=K|Wf[o}.,kg?13$I72# 6Q.J/s.ä|~&b@[~T8 ~N\{j3VB??upkOTS >0pv!t!5c , wky'3{Uo<)m*+v*{^a;(h|nRX~]@9 ؆Y] u@E^ksVC.gFCCB)l q7B]8H]? g`~<(.phWcse80~-n."nOåWj+ ~֜,?W&D˄apd{?yf㾓Smfa'[bY :sAYCj!h?a}c035zVO?@5*pv+^{ooosœ߄a=mIj}Kjyf{ ~g5ᶿM|7[ΰܢ;5vQCJ/NO K׹^j@=f3/+q.Vo8~r;fYj:i3'P"/U˶}{YLL8&׳(z(NYR V9ĊՃ*|VrzkUxܾχ>n M7 ?[c ܆=Jii>zY [#gc(4Dj޻Ǿm#k=~~w~ʹZwlNuZ|ɾ_QYJdT@T۪#+nS{Yxe}VX2Q dUV6@Q&glʍ6SǏ@)E Gkۗ' p"  MoM\kqnFTn9暐1BVQ-#Wuy҂2әr~U2 Dy {wyy1Ͼk9MJg>vҦD" 9BfyաJڙǤT1 @:h_|m{mm԰qP* /5 '_LuQ  vۧ2؉Ow߉fo੿}Dj$7)/Hu):qoO-қ ZI%tM]^,Jڐ AE^ͼz4%"4NyR(29| g;ٱg7|<~Gy9PG (XS,EDZ a@lfj̳?V1!$S!X͆r pi!@p_&܅߇ `;S@h tPOtἝ9 Dy6a+sl /zQϓ"FCJ"iw'x v$ѨgjJQ.#X 2BC I$#9O]\@}Qol%߻ZbO6QbD_I8 a4⽦#h7 Srcܳk~ObTg՝C-:"MaEH}aʊ\/5/Bw&otZdۦ C놝0~ _kMg_X V@xݴ"[")lN/X޹eWA3 ?mևmLH$rFHm*Q2!"g|8M0%HK.;Q 'KY|tTĐ!y/gvb(L>b/4!®" &YDׇlFDA1RF Z\*/f..|jx&oR~K04o F}5c8rS*y䓄ݾ7 qx_qjwP3s/^B2#3<dk3au")CF!Qa*Dye yݻ$Txv8OcM.ZcE r&mewg>ڪY7&2Ve ~SoB__xi*,77l_Rcܧ9vtvy;-3qyCkYkw5G&1t:P#ZmV=ܽ}jGh~>g?/`WkH KSqю%oͳ&v6{ŧv\̇{+#G_}=?߹sXݐ\ [uԮpDZ}!!¯lϽ"F1*0ɘ~3ʮN^5b#y9PH - ,-@alzL-;~5/Mo~@; d6`q7K05_ =zEuYC%E:^^>z< s9r7ݚ=Y\}Xc|1f"Kfsܾ_fT|žxU"0biv)#X\EV 5CwiQ`vqdK9p2X\}X8K𮫸}c؃_=1nfvp˱ڮdb*qV B=1*n1j/qr׾ꝼDo 1Co|k 4G*ɳbq{S^4QhJUǵσ[eݗai-A7n5y0-? ܎W |UAg ~[N}Ő\r9R\sQV9|t39z x؊[χckh=ϽV_\靲9~|* 9A. u\Cn_pjm1^8g~M_u3Ӣ@;jAӎt`e;tK]Mwgak8_y=D]FVȺXG:w#kGO0+:AR6SzMzMH|Aġ;?Ǒ?'I:l>x9.[HWs%d9zr,ѾswPqdQι;yInfD6Dl˓gE3 WGAR]8ڱq#&7QO ?L  ]WN xnm Ig[é7 5|cm 38l>"$c@q h"6->_!Y ?B^Kfwf9[!>9Rԭ[w{y}ǿb{k+,t@+OYQ,v(ah汏I+}$[(Zy@Ճavd{'GHbd՚ZۯxŐj(5=Abdz,@Tז7H[11L5 +]+[ =Y-s]4]ˆ,}>q%u^~d4`8'Wy뵯b{ '2XYGe}T^l`ncǸ͛?Nb@r oo{Ɨ>v~Gt6&xw> yr8Q ,xu.7\!@` ToÇrOƹِM]ˇZj6ܫ6}p-N՚uz*)b[j/|)'zkc\?K/Q tJn pԦ2VON>'ofCAs>>k|oO|/PpjS\ wAtݰo,~ ^\8tzl_BoSuu v Mw֖傢2L'n18yӭǏ@N>}CmS^_ӷmv׿['<ci5_聻R9qh|qد ~~leAj}kq\NMk]5x{Yo8ffg6VW9t=`Dlؔ,b- aFN"7V`4@HWS C NT ~a 7B4ny t 5#,h/FV6W1[؄Zj~Eew<Ձ .fE->k2i+ÿrC+zSrg~.Qp|Š=Vnu-S#gŠ=S/9F *j\$tkq-9ăʑ[1L2HֽMg,(Qa7{}\5-@ 4ot=LJ> It2[Xu =й9{ףJʩ:K?+j~!hI )l)ؼcrK'v%v/`60p>+s\-Y pf$XhWOps5PaCvE3F/BRؠcz5i 6|a՛[MW-j=jYdpͽsdi2ڼE9?7c]\b~is~7H]\9N{x$٨UE{6ӂf$fm0Ei/x ujn<ܬ|aϝt/0Nx#Q?n9pgjkuAN͟vٜ9ّs :qBs ]yžy^̱Gv?f)nO{_G\ʾ=g 57qgUnMFL8eF@eMp  &'LUHO~#pOWoE22I3/ֿ "J8W]x5~<rOdbݜh4ԟyn9:,yKdӧ֏p=1;wϰo;[12!"+TlTCWjiŕ3 IDATڕQYE? ,Sܴ ЇA c~ 5],qLd;Ab||I7lk>vxgoǷu:~]  ȇŨ6w#ο<{w35w.'Kwq7E?9vSaVҍd1Z]~…^rJ?CgNjt*O=kEv8K绅ˊH颢-ozJLŻsSy_gY<Yk ۉ   h:mnuiUrZ:2'[؋huPrԇhQ \ޞu$ATqVLg7)gdGYK{طS[r^|}hkVX=]7UeCx {(zb X4TǐŐfdD fY%agownWӸJ;tt0jZShWG<@8e}{  (U[Z@"{͜Er jE'z_ ةi[_MNؐ8L\ z ~ݭldLINKQYԨ21{6˘'8!ku:K ;Ib~Ң-ҨX/,a Q HY$_\{sQI;>{^jn V7)nm˶#q^1W~o^s}0&q3'{V/ }SAaMɆ@gQP͎g^]' <-"M;]ZM'%=zk/m5*ҒQK qZJS!J#0/AI852̉MPqiu3)0q[4Wwc×7+|wpGl{?v>˛ȁ5/~ȳvCm2GpxèUa v`)…aMcG3V\ölQ<[3OާP"bYEmCGj{:*ZN*/?C ,MXV{\ː\1g= >ЖoX>t%^:\|^ˮT|z9[fT?`UCܪÕsP]c}ro `4 c@fiDf1u6䅑- !LLFk(z)V2IDNJ0'\G1B -rTVvsz}Dz @\,Y ۯ㬅9W}+˼MF=Y`:)Dme3u7{]UP~| Xۄ}&@D9|vN/)X"bEl>er|6!Ր$ *jEdT,dQQIE s%f'k%,J.ȉz'ҭrnky0Szq/qN;y}sC65V7_3e [GbXںN AǀoE&OlZ ^I` ιv&S+jXe0#b,>ȈݽRZsxftRx%"2O͸|%crc[<9ٝpn Z8K9{&%QCvfe#@e̸2kJ s,ϓEvC.离?])}p;"K.,Bc,%=kěDLjʏ棑OE␧ O J5@7I+'i SuPOh[@HfPq崲-޶Z4Mt<يw&mX"GdE!r7}vyᑗ]gs:jM52e(g7d>\Z@Z-߰7˘aʛ?:ү; o/Da%o/ӿr.+s5O#{kah,-nl7fǴkv7psgi35@ ; Ew 5,JQ{$,]{8*v.M\rs3QQ]!X^s|c՜O.}/-$ܾgKwDsΞqhk f! ȏ--,"S+k} ko孿e?2x#v u+-zk~/Vx۵`I0]s5&Ϟ\#|<+!_r_-І>!%Xv+"$iX /} GW27hC ݘT$_Y>;9 85ʗ?{=Oy2Pmf;'|֔w.rJxpWbI]T[`i˾ ^JP:B#HG4\@4SW[@*>z_;ރޫ'.WXB* kŬ?N"rCdB?wx=\ϡ/]8k{,߭XY_xuce⼫ae|=ywmf]q#GW לM{aa<(CD1AP/i#@W ,?̙?{XHzoۯN93Q[lHbY10L`: T]PKݚZ!!a GS/,KrYtZUρQ,jWMC/uX=~/_xwIm7ƑA^8gkO+ o΀ *Y7:KRe,CR k=F+A"'%$`3]}D/pɊIVetx%W/.+q_B,GDRNk  鶖hݳΞ6p?܏C"KwQ4~?b\6b̭k9^@pb3te2.P =}n@u^~Inm_<.]Z"h-⢸{d7V2c/*~\sP"8RXCx l-Ş+{}v~> ;l5Gɮ_;7]+e Q@ij_jW+pT:fx[I9^- IPN}53n`r-."uZ">m+v/^&'v=$7N$^t\):$~_i"½\ȩ;ko/o/Q8~!KBh܉*]q B0hP=qTyD0'].B `!VG9*_t)rr2 Iv-LL}u*T6c?@ kf"pbIkmgLq n?7~w0ACNtinGi2wCeڡ@_ XebSxB1dV:$ B~yp>H?# E\ٰyv>G0+eʻ4^ ]՘Hl$IGI~ hls!lAol9xN:^۠ps8U>Z7m .S4(5 y@w 0-yfsq't\?& Rf,xZmȯVy1mb@‰ NlDI C&2(cO|N?.۷S`qa uͯ?З).;8-t!JzDD( #\(Lھ}x6,uw'=<%k*efWqܦ:-=i]$OLI$MWR% 2^mB e  sǵVIk@6#qc-Bj)/lQNN$H<=>i1OpAH<TR>Տqß}Kk-w-6}&idyYaUk{![6nԏ~fO$/ׇ `#Szi$olSv?~.'!1DP Ĕn$Uh!HtЉJE{PG;lPÕJ&WdX _ wvAоk/w "r ?fcc!a\0ϯ?Zn9q+RŞ!2̒p~UlHR$,ZR݂0ivlanT5p ITرlEҩ98SA%?|{P.-pG1y N\Z3S6Ú}DdSυ+n@<9`ZDa8~>D` X~]$C7U§zL/nzROok,/hX|]*ZU~?~"_.f#2Dqn{n;xyR3 IDAT*|h_wv{9\Rj; :᧠6CLI+pdUx#ڗ=UũDągscYvbRy;},tM4kq( X18$jAX&4A 7/Eꖫ݄kpI qȪ+0"I]A쥚,a]>sʧ)?^QU@oq?׋?a4 ГX[Zq#a/h;aouߦV0PEQtTJiӘTo'w J'pKDӴ'&B0,RoGUH)㇑Mz2NʡTs NIHs^Vrj(2=tz!/4fuxt>Hw?2WhdA9G{ Y7;``GfO(ml凬MߘtWSRM4&f[WozS8 k6RU2>ʹ$sc!>VccwK]/ qljn_zpp=f7|z>_'#L͹1X8SFerG&}tH(B8|/DG 8PT)[`BJ!TQ S(3f'KL19Q{!|g٤j#V`YZdvuTqcU ThWcG[/SG ;1 t)([ml>TP )*D7)vS 6!"?6⢉P37[C1W Up|CP:GQBy/{_<,!=&WqS~?b]!+p0QWY<j>eW"UFզῖ3I]Ot:).Zןb;.(̅:ʸo*$CT1NB"G 񃎌cPJ"S 1@1A R2B`p}a$YNYHG{3hn Z9~8'q3zcsB8@ae;ʝl:Ijt q+fRd)rhE,VE-W knڸāHeJ(@s+XN 30OHIQArJ(+4jUܞc^5Gf *+laa=K?GA>4̉'?ЗK pHgn%?`w`+TXz&)D>8tQ;!Ċ?XF#u|Bipؤ$.lD`RH! Rqc? tTh'"T.> viMS@o8LL)M4~a|K f:p}<Ekzy ae!Cc@}wC#.a50\*Fz%4HVH 8KSiҘ %:G} .&,,H(Bu( zT߫HPeGLz׳6ϪZ3UbxVU9Eo'Lc)'pR%:ܶT+C}Ōb`9cUIKd?##wM-WbW&>BP ڬR#0FKJ#@'DAxKcR!'א%8{ء(%61Ք(j΀Zd` kWevL%B 5v4_ٰ]}NZcǿ]{7W2]Z߿x~=/]xZ XD좷s ?oDXN 흌(B Ș _(`B6kG~!:"" cDKDБWe:$%ؔ#8uS:]*K ?ApNK3ն(IWv}~G G+WF\f6CPˀ;$IJs@9%>9B\LXFWI??*RV?e2 #tmdی˼Cm5/9$Fb 5 8%!ܽTG.ZDZ|Ws*xhL5<&MV2;ݤ^?|Aݼ/.\|_'P*&7fB< O\GY[vLa83kvۆ)HX$/tcpKP[-a#ZC}GÎp˩"xЉL6|G`_w~/zoQk0e ;bn#s|kpxe1eJ5\̓>ɭfVO(JaYxp aQs cXl6BJZ$܍@ +66'TL=%_Kd]$?O @m,ZD"m8I5" -Btt#ϸ7B8[ܝ4[䋎߿>x%[pJ5bvn}ZK%v~9x7M/1 pd)LJb].dA~b9>qVk^xF' 0Fexm!4M}10r-Bu)ncVQ67+TBk~J+H38_jϗ cW U8&{MV$ReC\mP<1 SL@QLņ_a,yc9O1&\ !i2b ؗA! gX*!jBp%<@ss׮jݔd_C{i 1x f*S*%ԫeNW௸16Yo%;uնScS!E#ǬdDB g**$VUD܅maa,Jζ:sQk.!asm!; ߉dž9;0qc^Ox+uG?'Oٌ[[ppPck9b͚$f5 }+`~U.uI K2k'ExrfǗu% ,;2X]FKJVB9Cw-%}^m.?,J]E&8"ɖ#*QL粧Π7 Re89+ڪS j3=b );&pP/tT4_—!*\Q>Р!3 q9̮UՒLܒ8.;2, H8=i!lXm #D (< -ɱv(yT˂9zbzS]o ~m?a@H& Sq4ǟOں*w}qd_]! TJ6!xԦ@D>N84ق#9Gy|p iםGlZ AQI:ؔ@N>Ձm{5B*b@ UN?dVF9u7Dؿodͣ2=CsfyKy+_Ϛ3bƍ6._#$]M#C3 V Zh+ys^Ώ) jrdIH81&2B7YtY\@pƙ6 l@qq ȔL:I& 2Q,fM2atHP檵4:LLjtAUV =c*D+SpjK{>{WA ҝq=6<bV;o3{lYx (Uo|2_~kX jdɺ3^NnޱS‘N\X\XA{ zo`A`>ά*," 2+f"`x57d0%F6b6GKcp&7)!?ž%@u9/~/?k-Y\_kb =d-G?U=6M<*Sڔ.R&$Z8Hik/Lq=_1<^J|[{Pgo'RJ6qYU0F bp3 E9@Dg67E{?Q@tm'"ŀ$? a4!uw " 0ȟ9)Nin\s?ūV(ך Z{pJS4lGS|c[˷!>k->^D=6I=*omë gѐmf>X{$G-[jy;} ;yiVWghxᣫ>LT(6gJU Ce: o}:ʙθ2.ۣ31MdEk`uMڣ41%o}/7^vSéAح΁hYhM׷|S7qǗp$F h/p'qzbk#|(MΕ ⃑1I!HZEa`2yw]ph7> J$Kx^ xaRc ٦h!5,_s6N{ +tz];3ZEUDI20NMyvVGx|_n$X3pK[_!L6451la@iNMJo9AJx"`qEdVD- $8MkLU)# '","#&U A8P&r1xnL;[F{)BgPeaq_<9VOE"A Gf2*1՘`9͗E~yж92-O0=VFm?ٶ[!a̘ݷ%u07+ɴ2p Wj:Ͱ$,N2J($I z4+NCDRHpLcȫ{:z&+̕0>Uѱ f{7maWI& ҪɆpUdo;w]~\b^ n7l<+)+A ;ۡQ6%ûA+FPTqr6i6d.Z")<kT ']D4@CPdu^"˫ы2YX^Yf$Ŗm'sg?u֦I :+~*tGz#u']N/Sx8b[mˠL6ldlR"Q?Vm.@r vɏΣ%f4gO BHJi;IEDm<ΰ;XDrئ޺ 1O/;!B&@/Ŷ|vZ~cD4K&Id(%0ab”<.۞,O} !J2uL Wm^FcIQ "QT,:ظns6REN&_Q h1|/9{>#ky,!u/6FiLRc)u?.@sҦhcR4ga0, "L .eIE+K-b)åI00+}T Jx2 u LMcˉMdq7/ik/ 7 kgyS;wԐ3,sS9bmfyo_H4'˭Uldtq#8D~־dK#qc˴:w3~LXӳ su_YV_؊ATrRmQQ@ԝIri৫2e*@Y)..'+BHOZ=TZO"A(jrS,Oc9ǃ󽫮D+Éy$/|Dǔy:SO^IEJjZAM]J;׆ H shA8y見{O2DY@"9G\"}Bz!B,c:vPiru;CT/578QI 2H"dsN\qsJBhdaϠRr) 6q6X *qu얼= ֮g=\̇s\Ʃ[klһTKL DY~궕"/Ǭ 9n V꘥ WwgJA['dAXV Zas@ 4( TX)P& Af!|݋ N%ZdV ;r3A]D;ƣOYȮss:1&L\k瞶dp IDATș@( k=ރS*K>jnQl s: @F} 9Nb?@ ΃iއ.,+m}@<"`[I]t&% yy20^/0J2rqDșw PĹe)QPf ZҼ&2( RAe|Qɟ, 'H+#LLx]4 %#N{;|C]d?LJqCɫ>iW*C銟)$`k4Rl|i-2""<9Hl,KD!}L,i6?/ø1#1ΓpF  521n}S,d# k$cV?flԈ¯wB&r% NqHslp';nBkL6hL5M?G >o"DAl̹+)i:4-aY #5hJgɪm!hF>E]S!ˋ x sh#l!LLaQZ9( .:~/`q: y [m?`o?0wC,d~ "Hh%6rw7[vR:WD B?a#ά4*8MwnRDJp|*Kޓ-Xbe Hy҈@#A2.a ,@(iO(F$ELe9G\bIv\ %P~ʼn6jD+j'?Oj'cƊ!wߐby_؄@,4qaɐJb"]ʓ=,T_yl "D Fc1+}JX [HW|(*S)$ZF Yݻ~[uix=#~7L*Q]o_3y#t)36SjJR}Z 2YLY-Lr&s]436\lIb 挛;93d@mMn=doj%M֘?'yE^G1H?t%^1FHi{hE%ŭլo*^Z)BGrYg> yK0J+$;.?|ߤ,VR$+؜,kRf|A\mZ`%M_Ugl8`.Av3!CT{Xb?&ms>?;?c=FLx rDbE D#qgcHFC\5>ZiVWz(&y5D8j}<∣ٺa ^'zjF8MP_kD !ߒLۦDN a_Ũ!lݎX[)ŏR\f1mm?&XbLIڔ;E6Ghk&;)AȐ<+P 9>}֢aLEZ$5H I/)%T]O}g,rg4;>d-x7{oJE,;W]nsq*H-a5ms"c"p{OΓ )aَK"$ H~'~ ղAE`NGD$>f<^V=Aj e2啗3ڲ!ksܚErR\$n0#"pJƞK#k<*EF4 EMKA``ͼsefZA5;Y\>^הΜej&q[ōA&ffx)[D [߱Vgp^y!yJtqctrǐ/3Gd'U7~@1Of,jc3+y9yW} #◶tbeׁ]8U|.kB0ʵ|{xys\ލz0$2TbUsxʅlXgY#d]G@Uo2UƑU`Gs&Cj쑉3L#: M(5,F!63 gCd "/Dm_~Fexace-v~[njiŘsĸK-^߿u`?wK %pD04au-trn^a tx⣷[ase?vp k3y;o=mq .B*[g8'1i{o zcx£ݷ'! xhİӣ; _&( 5k()QCHXuc>*4yBҭWy֛JFN\1!B:<*\yuS9nC]#B@ӬHtJե6uAC@?N!3kGG=g A`X!$)gpD<,m; 5H?0ľ7D '; RHp  3-@)Z:Lsθ,Z + T \>3IMo^Aܳ?< fvj /젅=?pT貫*6ɯ~']JPw+zQ)ϰ'Qci J33} / 64 UŤ|=@jgաT?c U:`B-EG=Pa/0`+'1-ZB~n.v &6`T?!!p~mx+ˌ4LGgǏQ1-7U%5tU/ߞkѫj9ڊ@3qQTD/nţ8|si:=32W1-8aÐgRtH| 72T.iGMθ౜,\{4|L}.1=QSwQ Zq%'KDq` H+՗Yk2(O?|p4'GSvb8@0fCF@ʟ/I' Y ؎>}+icZwX^rwă|mwQ/`!=.FR?9flWTlАV@@(/nFgjċ.d=PIB"o$USw&D >/7񌋶*jso^ rإ*La7|8*3Ly!w. )zW=CEgmqyxԓs}s<ys[:WNog67^w_㷌 kdi6\d6~O_O8g Z%hE?SK??[xƤ9`w4>ľغ桜POv\J-H-B~hz{Y?Y'Tta+6K?Ys؟ot}y-uׯ~{{`G^$$x(B'",rbBȒ? bEb d Q@XX [C ;f<3}}:o=r{ow]U_s*_QH2l. o0,qS >J JG!uMCryյfdOFʅc´_S5 ؿv*K[Cu[ؚ5On4-ܿ0|yxaueQ̪^s!mWx)COй68~#?O?E4 ޿Kw*>r^Ǝ[`k u¥ >[s\|kk\ؠj8.F{Ofةܜ[g7Qބ;98< 53E,;śOyKc C=ޮ 胡PCo"7}K8B&) $ I `0((u˸r22 zn޽@Up=> WqxW^­h]Uᏽ2B/p6Xmgvmu[8Zu~_ptVcw/} T/> :>FXΖ Հ#oH@W@$H p:`g$2r01'~"X!ք AH}ҡԣJZ$֘vPCs؞@4:+6iBdӉN*,B( 0\\ |]'dNڄKNT)2UyQ)v~Z`s5níhgóAPUζp OP!`<8.s,,LRe} a:[vgmO~G6_/p|g>Qf2Δ ¡Zx ׮д'*ެO}OnPAy E8g"_8RGtkN+5 t0Vő|۸Cwe^p-6nE`G`RM@8Nn4KЪuvSP4`GBr6`IX1F`4Ajzs xep@&$k4 c#pK?@lVv 6NFkyw`q,lJABتʏU'gs'tzr%ⳟ16Yo[w߃ZA 3) IDAT6n%G&{\XSu:ߟ+ sh`y$uҁ2#," @T0b?b" h)a40P~7"ܩڐ(̢S`A"pEh0{*O4P1!pyܪdgIj/6&WVT/{wɇ%~^_¼;C*TŸ'|;@ՉI y?{0E?JHZR~ К r?) H)"7u@Tx-v" 8uVa QQx xC\M2W#7F%;"  +s| O~_}waEܪVC߶z1Q?n[ry\]k A%_kFiyEHJ܀Εԙo$vi0 OƋy?aCC.+g3 p7µ2u֥{FǣȘ}sK> ) aMBxirx~< ڣos;u$4ɟK8{ܻqasw"0|XeuPcOĢ t=cՖ@|n⯺#xғ?f) :n|3)I(dqx3$թ/e?+TNJ `*9N7%8qtxQexG)X8OV\:B֮wqKW4yߨ.m?/ͯ.܏? \6o›{ptxP{`T^(NKDgԧHTס_V7d |ގYzF =9=zC0iG{yKiri10v0A]~E` ZҀr>u]+Ri |N|:zY} Nllߦ%[^7_:ij@ M>mr2zJ2Zp׫(jIwĸ7 S 1 բ!$7b C.L 6;A0u+PtL_De#iʩ6WHfc~2f@ݠܚo;./prxhW#<¿y/W~ V g,)S~&NUKڅ{C 㫾%З< 'nGrɞw"R`g41ACzaQ(.2,pskI }K 㔀ė+[w;B|'9{@sp!Qa>pU%Wj@Xƒf1o{vw◿)|T}_:xo·8.`:qZ-|xJ|jQT :&L'}"ג\8QSiS"`x0ƩtKS@W$a~i+4eJVcD9$P53(?+x?.u1z<{PW}"t?] |,S)@JjQH gۂI@:_H'( Բ] J0I@/./$`.D\r$W$R0:v4o&ߧj @:c;V LUr[XT5cnG'O~_xC;x탗p§w;|ezخo|^/.^Vw MsK/&.f$0Gߩ>!%Aw[) ^C%$}'7/ 輆!f_/1 IJ g,uF%PDPV}psʉc9,q!R?dنR=-; tkp_r^N;v;w>D[퀚]uC# -8]ptݸ.Wzq+Դ+; 84K!a u2ȯW?2"!_lԿ}BVFs? A( @Zk-- '$,sX' ,bŒ@G~i/ǓR:j|H)O뀪sUT'@h;iNp&~^@7Ip-{_wbz4;h-@߮gp,(x{ s 4^q8ZBug:vt}i7)W4rB2|LLShgsROʫ] 1p'2C6 l;%D7SEm\N= 84p.k[M| Mw|G{ Vwfqfu7Y-V T3n1;.?ˉXRؔz `5 }$c%iL!BZ[ i|39p@O*gԍSٍSBd S~e"J]ʭJWz5G=Wpg5N+ìZ\o|+wGUn'Npo'U _/ X.@Kهj@o0%t "aD*AE,";buNQd5SUpIm t@UA`}@#է?*0Gܒ}`BijAqN-}sqټ  W"9 %}uĒ@ n@&w- 8{Wgw z|>Tn fK%oŝxwU،C^zG Gu1"K|$ -DR(1)M ϛ$ZB3o-Pa#y7 7!1unbD@}/|ǖk_-c>s=-or]|W.//EU EE}J(::K}?7@;$`5$H@P42N_@N@@$v $bgS@ ?6G0rQOI} Kd}ap6!= ^>xڝr=h =gدUN*C/MqϧG?kX":)~d/ e$_Ɏ@H8$:4;4a 2Y4 1i3ti+os q~1~„ F | Epe;^/!P]$0mHAV@5jN+N.~ Պ@_efCkWQ^AtGq"($?# ~٭#P iؔ07F?ˆ]@E44iilR |w(Hh]q)A"d LLGbrWN t!O V~sHz2p]\9/@_i9PXiO"TuEE@݄MI>Gt6 KGKR@x/!%s0Nq "4bҡFȍ2.`*?|ؓ'S˜ќd0!%('ëlΖu:2i\zgbClc5~?Q Q@].05xP嗂 vl%}_~AIA~{wU_4X0Ӏ$by Ԣ$ #~$GiB^$Ioh . zt OX6P2|83)@Y\ 4' DbrS͸+ uDJ7E̻]Ǟ3òbjP5f8 9Q( @WOvQV A$Ӏ$ ATCmR$+ldatM&a:Rψg@u0F$DP ! WNҦdU85Xԙr}A(ѓ)\D!mW[Xb #\j_V{P AL:+MPڂ*X(Y-䢥l/Z nEb BO0~40 $`Q$ӹ yC@̕1Lz1CCҀVAQY@P09fb":D{5XOSL "^M)Kl a\Ŋ*U d"N X}ہz?|k_&˙Wז, 2LL>@H$ `Lla*=X6 V3kɨo-)2 iK84U@OUNY)Y@{hqeٓm f1f#``PT+oX}`qZ=H_pDM? n&| kHM%T$ =_lZ*C+CEi :i +8$YЈ\>Q,e]M ̚II`7l.$rjP/8J@9w @S?I~7.YS S}x߿mjsS$$P|j+H_" 1(7ZRHR -k$=h j( (}MJ\q#FB$dLH"*- 7O !J0 S:0{PJ@ڇNAz?p_ػ:נ#_?<#|n' ]~DZerهhٿC(KAr ' ,+$~Fg;B qV##Ҁ ݑKƌNׅKK dC!W! lFi? 1[.UaM?KfF! (*vt^٩w ۋ]uU {-S;/=GˆJ341BI;{x8mұY<?$i >GHL-qlM `$LBv 4rCЀ0>'(Գá0Q/Uze;PUQeܿӿ\VD̃z'rO~342Lw~$ 0)7 B]Or1N^*LJ$ pE)i@ r+D)POK kH̿t.L20Ep~_ ½TԹsmP]ۺp'Gp ~ՕNn0td uxp?< ۂoJ u7FL J= Kbc`D-<܄]'u 8`$r}uPȳH\?Um9@l㬹 zYW+sR!#LI@4nHTsp8?wۂ%]0NG,?{(qkJ(tvˆ4!n 9:8p."p!Q"0L3!D5?̀S& (%"l-P1\ʦLkȂnAY:G v];NNNQuoG:-KR@~zΤԀ/ց\ IOH-rέpi `|P-ϔ[|a**81":LGg RCa"֗Ԃ+9CQTr OIJrIS2f$;V pgFjA۝ ? \"$jz] W3p20( -@jx_Oѩ߽e0őF~5} ^K6N p%cDUJSO^Dw(N"hH 08JztiGHѨZ)DGN!rHA3aKskgiWU 숼PUq7e| F">4+갡mK#4/n_>k  EpARr.SgI2L|fq <@FBVC2 !0S"(MrFg7,ѻr* -]60)@!$ [54p0>OAl$u#p`GhiTym\y1_.DPHBpA;~0b$QKCro_&rA KGAnn5`' ~>7R@hp}s.l⯥a䓀nqC̀5T&*3 ~XOtn;?|J|- )\S$]$!!rsob%H:> $AZ\CHz=qu ui*#i#N$%DağKPF{J͂FمхN_nz!𓴊~ONߟ44V]$J@ J~8XJSTMf ^E" 2I%:!1;&!i;H\OX}^%Pu ~S4 m("$ @. z LmH(LdnL tc޹@`reл$i`kJ#L#@t07&jX~)ld9YVrKӒjmRZ#&0 Ui*, @B4rTP6'$" ]Cܪ]],xN ҰL RAxVse ρ3þFhO*$^Ĺk>J}` JO2U߷9a- P3JiNQ @(`$,A7y &LSʜ +_OY%(I Pn@^_>b]I/Gp9e ?#$. ``9 &iҀ'G;Ҁ4@pAQLĺzT o*POb|L4ROf Jn({u:Cd(Ƶϝ*wqOPvd'd$`mD!]ki܇ `d0k)ϩ$ (Ad*BVҀp|,'4:i`3ku~BHP$'Kg(H  1l4`BR !t03Yэ3'gǹ·+2(\ \#bXx! /'Ā)Ibc%6; @5]9֩7@!Έ4 IDFpY\!BD`HȈ>;$ M%G5lj }2nܓGAzD=ǀ46|3k˗ p^* ۨJUi DZ e<SŕM=`(.!XTTFcdHz?&@)1L~wXnxSG`ɀ/@@]NHwn)TNX hH\v)_. 0;>4&I3 _"#Cu#AՃ - #dz 0 D1L"89SX C閉$}!FDJZʼnT N%ZH7!-Jn@Ed$ŀ<2.z jR4 $ m#ogH0ƸBV( _v-@) )y~2>":C(>/l֐G)xr) $j3Hy(tD@*~T |)t;Ϩzn2@^E@7 M` yN_b͇E )h)aIbjW%  r?;^ ;IENDB`fraqtive-0.4.8.1/src/fraqtive.rc000066400000000000000000000032321440132223600164360ustar00rootroot00000000000000#include <winver.h> IDI_ICON1 ICON DISCARDABLE "fraqtive.ico" VS_VERSION_INFO VERSIONINFO FILEVERSION 0,4,8,5508 PRODUCTVERSION 0,4,8,5508 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "MichaB MciDski" VALUE "FileDescription", "Mandelbrot family fractal generator" VALUE "FileVersion", "0.4.8" VALUE "LegalCopyright", "Copyright (C) 2004-2015 MichaB MciDski" VALUE "OriginalFilename", "fraqtive.exe" VALUE "ProductName", "Fraqtive" VALUE "ProductVersion", "0.4.8" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END fraqtive-0.4.8.1/src/fraqtive_pch.h000066400000000000000000000017551440132223600171230ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRAQTIVE_PCH_H #define FRAQTIVE_PCH_H #include #include #include #include #endif fraqtive-0.4.8.1/src/fraqtiveapplication.cpp000066400000000000000000000147651440132223600210550ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fraqtiveapplication.h" #include #include #include #include #include #if defined( Q_OS_WIN ) #include #endif #include "jobscheduler.h" #include "configurationdata.h" #include "fraqtivemainwindow.h" #include "datastructures.h" #include "aboutbox.h" #include "guidedialog.h" #include "iconloader.h" #if defined( Q_OS_WIN ) #include "xmlui/windowsstyle.h" #elif defined( Q_OS_MAC ) #include "xmlui/macstyle.h" #endif FraqtiveApplication::FraqtiveApplication( int& argc, char** argv ) : QApplication( argc, argv ) { #if defined( Q_OS_WIN ) && !defined( XMLUI_NO_STYLE_WINDOWS ) setStyle( new XmlUi::WindowsStyle() ); #elif defined( Q_OS_MAC ) && !defined( XMLUI_NO_STYLE_MAC ) setStyle( new XmlUi::MacStyle() ); #endif setWindowIcon( IconLoader::icon( "fraqtive" ) ); registerDataStructures(); m_jobScheduler = new JobScheduler(); m_configuration = new ConfigurationData(); m_configuration->readConfiguration(); m_mainWindow = new FraqtiveMainWindow(); m_mainWindow->show(); if ( m_configuration->value( "LastVersion" ).toString() != version() ) { m_configuration->setValue( "LastVersion", version() ); QTimer::singleShot( 100, this, SLOT( about() ) ); } } FraqtiveApplication::~FraqtiveApplication() { delete m_mainWindow; m_mainWindow = NULL; delete m_jobScheduler; m_jobScheduler = NULL; m_configuration->writeConfiguration(); delete m_configuration; m_configuration = NULL; } QString FraqtiveApplication::version() const { return "0.4.8"; } #if defined( Q_OS_WIN ) #if defined( Q_CC_GNU ) #define __ImageBase _image_base__ #endif extern "C" IMAGE_DOS_HEADER __ImageBase; #endif QString FraqtiveApplication::technicalInformation() { #if defined( Q_OS_WIN ) #if defined( Q_OS_WIN64 ) QString configBits = "64"; #else QString configBits = "32"; #endif #endif #if defined ( QT_DEBUG ) QString configMode = "debug"; #else QString configMode = "release"; #endif #if defined( QT_SHARED ) QString configLink = "dynamic"; #else QString configLink = "static"; #endif QString qtVersion = qVersion(); QString infoMessage; infoMessage += "

" + tr( "Technical Information" ) + "

"; infoMessage += "

"; #if defined( Q_OS_WIN ) const IMAGE_NT_HEADERS* header = (const IMAGE_NT_HEADERS*)( (char*)&__ImageBase + __ImageBase.e_lfanew ); QDateTime compiled = QDateTime::fromTime_t( header->FileHeader.TimeDateStamp ); infoMessage += tr( "Built on %1 in %2-bit %3 mode." ).arg( compiled.toString( "yyyy-MM-dd HH:mm" ), configBits, configMode ) + " "; #else infoMessage += tr( "Built in %1 mode." ).arg( configMode ) + " "; #endif infoMessage += tr( "Using Qt %1 (%2 linking)." ).arg( qtVersion, configLink ) + "

"; return infoMessage; } void FraqtiveApplication::about() { if ( !m_aboutBox ) { QString message; message += "

" + tr( "Fraqtive %1" ).arg( version() ) + "

"; message += "

" + tr( "Mandelbrot family fractal generator." ) + "

"; message += "

" + tr( "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." ) + "

"; message += "

" + trUtf8( "Copyright © 2004-2015 Michał Męciński" ) + "

"; QString link = "fraqtive.mimec.org"; QString helpMessage; helpMessage += "

" + tr( "Help" ) + "

"; helpMessage += "

" + tr( "Open the Fraqtive Quick Guide for help." ) + "

"; QString webMessage; webMessage += "

" + tr( "Website" ) + "

"; webMessage += "

" + tr( "Visit %1 for more information about Fraqtive." ).arg( link ) + "

"; QString donateMessage; donateMessage += "

" + tr( "Donations" ) + "

"; donateMessage += "

" + tr( "If you like this program, your donation will help me dedicate more time for it, support it and implement new features." ) + "

"; QString infoMessage = technicalInformation(); m_aboutBox = new AboutBox( tr( "About Fraqtive" ), message, m_mainWindow ); AboutBoxSection* helpSection = m_aboutBox->addSection( IconLoader::pixmap( "help" ), helpMessage ); QPushButton* helpButton = helpSection->addButton( tr( "&Quick Guide" ) ); connect( helpButton, SIGNAL( clicked() ), this, SLOT( showQuickGuide() ) ); m_aboutBox->addSection( IconLoader::pixmap( "web" ), webMessage ); AboutBoxSection* donateSection = m_aboutBox->addSection( IconLoader::pixmap( "donate" ), donateMessage ); QPushButton* donateButton = donateSection->addButton( tr( "&Donate" ) ); connect( donateButton, SIGNAL( clicked() ), this, SLOT( openDonations() ) ); m_aboutBox->addSection( IconLoader::pixmap( "info" ), infoMessage ); } m_aboutBox->show(); m_aboutBox->activateWindow(); } void FraqtiveApplication::showQuickGuide() { m_aboutBox->close(); if ( !m_guideDialog ) { m_guideDialog = new GuideDialog( m_mainWindow ); m_guideDialog->resize( m_mainWindow->width() / 2, m_mainWindow->height() - 100 ); m_guideDialog->move( m_mainWindow->pos().x() + m_mainWindow->width() / 2 - 50, m_mainWindow->pos().y() + 50 ); } m_guideDialog->show(); m_guideDialog->activateWindow(); } void FraqtiveApplication::openDonations() { QDesktopServices::openUrl( QUrl( "http://fraqtive.mimec.org/donations" ) ); } fraqtive-0.4.8.1/src/fraqtiveapplication.h000066400000000000000000000035041440132223600205070ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRAQTIVEAPPLICATION_H #define FRAQTIVEAPPLICATION_H #include #include class JobScheduler; class ConfigurationData; class FraqtiveMainWindow; class AboutBox; class GuideDialog; class FraqtiveApplication : public QApplication { Q_OBJECT public: FraqtiveApplication( int& argc, char** argv ); ~FraqtiveApplication(); public: JobScheduler* jobScheduler() const { return m_jobScheduler; } ConfigurationData* configuration() const { return m_configuration; } public slots: void about(); void showQuickGuide(); void openDonations(); private: QString version() const; QString technicalInformation(); private: JobScheduler* m_jobScheduler; ConfigurationData* m_configuration; FraqtiveMainWindow* m_mainWindow; QPointer m_aboutBox; QPointer m_guideDialog; }; inline FraqtiveApplication* fraqtive() { return static_cast( qApp ); } #endif fraqtive-0.4.8.1/src/fraqtivemainwindow.cpp000066400000000000000000000565611440132223600207260ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fraqtivemainwindow.h" #include #include #include #include #include #include #include #include #include "datastructures.h" #include "fractalmodel.h" #include "fractalpresenter.h" #include "fractaltypedialog.h" #include "gradientdialog.h" #include "imageview.h" #include "meshview.h" #include "fraqtiveapplication.h" #include "configurationdata.h" #include "loadbookmarkdialog.h" #include "savebookmarkdialog.h" #include "loadpresetdialog.h" #include "savepresetdialog.h" #include "generateimagedialog.h" #include "generateseriesdialog.h" #include "imagegenerator.h" #include "iconloader.h" #include "xmlui/toolstrip.h" #include "xmlui/builder.h" FraqtiveMainWindow::FraqtiveMainWindow() { QAction* action; action = new QAction( IconLoader::icon( "edit" ), tr( "Fractal Type..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( fractalType() ) ); setAction( "fractalType", action ); action = new QAction( IconLoader::icon( "gradient" ), tr( "Edit Gradient..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( editGradient() ) ); setAction( "editGradient", action ); action = new QAction( IconLoader::icon( "fullscreen" ), tr( "Full Screen" ), this ); action->setShortcut( QKeySequence( Qt::Key_F11 ) ); connect( action, SIGNAL( triggered() ), this, SLOT( fullScreen() ) ); setAction( "fullScreen", action ); action = new QAction( IconLoader::icon( "back" ), tr( "Navigate Back" ), this ); action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_Left ) ); connect( action, SIGNAL( triggered() ), this, SLOT( navigateBack() ) ); setAction( "navigateBack", action ); action = new QAction( IconLoader::icon( "forward" ), tr( "Navigate Forward" ), this ); action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_Right ) ); connect( action, SIGNAL( triggered() ), this, SLOT( navigateForward() ) ); setAction( "navigateForward", action ); action = new QAction( IconLoader::icon( "home" ), tr( "Default Position" ), this ); action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_Home ) ); connect( action, SIGNAL( triggered() ), this, SLOT( defaultPosition() ) ); setAction( "defaultPosition", action ); action = new QAction( IconLoader::icon( "load-preset" ), tr( "Load Preset..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( loadPreset() ) ); setAction( "loadPreset", action ); action = new QAction( IconLoader::icon( "save-preset" ), tr( "Save Preset..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( savePreset() ) ); setAction( "savePreset", action ); action = new QAction( IconLoader::icon( "load-bookmark" ), tr( "Load Bookmark..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( loadBookmark() ) ); setAction( "loadBookmark", action ); action = new QAction( IconLoader::icon( "save-bookmark" ), tr( "Save Bookmark..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( saveBookmark() ) ); setAction( "saveBookmark", action ); action = new QAction( IconLoader::icon( "save" ), tr( "Save Image..." ), this ); action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ) ); connect( action, SIGNAL( triggered() ), this, SLOT( saveImage() ) ); setAction( "saveImage", action ); action = new QAction( IconLoader::icon( "copy" ), tr( "Copy Image" ), this ); action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_C ) ); connect( action, SIGNAL( triggered() ), this, SLOT( copyImage() ) ); setAction( "copyImage", action ); action = new QAction( IconLoader::icon( "generate-image" ), tr( "Generate Image..." ), this ); action->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_G ) ); connect( action, SIGNAL( triggered() ), this, SLOT( generateImage() ) ); setAction( "generateImage", action ); action = new QAction( IconLoader::icon( "generate-series" ), tr( "Generate Series..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( generateSeries() ) ); setAction( "generateSeries", action ); action = new QAction( IconLoader::icon( "view2d" ), tr( "2D View" ), this ); action->setShortcut( QKeySequence( Qt::Key_F2 ) ); action->setCheckable( true ); action->setChecked( true ); connect( action, SIGNAL( triggered() ), this, SLOT( view2d() ) ); setAction( "view2d", action ); action = new QAction( IconLoader::icon( "view3d" ), tr( "3D View" ), this ); action->setShortcut( QKeySequence( Qt::Key_F3 ) ); action->setCheckable( true ); connect( action, SIGNAL( triggered() ), this, SLOT( view3d() ) ); setAction( "view3d", action ); action = new QAction( IconLoader::icon( "about" ), tr( "About Fraqtive" ), this ); action->setShortcut( QKeySequence( Qt::Key_F1 ) ); connect( action, SIGNAL( triggered() ), fraqtive(), SLOT( about() ) ); setAction( "aboutFraqtive", action ); setTitle( "sectionFile", tr( "File" ) ); setTitle( "sectionEdit", tr( "Edit" ) ); setTitle( "sectionView", tr( "View" ) ); setTitle( "sectionPosition", tr( "Position" ) ); loadXmlUiFile( ":/resources/fraqtivemainwindow.xml" ); XmlUi::ToolStrip* strip = new XmlUi::ToolStrip( this ); strip->addAuxiliaryAction( this->action( "aboutFraqtive" ) ); setMenuWidget( strip ); XmlUi::Builder* builder = new XmlUi::Builder( this ); builder->registerToolStrip( "stripMain", strip ); builder->addClient( this ); strip->setContextMenuPolicy( Qt::CustomContextMenu ); connect( strip, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( customContextMenuRequested( const QPoint& ) ) ); m_ui.setupUi( this ); m_model = new FractalModel( this ); connect( m_model, SIGNAL( positionChanged() ), this, SLOT( positionChanged() ) ); connect( m_model, SIGNAL( navigationChanged() ), this, SLOT( navigationChanged() ) ); ImageView* view = new ImageView( m_ui.mainContainer, m_model->presenter() ); view->setInteractive( true ); m_model->presenter()->setView( view ); m_ui.mainContainer->setView( view ); m_ui.propertyToolBox->setModel( m_model ); FractalPresenter* previewPresenter = new FractalPresenter( this ); ImageView* preview = new ImageView( m_ui.previewContainer, previewPresenter ); previewPresenter->setView( preview ); previewPresenter->setPreviewMode( true ); previewPresenter->setPriority( -1 ); m_ui.previewContainer->setView( preview ); m_model->setPreviewPresenter( previewPresenter ); FractalType type; type.setIntegralExponent( 2 ); m_model->setFractalType( type ); m_model->setDefaultPosition(); m_model->loadDefaultColorSettings(); m_model->loadDefaultGeneratorSettings(); m_model->loadDefaultViewSettings(); m_model->setNavigationEnabled( true ); m_model->setEnabled( true ); m_ui.mainContainer->installEventFilter( this ); this->action( "view3d" )->setEnabled( QGLFormat::hasOpenGL() ); m_model->setViewMode( ImageViewMode ); view->setFocus(); ConfigurationData* config = fraqtive()->configuration(); if ( config->contains( "Geometry" ) ) restoreGeometry( config->value( "Geometry" ).toByteArray() ); else setWindowState( Qt::WindowMaximized ); if ( config->contains( "State" ) ) restoreState( config->value( "State" ).toByteArray(), 2 ); } FraqtiveMainWindow::~FraqtiveMainWindow() { } void FraqtiveMainWindow::closeEvent( QCloseEvent* e ) { e->accept(); if ( isFullScreenMode() ) leaveFullScreenMode(); ConfigurationData* config = fraqtive()->configuration(); config->setValue( "Geometry", saveGeometry() ); config->setValue( "State", saveState( 2 ) ); } bool FraqtiveMainWindow::eventFilter( QObject* watched, QEvent* e ) { if ( watched == m_ui.mainContainer ) { if ( e->type() == QEvent::Close ) { close(); return true; } if ( e->type() == QEvent::KeyPress && static_cast( e )->key() == Qt::Key_Escape ) { if ( isFullScreenMode() ) leaveFullScreenMode(); return true; } } return QMainWindow::eventFilter( watched, e ); } void FraqtiveMainWindow::customContextMenuRequested( const QPoint& pos ) { QMenu* menu = createPopupMenu(); if ( menu ) menu->popup( menuWidget()->mapToGlobal( pos ) ); } void FraqtiveMainWindow::fractalType() { FractalTypeDialog dialog( this, m_model ); if ( dialog.exec() == QDialog::Accepted ) m_model->setParameters( dialog.fractalType(), dialog.position() ); } void FraqtiveMainWindow::editGradient() { GradientDialog dialog( this ); dialog.setGradient( m_model->gradient() ); connect( &dialog, SIGNAL( applyGradient( const Gradient& ) ), this, SLOT( applyGradient( const Gradient& ) ) ); dialog.exec(); } void FraqtiveMainWindow::applyGradient( const Gradient& gradient ) { m_model->setGradient( gradient ); } void FraqtiveMainWindow::fullScreen() { if ( isFullScreenMode() ) leaveFullScreenMode(); else enterFullScreenMode(); } bool FraqtiveMainWindow::isFullScreenMode() const { return m_ui.mainContainer->isFullScreen(); } void FraqtiveMainWindow::enterFullScreenMode() { m_ui.mainContainer->setParent( NULL ); m_ui.mainContainer->showFullScreen(); m_ui.mainContainer->addActions( XmlUi::Client::actions() ); m_ui.mainContainer->setWindowTitle( windowTitle() ); hide(); } void FraqtiveMainWindow::leaveFullScreenMode() { m_ui.vboxLayout->addWidget( m_ui.mainContainer ); m_ui.mainContainer->showNormal(); QList actions = XmlUi::Client::actions(); for ( int i = 0; i < actions.count(); i++ ) m_ui.mainContainer->removeAction( actions.at( i ) ); show(); } void FraqtiveMainWindow::defaultPosition() { m_model->setDefaultPosition(); } void FraqtiveMainWindow::positionChanged() { action( "defaultPosition" )->setEnabled( !m_model->hasDefaultPosition() ); } void FraqtiveMainWindow::navigateBack() { m_model->navigateBackward(); } void FraqtiveMainWindow::navigateForward() { m_model->navigateForward(); } void FraqtiveMainWindow::navigationChanged() { action( "navigateBack" )->setEnabled( m_model->canNavigateBackward() ); action( "navigateForward" )->setEnabled( m_model->canNavigateForward() ); } void FraqtiveMainWindow::loadPreset() { LoadPresetDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void FraqtiveMainWindow::savePreset() { SavePresetDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void FraqtiveMainWindow::loadBookmark() { LoadBookmarkDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void FraqtiveMainWindow::saveBookmark() { SaveBookmarkDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void FraqtiveMainWindow::saveImage() { QByteArray format; QString fileName = getSaveImageName( &format ); if ( !fileName.isEmpty() ) { QImageWriter* writer = createImageWriter( fileName, format ); QImage image = currentImage(); if ( !writer->write( image ) ) { QMessageBox::warning( this, tr( "Error" ), tr( "The selected file could not be saved." ) ); } delete writer; } } void FraqtiveMainWindow::copyImage() { QImage image = currentImage(); QApplication::clipboard()->setImage( image ); } QString FraqtiveMainWindow::getSaveFileName( const QString& title, const QString& fileName, QByteArray* selectedFormat, QFileDialog::Options options /*= 0*/ ) { QList supportedFormats = QImageWriter::supportedImageFormats(); QList formats; QStringList filters; const char* data[] = { "png", QT_TR_NOOP( "PNG Image" ), "*.png", "jpeg", QT_TR_NOOP( "JPEG Image" ), "*.jpeg;*.jpg", "tiff", QT_TR_NOOP( "TIFF Image" ), "*.tiff;*.tif", "bmp", QT_TR_NOOP( "Windows Bitmap" ), "*.bmp", "ppm", QT_TR_NOOP( "Portable Pixmap" ), "*.ppm", NULL }; for ( int i = 0; data[ i ] != NULL; i += 3 ) { if ( supportedFormats.contains( data[ i ] ) ) { formats.append( data[ i ] ); filters.append( QString( "%1 (%2)" ).arg( tr( data[ i + 1 ] ), QString::fromLatin1( data[ i + 2 ] ) ) ); } } QByteArray format = *selectedFormat; if ( format.isEmpty() || !formats.contains( format ) ) format = formats.first(); QString selectedFilter = filters.at( formats.indexOf( format ) ); QString result = QFileDialog::getSaveFileName( this, title, fileName, filters.join( ";;" ), &selectedFilter, options ); if ( !result.isEmpty() ) { int index = filters.indexOf( selectedFilter ); if ( index >= 0 ) format = formats.at( index ); *selectedFormat = format; if ( QFileInfo( result ).suffix().isEmpty() ) result += '.' + format; } return result; } QString FraqtiveMainWindow::getSaveImageName( QByteArray* selectedFormat ) { ConfigurationData* config = fraqtive()->configuration(); QByteArray format = config->value( "SaveFormat" ).toByteArray(); QString path = config->value( "SavePath", QDir::homePath() ).toString(); QString fileName = QFileInfo( QDir( path ), tr( "fractal" ) ).absoluteFilePath(); QString result = getSaveFileName( tr( "Save Image" ), fileName, &format ); if ( !result.isEmpty() ) { config->setValue( "SaveFormat", format ); config->setValue( "SavePath", QFileInfo( result ).absolutePath() ); *selectedFormat = format; } return result; } QString FraqtiveMainWindow::getSaveSeriesName( QByteArray* selectedFormat ) { ConfigurationData* config = fraqtive()->configuration(); QByteArray format = config->value( "SeriesFormat" ).toByteArray(); QString path = config->value( "SeriesPath", QDir::homePath() ).toString(); QString fileName = QFileInfo( QDir( path ), tr( "series" ) ).absoluteFilePath(); QString result = getSaveFileName( tr( "Save Series" ), fileName, &format, QFileDialog::DontConfirmOverwrite ); if ( !result.isEmpty() ) { config->setValue( "SeriesFormat", format ); config->setValue( "SeriesPath", QFileInfo( result ).absolutePath() ); *selectedFormat = format; } return result; } QImageWriter* FraqtiveMainWindow::createImageWriter( const QString& fileName, const QByteArray& format ) { QImageWriter* writer = new QImageWriter( fileName, format ); if ( format == "tiff" ) writer->setCompression( 1 ); return writer; } QImage FraqtiveMainWindow::currentImage() { if ( ImageView* imageView = qobject_cast( m_ui.mainContainer->view() ) ) return imageView->image(); if ( MeshView* meshView = qobject_cast( m_ui.mainContainer->view() ) ) return meshView->image(); return QImage(); } void FraqtiveMainWindow::generateImage() { GenerateImageDialog dialog( this ); if ( dialog.exec() == QDialog::Accepted ) { QByteArray format; QString fileName = getSaveImageName( &format ); if ( !fileName.isEmpty() ) { ImageGenerator generator( this ); generator.setResolution( dialog.resolution() * ( 1 << dialog.multiSampling() ) ); generator.setParameters( m_model->fractalType(), m_model->position() ); generator.setColorSettings( m_model->gradient(), m_model->backgroundColor(), m_model->colorMapping() ); generator.setGeneratorSettings( dialog.generatorSettings() ); generator.setViewSettings( dialog.viewSettings() ); QProgressDialog progress( this ); progress.setWindowModality( Qt::WindowModal ); progress.setRange( 0, generator.maximumProgress() ); progress.setWindowTitle( tr( "Generate Image" ) ); progress.setLabelText( tr( "Calculating..." ) ); progress.setValue( 0 ); progress.setFixedHeight( progress.sizeHint().height() ); progress.resize( 300, progress.height() ); QEventLoop eventLoop; connect( &generator, SIGNAL( progressChanged( int ) ), &progress, SLOT( setValue( int ) ), Qt::QueuedConnection ); connect( &generator, SIGNAL( completed() ), &eventLoop, SLOT( quit() ), Qt::QueuedConnection ); connect( &progress, SIGNAL( canceled() ), &eventLoop, SLOT( quit() ) ); if ( !generator.start() ) { QMessageBox::warning( this, tr( "Error" ), tr( "Not enough memory to generate image." ) ); return; } eventLoop.exec(); if ( !progress.wasCanceled() ) { QImage image = generator.takeImage(); for ( int i = 0; i < dialog.multiSampling(); i++ ) image = image.scaledToWidth( image.width() / 2, Qt::SmoothTransformation ); QImageWriter* writer = createImageWriter( fileName, format ); if ( !writer->write( image ) ) QMessageBox::warning( this, tr( "Error" ), tr( "The selected file could not be saved." ) ); delete writer; } } } } void FraqtiveMainWindow::generateSeries() { GenerateSeriesDialog dialog( this, m_model ); if ( dialog.exec() == QDialog::Accepted ) { QByteArray format; QString fileName = getSaveSeriesName( &format ); if ( !fileName.isEmpty() ) { QFileInfo info( fileName ); ImageGenerator generator( this ); generator.setImageCount( dialog.images() ); generator.setResolution( dialog.resolution() * ( 1 << dialog.multiSampling() ) ); generator.setColorSettings( m_model->gradient(), m_model->backgroundColor(), m_model->colorMapping() ); generator.setGeneratorSettings( dialog.generatorSettings() ); generator.setViewSettings( dialog.viewSettings() ); QProgressDialog progress( this ); progress.setWindowModality( Qt::WindowModal ); progress.setRange( 0, generator.maximumProgress() ); progress.setWindowTitle( tr( "Generate Series" ) ); progress.setValue( 0 ); progress.setFixedHeight( progress.sizeHint().height() ); progress.resize( 300, progress.height() ); connect( &generator, SIGNAL( progressChanged( int ) ), &progress, SLOT( setValue( int ) ), Qt::QueuedConnection ); QImage previous; for ( int i = 0; i < dialog.images(); i++ ) { progress.setLabelText( tr( "Calculating %1 of %2..." ).arg( i + 1 ).arg( dialog.images() ) ); generator.setCurrentImage( i ); Position position = m_model->position(); double zoomTo = position.zoomFactor(); double zoomFrom = zoomTo - dialog.zoomFactor(); double angleTo = position.angle(); double angleFrom = angleTo - dialog.angle(); double a = (double)i / (double)( dialog.images() - 1 ); position.setZoomFactor( zoomFrom + a * ( zoomTo - zoomFrom ) ); position.setAngle( angleFrom + a * ( angleTo - angleFrom ) ); generator.setParameters( m_model->fractalType(), position ); QEventLoop eventLoop; connect( &generator, SIGNAL( completed() ), &eventLoop, SLOT( quit() ), Qt::QueuedConnection ); connect( &progress, SIGNAL( canceled() ), &eventLoop, SLOT( quit() ) ); if ( !generator.start() ) { QMessageBox::warning( this, tr( "Error" ), tr( "Not enough memory to generate image." ) ); return; } eventLoop.exec(); if ( progress.wasCanceled() ) break; QString fullName = info.completeBaseName() + QLatin1String( "." ) + QString::number( i ).rightJustified( 4, QLatin1Char( '0' ) ) + QLatin1String( "." ) + info.suffix(); QString fullPath = info.absoluteDir().absoluteFilePath( fullName ); QImage current = generator.takeImage(); if ( !previous.isNull() ) { QPainter painter( ¤t ); double angle = ( angleTo - angleFrom ) / (double)( dialog.images() - 1 ); double scale = pow( 10.0, ( zoomTo - zoomFrom ) / (double)( dialog.images() - 1 ) ); QTransform transform; transform.translate( current.width() / 2, current.height() / 2 ); transform.rotate( angle ); transform.scale( scale, scale ); transform.translate( -current.width() / 2, -current.height() / 2 ); painter.setOpacity( dialog.blending() ); painter.setTransform( transform ); painter.setRenderHint( QPainter::SmoothPixmapTransform ); painter.drawImage( 0, 0, previous ); } if ( dialog.blending() > 0.01 ) previous = current; for ( int i = 0; i < dialog.multiSampling(); i++ ) current = current.scaledToWidth( current.width() / 2, Qt::SmoothTransformation ); QImageWriter* writer = createImageWriter( fullPath, format ); if ( !writer->write( current ) ) { QMessageBox::warning( this, tr( "Error" ), tr( "The selected file could not be saved." ) ); delete writer; break; } delete writer; } } } } void FraqtiveMainWindow::view2d() { if ( !qobject_cast( m_ui.mainContainer->view() ) ) { ImageView* view = new ImageView( m_ui.mainContainer, m_model->presenter() ); view->setInteractive( true ); m_model->presenter()->setView( view ); m_ui.mainContainer->setView( view ); m_model->setViewMode( ImageViewMode ); view->setFocus(); } action( "view2d" )->setChecked( true ); action( "view3d" )->setChecked( false ); } void FraqtiveMainWindow::view3d() { if ( !qobject_cast( m_ui.mainContainer->view() ) ) { MeshView* view = new MeshView( m_ui.mainContainer, m_model->presenter() ); m_model->presenter()->setView( view ); m_ui.mainContainer->setView( view ); m_model->clearHovering(); m_model->setViewMode( MeshViewMode ); view->setFocus(); } action( "view2d" )->setChecked( false ); action( "view3d" )->setChecked( true ); } fraqtive-0.4.8.1/src/fraqtivemainwindow.h000066400000000000000000000047151440132223600203650ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef FRAQTIVEMAINWINDOW_H #define FRAQTIVEMAINWINDOW_H #include #include #include "ui_fraqtivemainwindow.h" #include "xmlui/client.h" class FractalModel; class Gradient; class FraqtiveMainWindow : public QMainWindow, public XmlUi::Client { Q_OBJECT public: FraqtiveMainWindow(); ~FraqtiveMainWindow(); public: // overrides bool eventFilter( QObject* watched, QEvent* e ); protected: // overrides void closeEvent( QCloseEvent* e ); private slots: void fractalType(); void editGradient(); void fullScreen(); void navigateBack(); void navigateForward(); void defaultPosition(); void loadPreset(); void savePreset(); void loadBookmark(); void saveBookmark(); void saveImage(); void copyImage(); void generateImage(); void generateSeries(); void view2d(); void view3d(); void customContextMenuRequested( const QPoint& pos ); void positionChanged(); void navigationChanged(); void applyGradient( const Gradient& gradient ); private: bool isFullScreenMode() const; void enterFullScreenMode(); void leaveFullScreenMode(); QString getSaveFileName( const QString& title, const QString& fileName, QByteArray* selectedFormat, QFileDialog::Options options = 0 ); QString getSaveImageName( QByteArray* selectedFormat ); QString getSaveSeriesName( QByteArray* selectedFormat ); QImageWriter* createImageWriter( const QString& fileName, const QByteArray& format ); QImage currentImage(); private: Ui::FraqtiveMainWindow m_ui; FractalModel* m_model; }; #endif fraqtive-0.4.8.1/src/fraqtivemainwindow.ui000066400000000000000000000040151440132223600205440ustar00rootroot00000000000000 FraqtiveMainWindow 0 0 880 650 Fraqtive 0 Properties 2 0 Julia Preview 2 0 ViewContainer QWidget
viewcontainer.h
1
PropertyToolBox QWidget
propertytoolbox.h
1
fraqtive-0.4.8.1/src/generateimagedialog.cpp000066400000000000000000000144351440132223600207570ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "generateimagedialog.h" #include #include "fraqtiveapplication.h" #include "configurationdata.h" #include "datafunctions.h" #include "iconloader.h" static void initializeDefaultSettings() { static bool initialized = false; if ( !initialized ) { ConfigurationData* config = fraqtive()->configuration(); if ( !config->contains( "ImageResolution" ) ) config->setValue( "ImageResolution", QVariant::fromValue( QApplication::desktop()->screenGeometry().size() ) ); if ( !config->contains( "ImageMultiSampling" ) ) config->setValue( "ImageMultiSampling", QVariant::fromValue( 0 ) ); if ( !config->contains( "ImageGeneratorSettings" ) ) config->setValue( "ImageGeneratorSettings", QVariant::fromValue( DataFunctions::defaultGeneratorSettings() ) ); if ( !config->contains( "ImageViewSettings" ) ) config->setValue( "ImageViewSettings", QVariant::fromValue( DataFunctions::defaultViewSettings() ) ); initialized = true; } } GenerateImageDialog::GenerateImageDialog( QWidget* parent ) : QDialog( parent ), m_multiSampling( 0 ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "generate-image", 22 ) ); m_ui.promptLabel->setText( tr( "Generate an image of the fractal:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); setFixedHeight( sizeHint().height() ); m_ui.sliderDepth->setScaledRange( 1.5, 4.0 ); m_ui.sliderDetail->setScaledRange( 3.0, 0.0 ); initializeDefaultSettings(); ConfigurationData* config = fraqtive()->configuration(); m_multiSampling = config->value( "ImageMultiSampling" ).value(); switch ( m_multiSampling ) { case 0: m_ui.radioMSNone->setChecked( true ); break; case 1: m_ui.radioMS2x2->setChecked( true ); break; case 2: m_ui.radioMS4x4->setChecked( true ); break; case 3: m_ui.radioMS8x8->setChecked( true ); break; } updateMaximumSize(); m_resolution = config->value( "ImageResolution" ).value(); m_ui.spinWidth->setValue( m_resolution.width() ); m_ui.spinHeight->setValue( m_resolution.height() ); m_generatorSettings = config->value( "ImageGeneratorSettings" ).value(); m_ui.sliderDepth->setScaledValue( m_generatorSettings.calculationDepth() ); m_ui.sliderDetail->setScaledValue( m_generatorSettings.detailThreshold() ); m_viewSettings = config->value( "ImageViewSettings" ).value(); switch ( m_viewSettings.antiAliasing() ) { case NoAntiAliasing: m_ui.radioAANone->setChecked( true ); break; case LowAntiAliasing: m_ui.radioAALow->setChecked( true ); break; case MediumAntiAliasing: m_ui.radioAAMedium->setChecked( true ); break; case HighAntiAliasing: m_ui.radioAAHigh->setChecked( true ); break; } } GenerateImageDialog::~GenerateImageDialog() { } void GenerateImageDialog::on_radioMSNone_clicked() { updateMaximumSize(); } void GenerateImageDialog::on_radioMS2x2_clicked() { updateMaximumSize(); } void GenerateImageDialog::on_radioMS4x4_clicked() { updateMaximumSize(); } void GenerateImageDialog::on_radioMS8x8_clicked() { updateMaximumSize(); } void GenerateImageDialog::updateMaximumSize() { int width, height; if ( QSysInfo::WordSize == 64 ) { width = 30720; height = 17280; } else { width = 8000; height = 8000; } int multiSampling = 0; if ( m_ui.radioMS2x2->isChecked() ) multiSampling = 1; else if ( m_ui.radioMS4x4->isChecked() ) multiSampling = 2; else if ( m_ui.radioMS8x8->isChecked() ) multiSampling = 3; m_ui.spinWidth->setMaximum( width >> multiSampling ); m_ui.spinHeight->setMaximum( height >> multiSampling ); } void GenerateImageDialog::accept() { ConfigurationData* config = fraqtive()->configuration(); m_resolution = QSize( m_ui.spinWidth->value(), m_ui.spinHeight->value() ); config->setValue( "ImageResolution", QVariant::fromValue( m_resolution ) ); if ( m_ui.radioMSNone->isChecked() ) m_multiSampling = 0; else if ( m_ui.radioMS2x2->isChecked() ) m_multiSampling = 1; else if ( m_ui.radioMS4x4->isChecked() ) m_multiSampling = 2; else if ( m_ui.radioMS8x8->isChecked() ) m_multiSampling = 3; config->setValue( "ImageMultiSampling", QVariant::fromValue( m_multiSampling ) ); m_generatorSettings.setCalculationDepth( m_ui.sliderDepth->scaledValue() ); m_generatorSettings.setDetailThreshold( m_ui.sliderDetail->scaledValue() ); config->setValue( "ImageGeneratorSettings", QVariant::fromValue( m_generatorSettings ) ); if ( m_ui.radioAANone->isChecked() ) m_viewSettings.setAntiAliasing( NoAntiAliasing ); else if ( m_ui.radioAALow->isChecked() ) m_viewSettings.setAntiAliasing( LowAntiAliasing ); else if ( m_ui.radioAAMedium->isChecked() ) m_viewSettings.setAntiAliasing( MediumAntiAliasing ); else if ( m_ui.radioAAHigh->isChecked() ) m_viewSettings.setAntiAliasing( HighAntiAliasing ); config->setValue( "ImageViewSettings", QVariant::fromValue( m_viewSettings ) ); QDialog::accept(); } fraqtive-0.4.8.1/src/generateimagedialog.h000066400000000000000000000034631440132223600204230ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef GENERATEIMAGEDIALOG_H #define GENERATEIMAGEDIALOG_H #include #include "ui_generateimagedialog.h" #include "datastructures.h" class GenerateImageDialog : public QDialog { Q_OBJECT public: GenerateImageDialog( QWidget* parent ); ~GenerateImageDialog(); public: QSize resolution() const { return m_resolution; } int multiSampling() const { return m_multiSampling; } GeneratorSettings generatorSettings() const { return m_generatorSettings; } ViewSettings viewSettings() const { return m_viewSettings; } public: // overrides void accept(); private slots: void on_radioMSNone_clicked(); void on_radioMS2x2_clicked(); void on_radioMS4x4_clicked(); void on_radioMS8x8_clicked(); private: void updateMaximumSize(); private: Ui::GenerateImageDialog m_ui; QSize m_resolution; int m_multiSampling; GeneratorSettings m_generatorSettings; ViewSettings m_viewSettings; }; #endif fraqtive-0.4.8.1/src/generateimagedialog.ui000066400000000000000000000340261440132223600206100ustar00rootroot00000000000000 GenerateImageDialog 0 0 350 394 Generate Image 0 0 0 0 0 10 true Qt::Horizontal 9 Image Resolution Qt::Horizontal QSizePolicy::Expanding 10 20 Width: spinWidth 60 0 32 8000 Qt::Horizontal QSizePolicy::Expanding 10 20 Height: spinHeight 60 0 32 8000 Qt::Horizontal QSizePolicy::Expanding 10 20 Advanced Settings Calculation Depth 100 Qt::Horizontal QSlider::TicksBelow 10 Detail Level 100 Qt::Horizontal QSlider::TicksBelow 10 Image Anti-Aliasing Qt::Horizontal 51 20 QFrame::NoFrame 4 0 0 0 0 None true Low Medium High Multi-Sampling Qt::Horizontal 40 20 QFrame::NoFrame 4 0 0 0 0 None true 2 x 2 4 x 4 8 x 8 Qt::Vertical 20 0 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
DoubleSlider QSlider
doubleslider.h
spinWidth spinHeight sliderDepth sliderDetail radioAANone radioAALow radioAAMedium radioAAHigh buttonBox buttonBox accepted() GenerateImageDialog accept() 227 270 157 274 buttonBox rejected() GenerateImageDialog reject() 290 276 286 274
fraqtive-0.4.8.1/src/generateseriesdialog.cpp000066400000000000000000000230641440132223600211650ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "generateseriesdialog.h" #include "fraqtiveapplication.h" #include "fractalpresenter.h" #include "fractalmodel.h" #include "imageview.h" #include "configurationdata.h" #include "datafunctions.h" #include "iconloader.h" static void initializeSeriesSettings() { static bool initialized = false; if ( !initialized ) { ConfigurationData* config = fraqtive()->configuration(); if ( !config->contains( "SeriesResolution" ) ) config->setValue( "SeriesResolution", QVariant::fromValue( QSize( 640, 480 ) ) ); if ( !config->contains( "SeriesMultiSampling" ) ) config->setValue( "SeriesMultiSampling", QVariant::fromValue( 0 ) ); if ( !config->contains( "SeriesGeneratorSettings" ) ) config->setValue( "SeriesGeneratorSettings", QVariant::fromValue( DataFunctions::defaultGeneratorSettings() ) ); if ( !config->contains( "SeriesViewSettings" ) ) config->setValue( "SeriesViewSettings", QVariant::fromValue( DataFunctions::defaultViewSettings() ) ); if ( !config->contains( "SeriesImages" ) ) config->setValue( "SeriesImages", 100 ); if ( !config->contains( "SeriesBlending" ) ) config->setValue( "SeriesBlending", 0.0 ); initialized = true; } } GenerateSeriesDialog::GenerateSeriesDialog( QWidget* parent, const FractalModel* model ) : QDialog( parent ), m_presenter( NULL ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "generate-series", 22 ) ); m_ui.promptLabel->setText( tr( "Generate a series of images:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); setFixedHeight( sizeHint().height() ); m_ui.sliderDepth->setScaledRange( 1.5, 4.0 ); m_ui.sliderDetail->setScaledRange( 3.0, 0.0 ); int width = 0; QLabel* labels[ 3 ] = { m_ui.labelZoom, m_ui.labelAngle, m_ui.labelBlending }; for ( int i = 0; i < 3; i++ ) width = qMax( width, labels[ i ]->sizeHint().width() ); m_ui.imageSpacer->changeSize( width + m_ui.animationLayout->horizontalSpacing(), 20, QSizePolicy::Fixed, QSizePolicy::Expanding ); for ( int i = 0; i < 3; i++ ) labels[ i ]->setFixedWidth( width ); initializeSeriesSettings(); ConfigurationData* config = fraqtive()->configuration(); m_multiSampling = config->value( "SeriesMultiSampling" ).value(); switch ( m_multiSampling ) { case 0: m_ui.radioMSNone->setChecked( true ); break; case 1: m_ui.radioMS2x2->setChecked( true ); break; case 2: m_ui.radioMS4x4->setChecked( true ); break; case 3: m_ui.radioMS8x8->setChecked( true ); break; } updateMaximumSize(); m_resolution = config->value( "SeriesResolution" ).value(); m_ui.spinWidth->setValue( m_resolution.width() ); m_ui.spinHeight->setValue( m_resolution.height() ); m_generatorSettings = config->value( "SeriesGeneratorSettings" ).value(); m_ui.sliderDepth->setScaledValue( m_generatorSettings.calculationDepth() ); m_ui.sliderDetail->setScaledValue( m_generatorSettings.detailThreshold() ); m_viewSettings = config->value( "SeriesViewSettings" ).value(); switch ( m_viewSettings.antiAliasing() ) { case NoAntiAliasing: m_ui.radioAANone->setChecked( true ); break; case LowAntiAliasing: m_ui.radioAALow->setChecked( true ); break; case MediumAntiAliasing: m_ui.radioAAMedium->setChecked( true ); break; case HighAntiAliasing: m_ui.radioAAHigh->setChecked( true ); break; } m_images = config->value( "SeriesImages" ).toInt(); m_ui.spinImages->setValue( m_images ); m_fractalType = model->fractalType(); m_endPosition = model->position(); m_zoomFactor = m_endPosition.zoomFactor() + 0.45; m_angle = 0.0; m_ui.spinZoom->setValue( m_zoomFactor ); m_ui.spinAngle->setValue( m_angle ); m_blending = config->value( "SeriesBlending" ).toDouble(); m_ui.spinBlending->setValue( m_blending ); m_presenter = new FractalPresenter( this ); ImageView* view = new ImageView( m_ui.viewContainer, m_presenter ); m_ui.viewContainer->setView( view ); m_presenter->setView( view ); m_presenter->setPriority( 1 ); m_presenter->setColorSettings( model->gradient(), model->backgroundColor(), model->colorMapping() ); updatePosition(); updateSettings(); m_presenter->setEnabled( true ); } GenerateSeriesDialog::~GenerateSeriesDialog() { } void GenerateSeriesDialog::accept() { ConfigurationData* config = fraqtive()->configuration(); m_resolution = QSize( m_ui.spinWidth->value(), m_ui.spinHeight->value() ); config->setValue( "SeriesResolution", QVariant::fromValue( m_resolution ) ); if ( m_ui.radioMSNone->isChecked() ) m_multiSampling = 0; else if ( m_ui.radioMS2x2->isChecked() ) m_multiSampling = 1; else if ( m_ui.radioMS4x4->isChecked() ) m_multiSampling = 2; else if ( m_ui.radioMS8x8->isChecked() ) m_multiSampling = 3; config->setValue( "SeriesMultiSampling", QVariant::fromValue( m_multiSampling ) ); config->setValue( "SeriesGeneratorSettings", QVariant::fromValue( m_generatorSettings ) ); config->setValue( "SeriesViewSettings", QVariant::fromValue( m_viewSettings ) ); m_images = m_ui.spinImages->value(); config->setValue( "SeriesImages", m_images ); m_zoomFactor = m_ui.spinZoom->value(); m_angle = m_ui.spinAngle->value(); m_blending = m_ui.spinBlending->value(); config->setValue( "SeriesBlending", m_blending ); QDialog::accept(); } void GenerateSeriesDialog::on_sliderDepth_valueChanged() { updateSettings(); } void GenerateSeriesDialog::on_sliderDetail_valueChanged() { updateSettings(); } void GenerateSeriesDialog::on_radioAANone_clicked() { updateSettings(); } void GenerateSeriesDialog::on_radioAALow_clicked() { updateSettings(); } void GenerateSeriesDialog::on_radioAAMedium_clicked() { updateSettings(); } void GenerateSeriesDialog::on_radioAAHigh_clicked() { updateSettings(); } void GenerateSeriesDialog::on_radioMSNone_clicked() { updateMaximumSize(); } void GenerateSeriesDialog::on_radioMS2x2_clicked() { updateMaximumSize(); } void GenerateSeriesDialog::on_radioMS4x4_clicked() { updateMaximumSize(); } void GenerateSeriesDialog::on_radioMS8x8_clicked() { updateMaximumSize(); } void GenerateSeriesDialog::on_spinZoom_valueChanged() { updatePosition(); } void GenerateSeriesDialog::on_spinAngle_valueChanged() { updatePosition(); } void GenerateSeriesDialog::on_animSlider_valueChanged() { updatePosition(); } void GenerateSeriesDialog::updateMaximumSize() { int width, height; if ( QSysInfo::WordSize == 64 ) { width = 30720; height = 17280; } else { width = 8000; height = 8000; } int multiSampling = 0; if ( m_ui.radioMS2x2->isChecked() ) multiSampling = 1; else if ( m_ui.radioMS4x4->isChecked() ) multiSampling = 2; else if ( m_ui.radioMS8x8->isChecked() ) multiSampling = 3; m_ui.spinWidth->setMaximum( width >> multiSampling ); m_ui.spinHeight->setMaximum( height >> multiSampling ); } void GenerateSeriesDialog::updatePosition() { if ( !m_presenter ) return; Position position = m_endPosition; double zoomTo = position.zoomFactor(); double zoomFrom = zoomTo - m_ui.spinZoom->value(); double angleTo = position.angle(); double angleFrom = angleTo - m_ui.spinAngle->value(); double a = (double)m_ui.animSlider->value() / 100.0; position.setZoomFactor( zoomFrom + a * ( zoomTo - zoomFrom ) ); position.setAngle( angleFrom + a * ( angleTo - angleFrom ) ); m_presenter->setParameters( m_fractalType, position ); } void GenerateSeriesDialog::updateSettings() { if ( !m_presenter ) return; m_generatorSettings.setCalculationDepth( m_ui.sliderDepth->scaledValue() ); m_generatorSettings.setDetailThreshold( m_ui.sliderDetail->scaledValue() ); if ( m_ui.radioAANone->isChecked() ) m_viewSettings.setAntiAliasing( NoAntiAliasing ); if ( m_ui.radioAALow->isChecked() ) m_viewSettings.setAntiAliasing( LowAntiAliasing ); if ( m_ui.radioAAMedium->isChecked() ) m_viewSettings.setAntiAliasing( MediumAntiAliasing ); if ( m_ui.radioAAHigh->isChecked() ) m_viewSettings.setAntiAliasing( HighAntiAliasing ); m_presenter->setGeneratorSettings( m_generatorSettings ); m_presenter->setViewSettings( m_viewSettings ); } fraqtive-0.4.8.1/src/generateseriesdialog.h000066400000000000000000000052051440132223600206270ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef GENERATESERIESDIALOG_H #define GENERATESERIESDIALOG_H #include #include "ui_generateseriesdialog.h" #include "datastructures.h" class FractalModel; class FractalPresenter; class GenerateSeriesDialog : public QDialog { Q_OBJECT public: GenerateSeriesDialog( QWidget* parent, const FractalModel* model ); ~GenerateSeriesDialog(); public: QSize resolution() const { return m_resolution; } int multiSampling() const { return m_multiSampling; } GeneratorSettings generatorSettings() const { return m_generatorSettings; } ViewSettings viewSettings() const { return m_viewSettings; } int images() const { return m_images; } double zoomFactor() const { return m_zoomFactor; } double angle() const { return m_angle; } double blending() const { return m_blending; } public: // overrides void accept(); private slots: void on_sliderDepth_valueChanged(); void on_sliderDetail_valueChanged(); void on_radioAANone_clicked(); void on_radioAALow_clicked(); void on_radioAAMedium_clicked(); void on_radioAAHigh_clicked(); void on_radioMSNone_clicked(); void on_radioMS2x2_clicked(); void on_radioMS4x4_clicked(); void on_radioMS8x8_clicked(); void on_spinZoom_valueChanged(); void on_spinAngle_valueChanged(); void on_animSlider_valueChanged(); private: void updateMaximumSize(); void updatePosition(); void updateSettings(); private: Ui::GenerateSeriesDialog m_ui; FractalPresenter* m_presenter; FractalType m_fractalType; Position m_endPosition; QSize m_resolution; int m_multiSampling; GeneratorSettings m_generatorSettings; ViewSettings m_viewSettings; int m_images; double m_zoomFactor; double m_angle; double m_blending; }; #endif fraqtive-0.4.8.1/src/generateseriesdialog.ui000066400000000000000000000610011440132223600210110ustar00rootroot00000000000000 GenerateSeriesDialog 0 0 731 390 Generate Series 0 0 0 0 0 10 true Qt::Horizontal Image Resolution Qt::Horizontal QSizePolicy::Expanding 10 20 Width: spinWidth 60 0 32 8000 Qt::Horizontal QSizePolicy::Expanding 10 20 Height: spinHeight 60 0 32 8000 Qt::Horizontal QSizePolicy::Expanding 10 20 Advanced Settings Calculation Depth 100 Qt::Horizontal QSlider::TicksBelow 10 Detail Level 100 Qt::Horizontal QSlider::TicksBelow 10 Image Anti-Aliasing Qt::Horizontal 51 20 QFrame::NoFrame 4 0 0 0 0 None true Low Medium High Multi-Sampling Qt::Horizontal 40 20 QFrame::NoFrame 4 0 0 0 0 None true 2 x 2 4 x 4 8 x 8 Qt::Vertical 20 0 Number of Images Qt::Horizontal 40 20 60 0 2 10000 Qt::Horizontal 63 20 Animation &Zoom Factor: spinZoom 100 0 10^ -15.000000000000000 15.000000000000000 0.100000000000000 Qt::Horizontal 26 20 &Rotation: spinAngle 100 0 deg 1 -36000.000000000000000 36000.000000000000000 5.000000000000000 Post-Processing &Blending: spinBlending 60 0 1 0.900000000000000 0.100000000000000 Qt::Horizontal 40 20 Qt::Vertical 20 0 Preview 0 0 100 1 Qt::Horizontal Qt::Vertical 20 0 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
DoubleSlider QSlider
doubleslider.h
ViewContainer QWidget
viewcontainer.h
1
spinWidth spinHeight sliderDepth sliderDetail radioAANone radioAALow radioAAMedium radioAAHigh spinImages spinZoom spinAngle buttonBox buttonBox accepted() GenerateSeriesDialog accept() 280 313 280 166 buttonBox rejected() GenerateSeriesDialog reject() 280 313 280 166
fraqtive-0.4.8.1/src/generatorcore.cpp000066400000000000000000000645341440132223600176460ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "generatorcore.h" #include #include #include #if defined( HAVE_SSE2 ) # include #endif // see http://wiki.mimec.org/wiki/Fraqtive/Generator_Core for a description of this code namespace GeneratorCore { static const double BailoutRadius = 64.0; #if defined( Q_CC_MSVC ) # pragma float_control( precise, off ) # pragma intrinsic( log, sqrt, exp, atan2, sin, cos, fabs ) #endif static const double BailoutLog = log( 2.0 * log( BailoutRadius ) ); static inline double calculateResult( int maxIterations, int count, double final, double exponent ) { if ( count == 0 ) return 0.0; double value = ( maxIterations - count ) + ( BailoutLog - log( log( sqrt( final ) ) ) ) / log( exponent ); return sqrt( value ); } template static void adjust( double& /*zx*/, double& /*zy*/ ); template<> inline void adjust( double& /*zx*/, double& /*zy*/ ) { } template<> inline void adjust( double& /*zx*/, double& zy ) { zy = -zy; } template<> inline void adjust( double& zx, double& zy ) { zx = fabs( zx ); zy = fabs( zy ); } template<> inline void adjust( double& /*zx*/, double& zy ) { zy = fabs( zy ); } template static inline double calculate( double x, double y, double cx, double cy, double exponent, int maxIterations ) { double zx = x; double zy = y; double radius; double exp2 = 0.5 * exponent; for ( int k = maxIterations; k > 0; k-- ) { adjust( zx, zy ); double zxx = zx * zx; double zyy = zy * zy; radius = zxx + zyy; if ( radius >= BailoutRadius ) return calculateResult( maxIterations, k, radius, exponent ); double z = exp( log( radius ) * exp2 ); double fi = exponent * atan2( zy, zx ); zx = z * cos( fi ) + cx; zy = z * sin( fi ) + cy; } return 0.0; } #if defined( Q_CC_MSVC ) # pragma float_control( precise, on ) # pragma function( log, sqrt, exp, atan2, sin, cos, fabs ) #endif class MandelbrotParams { public: MandelbrotParams( double exponent ) : m_exponent( exponent ) { } protected: double m_exponent; }; template class MandelbrotFunctor : public Functor, public MandelbrotParams { public: MandelbrotFunctor( const MandelbrotParams& params ) : MandelbrotParams( params ) { } double operator()( double zx, double zy, int maxIterations ) { return calculate( zx, zy, zx, zy, m_exponent, maxIterations ); } }; class JuliaParams : public MandelbrotParams { public: JuliaParams( double cx, double cy, double exponent ) : MandelbrotParams( exponent ), m_cx( cx ), m_cy( cy ) { } protected: double m_cx; double m_cy; }; template class JuliaFunctor : public Functor, public JuliaParams { public: JuliaFunctor( const JuliaParams& params ) : JuliaParams( params ) { } double operator()( double zx, double zy, int maxIterations ) { return calculate( zx, zy, m_cx, m_cy, m_exponent, maxIterations ); } }; template class FACTORY> class VariantDispatcher { public: template static BASE* create( Variant variant, const PARAMS& params ) { switch ( variant ) { case NormalVariant: return FACTORY::create( params ); case ConjugateVariant: return FACTORY::create( params ); case AbsoluteVariant: return FACTORY::create( params ); case AbsoluteImVariant: return FACTORY::create( params ); } return NULL; } }; template class FUNCTOR> class FunctorFactory { public: template static BASE* create( Variant variant, const PARAMS& params ) { return VariantDispatcher::create( variant, params ); } private: template class InnerFactory { public: template static BASE* create( const PARAMS& params ) { return new FUNCTOR( params ); } }; }; Functor* createMandelbrotFunctor( double exponent, Variant variant ) { return FunctorFactory::create( variant, MandelbrotParams( exponent ) ); } Functor* createJuliaFunctor( double cx, double cy, double exponent, Variant variant ) { return FunctorFactory::create( variant, JuliaParams( cx, cy, exponent ) ); } template static inline void calculatePower( double& zx, double& zy, double& radius ) { if ( N % 2 == 0 ) { calculatePower( zx, zy, radius ); double zxx = zx * zx; double zyy = zy * zy; double zxy = zx * zy; zx = zxx - zyy; zy = zxy + zxy; } else { double zx2 = zx; double zy2 = zy; calculatePower( zx2, zy2, radius ); double zxx2 = zx * zx2; double zxy2 = zx * zy2; double zyx2 = zy * zx2; double zyy2 = zy * zy2; zx = zxx2 - zyy2; zy = zxy2 + zyx2; } } template<> inline void calculatePower<2>( double& zx, double& zy, double& radius ) { double zxx = zx * zx; double zyy = zy * zy; double zxy = zx * zy; zx = zxx - zyy; zy = zxy + zxy; radius = zxx + zyy; } template<> inline void calculatePower<1>( double& /*zx*/, double& /*zy*/, double& /*radius*/ ) { } template static double calculateFast( double x, double y, double cx, double cy, int maxIterations ) { double zx = x; double zy = y; for ( int k = maxIterations; k > 0; k-- ) { adjust( zx, zy ); double radius; calculatePower( zx, zy, radius ); if ( radius >= BailoutRadius ) return calculateResult( maxIterations, k, radius, N ); zx += cx; zy += cy; } return 0.0; } class MandelbrotFastParams { public: MandelbrotFastParams() { } }; template class MandelbrotFastFunctor : public Functor, public MandelbrotFastParams { public: MandelbrotFastFunctor( const MandelbrotFastParams& params ) : MandelbrotFastParams( params ) { } double operator()( double zx, double zy, int maxIterations ) { return calculateFast( zx, zy, zx, zy, maxIterations ); } }; class JuliaFastParams : public MandelbrotFastParams { public: JuliaFastParams( double cx, double cy ) : MandelbrotFastParams(), m_cx( cx ), m_cy( cy ) { } protected: double m_cx; double m_cy; }; template class JuliaFastFunctor : public Functor, public JuliaFastParams { public: JuliaFastFunctor( const JuliaFastParams& params ) : JuliaFastParams( params ) { } double operator()( double zx, double zy, int maxIterations ) { return calculateFast( zx, zy, m_cx, m_cy, maxIterations ); } }; template class FACTORY, int EXPONENT = MaxExponent> class ExponentDispatcher { public: template static BASE* create( int exponent, Variant variant, const PARAMS& params ) { if ( exponent == EXPONENT ) return VariantDispatcher::create( variant, params ); return ExponentDispatcher::create( exponent, variant, params ); } private: template class FactoryAdapter { public: template static BASE* create( const PARAMS& params ) { return FACTORY::create( params ); } }; }; template class FACTORY> class ExponentDispatcher { public: template static BASE* create( int /*exponent*/, Variant /*variant*/, const PARAMS& /*params*/ ) { return NULL; } }; template class FUNCTOR> class FastFunctorFactory { public: template static BASE* create( int exponent, Variant variant, const PARAMS& params ) { return ExponentDispatcher::create( exponent, variant, params ); } private: template class InnerFactory { public: template static BASE* create( const PARAMS& params ) { return new FUNCTOR( params ); } }; }; Functor* createMandelbrotFastFunctor( int exponent, Variant variant ) { return FastFunctorFactory::create( exponent, variant, MandelbrotFastParams() ); } Functor* createJuliaFastFunctor( double cx, double cy, int exponent, Variant variant ) { return FastFunctorFactory::create( exponent, variant, JuliaFastParams( cx, cy ) ); } void generatePreview( const Input& input, const Output& output, Functor* functor, int maxIterations ) { for ( int y = 0; y < output.m_height; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width; x += CellSize ) { double zx = input.m_x + input.m_ca * x + input.m_sa * y; double zy = input.m_y - input.m_sa * x + input.m_ca * y; row[ x ] = ( *functor )( zx, zy, maxIterations ); } } } static inline bool checkThreshold( double p1, double p2, double threshold ) { double pmin, pmax; if ( p1 < p2 ) pmin = p1, pmax = p2; else pmin = p2, pmax = p1; if ( pmin == 0.0 && pmax != 0.0 ) return true; if ( ( pmax - pmin ) > threshold ) return true; return false; } static inline bool checkThreshold( double p1, double p2, double p3, double p4, double threshold ) { return checkThreshold( p1, p2, threshold ) || checkThreshold( p3, p4, threshold ) || checkThreshold( p1, p3, threshold ) || checkThreshold( p2, p4, threshold ); } void generateDetails( const Input& input, const Output& output, Functor* functor, int maxIterations, double threshold ) { for ( int y = 0; y < output.m_height; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width - CellSize; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ x + CellSize ]; if ( checkThreshold( p1, p2, threshold ) ) { for ( int i = 1; i < CellSize; i++ ) { double zx = input.m_x + input.m_ca * ( x + i ) + input.m_sa * y; double zy = input.m_y - input.m_sa * ( x + i ) + input.m_ca * y; row[ x + i ] = ( *functor )( zx, zy, maxIterations ); } } } } for ( int y = 0; y < output.m_height - CellSize; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ output.m_stride * CellSize + x ]; if ( checkThreshold( p1, p2, threshold ) ) { for ( int i = 1; i < CellSize; i++ ) { double zx = input.m_x + input.m_ca * x + input.m_sa * ( y + i ); double zy = input.m_y - input.m_sa * x + input.m_ca * ( y + i ); row[ output.m_stride * i + x ] = ( *functor )( zx, zy, maxIterations ); } } } } for ( int y = 0; y < output.m_height - CellSize; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width - CellSize; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ x + CellSize ]; double p3 = row[ output.m_stride * CellSize + x ]; double p4 = row[ output.m_stride * CellSize + x + CellSize ]; if ( checkThreshold( p1, p2, p3, p4, threshold ) ) { for ( int i = 1; i < CellSize; i++ ) { for ( int j = 1; j < CellSize; j++ ) { double zx = input.m_x + input.m_ca * ( x + j ) + input.m_sa * ( y + i ); double zy = input.m_y - input.m_sa * ( x + j ) + input.m_ca * ( y + i ); row[ output.m_stride * i + x + j ] = ( *functor )( zx, zy, maxIterations ); } } } } } } void interpolate( const Output& output ) { for ( int y = 0; y < output.m_height; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width - CellSize; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ x + CellSize ]; for ( int i = 1; i < CellSize; i++ ) row[ x + i ] = (double)( CellSize - i ) / (double)CellSize * p1 + (double)i / (double)CellSize * p2; } } for ( int y = 0; y < output.m_height - CellSize; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width; x++ ) { double p1 = row[ x ]; double p2 = row[ output.m_stride * CellSize + x ]; for ( int i = 1; i < CellSize; i++ ) row[ output.m_stride * i + x ] = (double)( CellSize - i ) / (double)CellSize * p1 + (double)i / (double)CellSize * p2; } } } #if defined( HAVE_SSE2 ) #if defined( Q_CC_MSVC ) # define ALIGNXMM( var ) __declspec(align(16)) var #else # define ALIGNXMM( var ) var __attribute__((aligned(16))) #endif enum CPUFeatures { MMX = 1, SSE = 2, SSE2 = 4 }; // based on qdrawhelper.cpp static int detectCPUFeatures() { #if defined( __x86_64__ ) || defined( __ia64__ ) || defined( Q_OS_WIN64 ) return MMX | SSE | SSE2; #elif defined( __i386__ ) || defined( _M_IX86 ) int result = 0; #if defined( Q_CC_GNU ) asm( "push %%ebx\n" "pushf\n" "pop %%eax\n" "mov %%eax, %%ebx\n" "xor $0x00200000, %%eax\n" "push %%eax\n" "popf\n" "pushf\n" "pop %%eax\n" "xor %%edx, %%edx\n" "xor %%ebx, %%eax\n" "jz 1f\n" "mov $0x00000001, %%eax\n" "cpuid\n" "1:\n" "pop %%ebx\n" "mov %%edx, %0\n" : "=r" ( result ) : : "%eax", "%ecx", "%edx" ); #elif defined ( Q_OS_WIN ) _asm { push eax push ebx push ecx push edx pushfd pop eax mov ebx, eax xor eax, 00200000h push eax popfd pushfd pop eax mov edx, 0 xor eax, ebx jz skip mov eax, 1 cpuid mov result, edx skip: pop edx pop ecx pop ebx pop eax } #endif int features = 0; if ( result & ( 1 << 23 ) ) features |= MMX; if ( result & ( 1 << 25 ) ) features |= SSE; if ( result & ( 1 << 26 ) ) features |= SSE2; return features; #else return 0; #endif } static const int AvailableCPUFeatures = detectCPUFeatures(); bool isSSE2Available() { return AvailableCPUFeatures & SSE2; } template static inline void calculatePowerSSE2( __m128d& zx, __m128d& zy, __m128d& radius ) { if ( N % 2 == 0 ) { calculatePowerSSE2( zx, zy, radius ); __m128d zxx = _mm_mul_pd( zx, zx ); __m128d zyy = _mm_mul_pd( zy, zy ); __m128d zxy = _mm_mul_pd( zx, zy ); zx = _mm_sub_pd( zxx, zyy ); zy = _mm_add_pd( zxy, zxy ); } else { __m128d zx2 = zx; __m128d zy2 = zy; calculatePowerSSE2( zx2, zy2, radius ); __m128d zxx2 = _mm_mul_pd( zx, zx2 ); __m128d zxy2 = _mm_mul_pd( zx, zy2 ); __m128d zyx2 = _mm_mul_pd( zy, zx2 ); __m128d zyy2 = _mm_mul_pd( zy, zy2 ); zx = _mm_sub_pd( zxx2, zyy2 ); zy = _mm_add_pd( zxy2, zyx2 ); } } template<> inline void calculatePowerSSE2<2>( __m128d& zx, __m128d& zy, __m128d& radius ) { __m128d zxx = _mm_mul_pd( zx, zx ); __m128d zyy = _mm_mul_pd( zy, zy ); __m128d zxy = _mm_mul_pd( zx, zy ); zx = _mm_sub_pd( zxx, zyy ); zy = _mm_add_pd( zxy, zxy ); radius = _mm_add_pd( zxx, zyy ); } template<> inline void calculatePowerSSE2<1>( __m128d& /*zx*/, __m128d& /*zy*/, __m128d& /*radius*/ ) { } template static void adjustSSE2( __m128d& /*zx*/, __m128d& /*zy*/ ); template<> inline void adjustSSE2( __m128d& /*zx*/, __m128d& /*zy*/ ) { } template<> inline void adjustSSE2( __m128d& /*zx*/, __m128d& zy ) { __m128d mask = _mm_castsi128_pd( _mm_set_epi32( int( 0x80000000 ), 0, int( 0x80000000 ), 0 ) ); zy = _mm_xor_pd( mask, zy ); } template<> inline void adjustSSE2( __m128d& zx, __m128d& zy ) { __m128d mask = _mm_castsi128_pd( _mm_set_epi32( 0x7fffffff, int( 0xffffffff ), 0x7fffffff, int( 0xffffffff ) ) ); zx = _mm_and_pd( zx, mask ); zy = _mm_and_pd( zy, mask ); } template<> inline void adjustSSE2( __m128d& /*zx*/, __m128d& zy ) { __m128d mask = _mm_castsi128_pd( _mm_set_epi32( 0x7fffffff, int( 0xffffffff ), 0x7fffffff, int( 0xffffffff ) ) ); zy = _mm_and_pd( zy, mask ); } template static inline bool calculateStepSSE2( int k, __m128d& zx, __m128d& zy, __m128d cx, __m128d cy, __m128d rmax, int count[], double final[] ) { adjustSSE2( zx, zy ); __m128d radius; calculatePowerSSE2( zx, zy, radius ); int mask = _mm_movemask_pd( _mm_cmpge_pd( radius, rmax ) ); zx = _mm_add_pd( zx, cx ); zy = _mm_add_pd( zy, cy ); if ( mask ) { if ( mask & 1 ) { if ( !count[ 0 ] ) { count[ 0 ] = k; _mm_storel_pd( &final[ 0 ], radius ); if ( count[ 1 ] ) return true; } } if ( mask & 2 ) { if ( !count[ 1 ] ) { count[ 1 ] = k; _mm_storeh_pd( &final[ 1 ], radius ); if ( count[ 0 ] ) return true; } } } return false; } template class RepeatStepsSSE2 { public: static inline bool calculate( int k, __m128d& zx, __m128d& zy, __m128d cx, __m128d cy, __m128d rmax, int count[], double final[] ) { if ( calculateStepSSE2( k, zx, zy, cx, cy, rmax, count, final ) ) return true; if ( RepeatStepsSSE2::calculate( k - 1, zx, zy, cx, cy, rmax, count, final ) ) return true; return false; } static const int Steps = STEPS; }; template class RepeatStepsSSE2 { public: static inline bool calculate( int /*k*/, __m128d& /*zx*/, __m128d& /*zy*/, __m128d /*cx*/, __m128d /*cy*/, __m128d /*rmax*/, int /*count*/[], double /*final*/[] ) { return false; } }; template class AutoStepsSSE2 : public RepeatStepsSSE2 { }; template static inline void calculateSSE2( double result[], double x[], double y[], double cx[], double cy[], int maxIterations ) { __m128d zx = _mm_load_pd( x ); __m128d zy = _mm_load_pd( y ); __m128d rcx = _mm_load_pd( cx ); __m128d rcy = _mm_load_pd( cy ); __m128d rmax = _mm_set1_pd( BailoutRadius ); int count[ 2 ] = { 0, 0 }; double final[ 2 ] = { 0.0, 0.0 }; for ( int k = maxIterations; k > 0; k -= AutoStepsSSE2::Steps ) { if ( AutoStepsSSE2::calculate( k, zx, zy, rcx, rcy, rmax, count, final ) ) break; } result[ 0 ] = count[ 0 ] ? calculateResult( maxIterations, count[ 0 ], final[ 0 ], N ) : 0.0; result[ 1 ] = count[ 1 ] ? calculateResult( maxIterations, count[ 1 ], final[ 1 ], N ) : 0.0; } template class MandelbrotFunctorSSE2 : public FunctorSSE2, public MandelbrotFastParams { public: MandelbrotFunctorSSE2( const MandelbrotFastParams& params ) : MandelbrotFastParams( params ) { } void operator()( double result[], double zx[], double zy[], int maxIterations ) { calculateSSE2( result, zx, zy, zx, zy, maxIterations ); } }; template class JuliaFunctorSSE2 : public FunctorSSE2, public JuliaFastParams { public: JuliaFunctorSSE2( const JuliaFastParams& params ) : JuliaFastParams( params ) { } void operator()( double result[], double zx[], double zy[], int maxIterations ) { ALIGNXMM( double cx[ 2 ] ) = { m_cx, m_cx }; ALIGNXMM( double cy[ 2 ] ) = { m_cy, m_cy }; calculateSSE2( result, zx, zy, cx, cy, maxIterations ); } }; FunctorSSE2* createMandelbrotFunctorSSE2( int exponent, Variant variant ) { return FastFunctorFactory::create( exponent, variant, MandelbrotFastParams() ); } FunctorSSE2* createJuliaFunctorSSE2( double cx, double cy, int exponent, Variant variant ) { return FastFunctorFactory::create( exponent, variant, JuliaFastParams( cx, cy ) ); } void generatePreviewSSE2( const Input& input, const Output& output, FunctorSSE2* functor, int maxIterations ) { ALIGNXMM( double zx[ 2 ] ); ALIGNXMM( double zy[ 2 ] ); double result[ 2 ]; for ( int y = 0; y < output.m_height; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width; x += CellSize ) { zx[ 0 ] = input.m_x + input.m_ca * x + input.m_sa * y; zx[ 1 ] = zx[ 0 ] + input.m_ca * CellSize; zy[ 0 ] = input.m_y - input.m_sa * x + input.m_ca * y; zy[ 1 ] = zy[ 0 ] - input.m_sa * CellSize; ( *functor )( result, zx, zy, maxIterations ); row[ x ] = result[ 0 ]; if ( x + CellSize < output.m_width ) row[ x + CellSize ] = result[ 1 ]; } } } void generateDetailsSSE2( const Input& input, const Output& output, FunctorSSE2* functor, int maxIterations, double threshold ) { ALIGNXMM( double zx[ 2 ] ); ALIGNXMM( double zy[ 2 ] ); double result[ 2 ]; for ( int y = 0; y < output.m_height; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width - CellSize; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ x + CellSize ]; if ( checkThreshold( p1, p2, threshold ) ) { for ( int i = 1; i < CellSize; i += 2 ) { zx[ 0 ] = input.m_x + input.m_ca * ( x + i ) + input.m_sa * y; zx[ 1 ] = zx[ 0 ] + input.m_ca; zy[ 0 ] = input.m_y - input.m_sa * ( x + i ) + input.m_ca * y; zy[ 1 ] = zy[ 0 ] - input.m_sa; ( *functor )( result, zx, zy, maxIterations ); row[ x + i ] = result[ 0 ]; if ( i + 1 < CellSize ) row[ x + i + 1 ] = result[ 1 ]; } } } } for ( int y = 0; y < output.m_height - CellSize; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ output.m_stride * CellSize + x ]; if ( checkThreshold( p1, p2, threshold ) ) { for ( int i = 1; i < CellSize; i += 2 ) { zx[ 0 ] = input.m_x + input.m_ca * x + input.m_sa * ( y + i ); zx[ 1 ] = zx[ 0 ] + input.m_sa; zy[ 0 ] = input.m_y - input.m_sa * x + input.m_ca * ( y + i ); zy[ 1 ] = zy[ 0 ] + input.m_ca; ( *functor )( result, zx, zy, maxIterations ); row[ output.m_stride * i + x ] = result[ 0 ]; if ( i + 1 < CellSize ) row[ output.m_stride * ( i + 1 ) + x ] = result[ 1 ]; } } } } for ( int y = 0; y < output.m_height - CellSize; y += CellSize ) { double* row = output.m_buffer + output.m_stride * y; for ( int x = 0; x < output.m_width - CellSize; x += CellSize ) { double p1 = row[ x ]; double p2 = row[ x + CellSize ]; double p3 = row[ output.m_stride * CellSize + x ]; double p4 = row[ output.m_stride * CellSize + x + CellSize ]; if ( checkThreshold( p1, p2, p3, p4, threshold ) ) { for ( int i = 1; i < CellSize; i++ ) { for ( int j = 1; j < CellSize; j += 2 ) { zx[ 0 ] = input.m_x + input.m_ca * ( x + j ) + input.m_sa * ( y + i ); zx[ 1 ] = zx[ 0 ] + input.m_ca; zy[ 0 ] = input.m_y - input.m_sa * ( x + j ) + input.m_ca * ( y + i ); zy[ 1 ] = zy[ 0 ] - input.m_sa; ( *functor )( result, zx, zy, maxIterations ); row[ output.m_stride * i + x + j ] = result[ 0 ]; if ( j + 1 < CellSize ) row[ output.m_stride * i + x + j + 1 ] = result[ 1 ]; } } } } } } #endif // defined( HAVE_SSE2 ) } // namespace GeneratorCore fraqtive-0.4.8.1/src/generatorcore.h000066400000000000000000000054121440132223600173010ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef GENERATORCORE_H #define GENERATORCORE_H #if defined( Q_OS_WIN64 ) && defined( _M_X64 ) #undef HAVE_SSE2 #endif namespace GeneratorCore { static const int MaxExponent = 6; enum Variant { NormalVariant, ConjugateVariant, AbsoluteVariant, AbsoluteImVariant }; class Functor { public: virtual ~Functor() {} virtual double operator()( double zx, double zy, int maxIterations ) = 0; }; Functor* createMandelbrotFunctor( double exponent, Variant variant ); Functor* createJuliaFunctor( double cx, double cy, double exponent, Variant variant ); Functor* createMandelbrotFastFunctor( int exponent, Variant variant ); Functor* createJuliaFastFunctor( double cx, double cy, int exponent, Variant variant ); static const int CellSize = 3; struct Input { double m_x; double m_y; double m_sa; double m_ca; }; struct Output { double* m_buffer; int m_stride; int m_width; // M * CellSize + 1 int m_height; // N * CellSize + 1 }; void generatePreview( const Input& input, const Output& output, Functor* functor, int maxIterations ); void generateDetails( const Input& input, const Output& output, Functor* functor, int maxIterations, double threshold ); void interpolate( const Output& output ); #if defined( HAVE_SSE2 ) bool isSSE2Available(); class FunctorSSE2 { public: virtual ~FunctorSSE2() {} virtual void operator()( double result[], double zx[], double zy[], int maxIterations ) = 0; }; FunctorSSE2* createMandelbrotFunctorSSE2( int exponent, Variant variant ); FunctorSSE2* createJuliaFunctorSSE2( double cx, double cy, int exponent, Variant variant ); void generatePreviewSSE2( const Input& input, const Output& output, FunctorSSE2* functor, int maxIterations ); void generateDetailsSSE2( const Input& input, const Output& output, FunctorSSE2* functor, int maxIterations, double threshold ); #endif // defined( HAVE_SSE2 ) } // namespace GeneratorCore #endif fraqtive-0.4.8.1/src/gradientdialog.cpp000066400000000000000000000041671440132223600177600ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "gradientdialog.h" #include #include "datastructures.h" #include "iconloader.h" GradientDialog::GradientDialog( QWidget* parent ) : QDialog( parent ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "gradient", 22 ) ); m_ui.promptLabel->setText( tr( "Edit the color gradient:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); } GradientDialog::~GradientDialog() { } void GradientDialog::setGradient( const Gradient& gradient ) { m_ui.gradient->setGradient( gradient ); m_ui.buttonBox->button( QDialogButtonBox::Apply )->setEnabled( false ); } Gradient GradientDialog::gradient() const { return m_ui.gradient->gradient(); } void GradientDialog::accept() { emit applyGradient( gradient() ); QDialog::accept(); } void GradientDialog::on_gradient_gradientChanged() { m_ui.buttonBox->button( QDialogButtonBox::Apply )->setEnabled( true ); } void GradientDialog::on_buttonBox_clicked( QAbstractButton* button ) { if ( button == m_ui.buttonBox->button( QDialogButtonBox::Apply ) ) { emit applyGradient( gradient() ); m_ui.buttonBox->button( QDialogButtonBox::Apply )->setEnabled( false ); } } fraqtive-0.4.8.1/src/gradientdialog.h000066400000000000000000000026661440132223600174270ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef GRADIENTDIALOG_H #define GRADIENTDIALOG_H #include #include "ui_gradientdialog.h" class GradientDialog : public QDialog { Q_OBJECT public: GradientDialog( QWidget* parent ); ~GradientDialog(); public: void setGradient( const Gradient& gradient ); Gradient gradient() const; signals: void applyGradient( const Gradient& gradient ); public: // overrides void accept(); private slots: void on_gradient_gradientChanged(); void on_buttonBox_clicked( QAbstractButton* button ); private: Ui::GradientDialog m_ui; }; #endif fraqtive-0.4.8.1/src/gradientdialog.ui000066400000000000000000000057371440132223600176170ustar00rootroot00000000000000 GradientDialog 0 0 525 450 Edit Gradient 0 0 10 true Qt::Horizontal 9 Qt::Horizontal QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
GradientEditor QWidget
gradienteditor.h
1
buttonBox accepted() GradientDialog accept() 248 254 157 274 buttonBox rejected() GradientDialog reject() 316 260 286 274
fraqtive-0.4.8.1/src/gradienteditor.cpp000066400000000000000000000041271440132223600200030ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "gradienteditor.h" #include "datafunctions.h" GradientEditor::GradientEditor( QWidget* parent ) : QWidget( parent ) { m_ui.setupUi( this ); m_ui.shadeRed->setShadeColor( QColor( 255, 0, 0 ) ); m_ui.shadeGreen->setShadeColor( QColor( 0, 255, 0 ) ); m_ui.shadeBlue->setShadeColor( QColor( 0, 0, 255 ) ); } GradientEditor::~GradientEditor() { } void GradientEditor::setGradient( const Gradient& gradient ) { m_ui.shadeRed->setPoints( gradient.red() ); m_ui.shadeGreen->setPoints( gradient.green() ); m_ui.shadeBlue->setPoints( gradient.blue() ); } Gradient GradientEditor::gradient() const { Gradient gradient; gradient.setRed( m_ui.shadeRed->points() ); gradient.setGreen( m_ui.shadeGreen->points() ); gradient.setBlue( m_ui.shadeBlue->points() ); return gradient; } void GradientEditor::on_shadeRed_pointsChanged() { updateGradient(); } void GradientEditor::on_shadeGreen_pointsChanged() { updateGradient(); } void GradientEditor::on_shadeBlue_pointsChanged() { updateGradient(); } void GradientEditor::updateGradient() { QGradientStops stops = DataFunctions::calculateGradientStops( gradient() ); m_ui.gradient->setGradientStops( stops ); emit gradientChanged(); } fraqtive-0.4.8.1/src/gradienteditor.h000066400000000000000000000026751440132223600174560ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef GRADIENTEDITOR_H #define GRADIENTEDITOR_H #include #include "ui_gradienteditor.h" class Gradient; class GradientEditor : public QWidget { Q_OBJECT public: GradientEditor( QWidget* parent ); ~GradientEditor(); public: void setGradient( const Gradient& gradient ); Gradient gradient() const; signals: void gradientChanged(); private slots: void on_shadeRed_pointsChanged(); void on_shadeGreen_pointsChanged(); void on_shadeBlue_pointsChanged(); private: void updateGradient(); private: Ui::GradientEditor m_ui; }; #endif fraqtive-0.4.8.1/src/gradienteditor.ui000066400000000000000000000023671440132223600176420ustar00rootroot00000000000000 GradientEditor 0 0 459 309 5 0 0 0 0 ShadeWidget QWidget
shadewidget.h
1
fraqtive-0.4.8.1/src/guidedialog.cpp000066400000000000000000000103341440132223600172510ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "guidedialog.h" #include "iconloader.h" #include "xmlui/gradientwidget.h" #include "xmlui/builder.h" #include "xmlui/toolstrip.h" #include #include #include #include #include GuideDialog::GuideDialog( QWidget* parent ) : QDialog( parent ) { setAttribute( Qt::WA_DeleteOnClose, true ); setWindowTitle( tr( "Quick Guide" ) ); QAction* action; action = new QAction( IconLoader::icon( "back" ), tr( "Back" ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( goBack() ) ); setAction( "goBack", action ); action = new QAction( IconLoader::icon( "forward" ), tr( "Forward" ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( goForward() ) ); setAction( "goForward", action ); action = new QAction( IconLoader::icon( "home" ), tr( "Home" ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( goHome() ) ); setAction( "goHome", action ); loadXmlUiFile( ":/resources/guidedialog.xml" ); XmlUi::Builder* builder = new XmlUi::Builder( this ); builder->addClient( this ); QVBoxLayout* topLayout = new QVBoxLayout( this ); topLayout->setMargin( 0 ); topLayout->setSpacing( 0 ); XmlUi::GradientWidget* promptWidget = new XmlUi::GradientWidget( this ); topLayout->addWidget( promptWidget ); QHBoxLayout* promptLayout = new QHBoxLayout( promptWidget ); promptLayout->setSpacing( 10 ); QLabel* promptPixmap = new QLabel( promptWidget ); promptPixmap->setPixmap( IconLoader::pixmap( "help", 22 ) ); promptLayout->addWidget( promptPixmap ); QLabel* promptLabel = new QLabel( promptWidget ); promptLabel->setWordWrap( true ); promptLabel->setText( tr( "Quick guide to Fraqtive:" ) ); promptLabel->setMinimumWidth( 350 ); promptLabel->setFixedHeight( promptLabel->heightForWidth( 350 ) ); promptLayout->addWidget( promptLabel, 1 ); QFrame* separator = new QFrame( this ); separator->setFrameStyle( QFrame::HLine | QFrame::Sunken ); topLayout->addWidget( separator ); QVBoxLayout* mainLayout = new QVBoxLayout(); mainLayout->setMargin( 9 ); mainLayout->setSpacing( 4 ); topLayout->addLayout( mainLayout ); XmlUi::ToolStrip* strip = new XmlUi::ToolStrip( this ); builder->registerToolStrip( "stripGuide", strip ); mainLayout->addWidget( strip ); m_browser = new QTextBrowser( this ); m_browser->setOpenExternalLinks( true ); mainLayout->addWidget( m_browser, 1 ); connect( m_browser, SIGNAL( historyChanged() ), this, SLOT( updateActions() ) ); mainLayout->addSpacing( 7 ); QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Horizontal, this ); mainLayout->addWidget( buttonBox ); buttonBox->button( QDialogButtonBox::Ok )->setText( tr( "&OK" ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); updateActions(); goHome(); } GuideDialog::~GuideDialog() { } void GuideDialog::goBack() { m_browser->backward(); } void GuideDialog::goForward() { m_browser->forward(); } void GuideDialog::goHome() { m_browser->setSource( QUrl::fromLocalFile( ":/tutorial/index.html" ) ); } void GuideDialog::updateActions() { action( "goBack" )->setEnabled( m_browser->isBackwardAvailable() ); action( "goForward" )->setEnabled( m_browser->isForwardAvailable() ); } fraqtive-0.4.8.1/src/guidedialog.h000066400000000000000000000024001440132223600167110ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef GUIDEDIALOG_H #define GUIDEDIALOG_H #include "xmlui/client.h" #include class QTextBrowser; class GuideDialog : public QDialog, public XmlUi::Client { Q_OBJECT public: GuideDialog( QWidget* parent ); ~GuideDialog(); private slots: void goBack(); void goForward(); void goHome(); void updateActions(); private: QTextBrowser* m_browser; }; #endif fraqtive-0.4.8.1/src/iconloader.cpp000066400000000000000000000073721440132223600171230ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "iconloader.h" #include #include #include QPixmap IconLoader::pixmap( const QString& name, int size ) { QString key = QString( "pixmap:%1:%2" ).arg( name ).arg( size ); QPixmap pixmap; if ( QPixmapCache::find( key, pixmap ) ) return pixmap; QString path = QString( ":/icons/%1-%2.png" ).arg( name ).arg( size ); pixmap = QPixmap( path ); if ( !pixmap.isNull() ) QPixmapCache::insert( key, pixmap ); return pixmap; } QPixmap IconLoader::overlayedPixmap( const QString& name, const QString& overlay, int size ) { QString key = QString( "overlayed:%1:%2:%3" ).arg( name ).arg( overlay ).arg( size ); QPixmap resultPixmap; if ( QPixmapCache::find( key, resultPixmap ) ) return resultPixmap; QPixmap basePixmap = pixmap( name, size ); QPixmap overlayPixmap = pixmap( overlay, size ); resultPixmap = QPixmap( size, size ); resultPixmap.fill( QColor( 0, 0, 0, 0 ) ); QPainter painter( &resultPixmap ); painter.drawPixmap( 0, 0, basePixmap ); painter.drawPixmap( 0, 0, overlayPixmap ); QPixmapCache::insert( key, resultPixmap ); return resultPixmap; } QPixmap IconLoader::overlayedPixmap( const QString& name, const QString& overlay1, const QString& overlay2, int size ) { QString key = QString( "overlayed2:%1:%2:%3:%4" ).arg( name ).arg( overlay1 ).arg( overlay2 ).arg( size ); QPixmap resultPixmap; if ( QPixmapCache::find( key, resultPixmap ) ) return resultPixmap; QPixmap basePixmap = pixmap( name, size ); QPixmap overlay1Pixmap = pixmap( overlay1, size ); QPixmap overlay2Pixmap = pixmap( overlay2, size ); resultPixmap = QPixmap( size, size ); resultPixmap.fill( QColor( 0, 0, 0, 0 ) ); QPainter painter( &resultPixmap ); painter.drawPixmap( 0, 0, basePixmap ); painter.drawPixmap( 0, 0, overlay1Pixmap ); painter.drawPixmap( 0, 0, overlay2Pixmap ); QPixmapCache::insert( key, resultPixmap ); return resultPixmap; } QIcon IconLoader::icon( const QString& name ) { QIcon icon; const int sizes[ 4 ] = { 16, 22, 32, 48 }; for ( int i = 0; i < 4; i++ ) { QString path = QString( ":/icons/%1-%2.png" ).arg( name ).arg( sizes[ i ] ); if ( QFile::exists( path ) ) icon.addFile( path, QSize( sizes[ i ], sizes[ i ] ) ); } return icon; } QIcon IconLoader::overlayedIcon( const QString& name, const QString& overlay ) { QIcon icon; const int sizes[ 4 ] = { 16, 22, 32, 48 }; for ( int i = 0; i < 4; i++ ) { QString imagePath = QString( ":/icons/%1-%2.png" ).arg( name ).arg( sizes[ i ] ); QString overlayPath = QString( ":/icons/%1-%2.png" ).arg( overlay ).arg( sizes[ i ] ); if ( QFile::exists( imagePath ) && QFile::exists( overlayPath ) ) icon.addPixmap( overlayedPixmap( name, overlay, sizes[ i ] ) ); } return icon; } fraqtive-0.4.8.1/src/iconloader.h000066400000000000000000000026031440132223600165600ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef ICONLOADER_H #define ICONLOADER_H #include #include class IconLoader { public: static QPixmap pixmap( const QString& name, int size = 16 ); static QPixmap overlayedPixmap( const QString& name, const QString& overlay, int size = 16 ); static QPixmap overlayedPixmap( const QString& name, const QString& overlay1, const QString& overlay2, int size = 16 ); static QIcon icon( const QString& name ); static QIcon overlayedIcon( const QString& name, const QString& overlay ); }; #endif fraqtive-0.4.8.1/src/icons.qrc000066400000000000000000000040021440132223600161050ustar00rootroot00000000000000 icons/about-16.png icons/arrows-16.png icons/back-16.png icons/back-22.png icons/configure-16.png icons/copy-16.png icons/copy-22.png icons/delete-16.png icons/donate-16.png icons/edit-16.png icons/edit-22.png icons/forward-16.png icons/forward-22.png icons/fraqtive-16.png icons/fraqtive-22.png icons/fraqtive-32.png icons/fraqtive-48.png icons/fullscreen-16.png icons/fullscreen-22.png icons/generate-image-16.png icons/generate-image-22.png icons/generate-series-16.png icons/generate-series-22.png icons/gradient-16.png icons/gradient-22.png icons/help-16.png icons/help-22.png icons/home-16.png icons/home-22.png icons/info-16.png icons/load-bookmark-16.png icons/load-bookmark-22.png icons/load-preset-16.png icons/load-preset-22.png icons/rename-16.png icons/rename-22.png icons/save-16.png icons/save-22.png icons/save-bookmark-16.png icons/save-bookmark-22.png icons/save-preset-16.png icons/save-preset-22.png icons/view2d-16.png icons/view2d-22.png icons/view3d-16.png icons/view3d-22.png icons/web-16.png fraqtive-0.4.8.1/src/icons/000077500000000000000000000000001440132223600154025ustar00rootroot00000000000000fraqtive-0.4.8.1/src/icons/about-16.png000066400000000000000000000013411440132223600174450ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  #utIME 1q,(nIDATxuKTQ?;w^Nj$P@iUܵh1HhQi WIFe2B QL=Np9(CiWS2HF$|&(T$/w_3VՌ,P}g8RT᧧OsX$<6ǥeO5HK g-?7DY?n<@F nIQvL/eY,X3nA윋@^2E9M5ao[R`vIBMCX֋*dkK YТ\ Z+;͓)J `i!wD!Zæ UL(D҆װ"Z  CiGYH́I}a+/V@rcGs"D}"YtCS2UDtWfj;W.7hm'^̳%:nOXëJ)~%j ټa;2rg56hK)!g1/U-IENDB`fraqtive-0.4.8.1/src/icons/arrows-16.png000066400000000000000000000005731440132223600176560ustar00rootroot00000000000000PNG  IHDRsO/bKGD@ pHYs  ~tIME LJ6IDATxڵQm0e1Tkxyv +uPe?"pjGooW7 /֋;}=4B\pED5M7`Cjn}<{bn<)(b^~ݪrB8&U 1 b%D) e<D ;H4Xe.aِp#pi *ב̿C24Vuj[{V IENDB`fraqtive-0.4.8.1/src/icons/back-16.png000066400000000000000000000006151440132223600172360ustar00rootroot00000000000000PNG  IHDRabKGD@ pHYs  tIME ƒctEXtCommentCreated with The GIMPd%nIDATxڵ10Eٽ9H$p O@9ԟ)c;Ld+Z)_ҼQe Tѩ33E jL%}a "4͓/0jL4;|]CHr3~$d0 '#}|P{nSߤ>$ C#콈Z)Hp)L0X[% $v +.8 bg߶ͽNu3ҹmC4>?~+ IENDB`fraqtive-0.4.8.1/src/icons/back-22.png000066400000000000000000000024561440132223600172400ustar00rootroot00000000000000PNG  IHDRj pHYs ,tIME 4ٸPLTEeeeeeeeeeeee2h2i7eeeeeeeeeeeeeObeee2h2i2geee2i2i5fVby9eeee9e2h2i2hAc2i2i8e2h2h7f3fFc9f8eIcAfFcDeBfCf>c2h2i2h2i2i2h2f4g2f6f3e2i2g3h2h2i4h2h4g4g2g2f2h2h2i2j2i2h4i2g4i2k2l2j4lAr3l5l=p5k=p4k7s>w>w?wFzFzN~WH{2o2o6y7z8q9z9~:;;CMOQST[`benbKGDHIDATrAῧ{Vv&I% Q= Ò! rkvm84=,o  pznsP@͓E^uٞAӨ+ >[;XG\2|{6Eb_X(KQf=,hV)@s[J#7ս!,(zyyc(/p]W|@}4 L/Ȳx~`[ȼTdU^ğ|s:^7M0lB 17WC$88hq]TrSEQ)~p)LS8Yyhhbv{Mߏ! F8(2g6j&N9wn yׇ$I+:>^|\.~8N_nje-g$8KK >o}̛/>]F''}9]cQ @ATmeeԦ4!z= Êʭ!d$ j9V*1<< G80&q71M_k},8xo.-`)$e/-JZS?hQd?t Ԥ(FƢģ•\t܋Ķo\T\ϑGr?r*%UD"ʤHƢkNƾ:"IENDB`fraqtive-0.4.8.1/src/icons/delete-16.png000066400000000000000000000013431440132223600175770ustar00rootroot00000000000000PNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<uIDATx}MHTQwә2-ODVh]PDADDm,)D !P(* eU~3{om'~?չhm87ƐAH&= |=Z^J/\<uE9CӤc^87;pO$ B!5Ғ,[^V(ۮ҆?dp>"##9~ʙN6h# X\O Ftv85@R?/f|h^fqS :@`Qxw7j5q#*qeeq^5CbĎ*̷ n}L[ʑKV"D6bxԈqVdg'3k8~ p)Jh@I.+?Qo~h2/)DZl!4HR -sX~ @]00d:cp֞(E,ڷaf^~ьcxBmLH'arP k?h=Sc++lx@IG秛_+z@x"|C8aoѩDMm] A#D#$>f_^n+IENDB`fraqtive-0.4.8.1/src/icons/donate-16.png000066400000000000000000000012371440132223600176110ustar00rootroot00000000000000PNG  IHDRڭgAMA7tEXtSoftwareAdobe ImageReadyqe<DPLTE@Xoy6aFHGHUvxE<BZkx>DFwz>J NSp~>FkZ8\\ad_v`Yj|jfqi"1~&U')IN2TT  )(_2FM7u.tRNS @P`````ppp_IDATc`iÌ" !"uvc唕<ݜó,dCҳ2 3+DA+" RCAR@ ݀ b}$rBpLHOH3 (FClUUL!|VK;mnM3 fcc`F!0wIENDB`fraqtive-0.4.8.1/src/icons/edit-16.png000066400000000000000000000012511440132223600172600ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME  )b6IDATxڅKTQ~u\3,̠DXJhUЮEH}B,VZ8k~xј1w<==G,|YVmI+Z ί<$ϖf<\5 RfGw%޲Uz^8Cא Wj|[N4Bgr`CGL{ '<}~545ׂbs!Fd|5~t7@4 $1v&(V CC Wmb?$IT4MDMFv0t(=obtY{a桥;'oQ?AF#Tʶ=W՚4!¶<׳V,@IB)zZZx.nF+&8Af]t_Ai#ҫ$j_sȋc$(Bd4M}ulm,/Ru.fJ6bX|b^>=6@TĶm|;(ΌPa;( I*1 )U[2;AյufguF[ek<jT@,IENDB`fraqtive-0.4.8.1/src/icons/edit-22.png000066400000000000000000000017661440132223600172700ustar00rootroot00000000000000PNG  IHDRj gAMA7tEXtSoftwareAdobe ImageReadyqe<+PLTE.;d4ilzjm{swtxmpsb|jq_ȶ]:dAgtx]R ͱZm@Ҍiկ׬r*x+߉!ߙ`ⴉZ B8긑NÎԻf _ʉѬƀzɉqֵ9ҠE/t/$/ 6E $ K^"*67ANa/QZQI%wAb^@tRNS @`߄Z8B6IDATNA7ígTc6A NO+%4jEr!6Bvofzy2³w0=껽W?|< pos~]@/{r/a["d~" ]ie(mWi8}'D`:,r gx$tq-:D0~ bbeXl?Wu\D&Yagsև mK@ȹ5q`|F a1ߎy-8eRJHf~iIENDB`fraqtive-0.4.8.1/src/icons/forward-16.png000066400000000000000000000006061440132223600200020ustar00rootroot00000000000000PNG  IHDRabKGD@ pHYs  tIME ͗tEXtCommentCreated with The GIMPd%nIDATxڵ0 E$S `d @f`'Iel P_Svi ] &" $6 D`B "AYU (I<2Q#ao2OS}d'` XaxPm'8 [,#i!MSs`̸MH!? ʪT n1A8q_G̲LnL%E=Xm&_%f>(y8So RIENDB`fraqtive-0.4.8.1/src/icons/forward-22.png000066400000000000000000000024121440132223600177740ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs ,tIME 'VnIDATxڍUkkU~Ι9sٝt{٦RۚvP V"ikA "*~oE_$hEEjtkZ16޳ٹѶ< s9}Cpd_4>xpy䠇>bo-A7\#<8\ %,$%&h ,ğe bk"o]6 wD4&1Y`]AP09lŅ <~]7g-+wD+؞V3~ AP o4ЛP1?0Uu+'NA_8hY\>\=-",%1p(bh,$nP)%!J&~^69h!9~8DZ'j=vSJҶpB oDA|d\ @R}iS(OeK˽":(*42IENDB`fraqtive-0.4.8.1/src/icons/fraqtive-16.png000066400000000000000000000013531440132223600201570ustar00rootroot00000000000000PNG  IHDRh6sRGB pHYs  IDAT(UKHTQsc)QFgL ).E6"mZT*Eh٢pF;B( Q'Squ=wCR 2 0F*R2RqXf@€(0 {8 #`@8#Q(0&@xwttՉ]FUeҎ/Ů \&|<'銔K]7F<~cn ˶u~/+nsPj0%}ZB9?9vy-pSN8u5(fãJHBij`Uo?|ucq1nIZY&`+pU1?`@BP*xVyvjA3sg{N<'hlnV^-h"|G(CӇӻrf?\/Ё5(mLqݖIv?Z$Օ؄AmR_27r9 `kIfJzo&f2HEZFJEJJUX+7D Hi0VJ+UT,}>X*`Q)AjkheJ*((`\b,<|&IENDB`fraqtive-0.4.8.1/src/icons/fraqtive-22.png000066400000000000000000000021741440132223600201560ustar00rootroot00000000000000PNG  IHDRKlsRGB pHYs  !IDAT8mKlU眙sw{pK[(@i>pC…LMXaH@LjBbL4Q\ F. T - ԶsΌ{%dmQ+jֈ֨FIkJG>>P+DfPք o! GCKY3ZR["N-5DCƑ;np?T+PjVG$7%)屫ӷtMUDi*%Bc,GƑMYab {!,)n||OnYH 8CD4 "K %r 9ܟ5T&FdžO=kAY5kQ~Ac,Kâ%mH9^ޟƇO (uv=͛+dځMI`VV XTYL#랅d'ٜ9cs,kvT=*5Vu+ǰ~]9+&PG |_im{'ΞYrݯ_6k@b~y/ZlJ|l// ._}kyyԎmՆ)DkBrIUnШyמk7.đazyiY{zܷk^OnzG$$r%-щU~h  w .a`Ja_uNw.)mܶǣ9wPW'{)aefZ5I*><ø!\ob鱭[+oNW{V9d %t(<[~{^x>pO~:b'>"+"Qb`"e!ˊiA90ӻd`}2GJqB`h ܮch37ɳl:LO(,D@XDXccՕIkL6fY#M@!afdͨu!YpXRKkYBBYD (̊DDfucBVϔ} >g_Cj-IENDB`fraqtive-0.4.8.1/src/icons/fraqtive-32.png000066400000000000000000000036101440132223600201530ustar00rootroot00000000000000PNG  IHDR sRGB pHYs  -IDATHDžk]Uc}ιwtfth6E*G&(`H* VbHD Gb|`LSACD N)tDɎ]830:ݷwN M*2c$43p1)DvDQUOr̞\p74H## d}~2}m4:晵a#:|TT"DcvĎyGZccϮD2I~ܛ Em|bwk.[H;tK)cFקWP|p.s.1z!pEp-72zk`Uطoۿ׿c-V;PÒ !Ty?>3?=.)6_xѪ< <9WnjzW %Wy'buk}Jnbk>5:=bOγ˜}C_Ϩ^P- \;겝>zM9:1_IGH@HD󹯎<灊8B]Яv?Ȏccw ԡI8nLhj|<3f5>~{{[kޏx6mp`Q?w5 6z+Z^|`wooE_;J_9:/])S53B&s̋8 qEBcG̟P%Y1,X?R~hdXO_u?oʹ+ 7N}fg'hsҍId)n3+6;Jk_ݳWz+.`DTjvϥ(x'a0sU7>oRz+s#GlD@%))vcIJ]VO:/_{aEm-I?{ǶFp55fw^z.`8!7iÙciCcxu۸sSϧ$Z `LEB=#:F( lռe>9sZG>z['"$IV Rw5{&,&3s-dǟ:ơ<6oݲ KBORFI}76>m3uqxdG׀Ĩ+׶}1><3S(Bs H Џ*)2&ҤD- gV+it|7!1LN3svlb7R(ۢ%"!sTmm*rWrL'~2k/yi.V-b fP4#c5363%T3QbZ ]T!oLqߴ4[B씱RL+lVA3 cjHbĦj,IUS|)6˓]^LM҉RGW}fJlfFFԯ 'ڙ씩RTIĩ(rȐ M҈oFLy1]I$J9 %E$huE3 2#CRW%#E%"!"?˚+_(;IENDB`fraqtive-0.4.8.1/src/icons/fraqtive-48.png000066400000000000000000000067331440132223600201730ustar00rootroot00000000000000PNG  IHDR00`nsRGB pHYs   IDATXÝk]uc;wƏ ~02!ĥ!8<1MLJjG5ZC$"奨iZ*i \Å`%)F`ccpl`ug9{ܙ;ao]:w>{|31|R9""Ry0h9'D C!"Z ,FX-]W: "EQ(  9ЅRP.@D&"D&bb&bU/{/H(^DBQx%qPgyU/(DĆزI"Dw΋Q "W@ 1eA7щ!:HL`kllLos&%9zQ+w"zO1h d:4H]X!^D4HNc-kLQC+&Wg}E GG1tON,,-aŽc0[`Q!b_J|_fӊ ϡ0bcu,ˉӉa6Ć)2[Jb$1vrZwuJ" qw)y;8&l-kLdllLl)((M܋έ?6m+SPĘ0&&b4KhBFȋ0Y&k"iB>zou+GgT ; yiw:C]X*&,&EZ$$q}G?_ܗ>Y*@1B utEhޡA'^H] &[.U'yT&=%n`V2Gj6ԋ4>**,z0up` BYJb.Z6đ8u?7WEykʫVM_~v />TY1a98v1rGZ*3cG-dDf4`d)Mv΃|;yhדlT\WRC⟼Z;s'JΛ)a\ıVb&2l #e a4zRLK)4|]_ۻozbN4jemt랸o~MeVLSKrÖMdLb'AcXhLb_K)*`hco?yGC ?E05&bX.fS$à Ȍq"ҁ1t}z x?UKLju2m*ZPa&G&ZAsVtzœcU&G6?76 r¡[."C$8B۔4au+ʱcf&+oO&xlgP<]?X6ؘȘpl)Ĕ$ĈPn|߿gf⶿^S: I7~gk?vŅT@Xq ;ahKRړ%3gygf=O=_طIg*?o^*a&616,c(G\.F5gy1;g+;~Ni$Is}{Uc"{"[9'4PdFk0^;{eźSڴKM鱶*d`Yޏi}2>6k-w}jWu'is2S`NR}yhR@=%MJc$)INVDj5볿 4t{pj\U07;@s0=agꤩOĚU?k}ӾW>89m鱓:|#d5\v'vݮ6򙚛cn*3nf}o0^klQܻ˛ye5})ԛ31UpWaE>U__ΩU+{tz{'^TTv̹ȣPrKg2kW9o?<4tއ[/:?3?70Z]j iK\;'|%k%Vh<#jPHCQ("bxd7}w3h-?[FKky۹s vE 3ur .vAUXF5(Y[n6x͎7|3seg;sx' *4E)L D ("B(zJ^8!Ibˢediq.tdGQQ! `&y2T$E%$E$DETT $E*^( !1*:Gof[k; LTyjDDA@A 󉤨tBE"%DRV%.*(aVY 8(hQU$Q@@A@E P ) :!(v$drxsAERC3v> u 1"h: " PG*ŠUTQPPT ETD<53DW1GR+(Ä b#DCw1"Z\QŚABA@*z`OXx $+1%^T?+0#;wP} VҐ[GH=cҀ`ꆣ:M}S#d@0iy6fhiOc,B]ʟAjiظ=Ksk!ĠTA&'Z|LnfU!xAlLw9c[wK: $}nPDj@h նfߙ|d}w.8ك}@{jQЏߌ F̛īPlzePZ-rA`>]+y|oet5 qV)}σ20W$`vmmBY)(|4㜣Q+FZƖ"AIENDB`fraqtive-0.4.8.1/src/icons/generate-image-16.png000066400000000000000000000013451440132223600212110ustar00rootroot00000000000000PNG  IHDR(-S pHYs  gAMA|Q cHRMz%u0`:o_FwPLTEc%l/t4Iw8X9zDOPSXVZq^ijnrrrtttxxx{{{}~}{ʘثϵ~%etRNS L&IDATcG 5F"<\,5 Ԥ@_@aVYuUEIqA^~XQ?:/(8Z ,P.p2׎t ))d갱s[8ATRlyMUzb`EIIg;}qaA@ 33-=AF (Pj5 AA)P=xK=~:#IENDB`fraqtive-0.4.8.1/src/icons/generate-image-22.png000066400000000000000000000021301440132223600211770ustar00rootroot00000000000000PNG  IHDRj pHYs  gAMA|Q cHRMz%u0`:o_FOPLTE[af':m"k'q+q.7J0w2Z2w67>8~9o:{>BOAAFBBFGpHNYJKMORRWZ`pppqqqsssuuuvvvwwwxxxxyyyyyzzz~~}ݍ޶$UtRNS)+=v`IDATc`훫rb" UDx9٥5iI jJrbB|<`{wڽw[6_rGPÇ@@@@DDDEDDJJJLKKLPUMMMOOOPPOQQQVVUVZaXXW^\\^^^___ba`ektllloootttuuuyxyzzz~~~ưɳĶʽ@0+2tRNS !#20IDATxmUWQLlnDbw(Lpܿ׳ƙ.6AA^[qRK y麘h"D̳7`+<=r0^lOi, x~yyF0Q1uE%cOz2“ɝ%I) n3zQ8DaTFP'IENDB`fraqtive-0.4.8.1/src/icons/gradient-16.png000066400000000000000000000015301440132223600201300ustar00rootroot00000000000000PNG  IHDR(-S pHYs  gAMA|Q cHRMz%u0`:o_FPLTE N3sg% n6~$%"|))/"&#$#"x%$'S'U*xClZV t t v w z ͜ ͞ ͭ ͽ ;Γ M yI u\y%&(xz%%$%&')V`'f-f.z,-,,+,-,--../00g/.-./01*////013[*j0`0a336b1n@tA.=/ 28;<=*e=>?Arde.tRNS>@@AAJS^bppppppqqttue IDATeAAFvp7W(΃x^A;;Nyr/g]/(=A +D@izc_7ќj٫j)b%c2X*-! >wt ن^%@ϥ@Ӝ>/=DFÜA7~oKPLSIENDB`fraqtive-0.4.8.1/src/icons/gradient-22.png000066400000000000000000000017011440132223600201250ustar00rootroot00000000000000PNG  IHDRĴl; pHYs  gAMA|Q cHRMz%u0`:o_F7IDATx[leֽk8dV\ۍ D17ueC;xa2P]1n-3Qb@txLäXִZo'7OpSƬmkMëB5́ڼP`-K ŧNe7jg5,haIǚlvc.OgWX%S=X/٣[Zܜ_|1jzAһӽСWqJr0[z25^~Z?gۺZ?_ørr|%[H2UM"ٯG6TT[mseex̕ `"3"A}CejȥQ)ٜWd8T#|2}XDr-' ICٯH1ѓӴ`!וj#B8 Q4c87ǔvm/ EM+ ZD9WfwbqgMU]D쒉q,dt}U2.oޟ?IIENDB`fraqtive-0.4.8.1/src/icons/help-16.png000066400000000000000000000016331440132223600172670ustar00rootroot00000000000000PNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<-IDATUkU͌h6qͦ$Z)UV-A< OKn"ZA 9j@4Ф6l6&kf޼5~>bwƮGD¾2P7VFKkIP*afN\c]0` #g͎g۱6CZ2/~X1 di9 WaZ2HTPƟ̝;Gő$J)KN)ܫ$aj |&˙1Ϗϖs-(rs4J WJ,=5[~/ӯ^mI ǡafmv:_F,Dk[TfLa*N%95lc>՜zP #,DHuO?iP25Hic`z "ŨOO ,(%wї=7f|nBıfسiP}"dAXNv5,P^7~vC2a Fc ZXѥ 3WK:^>0 <q9@+09f(dẓ2* }ٶ -{asplA6ݦȏ=o5qinv3BZ& Y1Sh-#<7+jݮk\~o#iEWIVҎR)PPkiF 6v%[7o:-1HBlZT-d@+J/+Շ{ϩ77-pRgչŜڝ+%zw{K|7IENDB`fraqtive-0.4.8.1/src/icons/help-22.png000066400000000000000000000022421440132223600172610ustar00rootroot00000000000000PNG  IHDRj gAMA7tEXtSoftwareAdobe ImageReadyqe<yPLTEFJa }ވ$(.>,눗qՎ V Z \)舗$;$eGR"$+,*,6舗IRu+ꈗ̊$6$& M!sՒ3 M,1列̚=PP$q2r͈;R` k#_.h2g;swо k%Y]s.5p]+ Ղ(WMI[|љclW9Ӗ,Py}m9/G\//r5voٳt˺8x`Zپ-mӺ"`aSo׺{9inb̒xh8JzUuޟ) _倲(3vD3F4u591.sw y{QTIENDB`fraqtive-0.4.8.1/src/icons/home-16.png000066400000000000000000000006251440132223600172670ustar00rootroot00000000000000PNG  IHDRabKGD@ pHYs  tIME  P2tEXtCommentCreated with The GIMPd%nIDATx͐0 EsTK44H"Y~>LE W(I_#4E)U%j(9$S%@?糿xY(Ix>& hB{0 s`5& bw Xpdu]G.c`1/ѸÊ) lww@%'vUW 8 C43*&ѾhxK,^,al(24g/KI[lIENDB`fraqtive-0.4.8.1/src/icons/home-22.png000066400000000000000000000024301440132223600172600ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs ,tIME E`IDATxڅkUrΜ[NMbj1b(m)>(HPo#E!䋈KE[-զiKn'9''23{;3I`1{^O>@7jCh@jRx]Ѓ:VU]GPC+3Y T2Քq5q,)Kj9_.+|k_)c y̩#!&B 'fk) ቸpE>,3}lșWx[Soԉ_ux f\U`{.MlӔ1h q0{Ə ;ҙs_Ί7-lKR48<.ebݍ6o$Lִ7XXiî#ˆ;ЛjbjMu!xs>Z8!%)LfEd+3ΌYt:}`RԧjrE%ha-p'&&MnϖQ*6jL+T\d`&S'qBIFqZcQ%$glB9ATDg)-(keoO"=-1z({qK10 6 ;'drY-)ZvJ(g(:xГk Xɦ FxU #RmxZq F h5샐&@It9Cɏsoއ]Yɡ~0|#>; \-dRګu -myL$*ХI24fk;UIX~2eh}K|WhNh >zUQ,~BO{lB[jp:ci#7lyH`Uk<\\R| *a 9 /FЩ J] ~Ĭ ̍'<.p3SPXӬxt (lα|/{݁А6C3a{X,]nL[,5{:oRhx+cÉȗb.{vD11D 'R=S\[]-\3݄.Pk}i $oOVXR``bٯ(_- O^VCEp ~w64pJiRa"P˴%v]uIENDB`fraqtive-0.4.8.1/src/icons/info-16.png000066400000000000000000000016361440132223600172750ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  d_tIME %9tEXtCommentCreated with The GIMPd%nIDATx]SKhSQ=嵩ilZ֦F~kTQPB ]"YrՍ"Aх(ՊnD Զ I4m>N.&;s̼{9g^}! t 2A0޼bvܟͯOO^|rgek 1O?#2{p/؄phU0M$²hB$zOo{x"޶~c*"-"=#[{r&Y^MF/e[6F( Lc~M AD8%kaH x[9}rۭ<.Q%eYy% iKWaVݙ"R9ry5~"DékK1ˢH"|. 4 ,uIMa X"ID%NLJ y2`Y $i?2,Adhj"TYI n^xd 9%92 nEDYCvEE'S@UB <2gt&"1)ai;ypCڴtjm-i62THdfuٻ5{]Ypѯ]:h-xsyJeZ*Uaۊ80!vzQQzo>Cdl6 âA=w%/,?6ܮ5% }ҳ*MUo+IENDB`fraqtive-0.4.8.1/src/icons/load-bookmark-16.png000066400000000000000000000015661440132223600210660ustar00rootroot00000000000000PNG  IHDRasRGBbKGDUd pHYs   IDAT8˥Kh\eGLftII0AL Qj*j}Pbą"@EUƸĕЍ M(4mZW;2;̝u!q |߁('o7m6]W~f{<Lܭyn4'u?w=g2׻"#FCqtbsF^sUgK8 +%B3ӟ Ϣ ͵ž/ٽokq@upZAo`l:iB 1"g?|8$hokkh؅ii* ufrfp!%͝GwOd[<+W50589[#YDuOa]Q,+G{G6^\5prH4'L%= ȮVxnjj[/z\zܜPjt&'wįfG/hk,1Ʌm GJD#)oΣrzT*XWVd]#)@+D4(MԊ "64xP'̥KeOz j5bτ"Jh`y "zRq[qxp/@@aR=BZJfkN'~ԔZёPW(zkֿ?,*qJR?RMAaXit)IENDB`fraqtive-0.4.8.1/src/icons/load-bookmark-22.png000066400000000000000000000023471440132223600210610ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs22 tIME  &5gIDAT8˵{he?߹n6tgA)EQ)/ @OIEXE 2BAvA4(K73ҍLrţ~~;~?ҕv!|}ZkFܥ0k;=^&t*m/~֗ +]TUTj/k#ƶ:ei 9:]ZVgKjP l PU]a}E̯0߃Ǒ]Ak,V|(Ik.*d$]L<ŲLVm7Zk{SlzN|怔Q)MՃE̝VD𮦳Kut&m#)AÁ53Ht3kP }k fϸ1KѶIQJA`@Ғ:Xnnބ2d DJ%5b|*H6p=h3*營:MC@()7^#@)S';.!Iۚ C͐d`ٓϣ6qb#`J0'Bt"r(,qZ'!8(DSYʳGN-w ɘ- mi>\@Qkf=:,SIE‚sc+bwWES b1X 3baF,x'{Cz<.^]ѐ18P|_wB@NfɩُB4frwq,8d21f$>^0~99wp[C`3 nR 4q^Op5FGIl]MFF:oŠLu#5K ⃂pt Ҁ2 W7_\<-ܘM#ZG+R(R!yyXo G8YV|q9HVkWY5{ RgxdmlضSCw-IENDB`fraqtive-0.4.8.1/src/icons/load-preset-16.png000066400000000000000000000014711440132223600205560ustar00rootroot00000000000000PNG  IHDRasRGBbKGDUd pHYs  IDAT8˥Kh\U{LflN1tѦPk#* ](Q0HKEA7VpJETF\YFS%#*fj:6͝{X؅?/>qo$Lo1ړ<~4i̎*M=}}au_F ?q{E[8͕{*1o?Xf01yç_la3_Dŵ',, qo^~wrاoE$ %D{3aӵ#c:{ o-lRk,[2)FWzTk48t/Cݴ?#98$][|S?\_[G)/ϒ\=pfb3Ҳx`[g5ƋQwGcv/BepC!% eH+Q5l:Pp@?!@p}@!ռ*0;Wgl4O XT5\\С|s>`WF i/ qK!p]Ã}ڑVaPW16 Bb qt\G<'w cn+ !1+[7EMULԔpm{ko.-0TmubV$֨(ܘt6_`⓵?$jHmpǴIENDB`fraqtive-0.4.8.1/src/icons/load-preset-22.png000066400000000000000000000021471440132223600205540ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs22 tIME  (2;IDAT8˵[lEw8-A6\m0 'y}jsEy3Dvۖ˨ڛĺ'XDP^< i;fyg&P]hNtTgY {:2o fL:(l?U4#-0ᔅTu{f1tLÔc?@܄܂`F 4]0=s*}N)v ]f}TWA)TiseKD{2P l eteXHQzN`B'` BlV 40`-YBZR; "gVMv>< azzRI˸wyei>P(i3jltIKs6IENDB`fraqtive-0.4.8.1/src/icons/rename-16.png000066400000000000000000000004251440132223600176040ustar00rootroot00000000000000PNG  IHDR1_gAMA abKGD oFFsmT* pHYs  tIME "}IDATx= `g;ys ZXX8,[̻ʌڠR&oM{\ѼAhv A4 C>zWl\gxOKfd$3.ºc!ݐ LS~IENDB`fraqtive-0.4.8.1/src/icons/rename-22.png000066400000000000000000000003551440132223600176030ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGDP' pHYs  ~tIME*!dXmIDAT8핻 @@+,MBwrULJsSUAH*V#g lXUm"'Ij)8{uLC|yJZl{ǭ,FΩ>B ȗqp=IENDB`fraqtive-0.4.8.1/src/icons/save-16.png000066400000000000000000000012331440132223600172710ustar00rootroot00000000000000PNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<-IDATxڥOkAƟM& "bO9xQDwG^< *_GJ"j $n6;;wwwV0.yfޙ9 /^u} lU"i#8WBH9E:й=xoLYguO_}p=sß>OSk(SE  ?N' (n5[ vBwέ(pr Ea%@}뻴zx1znMa-rYR$)q;'TBX#s$i Oѷ}!Bh3ֈZ./c*@1+۸1 U}^Rxf_?YpZUN492XRB_: Ʊ"e\I"Z`Łlߍ s)Dh-9V #$}4A5@jrdyNfDmaLFdUC)MsEҀ 1!(GP`ss$Ue\(  L192=1YIENDB`fraqtive-0.4.8.1/src/icons/save-22.png000066400000000000000000000014321440132223600172670ustar00rootroot00000000000000PNG  IHDRĴl; pHYs  ~tIME/bKGDIDATxՔ=kAݽ7櫐!b!D,Dhm%Je?FQhB !J św?ffws&3%Ys$TkCe$),h$K ܽyjC~3h^ݝ>ubk,M9jmתiުHDU%SV(;Rf?,,*Zkb< 4(qa8 [<05cܾq(KI!X+!.+[x#z8c fmv+asSnv0mPއwJ\SVSsLLtjPQdPס4SL++$IU9m8pVv|.Lm m< uAnlW\V¾0hc>bچ/JJ p^!O2j`+{+~OEvdqR%~sͪ粫{(JVE/E5IENDB`fraqtive-0.4.8.1/src/icons/save-bookmark-16.png000066400000000000000000000014411440132223600210750ustar00rootroot00000000000000PNG  IHDRasRGBbKGDUd pHYs  IDAT8˥Mk]UsGro$дq[ ŁTۙ" :t B+B)Ui'j6&&7{gv'w+t"gɥVSKwԤiN+4(QʠuA2YXX/]>C`lltkǛ6ԇ=xkeWO~v1LE.oV= dY1j ! FsYfgv?`z@[+Gfpα5oU8.PzO.$?"2JsMa+VRhSERYl H%RC&шEE{Kl4oW{LdԤBo/NP`zy{GRn;.YK%Z.[{TeSTBx(6 dPUB.MsJlibN7 5wJ@'$DIwPEMF:ABLY>m 4\1 LW7XX+GFƻ\߶tHb.ͰVBҵ*nĬ8D%_~><ӓ&>; n9\k&0^;CAᬵ|+āe)9Y^IENDB`fraqtive-0.4.8.1/src/icons/save-bookmark-22.png000066400000000000000000000021371440132223600210750ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  ~tIME  'ݘIIDAT8ՕMUusuƏ 4¾ #6AE VF #ȒEƅ&E.&H)tǙqrsZ{G8??[7? ^c,0G#JȔhm#م3\nԚ/@a~+C~z#[W#LJm_.R$!NW-[]k$89ԼNA ܿšX1wKBD)͵`mF-oE/^xSsz#^k b+-hc^k$xl{٨ݷ;07qiz$)nYdňE"ֵ{Jh-dQٹ,7RlƐfHmEJl!S,DQ'ҏ0q y5Yaumsrib];BN -yo9RRkݍ ŞO>iISRcmPzE";Oξd-38wo8#32+)5OPo!Myz!V(e"FTc sIj~n[V&<ie}}V JSh i-l#(x>Pg%*?Չ/R܌fF "xUǪ1zl:z }@~>ְ{8NaZ?D|#(o+_y _?:_/ w #4Sw8Z>1vFkt$+Oή'8#EX+4hubVʥEOP (8KoQQBͫS1;S{}L)ΜZ?ZK' l9W) )dm%X{$mD1`Wq(Pĥ._!rH@VRD& E`:ty{9E@ 6_}}UH'󽹾 ޵TReUҠF)5i<}ַ]^{~X;w|s k- `chXOlc#hC^JC lDo 4~ )5s锣 ,+"/jBGH\(4vb4M6cA>L`ex1\GX~g]X`[G.j~_W`G"0 NLVn\v=,@IENDB`fraqtive-0.4.8.1/src/icons/save-preset-22.png000066400000000000000000000020071440132223600205660ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  ~tIME  (&-ȗIDAT8ՕkU?L_ĦIi"DRT B(\[]YK7*BU,h)`&1J1?7ޛ{x/i~[bΙY| ߎJ;i:RM.Ë'KD<:D< mEauZ_λ_Hi>~f8(&gEűދ~O~xsGY[To,0z(i-U ЭSO VX:Ag>Ǝ !mV6VYpIbv?oEasj) Y‰G#>sX+ԕt6uma߳xu3QזvCUaV]wߊG >+ QoH H =sgHd>Q, 42{!ʲcP`04y ӫɷ?f@SUWLO=Jz Klnu'<1O]\Sw uq++ ?Wy=΃Q@DH"D(8RkYoGPG%)h: DAĨdNċԴZ%"d#=v nE <{bDtUm*!""!U;ޖ쩍; t[m:A Jgh-h{!Q; J)RPn:[>BћW_&ƚS b !BNcvJ5wazSo<<3iZc P0FjNјG/^5ZiiP! i;u;UPl1IENDB`fraqtive-0.4.8.1/src/icons/view2d-16.png000066400000000000000000000005361440132223600175400ustar00rootroot00000000000000PNG  IHDRasRGBbKGDK* pHYs  IDAT8˥N0 EW·G0uD 46CjTUdɎkD^^ :@N *\D"`s_n s;YA¤ОXHa@#`3(VsvHK(1foM>pH-1>Rйa[;bM+1̶|eM99 d"!{T\;HWo^c7&__ksTG. L[w7Y?oIENDB`fraqtive-0.4.8.1/src/icons/view2d-22.png000066400000000000000000000007621440132223600175360ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME   hrIDAT8˭UN0;#ġp@‰k_w rᄈrݬqrhu4:p}'bי+S&ܩ6, .M>maêL:C퉶2@G9A` Mjp]QA'>D!`,#Ra Qf)̹A\Q}R|tVqszrޭp]f,O%@Z84 )bb hO)vӒL2Pf}*vՉO#Fh ̰< yjl~H4N]BIrˈXe!M8㦋׷;6f7$_>^߄LW]&-IENDB`fraqtive-0.4.8.1/src/icons/view3d-16.png000066400000000000000000000012641440132223600175400ustar00rootroot00000000000000PNG  IHDRasRGBbKGDUd pHYs  GIDAT8mKLSAҖbi(X FԠh#&+cܸ1. .I\hk*.k "",L\DAW-};.B{ӓ_#Tc?{B՜7.x&*փe-пPs܆Eg4eWtMa"F+ j`WЈ]0־j7/z&ao``GCɅEyÿ1ڗQIdfB,\ٚD6#:3l@IhS:p(NB2 ({QH!P 8(6U"ҠZ+(bGH7|XopyL0@PNDmI0L @REc"Y)IS$Ғ,"D1efQ@R ! yV\:}XUaWt(Q2 ɐ6Ѧ8L_k} 6>Wk^S` S!ܣSꞞhImnBi}Zr>Ezs }C3'2 >}ҵ7o,JwM,ʚh:ZwE\IENDB`fraqtive-0.4.8.1/src/icons/view3d-22.png000066400000000000000000000024101440132223600175270ustar00rootroot00000000000000PNG  IHDRĴl;sRGBbKGD pHYs  tIME  "֐IDAT8uUkUU>ښr-`(B bCStsEߏ{ldžG +l-YNvq.>MGi-&,P `҆WsҿGRg)/5Վwd$2Gk4X1D L0Ev*TJSrs=ʚSJMdfتgb&*ITߌ !C#69&KMwМ+T&JA E{P2I) |PbCX&@g h*Q $i T+M@ DT CRƠ 126H WvpA{EL1+^4 }/M@,M Bv 4a@etu*nPP`x.]ܠ| @WeY'X/:(nd 0U\4Ci@o l+ 5n )חkCdHJ IdED2 6A2PL1ȫVa冠B(t5Ŝ/8微U ŰiA0%4  b 3 jrŪ'E}p?߮^~s?KL\2mq[F h`UM:9yR!.~&N]wi+ m8`xiBlߑ3;<Y>u/h({xfoyN[Ք SJ3ǻ>NFm 0~Uc6_w|À:zߖ +~=X86pIENDB`fraqtive-0.4.8.1/src/icons/web-16.png000066400000000000000000000016131440132223600171120ustar00rootroot00000000000000PNG  IHDRaRIDAT8eoe]ޤ'1QDPJZPD3h%ĩ"U !$Pq@j8R.HpBHUq#T<4ȱڱoc*s̜~Cc8b׾[( ژa%%~7JEt4O|;Wy(4 kY% lo=n?~~aG84OWҍ)\8ʀǐvcp5o>\ >S(PPbP/>׏'`|gk2OIL_~vNCH 1-K|ʍ}S5mA7W2Qذ$NYP2#qL>-ޒkj,j "\69S@̙G`ixag) LC. **************************************************************************/ #include "imagegenerator.h" #include #ifndef M_PI # define M_PI 3.14159265358979323846 #endif #include #include #include #include "fraqtiveapplication.h" #include "fractaldata.h" #include "jobscheduler.h" #include "datafunctions.h" ImageGenerator::ImageGenerator( QObject* parent ) : QObject( parent ), m_gradientCache( NULL ), m_maximumProgress( 0 ), m_activeJobs( 0 ), m_imageCount( 1 ), m_currentImage( 0 ) { } ImageGenerator::~ImageGenerator() { QMutexLocker locker( &m_mutex ); cancelJobs(); while ( m_activeJobs > 0 ) m_allJobsDone.wait( &m_mutex ); delete[] m_gradientCache; } static const int CellsPerRegion = 20; static const int RegionSize = CellsPerRegion * GeneratorCore::CellSize + 1; static int roundToCellSize( int size ) { // round up to nearest N * CellSize + 1 return ( ( size - 1 + GeneratorCore::CellSize - 1 ) / GeneratorCore::CellSize ) * GeneratorCore::CellSize + 1; } void ImageGenerator::setResolution( const QSize& resolution ) { m_resolution = resolution; int height = resolution.height() + 2; int fullRegions = height / ( RegionSize - 2 ); int remainder = height - fullRegions * ( RegionSize - 2 ); m_maximumProgress = fullRegions; if ( remainder > 0 ) m_maximumProgress++; } void ImageGenerator::setParameters( const FractalType& type, const Position& position ) { m_type = type; m_position = position; } static const int GradientSize = 16384; void ImageGenerator::setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ) { if ( !m_gradientCache ) m_gradientCache = new QRgb[ GradientSize ]; DataFunctions::fillGradientCache( gradient, m_gradientCache, GradientSize ); m_backgroundColor = backgroundColor; m_colorMapping = mapping; } void ImageGenerator::setGeneratorSettings( const GeneratorSettings& settings ) { m_generatorSettings = settings; } void ImageGenerator::setViewSettings( const ViewSettings& settings ) { m_viewSettings = settings; } void ImageGenerator::setImageCount( int count ) { m_imageCount = count; } void ImageGenerator::setCurrentImage( int image ) { m_currentImage = image; } QImage ImageGenerator::takeImage() { QImage result = m_image; m_image = QImage(); return result; } bool ImageGenerator::start() { m_image = QImage( m_resolution, QImage::Format_RGB32 ); if ( m_image.isNull() ) return false; m_regions.clear(); int width = roundToCellSize( m_image.width() + 2 ); int height = m_image.height() + 2; int fullRegions = height / ( RegionSize - 2 ); int remainder = height - fullRegions * ( RegionSize - 2 ); for ( int i = 0; i < fullRegions; i++ ) { QRect region( 0, i * ( RegionSize - 2 ), width, RegionSize ); m_regions.append( region ); } if ( remainder > 0 ) { QRect region( 0, fullRegions * ( RegionSize - 2 ), width, roundToCellSize( remainder ) ); m_regions.append( region ); } addJobs(); return true; } int ImageGenerator::priority() const { return 1; } void ImageGenerator::executeJob() { QMutexLocker locker( &m_mutex ); if ( m_regions.count() > 0 ) calculateRegion( m_regions.takeFirst() ); finishJob(); } void ImageGenerator::calculateRegion( const QRect& region ) { GeneratorCore::Input input; calculateInput( &input, region ); GeneratorCore::Output output; calculateOutput( &output, region ); int maxIterations = maximumIterations(); double threshold = m_generatorSettings.detailThreshold(); m_mutex.unlock(); #if defined( HAVE_SSE2 ) GeneratorCore::FunctorSSE2* functorSSE2 = DataFunctions::createFunctorSSE2( m_type ); if ( functorSSE2 ) { GeneratorCore::generatePreviewSSE2( input, output, functorSSE2, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetailsSSE2( input, output, functorSSE2, maxIterations, threshold ); delete functorSSE2; } else { #endif GeneratorCore::Functor* functor = DataFunctions::createFunctor( m_type ); if ( functor ) { GeneratorCore::generatePreview( input, output, functor, maxIterations ); GeneratorCore::interpolate( output ); GeneratorCore::generateDetails( input, output, functor, maxIterations, threshold ); delete functor; } #if defined( HAVE_SSE2 ) } #endif m_mutex.lock(); FractalData data; data.transferBuffer( output.m_buffer, output.m_stride, region.size() ); DataFunctions::ColorMapper mapper( m_gradientCache, GradientSize, m_backgroundColor.rgb(), m_colorMapping ); DataFunctions::drawImage( m_image, region.topLeft(), &data, QRect( 0, 0, m_image.width(), qMin( region.height() - 2, m_image.height() - region.top() ) ), mapper, m_viewSettings.antiAliasing() ); } void ImageGenerator::calculateInput( GeneratorCore::Input* input, const QRect& region ) { double scale = pow( 10.0, -m_position.zoomFactor() ) / (double)m_image.height(); double sa = scale * sin( m_position.angle() * M_PI / 180.0 ); double ca = scale * cos( m_position.angle() * M_PI / 180.0 ); double offsetX = (double)region.left() - (double)m_image.width() / 2.0 - 0.5; double offsetY = (double)region.top() - (double)m_image.height() / 2.0 - 0.5; input->m_sa = sa; input->m_ca = ca; input->m_x = m_position.center().x() + ca * offsetX + sa * offsetY; input->m_y = m_position.center().y() - sa * offsetX + ca * offsetY; } void ImageGenerator::calculateOutput( GeneratorCore::Output* output, const QRect& region ) { output->m_buffer = new double[ region.width() * region.height() ]; output->m_stride = region.width(); output->m_width = region.width(); output->m_height = region.height(); } int ImageGenerator::maximumIterations() const { return (int)( pow( 10.0, m_generatorSettings.calculationDepth() ) * qMax( 1.0, 1.45 + m_position.zoomFactor() ) ); } void ImageGenerator::addJobs() { int count = m_regions.count(); if ( count > 0 ) { fraqtive()->jobScheduler()->addJobs( this, count ); m_activeJobs += count; } } void ImageGenerator::cancelJobs() { int count = fraqtive()->jobScheduler()->cancelAllJobs( this ); m_activeJobs -= count; emit progressChanged( m_maximumProgress * m_currentImage + m_maximumProgress - m_activeJobs ); if ( m_activeJobs == 0 ) m_allJobsDone.wakeAll(); } void ImageGenerator::finishJob() { m_activeJobs--; emit progressChanged( m_maximumProgress * m_currentImage + m_maximumProgress - m_activeJobs ); if ( m_activeJobs == 0 ) { m_allJobsDone.wakeAll(); emit completed(); } } fraqtive-0.4.8.1/src/imagegenerator.h000066400000000000000000000052771440132223600174440ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef IMAGEGENERATOR_H #define IMAGEGENERATOR_H #include #include #include #include #include "abstractjobprovider.h" #include "datastructures.h" class ImageGenerator : public QObject, public AbstractJobProvider { Q_OBJECT public: ImageGenerator( QObject* parent ); ~ImageGenerator(); public: void setResolution( const QSize& resolution ); void setParameters( const FractalType& type, const Position& position ); void setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ); void setGeneratorSettings( const GeneratorSettings& settings ); void setViewSettings( const ViewSettings& settings ); void setImageCount( int count ); void setCurrentImage( int image ); int maximumProgress() const { return m_maximumProgress * m_imageCount; } QImage takeImage(); bool start(); public: // AbstractJobProvider implementation int priority() const; void executeJob(); signals: void progressChanged( int value ); void completed(); private: void calculateRegion( const QRect& region ); void calculateInput( GeneratorCore::Input* input, const QRect& region ); void calculateOutput( GeneratorCore::Output* output, const QRect& region ); int maximumIterations() const; void addJobs(); void cancelJobs(); void finishJob(); private: QSize m_resolution; FractalType m_type; Position m_position; QRgb* m_gradientCache; QColor m_backgroundColor; ColorMapping m_colorMapping; GeneratorSettings m_generatorSettings; ViewSettings m_viewSettings; int m_maximumProgress; QMutex m_mutex; QImage m_image; QList m_regions; int m_activeJobs; QWaitCondition m_allJobsDone; int m_imageCount; int m_currentImage; }; #endif fraqtive-0.4.8.1/src/imageview.cpp000066400000000000000000000345411440132223600167570ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "imageview.h" #include #ifndef M_PI # define M_PI 3.14159265358979323846 #endif #include #include #include #include #include #include "fractalpresenter.h" #include "datafunctions.h" ImageView::ImageView( QWidget* parent, FractalPresenter* presenter ) : QWidget( parent ), m_presenter( presenter ), m_interactive( false ), m_gradientCache( NULL ), m_tracking( NoTracking ) { setContextMenuPolicy( Qt::PreventContextMenu ); } ImageView::~ImageView() { delete[] m_gradientCache; } void ImageView::setInteractive( bool interactive ) { m_interactive = interactive; if ( interactive ) { setFocusPolicy( Qt::WheelFocus ); setMouseTracking( true ); } else { setFocusPolicy( Qt::NoFocus ); setMouseTracking( false ); } } void ImageView::clearView() { m_image = QImage(); m_updatedRegion = QRect(); m_tracking = NoTracking; if ( m_interactive ) { m_presenter->clearTracking(); m_presenter->clearHovering(); } update(); } void ImageView::transformView( const QTransform& transform ) { if ( m_image.isNull() ) return; QImage image( size(), QImage::Format_RGB32 ); image.fill( m_backgroundColor.rgb() ); QPainter painter( &image ); painter.setRenderHint( QPainter::SmoothPixmapTransform ); painter.setWorldTransform( transform * m_scale ); painter.drawImage( 0, 0, m_image ); m_image = image; m_updatedRegion = QRect(); calculateScale(); update(); } void ImageView::initialUpdate( const FractalData* data ) { if ( m_image.isNull() || m_image.size() != data->size() - QSize( 2, 2 ) ) { QImage image( data->size() - QSize( 2, 2 ), QImage::Format_RGB32 ); image.fill( m_backgroundColor.rgb() ); if ( !m_image.isNull() ) { QPainter painter( &image ); painter.setRenderHint( QPainter::SmoothPixmapTransform ); painter.setWorldTransform( m_scale ); painter.drawImage( 0, 0, m_image ); } m_image = image; calculateScale(); update(); } m_updatedRegion = QRect(); partialUpdate( data ); } void ImageView::partialUpdate( const FractalData* data ) { const QList validRegions = data->validRegions(); if ( validRegions.count() > 0 && validRegions.first().top() == 0 && validRegions.first().bottom() > m_updatedRegion.bottom() ) { int top = qMax( m_updatedRegion.bottom() - 1, 0 ); QRect region( 0, top, validRegions.first().width() - 2, validRegions.first().bottom() - top - 1 ); drawImage( data, region ); m_updatedRegion = validRegions.first(); update( worldTransform().mapRect( region ).adjusted( -1, -1, 1, 1 ) ); } } void ImageView::fullUpdate( const FractalData* data ) { m_image = QImage( data->size() - QSize( 2, 2 ), QImage::Format_RGB32 ); drawImage( data, m_image.rect() ); m_updatedRegion = m_image.rect(); calculateScale(); update(); } static const int GradientSize = 16384; void ImageView::drawImage( const FractalData* data, const QRect& region ) { ColorMapping mapping = m_colorMapping; double offset = mapping.offset() + m_animationState.scrolling(); if ( offset > 1.0 ) offset -= 1.0; mapping.setOffset( offset ); DataFunctions::ColorMapper mapper( m_gradientCache, GradientSize, m_backgroundColor.rgb(), mapping ); DataFunctions::drawImage( m_image, data, region, mapper, m_settings.antiAliasing() ); } void ImageView::setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ) { m_gradient = gradient; m_backgroundColor = backgroundColor; m_colorMapping = mapping; updateGradient(); updateBackground(); updateImage(); } void ImageView::setGradient( const Gradient& gradient ) { m_gradient = gradient; updateGradient(); updateImage(); } void ImageView::setBackgroundColor( const QColor& backgroundColor ) { m_backgroundColor = backgroundColor; updateBackground(); updateImage(); } void ImageView::setColorMapping( const ColorMapping& mapping ) { m_colorMapping = mapping; updateImage(); } void ImageView::setViewSettings( const ViewSettings& settings ) { m_settings = settings; updateImage(); } void ImageView::setAnimationState( const AnimationState& state ) { if ( m_animationState.scrolling() != state.scrolling() ) { m_animationState = state; updateImage(); } } void ImageView::updateGradient() { if ( !m_gradientCache ) m_gradientCache = new QRgb[ GradientSize ]; DataFunctions::fillGradientCache( m_gradient, m_gradientCache, GradientSize ); } void ImageView::updateBackground() { QPalette palette; palette.setBrush( QPalette::Background, m_backgroundColor ); setPalette( palette ); setBackgroundRole( QPalette::Background ); setAutoFillBackground( true ); } void ImageView::updateImage() { if ( m_image.isNull() ) return; const FractalData* data = m_presenter->fractalData(); initialUpdate( data ); } void ImageView::resizeEvent( QResizeEvent* e ) { m_presenter->setResolution( e->size() + QSize( 2, 2 ) ); calculateScale(); } void ImageView::calculateScale() { double scale = (double)height() / (double)m_image.height(); QPointF center( width() / 2.0, height() / 2.0 ); QPointF imageCenter( m_image.width() / 2.0, m_image.height() / 2.0 ); // scale image to view size and move it to the center of the view m_scale.reset(); m_scale.translate( center.x(), center.y() ); m_scale.scale( scale, scale ); m_scale.translate( -imageCenter.x(), -imageCenter.y() ); m_invScale = m_scale.inverted(); } void ImageView::paintEvent( QPaintEvent* /*e*/ ) { if ( m_image.isNull() ) return; QPainter painter( this ); painter.setRenderHint( QPainter::SmoothPixmapTransform ); painter.setWorldTransform( worldTransform() ); painter.drawImage( 0, 0, m_image ); } QTransform ImageView::worldTransform() { if ( m_tracking != NoTracking ) return m_transform * m_scale; else return m_scale; } void ImageView::mousePressEvent( QMouseEvent* e ) { if ( !m_interactive || m_image.isNull() ) return; if ( m_tracking != NoTracking ) { m_tracking = NoTracking; m_presenter->clearTracking(); if ( !m_transform.isIdentity() ) update(); return; } if ( e->button() == Qt::XButton1 ) { m_presenter->navigateBackward(); return; } if ( e->button() == Qt::XButton2 ) { m_presenter->navigateForward(); return; } m_trackStart = e->pos(); if ( e->button() == Qt::LeftButton ) { if ( e->modifiers() & Qt::ShiftModifier ) m_tracking = DragMove; else if ( e->modifiers() & Qt::ControlModifier ) m_tracking = ZoomCenter; else m_tracking = DragZoomIn; } else if ( e->button() == Qt::RightButton ) { if ( e->modifiers() & Qt::ShiftModifier ) m_tracking = DragRotate; else if ( e->modifiers() & Qt::ControlModifier ) m_tracking = RotateCenter; else m_tracking = DragZoomOut; } else if ( e->button() == Qt::MidButton ) { m_tracking = DragMove; } m_transform.reset(); } void ImageView::mouseMoveEvent( QMouseEvent* e ) { if ( !m_interactive || m_image.isNull() ) return; if ( m_tracking == NoTracking ) { QPointF point = worldTransform().inverted().map( e->pos() ); m_presenter->setHoveringPoint( point ); return; } const double zoomFactor = 400.0; const double rotateFactor = 2.0; QPointF center( width() / 2.0, height() / 2.0 ); QLineF offset( m_trackStart, e->pos() ); QTransform transform; // first calculate new transformation in view coordinates switch ( m_tracking ) { case DragMove: transform.translate( offset.dx(), offset.dy() ); break; case ZoomCenter: { double zoom = pow( 10.0, offset.dy() / zoomFactor ); transform.translate( center.x(), center.y() ); transform.scale( zoom, zoom ); transform.translate( -center.x(), -center.y() ); break; } case DragZoomIn: case DragZoomOut: { double direction = ( m_tracking == DragZoomIn ) ? 1.0 : -1.0; double zoom = pow( 10.0, direction * offset.length() / zoomFactor ); transform.translate( m_trackStart.x(), m_trackStart.y() ); transform.scale( zoom, zoom ); transform.translate( -m_trackStart.x(), -m_trackStart.y() ); break; } case DragRotate: { QLineF from( center, m_trackStart ); QLineF to( center, e->pos() ); double fromAngle = atan2( from.dy(), from.dx() ); double toAngle = atan2( to.dy(), to.dx() ); transform.translate( center.x(), center.y() ); transform.rotate( ( toAngle - fromAngle ) * 180.0 / M_PI ); transform.translate( -center.x(), -center.y() ); break; } case RotateCenter: { double angle = offset.dx() / rotateFactor; transform.translate( center.x(), center.y() ); transform.rotate( angle ); transform.translate( -center.x(), -center.y() ); break; } default: break; } // then convert it from view coordinates to image coordinates m_transform = m_scale * transform * m_invScale; m_presenter->setTrackingTransform( m_transform ); update(); } void ImageView::mouseReleaseEvent( QMouseEvent* e ) { if ( !m_interactive || m_tracking == NoTracking || m_image.isNull() ) return; if ( !m_transform.isIdentity() ) { m_presenter->changePosition( m_transform ); update(); } m_tracking = NoTracking; m_presenter->clearTracking(); QPointF point = worldTransform().inverted().map( e->pos() ); m_presenter->setHoveringPoint( point ); } void ImageView::mouseDoubleClickEvent( QMouseEvent* e ) { if ( m_interactive && !m_image.isNull() ) { QPointF point = worldTransform().inverted().map( e->pos() ); m_presenter->switchToJulia( point ); } } void ImageView::wheelEvent( QWheelEvent* e ) { if ( !m_interactive || m_image.isNull() || m_tracking != NoTracking ) { e->ignore(); return; } Tracking mode = NoTracking; if ( e->modifiers() & Qt::ShiftModifier ) mode = RotateCenter; else if ( e->modifiers() & Qt::ControlModifier ) mode = ZoomCenter; else mode = ZoomPoint; const double zoomFactor = 120.0; const double rotateFactor = 0.5; QPointF center( width() / 2.0, height() / 2.0 ); double delta = e->delta() / 8.0; QTransform transform; switch ( mode ) { case ZoomPoint: { double zoom = pow( 10.0, -delta / zoomFactor ); transform.translate( e->pos().x(), e->pos().y() ); transform.scale( zoom, zoom ); transform.translate( -e->pos().x(), -e->pos().y() ); break; } case ZoomCenter: { double zoom = pow( 10.0, -delta / zoomFactor ); transform.translate( center.x(), center.y() ); transform.scale( zoom, zoom ); transform.translate( -center.x(), -center.y() ); break; } case RotateCenter: { double angle = -delta / rotateFactor; transform.translate( center.x(), center.y() ); transform.rotate( angle ); transform.translate( -center.x(), -center.y() ); break; } default: break; } m_presenter->changePosition( m_scale * transform * m_invScale ); e->accept(); } void ImageView::leaveEvent( QEvent* /*e*/ ) { if ( m_interactive && !m_image.isNull() ) m_presenter->clearHovering(); } void ImageView::keyPressEvent( QKeyEvent* e ) { if ( !m_interactive || m_image.isNull() || ( e->modifiers() & Qt::AltModifier ) != 0 ) { e->ignore(); return; } if ( e->key() == Qt::Key_Escape && m_tracking != NoTracking ) { e->accept(); m_tracking = NoTracking; m_presenter->clearTracking(); if ( !m_transform.isIdentity() ) update(); return; } QPointF center( width() / 2.0, height() / 2.0 ); double step = height() / 4.0; QTransform transform; switch ( e->key() ) { case Qt::Key_Up: transform.translate( 0, step ); break; case Qt::Key_Down: transform.translate( 0, -step ); break; case Qt::Key_Left: transform.translate( step, 0 ); break; case Qt::Key_Right: transform.translate( -step, 0 ); break; case Qt::Key_Plus: case Qt::Key_Equal: transform.translate( center.x(), center.y() ); transform.scale( 2.0, 2.0 ); transform.translate( -center.x(), -center.y() ); break; case Qt::Key_Minus: transform.translate( center.x(), center.y() ); transform.scale( 0.5, 0.5 ); transform.translate( -center.x(), -center.y() ); break; } if ( !transform.isIdentity() ) { e->accept(); m_presenter->changePosition( m_scale * transform * m_invScale ); } else { e->ignore(); } } fraqtive-0.4.8.1/src/imageview.h000066400000000000000000000062131440132223600164170ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef IMAGEVIEW_H #define IMAGEVIEW_H #include #include "abstractview.h" #include "datastructures.h" class FractalPresenter; class ImageView : public QWidget, public AbstractView { Q_OBJECT public: ImageView( QWidget* parent, FractalPresenter* presenter ); ~ImageView(); public: void setInteractive( bool interactive ); QImage image() const { return m_image; } public: // AbstractView implementation void clearView(); void transformView( const QTransform& transform ); void initialUpdate( const FractalData* data ); void partialUpdate( const FractalData* data ); void fullUpdate( const FractalData* data ); void setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ); void setGradient( const Gradient& gradient ); void setBackgroundColor( const QColor& color ); void setColorMapping( const ColorMapping& mapping ); void setViewSettings( const ViewSettings& settings ); void setAnimationState( const AnimationState& state ); protected: // overrides void resizeEvent( QResizeEvent* e ); void paintEvent( QPaintEvent* e ); void mousePressEvent( QMouseEvent* e ); void mouseMoveEvent( QMouseEvent* e ); void mouseReleaseEvent( QMouseEvent* e ); void mouseDoubleClickEvent( QMouseEvent* e ); void wheelEvent( QWheelEvent* e ); void leaveEvent( QEvent* e ); void keyPressEvent( QKeyEvent* e ); private: void updateGradient(); void updateBackground(); void updateImage(); void drawImage( const FractalData* data, const QRect& region ); void calculateScale(); QTransform worldTransform(); private: enum Tracking { NoTracking, DragMove, DragRotate, DragZoomIn, DragZoomOut, RotateCenter, ZoomCenter, ZoomPoint }; private: FractalPresenter* m_presenter; bool m_interactive; QImage m_image; Gradient m_gradient; QColor m_backgroundColor; ColorMapping m_colorMapping; ViewSettings m_settings; AnimationState m_animationState; QRgb* m_gradientCache; QRect m_updatedRegion; QTransform m_scale; QTransform m_invScale; Tracking m_tracking; QPoint m_trackStart; QTransform m_transform; }; #endif fraqtive-0.4.8.1/src/jobscheduler.cpp000066400000000000000000000052441440132223600174510ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "jobscheduler.h" #include "abstractjobprovider.h" JobScheduler::JobScheduler( QObject* parent ) : QObject( parent ), m_stopping( false ) { int threads = QThread::idealThreadCount(); if ( threads < 0 ) threads = 1; for ( int i = 0; i < threads; i++ ) { WorkerThread* thread = new WorkerThread( this ); thread->start( QThread::LowPriority ); m_threads.append( thread ); } } JobScheduler::~JobScheduler() { QMutexLocker locker( &m_mutex ); m_stopping = true; m_hasPendingProviders.wakeAll(); locker.unlock(); for ( int i = 0; i < m_threads.count(); i++ ) m_threads[ i ]->wait(); } void JobScheduler::addJobs( AbstractJobProvider* provider, int count ) { QMutexLocker locker( &m_mutex ); int pos = 0; int priority = provider->priority(); while ( pos < m_pendingProviders.count() && m_pendingProviders[ pos ]->priority() >= priority ) pos++; for ( int i = 0; i < count; i++ ) m_pendingProviders.insert( pos, provider ); m_hasPendingProviders.wakeAll(); } int JobScheduler::cancelAllJobs( AbstractJobProvider* provider ) { QMutexLocker locker( &m_mutex ); return m_pendingProviders.removeAll( provider ); } bool JobScheduler::executeJob() { QMutexLocker locker( &m_mutex ); while ( !m_stopping && m_pendingProviders.count() == 0 ) m_hasPendingProviders.wait( &m_mutex ); if ( m_stopping ) return false; AbstractJobProvider* provider = m_pendingProviders.takeFirst(); locker.unlock(); provider->executeJob(); return true; } WorkerThread::WorkerThread( JobScheduler* scheduler ) : QThread( scheduler ), m_scheduler( scheduler ) { } WorkerThread::~WorkerThread() { } void WorkerThread::run() { while ( m_scheduler->executeJob() ) ; } fraqtive-0.4.8.1/src/jobscheduler.h000066400000000000000000000033051440132223600171120ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef JOBSCHEDULER_H #define JOBSCHEDULER_H #include #include #include class AbstractJobProvider; class JobScheduler : public QObject { Q_OBJECT public: JobScheduler( QObject* parent = NULL ); ~JobScheduler(); public: void addJobs( AbstractJobProvider* provider, int count ); int cancelAllJobs( AbstractJobProvider* provider ); private: bool executeJob(); private: QList m_threads; bool m_stopping; QMutex m_mutex; QList m_pendingProviders; QWaitCondition m_hasPendingProviders; friend class WorkerThread; }; class WorkerThread : public QThread { Q_OBJECT public: WorkerThread( JobScheduler* scheduler ); ~WorkerThread(); public: // overrides void run(); private: JobScheduler* m_scheduler; }; #endif fraqtive-0.4.8.1/src/loadbookmarkdialog.cpp000066400000000000000000000072771440132223600206350ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "loadbookmarkdialog.h" #include #include "fraqtiveapplication.h" #include "configurationdata.h" #include "fractalpresenter.h" #include "fractalmodel.h" #include "imageview.h" #include "iconloader.h" LoadBookmarkDialog::LoadBookmarkDialog( QWidget* parent ) : QDialog( parent ), m_model( NULL ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "load-bookmark", 22 ) ); m_ui.promptLabel->setText( tr( "Load fractal parameters from a bookmark:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); m_ui.listView->setMap( fraqtive()->configuration()->bookmarks() ); connect( m_ui.listView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( selectionChanged() ) ); connect( m_ui.listView->model(), SIGNAL( modelReset() ), this, SLOT( selectionChanged() ) ); m_presenter = new FractalPresenter( this ); ImageView* view = new ImageView( m_ui.viewContainer, m_presenter ); m_ui.viewContainer->setView( view ); m_presenter->setView( view ); m_presenter->setPriority( 2 ); selectionChanged(); } LoadBookmarkDialog::~LoadBookmarkDialog() { } void LoadBookmarkDialog::setModel( FractalModel* model ) { m_model = model; m_ui.listView->setColorSettings( model->gradient(), model->backgroundColor(), model->colorMapping() ); m_presenter->setColorSettings( model->gradient(), model->backgroundColor(), model->colorMapping() ); m_presenter->setGeneratorSettings( model->generatorSettings() ); m_presenter->setViewSettings( model->viewSettings() ); } void LoadBookmarkDialog::on_listView_doubleClicked() { accept(); } void LoadBookmarkDialog::selectionChanged() { QModelIndexList selection = m_ui.listView->selectionModel()->selectedIndexes(); m_ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( selection.count() == 1 ); if ( selection.count() == 1 ) { QString name = m_ui.listView->model()->data( selection[ 0 ] ).toString(); BookmarkMap* map = fraqtive()->configuration()->bookmarks(); Bookmark bookmark = map->value( name ); m_presenter->setParameters( bookmark.fractalType(), bookmark.position() ); m_presenter->setEnabled( true ); } else { m_presenter->setEnabled( false ); } } void LoadBookmarkDialog::accept() { QModelIndexList selection = m_ui.listView->selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = m_ui.listView->model()->data( selection[ 0 ] ).toString(); BookmarkMap* map = fraqtive()->configuration()->bookmarks(); Bookmark bookmark = map->value( name ); m_model->setParameters( bookmark.fractalType(), bookmark.position() ); QDialog::accept(); } } fraqtive-0.4.8.1/src/loadbookmarkdialog.h000066400000000000000000000026701440132223600202720ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef LOADBOOKMARKDIALOG_H #define LOADBOOKMARKDIALOG_H #include #include "ui_loadbookmarkdialog.h" class FractalPresenter; class FractalModel; class LoadBookmarkDialog : public QDialog { Q_OBJECT public: LoadBookmarkDialog( QWidget* parent ); ~LoadBookmarkDialog(); public: void setModel( FractalModel* model ); public: // overrides void accept(); private slots: void on_listView_doubleClicked(); void selectionChanged(); private: Ui::LoadBookmarkDialog m_ui; FractalPresenter* m_presenter; FractalModel* m_model; }; #endif fraqtive-0.4.8.1/src/loadbookmarkdialog.ui000066400000000000000000000105461440132223600204610ustar00rootroot00000000000000 LoadBookmarkDialog 0 0 650 380 Load Bookmark 0 0 10 true Qt::Horizontal 9 9 Preview 0 0 Qt::Vertical 20 40 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
ViewContainer QWidget
viewcontainer.h
1
BookmarkListView QListView
bookmarklistview.h
buttonBox accepted() LoadBookmarkDialog accept() 248 254 157 274 buttonBox rejected() LoadBookmarkDialog reject() 316 260 286 274
fraqtive-0.4.8.1/src/loadpresetdialog.cpp000066400000000000000000000103421440132223600203150ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "loadpresetdialog.h" #include #include "fraqtiveapplication.h" #include "configurationdata.h" #include "fractalmodel.h" #include "iconloader.h" LoadPresetDialog::LoadPresetDialog( QWidget* parent ) : QDialog( parent ), m_model( NULL ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "load-preset", 22 ) ); m_ui.promptLabel->setText( tr( "Load color settings from a preset:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); m_ui.listDefault->setMap( fraqtive()->configuration()->defaultPresets() ); m_ui.listUser->setMap( fraqtive()->configuration()->userPresets() ); m_ui.listUser->setEditable( true ); connect( m_ui.listDefault->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( defaultSelectionChanged() ) ); connect( m_ui.listDefault->model(), SIGNAL( modelReset() ), this, SLOT( defaultSelectionChanged() ) ); connect( m_ui.listUser->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( userSelectionChanged() ) ); connect( m_ui.listUser->model(), SIGNAL( modelReset() ), this, SLOT( userSelectionChanged() ) ); defaultSelectionChanged(); } LoadPresetDialog::~LoadPresetDialog() { } void LoadPresetDialog::setModel( FractalModel* model ) { m_model = model; } void LoadPresetDialog::on_tabWidget_currentChanged() { if ( m_ui.tabWidget->currentIndex() == 0 ) defaultSelectionChanged(); else userSelectionChanged(); } void LoadPresetDialog::on_listDefault_doubleClicked() { accept(); } void LoadPresetDialog::on_listUser_doubleClicked() { accept(); } void LoadPresetDialog::on_buttonBox_clicked( QAbstractButton* button ) { if ( button == m_ui.buttonBox->button( QDialogButtonBox::Apply ) ) { apply(); m_ui.buttonBox->button( QDialogButtonBox::Apply )->setEnabled( false ); } } void LoadPresetDialog::defaultSelectionChanged() { QModelIndexList selection = m_ui.listDefault->selectionModel()->selectedIndexes(); m_ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( selection.count() == 1 ); m_ui.buttonBox->button( QDialogButtonBox::Apply )->setEnabled( selection.count() == 1 ); } void LoadPresetDialog::userSelectionChanged() { QModelIndexList selection = m_ui.listUser->selectionModel()->selectedIndexes(); m_ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( selection.count() == 1 ); m_ui.buttonBox->button( QDialogButtonBox::Apply )->setEnabled( selection.count() == 1 ); } void LoadPresetDialog::accept() { apply(); QDialog::accept(); } void LoadPresetDialog::apply() { PresetListView* list; PresetMap* map; if ( m_ui.tabWidget->currentIndex() == 0 ) { list = m_ui.listDefault; map = fraqtive()->configuration()->defaultPresets(); } else { list = m_ui.listUser; map = fraqtive()->configuration()->userPresets(); } QModelIndexList selection = list->selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = list->model()->data( selection[ 0 ] ).toString(); Preset preset = map->value( name ); m_model->setColorSettings( preset.gradient(), preset.backgroundColor(), preset.colorMapping() ); } } fraqtive-0.4.8.1/src/loadpresetdialog.h000066400000000000000000000030771440132223600177710ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef LOADPRESETDIALOG_H #define LOADPRESETDIALOG_H #include #include "ui_loadpresetdialog.h" class FractalModel; class LoadPresetDialog : public QDialog { Q_OBJECT public: LoadPresetDialog( QWidget* parent ); ~LoadPresetDialog(); public: void setModel( FractalModel* model ); public: // overrides void accept(); private slots: void on_tabWidget_currentChanged(); void on_listDefault_doubleClicked(); void on_listUser_doubleClicked(); void on_buttonBox_clicked( QAbstractButton* button ); void defaultSelectionChanged(); void userSelectionChanged(); private: void apply(); private: Ui::LoadPresetDialog m_ui; FractalModel* m_model; }; #endif fraqtive-0.4.8.1/src/loadpresetdialog.ui000066400000000000000000000075121440132223600201550ustar00rootroot00000000000000 LoadPresetDialog 0 0 450 380 Load Preset 0 0 10 true Qt::Horizontal 9 0 Default Presets 6 My Presets 6 Qt::Horizontal QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
PresetListView QListView
presetlistview.h
buttonBox accepted() LoadPresetDialog accept() 248 254 157 274 buttonBox rejected() LoadPresetDialog reject() 316 260 286 274
fraqtive-0.4.8.1/src/main.cpp000066400000000000000000000022671440132223600157260ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "fraqtiveapplication.h" #include #ifdef HAVE_STATIC_JPEG Q_IMPORT_PLUGIN( qjpeg ) #endif #ifdef HAVE_STATIC_TIFF Q_IMPORT_PLUGIN( qtiff ) #endif int main( int argc, char* argv[] ) { qRegisterMetaType >(); FraqtiveApplication application( argc, argv ); return application.exec(); } fraqtive-0.4.8.1/src/meshview.cpp000066400000000000000000000340621440132223600166270ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "meshview.h" #include #ifndef M_PI # define M_PI 3.14159265358979323846 #endif #include #include #include #include #include "fractalpresenter.h" #include "datafunctions.h" MeshView::MeshView( QWidget* parent, FractalPresenter* presenter ) : QGLWidget( parent ), m_presenter( presenter ), m_textureId( 0 ), m_textureDirty( false ), m_vertexArray( NULL ), m_textureCoordArray( NULL ), m_maximumDepth( 0.0 ), m_averageHeight( 0.0 ), m_rotation( 0.0 ), m_angle( -45.0 ), m_tracking( NoTracking ) { setContextMenuPolicy( Qt::PreventContextMenu ); setFocusPolicy( Qt::WheelFocus ); } MeshView::~MeshView() { if ( m_textureId != 0 ) { makeCurrent(); glDeleteTextures( 1, &m_textureId ); } delete[] m_vertexArray; delete[] m_textureCoordArray; } QImage MeshView::image() { return grabFrameBuffer(); } void MeshView::clearView() { delete[] m_vertexArray; m_vertexArray = NULL; delete[] m_textureCoordArray; m_textureCoordArray = NULL; m_resolution = QSize(); m_updatedRegion = QRect(); updateGL(); } void MeshView::transformView( const QTransform& /*transform*/ ) { // not used in 3D mode } void MeshView::initialUpdate( const FractalData* data ) { if ( m_resolution.isNull() || m_resolution != data->size() ) { m_resolution = data->size(); int vertices = m_resolution.width() * m_resolution.height(); delete[] m_vertexArray; m_vertexArray = new float[ 3 * vertices ]; delete[] m_textureCoordArray; m_textureCoordArray = new float[ vertices ]; initializeVertices(); } m_maximumDepth = sqrt( (double)m_presenter->maximumIterations() ); m_updatedRegion = QRect(); partialUpdate( data ); } void MeshView::partialUpdate( const FractalData* data ) { if ( m_resolution.isNull() || m_resolution != data->size() ) return; const QList validRegions = data->validRegions(); if ( validRegions.count() > 0 && validRegions.first().top() == 0 && validRegions.first().bottom() > m_updatedRegion.bottom() ) { int top = m_updatedRegion.bottom() + 1; QRect region( 0, top, validRegions.first().width(), validRegions.first().bottom() - top + 1 ); updateVertices( data, region ); m_updatedRegion = validRegions.first(); updateGL(); } } void MeshView::fullUpdate( const FractalData* data ) { initialUpdate( data ); } void MeshView::setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ) { if ( m_gradient != gradient ) { m_gradient = gradient; m_textureDirty = true; } m_backgroundColor = backgroundColor; m_colorMapping = mapping; updateGL(); } void MeshView::setGradient( const Gradient& gradient ) { m_gradient = gradient; m_textureDirty = true; updateGL(); } void MeshView::setBackgroundColor( const QColor& backgroundColor ) { m_backgroundColor = backgroundColor; updateGL(); } void MeshView::setColorMapping( const ColorMapping& mapping ) { m_colorMapping = mapping; updateGL(); } void MeshView::setViewSettings( const ViewSettings& settings ) { m_settings = settings; switch ( settings.meshResolution() ) { case LowResolution: m_presenter->setResolution( QSize( 256, 256 ) ); break; case MediumResolution: m_presenter->setResolution( QSize( 512, 512 ) ); break; case HighResolution: m_presenter->setResolution( QSize( 1024, 1024 ) ); break; case VeryHighResolution: m_presenter->setResolution( QSize( 2048, 2048 ) ); break; } updateGL(); } void MeshView::setAnimationState( const AnimationState& state ) { m_animationState = state; updateGL(); } void MeshView::initializeGL() { glEnable( GL_DEPTH_TEST ); glFrontFace( GL_CCW ); glEnable( GL_CULL_FACE ); glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); } void MeshView::resizeGL( int width, int height ) { glViewport( 0, 0, width, height ); } #ifndef GL_MIRRORED_REPEAT_ARB # define GL_MIRRORED_REPEAT_ARB 0x8370 #endif static bool hasMirroredRepeat() { static bool checked = false; static bool result = false; if ( !checked ) { QStringList extensions = QString::fromLatin1( (const char*)glGetString( GL_EXTENSIONS ) ).split( ' ' ); if ( extensions.contains( "GL_ARB_texture_mirrored_repeat" ) || extensions.contains( "GL_IBM_texture_mirrored_repeat" ) ) result = true; checked = true; } return result; } #ifndef APIENTRY # define APIENTRY #endif typedef void ( APIENTRY *_glLockArraysEXT )( GLint first, GLsizei count ); typedef void ( APIENTRY *_glUnlockArraysEXT )(); static _glLockArraysEXT p_glLockArraysEXT = NULL; static _glUnlockArraysEXT p_glUnlockArraysEXT = NULL; static bool hasLockArrays( const QGLContext* context ) { static bool checked = false; static bool result = false; if ( !checked ) { p_glLockArraysEXT = (_glLockArraysEXT)context->getProcAddress( "glLockArraysEXT" ); p_glUnlockArraysEXT = (_glUnlockArraysEXT)context->getProcAddress( "glUnlockArraysEXT" ); if ( p_glLockArraysEXT != NULL && p_glUnlockArraysEXT != NULL ) result = true; checked = true; } return result; } static const double CameraDistance = 40.0; static const double NearClipping = 10.0; static const double FarClipping = 70.0; void MeshView::paintGL() { qglClearColor( m_backgroundColor ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); if ( m_resolution.isEmpty() ) return; if ( m_textureDirty ) { generateTexture(); m_textureDirty = false; } double offset = m_colorMapping.offset() + m_animationState.scrolling(); if ( offset > 1.0 ) offset -= 1.0; double scale = m_colorMapping.scale(); glMatrixMode( GL_TEXTURE ); glLoadIdentity(); if ( m_colorMapping.isMirrored() && hasMirroredRepeat() ) { if ( m_colorMapping.isReversed() ) glTranslated( 2.0 * offset + 1.0, 0.0, 0.0 ); else glTranslated( 2.0 * offset, 0.0, 0.0 ); glScaled( scale, 1.0, 1.0 ); glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT_ARB ); } else { if ( m_colorMapping.isReversed() ) { glTranslated( -offset, 0.0, 0.0 ); glScaled( -scale, 1.0, 1.0 ); } else { glTranslated( offset, 0.0, 0.0 ); glScaled( scale, 1.0, 1.0 ); } glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT ); } GLint viewport[ 4 ]; glGetIntegerv( GL_VIEWPORT, viewport ); double vw = viewport[ 2 ]; double vh = viewport[ 3 ]; double fy = tan( 0.5 * m_settings.cameraZoom() * M_PI / 180.0 ) * NearClipping; double fx = fy * vw / vh; glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glFrustum( -fx, fx, -fy, fy, NearClipping, FarClipping ); double rotation = m_rotation - m_animationState.rotation() * 360.0; glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTranslated( 0.0, 0.0, -CameraDistance ); glRotated( m_angle, 1.0, 0.0, 0.0 ); glRotated( rotation, 0.0, 0.0, 1.0 ); glScaled( 1.0, 1.0, m_settings.heightScale() ); glTranslated( 0.0, 0.0, m_averageHeight ); double plane[ 4 ] = { 0.0, 0.0, 1.0, m_maximumDepth - 0.001 }; glClipPlane( GL_CLIP_PLANE0, plane ); glEnable( GL_CLIP_PLANE0 ); int width = m_resolution.width(); if ( hasLockArrays( context() ) ) p_glLockArraysEXT( 0, m_resolution.height() * m_resolution.width() ); int* indexArray = new int[ 2 * width ]; for ( int y = 0; y < m_resolution.height() - 1; y++ ) { int offset = y * width; for ( int x = 0; x < width; x++ ) { indexArray[ 2 * x ] = x + offset; indexArray[ 2 * x + 1 ] = x + offset + width; } glDrawElements( GL_TRIANGLE_STRIP, 2 * width - 2, GL_UNSIGNED_INT, indexArray ); } delete[] indexArray; if ( hasLockArrays( context() ) ) p_glUnlockArraysEXT(); } void MeshView::generateTexture() { const int size = 1024; QImage image( size, 1, QImage::Format_ARGB32 ); QRgb* line = (QRgb*)image.scanLine( 0 ); DataFunctions::fillGradientCache( m_gradient, line, size ); QImage textureImage = QGLWidget::convertToGLFormat( image ); if ( m_textureId == 0 ) glGenTextures( 1, &m_textureId ); glBindTexture( GL_TEXTURE_1D, m_textureId ); gluBuild1DMipmaps( GL_TEXTURE_1D, 4, size, GL_RGBA, GL_UNSIGNED_BYTE, textureImage.bits() ); glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST ); glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glEnable( GL_TEXTURE_1D ); } // should always be greater than maximumDepth static const float InfiniteDepth = 100.0f; void MeshView::initializeVertices() { int width = m_resolution.width(); for ( int y = 0; y < m_resolution.height(); y++ ) { float* vertices = m_vertexArray + y * 3 * width; float* coords = m_textureCoordArray + y * width; float vy = 10.0f - ( 20.0f * y ) / (float)( m_resolution.height() - 1 ); for ( int x = 0; x < width; x++ ) { vertices[ 3 * x ] = ( 20.0f * x ) / (float)( width - 1 ) - 10.0f; vertices[ 3 * x + 1 ] = vy; vertices[ 3 * x + 2 ] = -InfiniteDepth; coords[ x ] = 0.0f; } } m_averageRowHeight.fill( 0.0, m_resolution.height() ); m_averageHeight = 0.0; glVertexPointer( 3, GL_FLOAT, 0, m_vertexArray ); glEnableClientState( GL_VERTEX_ARRAY ); glTexCoordPointer( 1, GL_FLOAT, 0, m_textureCoordArray ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); } void MeshView::updateVertices( const FractalData* data, const QRect& region ) { int stride = data->stride(); int width = region.width(); for ( int y = region.top(); y <= region.bottom(); y++ ) { const double* src = data->buffer() + y * stride + region.left(); float* vertices = m_vertexArray + y * 3 * width; float* coords = m_textureCoordArray + y * width; double sum = 0.0; int count = 0; for ( int x = 0; x < width; x++ ) { double value = src[ x ]; if ( value > 0.0 ) sum += value, count++; else value = InfiniteDepth; vertices[ 3 * x + 2 ] = -(float)value; coords[ x ] = (float)value; } if ( count > 0 ) m_averageRowHeight[ y ] = sum / (double)count; } double sum = 0.0; int count = 0; for ( int i = 0; i < m_averageRowHeight.count(); i++ ) { double value = m_averageRowHeight[ i ]; if ( value > 0.0 ) sum += value, count++; } if ( count > 0 ) m_averageHeight = sum / (double)count; } void MeshView::mousePressEvent( QMouseEvent* e ) { if ( m_resolution.isEmpty() ) return; if ( m_tracking != NoTracking ) { m_tracking = NoTracking; return; } if ( e->button() == Qt::LeftButton ) { if ( e->modifiers() & Qt::ControlModifier ) m_tracking = ZoomInOut; else m_tracking = RotateXY; } else if ( e->button() == Qt::RightButton ) { m_tracking = ZoomInOut; } m_lastPos = e->pos(); } void MeshView::mouseMoveEvent( QMouseEvent* e ) { if ( m_tracking == NoTracking ) return; switch ( m_tracking ) { case RotateXY: { m_rotation += 0.4 * ( e->pos().x() - m_lastPos.x() ); m_angle += 0.4 * ( e->pos().y() - m_lastPos.y() ); updateGL(); break; } case ZoomInOut: { m_presenter->adjustCameraZoom( -0.02 * ( e->pos().y() - m_lastPos.y() ) ); break; } default: break; } m_lastPos = e->pos(); } void MeshView::mouseReleaseEvent( QMouseEvent* /*e*/ ) { m_tracking = NoTracking; } void MeshView::wheelEvent( QWheelEvent* e ) { double delta = e->delta() / 120.0; m_presenter->adjustCameraZoom( delta ); } void MeshView::keyPressEvent( QKeyEvent* e ) { if ( m_resolution.isEmpty() || ( e->modifiers() & Qt::AltModifier ) != 0 ) { e->ignore(); return; } if ( e->key() == Qt::Key_Escape && m_tracking != NoTracking ) { e->accept(); m_tracking = NoTracking; return; } switch ( e->key() ) { case Qt::Key_Up: case Qt::Key_Down: m_angle += ( e->key() == Qt::Key_Up ) ? 5.0 : -5.0; e->accept(); updateGL(); break; case Qt::Key_Left: case Qt::Key_Right: m_rotation += ( e->key() == Qt::Key_Left ) ? 5.0 : -5.0; e->accept(); updateGL(); break; case Qt::Key_Plus: case Qt::Key_Equal: m_presenter->adjustCameraZoom( 1.0 ); e->accept(); break; case Qt::Key_Minus: m_presenter->adjustCameraZoom( -1.0 ); e->accept(); break; default: e->ignore(); break; } } fraqtive-0.4.8.1/src/meshview.h000066400000000000000000000056671440132223600163050ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef MESHVIEW_H #define MESHVIEW_H #include #include "abstractview.h" #include "datastructures.h" class FractalPresenter; class MeshView : public QGLWidget, public AbstractView { Q_OBJECT public: MeshView( QWidget* parent, FractalPresenter* presenter ); ~MeshView(); public: QImage image(); public: // AbstractView implementation void clearView(); void transformView( const QTransform& transform ); void initialUpdate( const FractalData* data ); void partialUpdate( const FractalData* data ); void fullUpdate( const FractalData* data ); void setColorSettings( const Gradient& gradient, const QColor& backgroundColor, const ColorMapping& mapping ); void setGradient( const Gradient& gradient ); void setBackgroundColor( const QColor& color ); void setColorMapping( const ColorMapping& mapping ); void setViewSettings( const ViewSettings& settings ); void setAnimationState( const AnimationState& state ); protected: // overrides void initializeGL(); void resizeGL( int width, int height ); void paintGL(); void mousePressEvent( QMouseEvent* e ); void mouseMoveEvent( QMouseEvent* e ); void mouseReleaseEvent( QMouseEvent* e ); void wheelEvent( QWheelEvent* e ); void keyPressEvent( QKeyEvent* e ); private: void generateTexture(); void initializeVertices(); void updateVertices( const FractalData* data, const QRect& region ); private: enum Tracking { NoTracking, RotateXY, ZoomInOut }; private: FractalPresenter* m_presenter; Gradient m_gradient; QColor m_backgroundColor; ColorMapping m_colorMapping; ViewSettings m_settings; AnimationState m_animationState; GLuint m_textureId; bool m_textureDirty; float* m_vertexArray; float* m_textureCoordArray; QSize m_resolution; QRect m_updatedRegion; double m_maximumDepth; QVector m_averageRowHeight; double m_averageHeight; double m_rotation; double m_angle; Tracking m_tracking; QPoint m_lastPos; }; #endif fraqtive-0.4.8.1/src/parameterspage.cpp000066400000000000000000000140641440132223600200000ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "parameterspage.h" #include "fractalmodel.h" #include "fractaltypedialog.h" #include "loadbookmarkdialog.h" #include "savebookmarkdialog.h" ParametersPage::ParametersPage( QWidget* parent ) : QWidget( parent ), m_model( NULL ), m_loading( false ) { m_ui.setupUi( this ); } ParametersPage::~ParametersPage() { } void ParametersPage::setModel( FractalModel* model ) { m_model = model; connect( model, SIGNAL( fractalTypeChanged() ), this, SLOT( fractalTypeChanged() ) ); connect( model, SIGNAL( positionChanged() ), this, SLOT( positionChanged() ) ); connect( model, SIGNAL( trackingChanged() ), this, SLOT( trackingChanged() ) ); connect( model, SIGNAL( hoveringChanged() ), this, SLOT( hoveringChanged() ) ); } void ParametersPage::on_buttonType_clicked() { FractalTypeDialog dialog( this, m_model ); if ( dialog.exec() == QDialog::Accepted ) m_model->setParameters( dialog.fractalType(), dialog.position() ); } void ParametersPage::on_buttonRestore_clicked() { m_model->setDefaultPosition(); } void ParametersPage::on_buttonLoad_clicked() { LoadBookmarkDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void ParametersPage::on_buttonSave_clicked() { SaveBookmarkDialog dialog( this ); dialog.setModel( m_model ); dialog.exec(); } void ParametersPage::on_editJuliaX_valueChanged() { saveParameters(); } void ParametersPage::on_editJuliaY_valueChanged() { saveParameters(); } void ParametersPage::on_editPositionX_valueChanged() { savePosition(); } void ParametersPage::on_editPositionY_valueChanged() { savePosition(); } void ParametersPage::on_spinZoom_valueChanged() { savePosition(); } void ParametersPage::on_spinAngle_valueChanged() { savePosition(); } void ParametersPage::fractalTypeChanged() { loadFractalType(); loadParameters(); } void ParametersPage::positionChanged() { loadPosition(); } void ParametersPage::trackingChanged() { loadPosition(); } void ParametersPage::hoveringChanged() { loadParameters(); } void ParametersPage::loadFractalType() { FractalType type = m_model->fractalType(); QString fractal; if ( type.fractal() == MandelbrotFractal ) fractal = tr( "Mandelbrot" ); else if ( type.fractal() == JuliaFractal ) fractal = tr( "Julia" ); QString variant; switch ( type.variant() ) { case GeneratorCore::NormalVariant: variant = tr( "Normal" ); break; case GeneratorCore::ConjugateVariant: variant = tr( "Conjugate" ); break; case GeneratorCore::AbsoluteVariant: variant = tr( "Absolute" ); break; case GeneratorCore::AbsoluteImVariant: variant = tr( "Absolute Im." ); break; } QString exponent; if ( type.exponentType() == IntegralExponent ) exponent = QString::number( type.integralExponent() ); else if ( type.exponentType() == RealExponent ) exponent = QString::number( type.realExponent(), 'f', 2 ); m_ui.editType->setText( QString( "%1 (%2), N=%3" ).arg( fractal, variant, exponent ) ); } void ParametersPage::loadParameters() { m_loading = true; if ( m_model->isHovering() ) { FractalType type = m_model->hoveringFractalType(); m_ui.editJuliaX->setReadOnly( true ); m_ui.editJuliaY->setReadOnly( true ); m_ui.editJuliaX->setValue( type.parameter().x() ); m_ui.editJuliaY->setValue( type.parameter().y() ); } else { FractalType type = m_model->fractalType(); if ( type.fractal() == JuliaFractal ) { m_ui.editJuliaX->setReadOnly( false ); m_ui.editJuliaY->setReadOnly( false ); m_ui.editJuliaX->setValue( type.parameter().x() ); m_ui.editJuliaY->setValue( type.parameter().y() ); } else { m_ui.editJuliaX->setReadOnly( true ); m_ui.editJuliaY->setReadOnly( true ); m_ui.editJuliaX->clear(); m_ui.editJuliaY->clear(); } } m_loading = false; } void ParametersPage::saveParameters() { if ( !m_loading ) { FractalType type = m_model->fractalType(); if ( type.fractal() == JuliaFractal ) { type.setParameter( QPointF( m_ui.editJuliaX->value(), m_ui.editJuliaY->value() ) ); m_model->setFractalType( type ); } } } void ParametersPage::loadPosition() { m_loading = true; Position position = m_model->isTracking() ? m_model->trackingPosition() : m_model->position(); m_ui.editPositionX->setValue( position.center().x() ); m_ui.editPositionY->setValue( position.center().y() ); m_ui.spinZoom->setValue( position.zoomFactor() ); m_ui.spinAngle->setValue( position.angle() ); m_ui.buttonRestore->setEnabled( !m_model->hasDefaultPosition() ); m_loading = false; } void ParametersPage::savePosition() { if ( !m_loading && !m_model->isTracking() ) { Position position; position.setCenter( QPointF( m_ui.editPositionX->value(), m_ui.editPositionY->value() ) ); position.setZoomFactor( m_ui.spinZoom->value() ); position.setAngle( m_ui.spinAngle->value() ); m_model->setPosition( position ); } } fraqtive-0.4.8.1/src/parameterspage.h000066400000000000000000000036101440132223600174400ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef PARAMETERSPAGE_H #define PARAMETERSPAGE_H #include #include "ui_parameterspage.h" class FractalModel; class ParametersPage : public QWidget { Q_OBJECT public: ParametersPage( QWidget* parent ); ~ParametersPage(); public: void setModel( FractalModel* model ); private slots: void on_buttonType_clicked(); void on_buttonRestore_clicked(); void on_buttonLoad_clicked(); void on_buttonSave_clicked(); void on_editJuliaX_valueChanged(); void on_editJuliaY_valueChanged(); void on_editPositionX_valueChanged(); void on_editPositionY_valueChanged(); void on_spinZoom_valueChanged(); void on_spinAngle_valueChanged(); void fractalTypeChanged(); void positionChanged(); void trackingChanged(); void hoveringChanged(); private: void loadFractalType(); void loadParameters(); void saveParameters(); void loadPosition(); void savePosition(); private: Ui::ParametersPage m_ui; FractalModel* m_model; bool m_loading; }; #endif fraqtive-0.4.8.1/src/parameterspage.ui000066400000000000000000000200751440132223600176320ustar00rootroot00000000000000 ParametersPage 0 0 300 400 Parameters Fractal Type true ... Julia Parameters X: Qt::Horizontal QSizePolicy::Fixed 10 1 Y: View Position X: Qt::Horizontal QSizePolicy::Fixed 10 1 Y: Zoom Factor Qt::Horizontal 40 20 100 0 10^ -1.000000000000000 15.000000000000000 0.100000000000000 Rotation Angle Qt::Horizontal 40 20 100 0 deg 1 0.000000000000000 360.000000000000000 5.000000000000000 Default Position Qt::Horizontal 40 20 Restore Bookmarks Qt::Horizontal 84 25 Load... Save... Qt::Vertical 20 21 DoubleEdit QLineEdit
doubleedit.h
editJuliaX editJuliaY editPositionX editPositionY spinZoom spinAngle buttonRestore
fraqtive-0.4.8.1/src/presetlistview.cpp000066400000000000000000000064261440132223600200740ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "presetlistview.h" #include #include #include #include "presetmodel.h" #include "renamedialog.h" PresetListView::PresetListView( QWidget* parent ) : QListView( parent ), m_editable( false ) { setViewMode( QListView::IconMode ); setFlow( QListView::LeftToRight ); setMovement( QListView::Static ); setResizeMode( QListView::Adjust ); setWrapping( true ); setIconSize( QSize( 48, 48 ) ); setSpacing( 6 ); setWordWrap( true ); setModel( new PresetModel( this ) ); } PresetListView::~PresetListView() { } void PresetListView::setMap( PresetMap* map ) { ( (PresetModel*)model() )->setMap( map ); } void PresetListView::setEditable( bool editable ) { m_editable = editable; } void PresetListView::contextMenuEvent( QContextMenuEvent* e ) { if ( !m_editable ) return; QModelIndexList selection = selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QMenu menu( this ); menu.addAction( QIcon( ":/icons/rename-16.png" ), tr( "&Rename" ), this, SLOT( renameItem() ) ); menu.addAction( QIcon( ":/icons/delete-16.png" ), tr( "&Delete" ), this, SLOT( deleteItem() ) ); menu.exec( e->globalPos() ); } } void PresetListView::renameItem() { QModelIndexList selection = selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = model()->data( selection[ 0 ] ).toString(); PresetMap* map = ( (PresetModel*)model() )->map(); RenameDialog dialog( RenameDialog::PresetMode, name, this ); dialog.setExistingNames( map->keys() ); if ( dialog.exec() == QDialog::Accepted ) { Preset preset = map->take( name ); map->insert( dialog.name(), preset ); ( (PresetModel*)model() )->update(); } } } void PresetListView::deleteItem() { QModelIndexList selection = selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = model()->data( selection[ 0 ] ).toString(); if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Are you sure you want to delete preset
named %1?
" ).arg( name ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok ) { PresetMap* map = ( (PresetModel*)model() )->map(); map->remove( name ); ( (PresetModel*)model() )->update(); } } } fraqtive-0.4.8.1/src/presetlistview.h000066400000000000000000000025261440132223600175360ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef PRESETLISTVIEW_H #define PRESETLISTVIEW_H #include #include "datastructures.h" class PresetListView : public QListView { Q_OBJECT public: PresetListView( QWidget* parent ); ~PresetListView(); public: void setMap( PresetMap* map ); void setEditable( bool editable ); protected: // overrides void contextMenuEvent( QContextMenuEvent* e ); private slots: void renameItem(); void deleteItem(); private: bool m_editable; }; #endif fraqtive-0.4.8.1/src/presetmodel.cpp000066400000000000000000000100101440132223600173060ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "presetmodel.h" #include #include #include #include #include "datafunctions.h" PresetModel::PresetModel( QObject* parent ) : QAbstractListModel( parent ), m_map( NULL ) { } PresetModel::~PresetModel() { } void PresetModel::setMap( PresetMap* map ) { m_map = map; update(); } static bool localeAwareLessThan( const QString& s1, const QString& s2 ) { return QString::localeAwareCompare( s1, s2 ) < 0; } void PresetModel::update() { beginResetModel(); m_keys = m_map->keys(); qSort( m_keys.begin(), m_keys.end(), localeAwareLessThan ); endResetModel(); } int PresetModel::rowCount( const QModelIndex& parent ) const { if ( !parent.isValid() ) return m_keys.count(); return 0; } QVariant PresetModel::data( const QModelIndex& index, int role ) const { if ( role == Qt::DisplayRole ) return m_keys.at( index.row() ); if ( role == Qt::DecorationRole ) { QString name = m_keys.at( index.row() ); Preset preset = m_map->value( name ); QPixmap pixmap( 48, 48 ); QPainter painter( &pixmap ); QGradientStops stops = DataFunctions::calculateGradientStops( preset.gradient() ); bool reversed = preset.colorMapping().isReversed(); bool mirrored = preset.colorMapping().isMirrored(); if ( ( !mirrored && !reversed ) || ( mirrored && reversed ) ) { for ( int i = 0; i < stops.count() / 2; i++ ) { QGradientStop stop1 = stops.at( i ); QGradientStop stop2 = stops.at( stops.count() - i - 1 ); stops[ i ] = QGradientStop( 1.0 - stop2.first, stop2.second ); stops[ stops.count() - i - 1 ] = QGradientStop( 1.0 - stop1.first, stop1.second ); } if ( stops.count() % 2 == 1 ) { QGradientStop stop = stops.at( stops.count() / 2 ); stops[ stops.count() / 2 ] = QGradientStop( 1.0 - stop.first, stop.second ); } } if ( mirrored ) { for ( int i = stops.count() - 1; i >= 0; i-- ) { QGradientStop stop = stops.at( i ); stops[ i ] = QGradientStop( 0.5 * stop.first, stop.second ); stops.append( QGradientStop( 1.0 - 0.5 * stop.first, stop.second ) ); } } double angle = 90.0 + 360.0 * preset.colorMapping().offset(); QConicalGradient gradient( pixmap.width() / 2, pixmap.height() / 2, angle ); gradient.setStops( stops ); painter.fillRect( pixmap.rect(), gradient ); QPixmap pixmap2 = pixmap; QPainter painter2( &pixmap2 ); painter.setPen( QApplication::palette().color( QPalette::Dark ) ); painter.drawRect( pixmap.rect().adjusted( 0, 0, -1, -1 ) ); painter2.setPen( QApplication::palette().color( QPalette::Highlight ) ); painter2.drawRect( pixmap.rect().adjusted( 0, 0, -1, -1 ) ); painter2.drawRect( pixmap.rect().adjusted( 1, 1, -2, -2 ) ); QIcon icon; icon.addPixmap( pixmap, QIcon::Normal ); icon.addPixmap( pixmap2, QIcon::Selected ); return icon; } return QVariant(); } fraqtive-0.4.8.1/src/presetmodel.h000066400000000000000000000026441440132223600167710ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef PRESETMODEL_H #define PRESETMODEL_H #include #include #include "datastructures.h" class PresetModel : public QAbstractListModel { Q_OBJECT public: PresetModel( QObject* parent ); ~PresetModel(); public: void setMap( PresetMap* map ); PresetMap* map() const { return m_map; } void update(); public: // overrides int rowCount( const QModelIndex& parent ) const; QVariant data( const QModelIndex& index, int role ) const; private: PresetMap* m_map; QStringList m_keys; }; #endif fraqtive-0.4.8.1/src/propertytoolbox.cpp000066400000000000000000000066071440132223600202770ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "propertytoolbox.h" #include "parameterspage.h" #include "colorsettingspage.h" #include "advancedsettingspage.h" #include "animationpage.h" PropertyToolBox::PropertyToolBox( QWidget* parent ) : QToolBox( parent ) { m_parameters = new ParametersPage( this ); m_colorSettings = new ColorSettingsPage( this ); m_advancedSettings = new AdvancedSettingsPage( this ); m_animationPage = new AnimationPage( this ); addPage( m_parameters ); addPage( m_colorSettings ); addPage( m_advancedSettings ); addPage( m_animationPage ); setItemIcon( 0, QIcon( ":/icons/edit-16.png" ) ); setItemIcon( 1, QIcon( ":/icons/gradient-16.png" ) ); setItemIcon( 2, QIcon( ":/icons/configure-16.png" ) ); setItemIcon( 3, QIcon( ":/icons/arrows-16.png" ) ); } PropertyToolBox::~PropertyToolBox() { } void PropertyToolBox::setModel( FractalModel* model ) { m_parameters->setModel( model ); m_colorSettings->setModel( model ); m_advancedSettings->setModel( model ); m_animationPage->setModel( model ); } QSize PropertyToolBox::sizeHint() const { return QSize( 300, 400 ); } void PropertyToolBox::addPage( QWidget* page ) { QBoxLayout* pageLayout = qobject_cast( page->layout() ); if ( pageLayout && pageLayout->direction() == QBoxLayout::TopToBottom ) { pageLayout->setContentsMargins( 5, 5, 5, 5 ); pageLayout->setSpacing( 3 ); for ( int i = 0; i < pageLayout->count(); i++ ) { QLayoutItem* item = pageLayout->itemAt( i ); if ( item->spacerItem() ) continue; QLabel* label = qobject_cast( item->widget() ); if ( label ) { QString style = "border: none; border-bottom: 1px solid palette(dark);"; if ( i > 0 ) style += "margin-top: 2px;"; label->setStyleSheet( style ); continue; } QBoxLayout* itemLayout = qobject_cast( item->layout() ); if ( itemLayout && itemLayout->direction() == QBoxLayout::LeftToRight ) { itemLayout->insertSpacing( 0, 10 ); } else { pageLayout->removeItem( item ); QHBoxLayout* wrapperLayout = new QHBoxLayout(); wrapperLayout->addSpacing( 10 ); wrapperLayout->addItem( item ); pageLayout->insertLayout( i, wrapperLayout ); } } } page->setBackgroundRole( QPalette::Base ); addItem( page, page->windowTitle() ); } fraqtive-0.4.8.1/src/propertytoolbox.h000066400000000000000000000027421440132223600177400ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef PROPERTYTOOLBOX_H #define PROPERTYTOOLBOX_H #include class FractalModel; class ParametersPage; class ColorSettingsPage; class AdvancedSettingsPage; class AnimationPage; class PropertyToolBox : public QToolBox { public: PropertyToolBox( QWidget* parent ); ~PropertyToolBox(); public: void setModel( FractalModel* model ); public: // overrides QSize sizeHint() const; private: void addPage( QWidget* page ); private: ParametersPage* m_parameters; ColorSettingsPage* m_colorSettings; AdvancedSettingsPage* m_advancedSettings; AnimationPage* m_animationPage; }; #endif fraqtive-0.4.8.1/src/renamedialog.cpp000066400000000000000000000055201440132223600174240ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "renamedialog.h" #include #include #include "iconloader.h" RenameDialog::RenameDialog( Mode mode, const QString& name, QWidget* parent ) : QDialog( parent ), m_mode( mode ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "rename", 22 ) ); switch ( mode ) { case PresetMode: setWindowTitle( tr( "Rename Preset" ) ); m_ui.promptLabel->setText( tr( "Rename preset %1:" ).arg( name ) ); break; case BookmarkMode: setWindowTitle( tr( "Rename Bookmark" ) ); m_ui.promptLabel->setText( tr( "Rename bookmark %1:" ).arg( name ) ); break; } m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); setFixedHeight( sizeHint().height() ); m_ui.lineEdit->setText( name ); } RenameDialog::~RenameDialog() { } QString RenameDialog::name() const { return m_ui.lineEdit->text(); } void RenameDialog::setExistingNames( const QStringList& names ) { m_names = names; } void RenameDialog::accept() { QString name = m_ui.lineEdit->text(); if ( m_names.contains( name ) ) { QString message; switch ( m_mode ) { case PresetMode: message = tr( "Are you sure you want to overwrite the existing preset
named %1?
" ).arg( name ); break; case BookmarkMode: message = tr( "Are you sure you want to overwrite the existing bookmark
named %1?
" ).arg( name ); break; } if ( QMessageBox::warning( this, tr( "Warning" ), message, QMessageBox::Ok | QMessageBox::Cancel ) != QMessageBox::Ok ) return; } QDialog::accept(); } void RenameDialog::on_lineEdit_textChanged( const QString& text ) { m_ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !text.isEmpty() ); } fraqtive-0.4.8.1/src/renamedialog.h000066400000000000000000000027271440132223600170770ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef RENAMEDIALOG_H #define RENAMEDIALOG_H #include #include "ui_renamedialog.h" class RenameDialog : public QDialog { Q_OBJECT public: enum Mode { PresetMode, BookmarkMode }; public: RenameDialog( Mode mode, const QString& name, QWidget* parent ); ~RenameDialog(); public: QString name() const; void setExistingNames( const QStringList& names ); public: // overrides void accept(); private slots: void on_lineEdit_textChanged( const QString& text ); private: Ui::RenameDialog m_ui; Mode m_mode; QStringList m_names; }; #endif fraqtive-0.4.8.1/src/renamedialog.ui000066400000000000000000000061761440132223600172670ustar00rootroot00000000000000 RenameDialog 0 0 350 106 Rename 0 0 10 true Qt::Horizontal 9 Name: 60 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
buttonBox accepted() RenameDialog accept() 248 254 157 274 buttonBox rejected() RenameDialog reject() 316 260 286 274
fraqtive-0.4.8.1/src/resources.qrc000066400000000000000000000002411440132223600170050ustar00rootroot00000000000000 resources/fraqtivemainwindow.xml resources/guidedialog.xml fraqtive-0.4.8.1/src/resources/000077500000000000000000000000001440132223600163015ustar00rootroot00000000000000fraqtive-0.4.8.1/src/resources/fraqtivemainwindow.xml000066400000000000000000000014771440132223600227520ustar00rootroot00000000000000
fraqtive-0.4.8.1/src/resources/guidedialog.xml000066400000000000000000000002071440132223600212770ustar00rootroot00000000000000 fraqtive-0.4.8.1/src/savebookmarkdialog.cpp000066400000000000000000000064001440132223600206370ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "savebookmarkdialog.h" #include #include #include "fraqtiveapplication.h" #include "configurationdata.h" #include "fractalmodel.h" #include "iconloader.h" SaveBookmarkDialog::SaveBookmarkDialog( QWidget* parent ) : QDialog( parent ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "save-bookmark", 22 ) ); m_ui.promptLabel->setText( tr( "Save fractal parameters as a bookmark:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); connect( m_ui.listView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( selectionChanged() ) ); m_ui.listView->setMap( fraqtive()->configuration()->bookmarks() ); m_ui.editName->setText( tr( "New Bookmark" ) ); m_ui.editName->setFocus(); } SaveBookmarkDialog::~SaveBookmarkDialog() { } void SaveBookmarkDialog::setModel( FractalModel* model ) { m_model = model; m_ui.listView->setColorSettings( model->gradient(), model->backgroundColor(), model->colorMapping() ); } void SaveBookmarkDialog::on_listView_doubleClicked() { accept(); } void SaveBookmarkDialog::on_editName_textChanged( const QString& text ) { m_ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !text.isEmpty() ); if ( !m_keepSelection ) m_ui.listView->clearSelection(); } void SaveBookmarkDialog::selectionChanged() { QModelIndexList selection = m_ui.listView->selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = m_ui.listView->model()->data( selection[ 0 ] ).toString(); m_keepSelection = true; m_ui.editName->setText( name ); m_keepSelection = false; } } void SaveBookmarkDialog::accept() { QString name = m_ui.editName->text(); BookmarkMap* map = fraqtive()->configuration()->bookmarks(); if ( map->contains( name ) ) { if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Are you sure you want to overwrite the existing bookmark
named %1?
" ).arg( name ), QMessageBox::Ok | QMessageBox::Cancel ) != QMessageBox::Ok ) return; } Bookmark bookmark; bookmark.setFractalType( m_model->fractalType() ); bookmark.setPosition( m_model->position() ); map->insert( name, bookmark ); QDialog::accept(); } fraqtive-0.4.8.1/src/savebookmarkdialog.h000066400000000000000000000027201440132223600203050ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef SAVEBOOKMARKDIALOG_H #define SAVEBOOKMARKDIALOG_H #include #include "ui_savebookmarkdialog.h" class FractalModel; class SaveBookmarkDialog : public QDialog { Q_OBJECT public: SaveBookmarkDialog( QWidget* parent ); ~SaveBookmarkDialog(); public: void setModel( FractalModel* model ); public: // overrides void accept(); private slots: void on_listView_doubleClicked(); void on_editName_textChanged( const QString& text ); void selectionChanged(); private: Ui::SaveBookmarkDialog m_ui; FractalModel* m_model; bool m_keepSelection; }; #endif fraqtive-0.4.8.1/src/savebookmarkdialog.ui000066400000000000000000000070321440132223600204740ustar00rootroot00000000000000 SaveBookmarkDialog 0 0 450 340 Save Bookmark 0 0 10 true Qt::Horizontal 9 Bookmark Name: 60 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
BookmarkListView QListView
bookmarklistview.h
buttonBox accepted() SaveBookmarkDialog accept() 248 254 157 274 buttonBox rejected() SaveBookmarkDialog reject() 316 260 286 274
fraqtive-0.4.8.1/src/savepresetdialog.cpp000066400000000000000000000064061440132223600203420ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #include "savepresetdialog.h" #include #include #include "fraqtiveapplication.h" #include "configurationdata.h" #include "fractalmodel.h" #include "iconloader.h" SavePresetDialog::SavePresetDialog( QWidget* parent ) : QDialog( parent ), m_model( NULL ), m_keepSelection( false ) { m_ui.setupUi( this ); m_ui.promptPixmap->setPixmap( IconLoader::pixmap( "save-preset", 22 ) ); m_ui.promptLabel->setText( tr( "Save color settings as a preset:" ) ); m_ui.promptLabel->setMinimumWidth( 350 ); m_ui.promptLabel->setFixedHeight( m_ui.promptLabel->heightForWidth( 350 ) ); connect( m_ui.listView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( selectionChanged() ) ); m_ui.listView->setMap( fraqtive()->configuration()->userPresets() ); m_ui.listView->setEditable( true ); m_ui.editName->setText( tr( "New Preset" ) ); m_ui.editName->setFocus(); } SavePresetDialog::~SavePresetDialog() { } void SavePresetDialog::setModel( FractalModel* model ) { m_model = model; } void SavePresetDialog::on_listView_doubleClicked() { accept(); } void SavePresetDialog::on_editName_textChanged( const QString& text ) { m_ui.buttonBox->button( QDialogButtonBox::Ok )->setEnabled( !text.isEmpty() ); if ( !m_keepSelection ) m_ui.listView->clearSelection(); } void SavePresetDialog::selectionChanged() { QModelIndexList selection = m_ui.listView->selectionModel()->selectedIndexes(); if ( selection.count() == 1 ) { QString name = m_ui.listView->model()->data( selection[ 0 ] ).toString(); m_keepSelection = true; m_ui.editName->setText( name ); m_keepSelection = false; } } void SavePresetDialog::accept() { QString name = m_ui.editName->text(); PresetMap* map = fraqtive()->configuration()->userPresets(); if ( map->contains( name ) ) { if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Are you sure you want to overwrite the existing preset
named %1?
" ).arg( name ), QMessageBox::Ok | QMessageBox::Cancel ) != QMessageBox::Ok ) return; } Preset preset; preset.setGradient( m_model->gradient() ); preset.setBackgroundColor( m_model->backgroundColor() ); preset.setColorMapping( m_model->colorMapping() ); map->insert( name, preset ); QDialog::accept(); } fraqtive-0.4.8.1/src/savepresetdialog.h000066400000000000000000000027021440132223600200020ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Micha Mciski * * 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 . **************************************************************************/ #ifndef SAVEPRESETDIALOG_H #define SAVEPRESETDIALOG_H #include #include "ui_savepresetdialog.h" class FractalModel; class SavePresetDialog : public QDialog { Q_OBJECT public: SavePresetDialog( QWidget* parent ); ~SavePresetDialog(); public: void setModel( FractalModel* model ); public: // overrides void accept(); private slots: void on_listView_doubleClicked(); void on_editName_textChanged( const QString& text ); void selectionChanged(); private: Ui::SavePresetDialog m_ui; FractalModel* m_model; bool m_keepSelection; }; #endif fraqtive-0.4.8.1/src/savepresetdialog.ui000066400000000000000000000070101440132223600201650ustar00rootroot00000000000000 SavePresetDialog 0 0 450 340 Save Preset 0 0 10 true Qt::Horizontal 9 Preset Name: 60 Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::Ok XmlUi::GradientWidget QWidget
xmlui/gradientwidget.h
1
PresetListView QListView
presetlistview.h
buttonBox accepted() SavePresetDialog accept() 248 254 157 274 buttonBox rejected() SavePresetDialog reject() 316 260 286 274
fraqtive-0.4.8.1/src/shadewidget.cpp000066400000000000000000000164031440132223600172670ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "shadewidget.h" #include #include #include #include ShadeWidget::ShadeWidget( QWidget* parent ) : QWidget( parent ), m_dragging( false ) { } ShadeWidget::~ShadeWidget() { } void ShadeWidget::setShadeColor( const QColor& color ) { m_color = color; m_stops.clear(); update(); } void ShadeWidget::setGradientStops( const QGradientStops& stops ) { m_color = QColor(); m_stops = stops; update(); } void ShadeWidget::setPoints( const QPolygonF& points ) { if ( m_points != points ) { m_points = points; emit pointsChanged(); update(); } } QSize ShadeWidget::minimumSizeHint() const { return QSize( 30, 30 ); } void ShadeWidget::paintEvent( QPaintEvent* e ) { QPainter painter( this ); painter.setRenderHint( QPainter::Antialiasing ); painter.setPen( QColor( 80, 80, 80 ) ); painter.setBrush( QColor( 160, 160, 160 ) ); QPainterPath border; border.moveTo( 5.5, 0.0 ); border.arcTo( e->rect().width() - 11.5, 0.0, 11.0, 11.0, 90.0, -90.0 ); border.arcTo( e->rect().width() - 11.5, e->rect().height() - 11.5, 11.0, 11.0, 0.0, -90.0 ); border.arcTo( 0.0, e->rect().height() - 11.5, 11.0, 11.0, -90.0, -90.0 ); border.arcTo( 0.0, 0.0, 11.0, 11.0, -180.0, -90.0 ); painter.drawPath( border ); QRectF rect = e->rect(); rect.adjust( 5.5, 5.5, -5.5, -5.5 ); painter.setPen( QColor( 128, 128, 128 ) ); for ( int i = 1; i <= 9; i++ ) { double x = mapToWidget( QPointF( i / 10.0, 0.0 ) ).x(); painter.drawLine( QPointF( x, 0.0 ), QPointF( x, e->rect().bottom() ) ); } if ( m_color.isValid() ) { QLinearGradient gradient( rect.bottomLeft(), rect.topLeft() ); gradient.setColorAt( 0.0, Qt::black ); gradient.setColorAt( 1.0, m_color ); painter.setBrush( gradient ); } else if ( !m_stops.isEmpty() ) { QLinearGradient gradient( rect.topLeft(), rect.topRight() ); gradient.setStops( m_stops ); painter.setBrush( gradient ); } painter.setPen( QColor( 80, 80, 80 ) ); painter.drawRect( rect ); if ( !m_points.isEmpty() ) { painter.setPen( QPen( QColor( 255, 255, 255, 128 ), 2.0 ) ); painter.setBrush( Qt::NoBrush ); QPainterPath path; path.moveTo( mapToWidget( m_points.at( 0 ) ) ); for ( int i = 1; i < m_points.size(); i++ ) { QPointF p1 = mapToWidget( m_points.at( i - 1 ) ); QPointF p2 = mapToWidget( m_points.at( i ) ); path.cubicTo( ( p1.x() + p2.x() ) / 2, p1.y(), ( p1.x() + p2.x() ) / 2, p2.y(), p2.x(), p2.y() ); } painter.drawPath( path ); QPen pointPen( QColor( 255, 255, 255, 192 ) ); pointPen.setWidth( 1 ); painter.setPen( QPen( QColor( 255, 255, 255, 192 ), 1.0 ) ); painter.setBrush( QColor( 255, 255, 255, 144 ) ); for ( int i = 0; i < m_points.size(); i++ ) { QPointF point = mapToWidget( m_points.at( i ) ); painter.drawEllipse( QRectF( point.x() - 4.5, point.y() - 4.5, 9.0, 9.0 ) ); } } } void ShadeWidget::mousePressEvent( QMouseEvent* e ) { if ( e->button() != Qt::LeftButton || m_points.isEmpty() ) return; int index = -1; double minDistance = 0.0; for ( int i = 0; i < m_points.count(); i++ ) { QPointF center = mapToWidget( m_points.at( i ) ); double distance = QLineF( e->pos(), center ).length(); if ( index < 0 || distance < minDistance ) { index = i; minDistance = distance; } } QPointF point = mapFromWidget( e->pos() ); point.setX( qBound( (qreal)0, point.x(), (qreal)1 ) ); point.setY( qBound( (qreal)0, point.y(), (qreal)1 ) ); if ( index >= 0 && minDistance <= 10.0 ) { m_dragging = true; m_index = index; if ( index == 0 ) point.setX( 0.0 ); else if ( index == m_points.count() - 1 ) point.setX( 1.0 ); m_points[ index ] = point; } else if ( QRectF( 0.0, 0.0, 1.0, 1.0 ).contains( point ) ) { index = 1; while ( index < m_points.count() - 1 && m_points.at( index ).x() < point.x() ) index++; m_points.insert( index, point ); m_dragging = true; m_index = index; } if ( m_dragging ) { QToolTip::showText( mapToGlobal( mapToWidget( point ).toPoint() ), QString( "%1, %2" ).arg( point.x(), 0, 'f', 3 ).arg( point.y(), 0, 'f', 2 ), this ); emit pointsChanged(); update(); } } void ShadeWidget::mouseMoveEvent( QMouseEvent* e ) { if ( !m_dragging ) return; QPointF point = mapFromWidget( e->pos() ); point.setX( qBound( (qreal)0, point.x(), (qreal)1 ) ); point.setY( qBound( (qreal)0, point.y(), (qreal)1 ) ); if ( m_index == 0 ) { point.setX( 0.0 ); m_points[ m_index ] = point; } else if ( m_index == m_points.count() - 1 ) { point.setX( 1.0 ); m_points[ m_index ] = point; } else { if ( m_index >= 0 ) m_points.remove( m_index ); if ( rect().adjusted( -30, -30, 30, 30 ).contains( e->pos() ) ) { int index = 1; while ( index < m_points.count() - 1 && m_points.at( index ).x() < point.x() ) index++; m_points.insert( index, point ); m_index = index; } else { m_index = -1; } } if ( m_index >= 0 ) { QToolTip::showText( mapToGlobal( mapToWidget( point ).toPoint() ), QString( "%1, %2" ).arg( point.x(), 0, 'f', 3 ).arg( point.y(), 0, 'f', 2 ), this ); } else { QToolTip::hideText(); } emit pointsChanged(); update(); } void ShadeWidget::mouseReleaseEvent( QMouseEvent* e ) { if ( e->button() == Qt::LeftButton ) m_dragging = false; } QPointF ShadeWidget::mapToWidget( const QPointF& point ) { return QPointF( point.x() * ( width() - 14.0 ) + 7.0, height() - point.y() * ( height() - 14.0 ) - 7.0 ); } QPointF ShadeWidget::mapFromWidget( const QPointF& point ) { return QPointF( ( point.x() - 7.0 ) / ( width() - 14.0 ), ( height() - point.y() - 7.0 ) / ( height() - 14.0 ) ); } fraqtive-0.4.8.1/src/shadewidget.h000066400000000000000000000034131440132223600167310ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef SHADEWIDGET_H #define SHADEWIDGET_H #include class ShadeWidget : public QWidget { Q_OBJECT public: ShadeWidget( QWidget* parent ); ~ShadeWidget(); public: void setShadeColor( const QColor& color ); void setGradientStops( const QGradientStops& stops ); void setPoints( const QPolygonF& points ); QPolygonF points() const { return m_points; } signals: void pointsChanged(); public: // overrides QSize minimumSizeHint() const; protected: // overrides void paintEvent( QPaintEvent* e ); void mousePressEvent( QMouseEvent* e ); void mouseMoveEvent( QMouseEvent* e ); void mouseReleaseEvent( QMouseEvent* e ); private: QPointF mapToWidget( const QPointF& point ); QPointF mapFromWidget( const QPointF& point ); private: QColor m_color; QGradientStops m_stops; QPolygonF m_points; bool m_dragging; int m_index; }; #endif fraqtive-0.4.8.1/src/src.pro000066400000000000000000000135011440132223600156000ustar00rootroot00000000000000include( ../config.pri ) TEMPLATE = app TARGET = fraqtive QT += opengl xml HEADERS += aboutbox.h \ abstractjobprovider.h \ abstractview.h \ advancedsettingspage.h \ animationpage.h \ bookmarklistview.h \ bookmarkmodel.h \ colorsettingspage.h \ colorwidget.h \ configurationdata.h \ datafunctions.h \ datastructures.h \ doubleedit.h \ doubleslider.h \ fractaldata.h \ fractalgenerator.h \ fractalmodel.h \ fractalpresenter.h \ fractaltypedialog.h \ fractaltypewidget.h \ fraqtiveapplication.h \ fraqtivemainwindow.h \ generateimagedialog.h \ generateseriesdialog.h \ generatorcore.h \ gradientdialog.h \ gradienteditor.h \ guidedialog.h \ iconloader.h \ imagegenerator.h \ imageview.h \ jobscheduler.h \ loadbookmarkdialog.h \ loadpresetdialog.h \ meshview.h \ parameterspage.h \ presetlistview.h \ presetmodel.h \ propertytoolbox.h \ renamedialog.h \ savebookmarkdialog.h \ savepresetdialog.h \ shadewidget.h \ viewcontainer.h SOURCES += aboutbox.cpp \ advancedsettingspage.cpp \ animationpage.cpp \ bookmarklistview.cpp \ bookmarkmodel.cpp \ colorsettingspage.cpp \ colorwidget.cpp \ configurationdata.cpp \ datafunctions.cpp \ datastructures.cpp \ doubleedit.cpp \ doubleslider.cpp \ fractaldata.cpp \ fractalgenerator.cpp \ fractalmodel.cpp \ fractalpresenter.cpp \ fractaltypedialog.cpp \ fractaltypewidget.cpp \ fraqtiveapplication.cpp \ fraqtivemainwindow.cpp \ generateimagedialog.cpp \ generateseriesdialog.cpp \ gradientdialog.cpp \ gradienteditor.cpp \ guidedialog.cpp \ iconloader.cpp \ imagegenerator.cpp \ imageview.cpp \ jobscheduler.cpp \ loadbookmarkdialog.cpp \ loadpresetdialog.cpp \ main.cpp \ meshview.cpp \ parameterspage.cpp \ presetlistview.cpp \ presetmodel.cpp \ propertytoolbox.cpp \ renamedialog.cpp \ savebookmarkdialog.cpp \ savepresetdialog.cpp \ shadewidget.cpp \ viewcontainer.cpp FORMS += advancedsettingspage.ui \ animationpage.ui \ colorsettingspage.ui \ fractaltypedialog.ui \ fractaltypewidget.ui \ fraqtivemainwindow.ui \ generateimagedialog.ui \ generateseriesdialog.ui \ gradientdialog.ui \ gradienteditor.ui \ loadbookmarkdialog.ui \ loadpresetdialog.ui \ parameterspage.ui \ renamedialog.ui \ savebookmarkdialog.ui \ savepresetdialog.ui RESOURCES += data.qrc \ icons.qrc \ resources.qrc \ tutorial.qrc no-sse2|win32-msvc|win32-g++: CONFIG -= sse2 sse2 { DEFINES += HAVE_SSE2 win32-g++|!win32:!*-icc* { SSE2_SOURCES += generatorcore.cpp sse2_compiler.commands = $$QMAKE_CXX -c -msse2 $(CXXFLAGS) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT} sse2_compiler.dependency_type = TYPE_C sse2_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} sse2_compiler.input = SSE2_SOURCES sse2_compiler.variable_out = OBJECTS sse2_compiler.name = compiling[sse2] ${QMAKE_FILE_IN} silent:sse2_compiler.commands = @echo compiling[sse2] ${QMAKE_FILE_IN} && $$sse2_compiler.commands QMAKE_EXTRA_COMPILERS += sse2_compiler } else { SOURCES += generatorcore.cpp } } else { SOURCES += generatorcore.cpp } include( xmlui/xmlui.pri ) static { !contains( QT_CONFIG, no-jpeg ) : !contains( QT_CONFIG, jpeg ) { DEFINES += HAVE_STATIC_JPEG QTPLUGIN += qjpeg } !contains( QT_CONFIG, no-tiff ) : !contains( QT_CONFIG, tiff ) { DEFINES += HAVE_STATIC_TIFF QTPLUGIN += qtiff } } INCLUDEPATH += . PRECOMPILED_HEADER = fraqtive_pch.h win32 { !win32-g++:RC_FILE = fraqtive.rc LIBS += -lshell32 } unix { LIBS += -lGLU } !win32 | build_pass { MOC_DIR = ../tmp RCC_DIR = ../tmp UI_DIR = ../tmp CONFIG( debug, debug|release ) { OBJECTS_DIR = ../tmp/debug DESTDIR = ../debug } else { OBJECTS_DIR = ../tmp/release DESTDIR = ../release } } win32-msvc* { QMAKE_CXXFLAGS += -Fd\$(IntDir) CONFIG -= flat } target.path = $${DESTINATION}$$PREFIX/bin INSTALLS += target unix:!mac { desktop.files = fraqtive.desktop desktop.path = $${DESTINATION}$$PREFIX/share/applications INSTALLS += desktop ICON_SIZES = 16 22 32 48 for( size, ICON_SIZES ) { path = $${DESTINATION}$$PREFIX/share/icons/hicolor/$${size}x$${size}/apps file = $(INSTALL_ROOT)$$path/fraqtive.png eval( icon-$${size}.path = $$path ) eval( icon-$${size}.commands = -$(INSTALL_FILE) $$IN_PWD/icons/fraqtive-$${size}.png $$file ) eval( icon-$${size}.uninstall = -$(DEL_FILE) $$file ) INSTALLS += icon-$${size} } man.files = fraqtive.1 man.path = $${DESTINATION}$$PREFIX/share/man/man1 INSTALLS += man } fraqtive-0.4.8.1/src/tutorial.qrc000066400000000000000000000005241440132223600166420ustar00rootroot00000000000000 tutorial/advanced.html tutorial/color.html tutorial/images.html tutorial/index.html tutorial/navigation.html tutorial/style.css tutorial/type.html fraqtive-0.4.8.1/src/tutorial/000077500000000000000000000000001440132223600161325ustar00rootroot00000000000000fraqtive-0.4.8.1/src/tutorial/advanced.html000066400000000000000000000021031440132223600205610ustar00rootroot00000000000000 Advanced Settings

Advanced Settings

The Calculation Depth slider controls how many iterations are calculated before filling a point with the background color. The number of iterations is automatically adjusted when changing the zoom level.

The Detal Level slider controls how much details of the fractal are calculated. Parts containing few details are skipped for faster generation.

2D Mode

The Anti-Aliasing option controls the post-processing level of the image which makes it look more smooth in areas containing many details.

3D Mode

The Mesh Resolution option controls the resolution of the fractal rendered in 3D mode. Higher resolutions require a fast graphics card.

The Mesh Height Scale slider controls how much the mesh is stretched vertically.

The Camera Zoom controls the zoom of the camera, making the mesh appear closer or farther.

fraqtive-0.4.8.1/src/tutorial/color.html000066400000000000000000000022131440132223600201340ustar00rootroot00000000000000 Color Settings

Color Settings

Use the Edit > Gradient function or the popup button of the Gradient property on the Color Settings page to edit the gradient of colors which is used to draw the fractal.

The three curves allow to edit the red, green and blue component of the gradient separately. You can drag the curve points using the left mouse button, add them by clicking on a free area and remove by dragging them out of the rectangle.

Use the sliders in the Color Settings page to change color scaling and offset. The Mirror option adds a mirrored copy of the gradient and the Reversed option reverses the direction of the gradient.

You can save the current gradient and color settings using the Edit > Save Preset command and later restore it using Edit > Load Preset.

fraqtive-0.4.8.1/src/tutorial/images.html000066400000000000000000000031371440132223600202710ustar00rootroot00000000000000 Generating Images

Generating Images

You can save the currently displayed image using the File > Save Image command. This works both in 2D and 3D modes. The PNG, JPEG, BMP and PPM image formats are supported. You can also copy the current image to clipboard using the Edit > Copy Image command.

To quickly generate an image with the size of your screen (which is useful for creating wallpapers) you can enable the full screen mode and press Ctrl+S to save the current image.

Use the File > Generate Image command to generate an image of an arbitrary size, up to 8000 x 8000 pixels in the 32-bit version or up to 30720 x 17280 pixels in the 64-bit version. You can specify different advanced settings than the ones used in the main window, so you can use this function to generate high quality images and use fast settings while navigating.

Use the File > Generate Series command to generate a series of images with increasing zoom level. You can specify the number of images to generate, the difference between the zoom level in the first and last image and an optional rotation angle. The Blending option reduces flickering by blending consecutive images together with the specified factor, which is useful if the images are used to create an animation.

fraqtive-0.4.8.1/src/tutorial/index.html000066400000000000000000000020711440132223600201270ustar00rootroot00000000000000 Quick Guide to Fraqtive

Quick Guide to Fraqtive

This guide will help you quickly start working with Fraqtive. You can still use the application while this window is open. You can open this guide later by clicking the About Fraqtive icon or pressing F1.

The main window of Fraqtive consists of a tool strip on the top, a fractal view which takes most of the window, a properties panel and a Julia preview panel. You can undock both panels and move them to another position. You can use the properties panel to view and modify all parameters of the fractal, color settings, advanced settings and animation settings.

fraqtive-0.4.8.1/src/tutorial/navigation.html000066400000000000000000000056631440132223600211710ustar00rootroot00000000000000 Navigation

Navigation

2D Mode

The following key combinations can be used to navigate over the fractal surface using the mouse:

Keys Function
LMB Move the mouse away from the start point to zoom in to that point
RMB Move the mouse away from the start point to zoom out from that point
MMB Move the surface in any direction dragging it with the mouse
Shift + LMB Move the surface in any direction dragging it with the mouse
Shift + RMB Rotate the surface around the center dragging in with the mouse
Ctrl + LMB Move the mouse up and down to zoom in and out from the center of the surface
Ctrl + RMB Move the mouse left and right to rotate the surface around the center
4th Button Navigate back to the previous position
5th Button Navigate forward to the next position
Wheel Rotate the wheel up and down to zoom in and out from the point under the mouse
Shift + Wheel Rotate the wheel up and down to rotate the surface around the center
Ctrl + Wheel Rotate the wheel up and down to zoom in and out from the center of the surface

You can also use the following keys when the fractal view is active:

Keys Function
Cursor Keys Move the surface in any direction using the cursor keys
- Zoom out by 200%
+ Zoom in by 200%

You can also use the Parameters page to edit the position, zoom and angle of the visible part of the fractal surface.

While hovering the mouse over the main fractal surface, a preview of the Julia fractal corresponding to the point under the mouse is dynamically generated. Double-click on the main view to switch it to the Julia fractal.

3D Mode

Click View > 3D View to switch to the 3D mode. You can rotate and zoom the 3D view using the mouse:

Keys Function
LMB Move the mouse to rotate the fractal surface around its center
RMB,
Ctrl + LMB
Move the mouse up and down to zoom the view in and out
Wheel Rotate the wheel up and down to zoom the view in and out

You can also use the cursor keys and +/- keys to rotate and zoom in the 3D mode.

fraqtive-0.4.8.1/src/tutorial/style.css000066400000000000000000000005571440132223600200130ustar00rootroot00000000000000body { font-size: large; } h1 { font-size: x-large; font-weight: bold; color: #358; margin: 0 0 1em 0; } h2 { font-size: large; font-weight: bold; color: #358; margin: 0 0 1em 0; } p { margin: 0 0 0.8em 0; } table { margin: 0.8em 0 0.8em 0; } th { background-color: #ccf; padding: 0.2em; } td { background-color: #eee; padding: 0.2em; } fraqtive-0.4.8.1/src/tutorial/type.html000066400000000000000000000020761440132223600200060ustar00rootroot00000000000000 Fractal Type

Fractal Type

Use the Edit > Fractal Type function or the popup button of the Fractal Type property on the Parameters page to change the fractal set and formula.

The available fractal sets are: Mandelbrot and Julia (for a given point).

The formula can be changed by selecting a variant and an exponent. The Integral Exponent field allows one to select an exponent ranging from 2 to 6, which is calculated using a fast, predefined algorithms. The Real Exponent field allows entering a fractional number, but a significantly slower algorithm is used.

You can save the current fractal type and position using the Position > Save Bookmark command and restore it later using Position > Load Bookmark.

fraqtive-0.4.8.1/src/viewcontainer.cpp000066400000000000000000000025311440132223600176510ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #include "viewcontainer.h" #include ViewContainer::ViewContainer( QWidget* parent ) : QWidget( parent ), m_view( NULL ) { m_layout = new QVBoxLayout( this ); m_layout->setMargin( 0 ); } ViewContainer::~ViewContainer() { } void ViewContainer::setView( QWidget* view ) { if ( m_view != view ) { delete m_view; m_view = view; m_layout->addWidget( view ); } } QSize ViewContainer::sizeHint() const { return QSize( 200, 200 ); } fraqtive-0.4.8.1/src/viewcontainer.h000066400000000000000000000024161440132223600173200ustar00rootroot00000000000000/************************************************************************** * This file is part of the Fraqtive program * Copyright (C) 2004-2012 Michał Męciński * * 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 . **************************************************************************/ #ifndef VIEWCONTAINER_H #define VIEWCONTAINER_H #include class QBoxLayout; class ViewContainer : public QWidget { Q_OBJECT public: ViewContainer( QWidget* parent ); ~ViewContainer(); public: void setView( QWidget* view ); QWidget* view() const { return m_view; } public: // overrides QSize sizeHint() const; private: QBoxLayout* m_layout; QWidget* m_view; }; #endif fraqtive-0.4.8.1/src/xmlui/000077500000000000000000000000001440132223600154255ustar00rootroot00000000000000fraqtive-0.4.8.1/src/xmlui/README000066400000000000000000000035661440132223600163170ustar00rootroot00000000000000Simple XML-based UI builder for Qt4 Version 2.1 (2012-05-28) This library provides a tool strip widget, replacing classic menu bar and toolbars, and facilities for defining and merging the layout of actions from multiple components, using simple XML files. Website: http://www.mimec.org/components/xmlui Copyright ========= Copyright (C) 2007-2012 Michał Męciński Special thanks for Filipe Azevedo for the MacStyle contribution. License ======= Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. fraqtive-0.4.8.1/src/xmlui/builder.cpp000066400000000000000000000334711440132223600175670ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #include "builder.h" #include "client.h" #include "toolstrip.h" #include using namespace XmlUi; Builder::Builder( QWidget* parent ) : QObject( parent ), m_parent( parent ), m_updateEnabled( true ), m_updatePending( false ) { } Builder::~Builder() { foreach ( Client* client, m_clients ) client->m_builder = NULL; } void Builder::addClient( Client* client ) { if ( client->m_builder == this ) return; if ( client->m_builder ) client->m_builder->removeClient( client ); m_clients.append( client ); client->m_builder = this; rebuildAll(); } void Builder::removeClient( Client* client ) { if ( client->m_builder != this ) return; m_clients.removeAt( m_clients.indexOf( client ) ); client->m_builder = NULL; rebuildAll(); } Node Builder::mergeNodes( const Node& node1, const Node& node2 ) { Node result; result.setType( node1.type() ); result.setId( node1.id() ); QList children; int mergePos = -1; // copy nodes from node1 and find the position of the merge marker foreach ( Node child, node1.children() ) { if ( child.type() == Merge ) mergePos = children.count(); else children.append( child ); } // no merge marker, append node2 at the end if ( mergePos < 0 ) mergePos = children.count(); int newMergePos = -1; // process nodes from node2 foreach ( Node child, node2.children() ) { // remember the position of the merge marker if ( child.type() == Merge ) { newMergePos = mergePos; continue; } bool merged = false; // find a matching node from node1 for ( int j = 0; j < children.count(); j++ ) { if ( canMergeNodes( children.at( j ), child ) ) { // replace the original node with the recursively merged node children.replace( j, mergeNodes( children.at( j ), child ) ); merged = true; break; } } // no matching node to merge with, insert at merge location if ( !merged ) children.insert( mergePos++, child ); } if ( !children.isEmpty() ) { // no merge marker in node2, continue merging from current location if ( newMergePos < 0 ) newMergePos = mergePos; // insert new merge marker at appropriate position if needed if ( newMergePos < children.count() ) children.insert( newMergePos, Node( Merge ) ); result.setChildren( children ); } return result; } bool Builder::canMergeNodes( const Node& node1, const Node& node2 ) { if ( node1.type() == node2.type() ) { // nodes without id are never merged if ( node1.id().isEmpty() || node2.id().isEmpty() ) return false; // merge if both type and id is the same if ( node1.id() == node2.id() ) return true; } return false; } Node Builder::resolveGroups( const Node& node ) { Node result; result.setType( node.type() ); result.setId( node.id() ); for ( int i = 0; i < node.children().count(); i++ ) { Node child = node.children().at( i ); // process the element's groups recursively if ( child.children().count() > 0 ) child = resolveGroups( child ); if ( child.type() == Group ) { // replace the group whith its children for ( int k = 0; k < child.children().count(); k++ ) result.addChild( child.children().at( k ) ); } else { result.addChild( child ); } } return result; } void Builder::supressUpdate() { m_updateEnabled = false; } void Builder::resumeUpdate() { m_updateEnabled = true; if ( m_updatePending ) { rebuildAll(); m_updatePending = false; } } void Builder::rebuildAll() { if ( !m_updateEnabled ) { m_updatePending = true; return; } QList actionsToAdd; QList actionsToRemove = m_parent->actions(); foreach ( Client* client, m_clients ) { foreach ( QAction* action, client->actions() ) { if ( !actionsToRemove.removeAll( action ) && !actionsToAdd.contains( action ) ) actionsToAdd.append( action ); } } foreach ( QAction* action, actionsToRemove ) m_parent->removeAction( action ); m_parent->addActions( actionsToAdd ); if ( m_clients.isEmpty() ) return; Node node = m_clients.at( 0 )->m_rootNode; for ( int i = 1; i < m_clients.count(); i++ ) node = mergeNodes( node, m_clients.at( i )->m_rootNode ); m_rootNode = resolveGroups( node ); foreach ( QMenu* menu, m_contextMenus ) menu->deleteLater(); m_contextMenus.clear(); foreach ( Node child, m_rootNode.children() ) { if ( child.type() == Strip ) populateToolStrip( child ); } emit reset(); } void Builder::registerToolStrip( const QString& id, ToolStrip* strip ) { m_toolStrips.insert( id, strip ); foreach ( Node child, m_rootNode.children() ) { if ( child.type() == Strip && child.id() == id ) { populateToolStrip( child ); break; } } } ToolStrip* Builder::toolStrip( const QString& id ) const { return m_toolStrips.value( id ); } void Builder::populateToolStrip( const Node& node ) { ToolStrip* strip = m_toolStrips.value( node.id() ); if ( !strip ) return; strip->clearToolActions(); bool separator = false; bool added = false; foreach ( Node child, node.children() ) { if ( child.type() == Section ) { bool section = false; foreach ( Node sectionChild, child.children() ) { if ( sectionChild.type() == Grid ) { bool grid = false; foreach ( Node gridChild, sectionChild.children() ) { if ( gridChild.type() == Row ) { bool row = false; foreach ( Node rowChild, gridChild.children() ) { if ( rowChild.type() == Action ) { QAction* action = findAction( rowChild.id() ); if ( action && action->isVisible() ) { if ( !section ) { QString title = findTitle( child.id() ); strip->beginSection( title ); section = true; } if ( !grid ) { strip->beginGrid(); grid = true; } if ( !row ) { strip->beginRow(); row = true; } addToolAction( strip, action, rowChild.id() ); } } } if ( row ) strip->endRow(); } if ( gridChild.type() == Action ) { QAction* action = findAction( gridChild.id() ); if ( action && action->isVisible() ) { if ( !section ) { QString title = findTitle( child.id() ); strip->beginSection( title ); section = true; } if ( !grid ) { strip->beginGrid(); grid = true; } addToolAction( strip, action, gridChild.id() ); } } } if ( grid ) strip->endGrid(); } if ( sectionChild.type() == Action ) { QAction* action = findAction( sectionChild.id() ); if ( action && action->isVisible() ) { if ( !section ) { QString title = findTitle( child.id() ); strip->beginSection( title ); section = true; } addToolAction( strip, action, sectionChild.id() ); } } } if ( section ) strip->endSection(); } if ( child.type() == Action ) { QAction* action = findAction( child.id() ); if ( action && action->isVisible() ) { if ( separator ) { strip->addSeparator(); separator = false; } addToolAction( strip, action, child.id() ); added = true; } } if ( child.type() == Separator ) { if ( added ) separator = true; } } } void Builder::addToolAction( ToolStrip* strip, QAction* action, const QString& id ) { for ( int i = m_clients.count() - 1; i >= 0; i-- ) { QString menuId = m_clients.at( i )->popupMenu( id ); if ( !menuId.isEmpty() ) { QMenu* menu = contextMenu( menuId ); action->setMenu( menu ); QString defaultId = m_clients.at( i )->defaultMenuAction( menuId ); if ( !defaultId.isEmpty() ) menu->setDefaultAction( findAction( defaultId ) ); break; } } strip->addToolAction( action ); } QMenu* Builder::contextMenu( const QString& id ) { QMenu* menu = m_contextMenus.value( id ); if ( menu ) return menu; foreach ( Node child, m_rootNode.children() ) { if ( child.type() == Menu && child.id() == id ) { menu = createMenu( child ); break; } } if ( menu ) { for ( int i = m_clients.count() - 1; i >= 0; i-- ) { QString defaultId = m_clients.at( i )->defaultMenuAction( id ); if ( !defaultId.isEmpty() ) { menu->setDefaultAction( findAction( defaultId ) ); break; } } m_contextMenus.insert( id, menu ); } return menu; } QMenu* Builder::createMenu( const Node& node ) { QMenu* menu = NULL; bool separator = false; foreach ( Node child, node.children() ) { if ( child.type() == Separator ) { if ( menu != NULL ) separator = true; continue; } QAction* action = NULL; if ( child.type() == Action ) action = findAction( child.id() ); if ( child.type() == Menu ) { QMenu* subMenu = createMenu( child ); if ( subMenu ) action = subMenu->menuAction(); } if ( action && action->isVisible() ) { if ( !menu ) { QString title = findTitle( node.id(), node.id() ); menu = new QMenu( title, m_parent ); } if ( separator ) { menu->addSeparator(); separator = false; } menu->addAction( action ); } } return menu; } QAction* Builder::findAction( const QString& id ) { for ( int i = m_clients.count() - 1; i >= 0; i-- ) { QAction* action = m_clients.at( i )->action( id ); if ( action ) return action; } return NULL; } QString Builder::findTitle( const QString& id, const QString& defaultTitle /*= QString()*/ ) { for ( int i = m_clients.count() - 1; i >= 0; i-- ) { QString title = m_clients.at( i )->title( id ); if ( !title.isEmpty() ) return title; } return defaultTitle; } fraqtive-0.4.8.1/src/xmlui/builder.h000066400000000000000000000107171440132223600172320ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_BUILDER_H #define XMLUI_BUILDER_H #include "node_p.h" #include #include #include namespace XmlUi { class Node; class Client; class ToolStrip; } class QMainWindow; class QMenu; class QToolBar; class QAction; /** * Simple XML-based UI builder for Qt4 */ namespace XmlUi { /** * The UI builder connected to a window or dialog. * * The builder object automatically populates the ToolStrip widgets. * The builder can also create popup menus. * * The menus and toolstrips are created by merging the layout of all * registered clients. */ class Builder : public QObject { Q_OBJECT public: /** * Constructor. * @param parent The parent widget. */ Builder( QWidget* parent ); /** * Destructor. */ ~Builder(); public: /** * Add a client to the builder. * The UI is automatically rebuilt. The UI is merged in the same * order the clients are added. * @param client The client to add. */ void addClient( Client* client ); /** * Remove a client from the builder. * The UI is automatically rebuilt. * @param client The client to remove. */ void removeClient( Client* client ); /** * Create a context menu. * Note that the menu is deleted when the UI is rebuilt. * @param id The identifier of the menu. * @return The created menu or @c NULL if it wasn't found. */ QMenu* contextMenu( const QString& id ); /** * Register a toolstrip. * @param id The identifier of the toolstrip. * @param strip The ToolStrip to populate with actions. */ void registerToolStrip( const QString& id, ToolStrip* strip ); /** * Return the toolstrip with given identifier. */ ToolStrip* toolStrip( const QString& id ) const; /** * Supress rebuilding the UI. */ void supressUpdate(); /** * Resume rebuilding the UI. */ void resumeUpdate(); /** * Rebuild the entire UI. */ void rebuildAll(); signals: /** * Emitted when the UI is reset. */ void reset(); private: Node mergeNodes( const Node& node1, const Node& node2 ); bool canMergeNodes( const Node& node1, const Node& node2 ); Node resolveGroups( const Node& node ); void populateToolStrip( const Node& node ); void addToolAction( ToolStrip* strip, QAction* action, const QString& id ); QMenu* createMenu( const Node& node ); QAction* findAction( const QString& id ); QString findTitle( const QString& id, const QString& defaultTitle = QString() ); private: QWidget* m_parent; QList m_clients; Node m_rootNode; QMap m_contextMenus; QMap m_toolStrips; bool m_updateEnabled; bool m_updatePending; }; } #endif fraqtive-0.4.8.1/src/xmlui/client.cpp000066400000000000000000000117741440132223600174210ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #include "client.h" #include "builder.h" #include #include #include using namespace XmlUi; Client::Client() : m_builder( NULL ) { } Client::~Client() { if ( m_builder ) m_builder->removeClient( this ); } void Client::setAction( const QString& id, QAction* action ) { m_actions.insert( id, action ); } QAction* Client::action( const QString& id ) const { return m_actions.value( id, NULL ); } QList Client::actions() const { return m_actions.values(); } void Client::setTitle( const QString& id, const QString& title ) { m_titles.insert( id, title ); } QString Client::title( const QString& id ) const { return m_titles.value( id, QString() ); } void Client::setPopupMenu( const QString& actionId, const QString& menuId, const QString& defaultId ) { m_menus.insert( actionId, menuId ); m_defaultActions.insert( menuId, defaultId ); QObject::connect( action( actionId ), SIGNAL( triggered() ), action( defaultId ), SIGNAL( triggered() ) ); } QString Client::popupMenu( const QString& actionId ) { return m_menus.value( actionId, QString() ); } void Client::setDefaultMenuAction( const QString& menuId, const QString& defaultId ) { m_defaultActions.insert( menuId, defaultId ); } QString Client::defaultMenuAction( const QString& menuId ) { return m_defaultActions.value( menuId, QString() ); } bool Client::loadXmlUiFile( const QString& path ) { QDomDocument document; QFile file( path ); if ( !file.open( QIODevice::ReadOnly ) ) { qWarning( "XmlUi::Client::loadXmlUiFile: Cannot open file" ); return false; } QString error; int line; int column; if ( !document.setContent( &file, false, &error, &line, &column ) ) { qWarning( "XmlUi::Client::loadXmlUiFile: Cannot parse file" ); qWarning( "(%s, line: %d, column: %d)", qPrintable( error ), line, column ); return false; } m_rootNode = createNode( document.documentElement() ); if ( m_rootNode.type() != Root ) { qWarning( "XmlUi::Client::loadXmlUiFile: Incorrect root element type" ); return false; } return true; } Node Client::createNode( const QDomElement& element ) { Node node; node.setType( typeFromTag( element.tagName() ) ); node.setId( element.attribute( "id", QString() ) ); for ( QDomElement child = element.firstChildElement(); !child.isNull(); child = child.nextSiblingElement() ) node.addChild( createNode( child ) ); return node; } NodeType Client::typeFromTag( const QString& tag ) { if ( tag == QLatin1String( "xmlui" ) ) return Root; if ( tag == QLatin1String( "strip" ) ) return Strip; if ( tag == QLatin1String( "section" ) ) return Section; if ( tag == QLatin1String( "grid" ) ) return Grid; if ( tag == QLatin1String( "row" ) ) return Row; if ( tag == QLatin1String( "menu" ) ) return Menu; if ( tag == QLatin1String( "group" ) ) return Group; if ( tag == QLatin1String( "action" ) ) return Action; if ( tag == QLatin1String( "separator" ) ) return Separator; if ( tag == QLatin1String( "merge" ) ) return Merge; qWarning( "XmlUi::Client::loadXmlUiFile: Invalid tag '%s'", qPrintable( tag ) ); return Unknown; } fraqtive-0.4.8.1/src/xmlui/client.h000066400000000000000000000122511440132223600170550ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_CLIENT_H #define XMLUI_CLIENT_H #include "node_p.h" #include #include namespace XmlUi { class Builder; } class QAction; class QDomElement; namespace XmlUi { /** * The UI client containing actions and layout of menus and toolstrips. * * This class is a container for actions. It also describes the layout * of the toolstrips and context menus containing these actions. * * One ore more clients can be added to a Builder object connected to * a window. The client is automatically removed when it's deleted. * * A component class can inherit the Client class using multiple * inheritance, set up the actions and titles and load the layout from * an XML file. */ class Client { public: /** * Default constructor. */ Client(); /** * Destructor. */ ~Client(); public: /** * Add an action to the collection. * @param id The identifier of the action. * @param action The action to add. */ void setAction( const QString& id, QAction* action ); /** * Find an action with the given identifier. * @param id The identifier of the action. * @return The action or @c NULL if it wasn't found. */ QAction* action( const QString& id ) const; /** * Return all actions contained in the client. */ QList actions() const; /** * Set the title of a menu or section. * @param id The identifier of the menu or section. * @param title The user-visible name of the element. */ void setTitle( const QString& id, const QString& title ); /** * Return the title of a menu or section. * @param id The identifier of the menu or section. * @return The user-visible name of the element. */ QString title( const QString& id ) const; /** * Assign a popup menu to the given action. * @param actionId The identifier of the action. * @param menuId The identifier of the menu. * @param defaultId The identifier of the default action in the menu. */ void setPopupMenu( const QString& actionId, const QString& menuId, const QString& defaultId ); /** * Return popup menu for the given action. * @param actionId The identifier of the action. * @return The identifier of the menu. */ QString popupMenu( const QString& actionId ); /** * Set the default action in the contextual menu. * @param menuId The identifier of the menu. * @param defaultId The identifier of the default action in the menu. */ void setDefaultMenuAction( const QString& menuId, const QString& defaultId ); /** * Return the default action in the popup or contextual menu. * @param menuId The identifier of the menu. * @return The identifier of the default action in the menu. */ QString defaultMenuAction( const QString& menuId ); /** * Load the UI layout from the given XML file. * @param path The path of the file. * @return @c true if the file was loaded, @c false otherwise. */ bool loadXmlUiFile( const QString& path ); /** * Return the associated UI builder. */ Builder* builder() const { return m_builder; } private: Node createNode( const QDomElement& element ); NodeType typeFromTag( const QString& tag ); private: QMap m_actions; QMap m_titles; QMap m_menus; QMap m_defaultActions; Node m_rootNode; Builder* m_builder; friend class Builder; }; } #endif fraqtive-0.4.8.1/src/xmlui/gradientwidget.cpp000066400000000000000000000037141440132223600211370ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #include "gradientwidget.h" using namespace XmlUi; GradientWidget::GradientWidget( QWidget* parent ) : QWidget( parent ) { setPalette( QPalette( QColor( 255, 255, 255 ) ) ); setAutoFillBackground( true ); } GradientWidget::~GradientWidget() { } fraqtive-0.4.8.1/src/xmlui/gradientwidget.h000066400000000000000000000043231440132223600206010ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_GRADIENTWIDGET_H #define XMLUI_GRADIENTWIDGET_H #include namespace XmlUi { /** * Widget with styled gradient background. * * It uses the XmlUi::WindowsStyle if available to draw the gradient. * Otherwise it falls back to plain white background. */ class GradientWidget : public QWidget { Q_OBJECT public: /** * Constructor. * @param parent The parent widget. */ GradientWidget( QWidget* parent ); /** * Destructor. */ ~GradientWidget(); }; } #endif fraqtive-0.4.8.1/src/xmlui/macstyle.cpp000066400000000000000000000236141440132223600177600ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #include "macstyle.h" #if !defined( XMLUI_NO_STYLE_MAC ) #include #include #include #include #include #include #include #include #include #include #include #include using namespace XmlUi; MacStyle::MacStyle() : QProxyStyle() { } MacStyle::~MacStyle() { } static void drawHighlightFrameMac( QPainter* painter, const QWidget* widget, const QStyleOptionComplex* option, const QRect& rect ) { const QSize size( 50, 34 ); QStyleOptionButton opt; opt.initFrom( widget ); opt.direction = option->direction; opt.fontMetrics = option->fontMetrics; opt.palette = option->palette; opt.rect = QRect( QPoint(), size ); opt.state = option->state | QStyle::State_Sunken; // grab original rendering QPixmap pixmap( size ); pixmap.fill( QColor( Qt::transparent ) ); { QPainter p( &pixmap ); widget->style()->drawControl( QStyle::CE_PushButton, &opt, &p, 0 ); } pixmap = pixmap.copy( QRect( QPoint(), size ).adjusted( 6, 6, -6, -6 ) ); // 38x22 // create circle pixmap { QPixmap pix = QPixmap( pixmap.height(), pixmap.height() ); const QSize pixSize( pix.width() /2, pix.height() ); pix.fill( QColor( Qt::transparent ) ); { QPainter p( &pix ); p.drawPixmap( QPoint(), pixmap.copy( QRect( QPoint(), pixSize ) ) ); p.drawPixmap( QPoint( pix.width() /2, 0 ), pixmap.copy( QRect( QPoint( pixmap.width() -pix.width() /2, 0 ), pixSize ) ) ); } pixmap = pix; } // paint final pixmap { QPixmap topLeft; QPixmap topRight; QPixmap bottomLeft; QPixmap bottomRight; QPixmap left; QPixmap top; QPixmap right; QPixmap bottom; QPixmap center; const int width = qBound( 0, rect.width() /2, pixmap.width() /2 ); const int height = qBound( 0, rect.height() /2, pixmap.height() /2 ); const QSize pixSize( width, height ); topLeft = pixmap.copy( QRect( QPoint(), pixSize ) ); topRight = pixmap.copy( QRect( QPoint( pixmap.width() -pixSize.width(), 0 ), pixSize ) ); bottomLeft = pixmap.copy( QRect( QPoint( 0, pixmap.height() -pixSize.height() ), pixSize ) ); bottomRight = pixmap.copy( QRect( QPoint( pixmap.width() -pixSize.width(), pixmap.height() -pixSize.height() ), pixSize ) ); left = pixmap.copy( QRect( QPoint( 0, pixmap.height() /2 ), QSize( pixSize.width(), 1 ) ) ); top = pixmap.copy( QRect( QPoint( pixmap.width() /2, 0 ), QSize( 1, pixSize.height() ) ) ); right = pixmap.copy( QRect( QPoint( pixmap.width() -pixSize.width(), pixmap.height() /2 ), QSize( pixSize.width(), 1 ) ) ); bottom = pixmap.copy( QRect( QPoint( pixmap.width() /2, pixmap.height() -pixSize.height() ), QSize( 1, pixSize.height() ) ) ); center = pixmap.copy( QRect( QPoint( pixmap.width() /2, pixmap.height() /2 ), QSize( 1, 1 ) ) ); QPixmap pix = QPixmap( rect.size() ); pix.fill( QColor( Qt::transparent ) ); QRect r( QPoint(), rect.size() ); { QPainter p( &pix ); p.drawPixmap( r.topLeft(), topLeft ); p.drawPixmap( r.topRight() +QPoint( -topRight.width(), 0 ), topRight ); p.drawPixmap( r.bottomLeft() +QPoint( 0, -bottomLeft.height() ), bottomLeft ); p.drawPixmap( r.bottomRight() +QPoint( -bottomRight.width(), -bottomRight.height() ), bottomRight ); p.drawPixmap( QRect( QPoint( 0, topRight.height() ), QSize( left.width(), rect.height() -( topRight.height() +bottomRight.height() ) ) ), left ); p.drawPixmap( QRect( QPoint( topLeft.width(), 0 ), QSize( r.width() -( topLeft.width() +topRight.width() ), top.height() ) ), top ); p.drawPixmap( QRect( QPoint( r.width() -topRight.width() -1, topRight.height() ), QSize( right.width(), r.height() -( topRight.height() +bottomRight.height() ) ) ), right ); p.drawPixmap( QRect( QPoint( bottomLeft.width(), r.height() -bottom.height() -1 ), QSize( r.width() -( bottomLeft.width() +bottomRight.width() ), bottom.height() ) ), bottom ); p.drawPixmap( rect.adjusted( left.width(), top.height(), -right.width(), -bottom.height() ), center ); } pixmap = pix; } // draw scaled content painter->setRenderHint( QPainter::SmoothPixmapTransform ); painter->drawPixmap( rect.topLeft(), pixmap ); } void MacStyle::drawComplexControl( ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { switch ( control ) { case CC_ToolButton: if ( option->state & State_AutoRaise ) { if ( const QStyleOptionToolButton* optionToolButton = qstyleoption_cast( option ) ) { QRect buttonRect = subControlRect( control, option, SC_ToolButton, widget ); QStyle::State buttonState = option->state & ~State_Sunken; if ( option->state & State_Sunken ) { if ( optionToolButton->activeSubControls & SC_ToolButton ) buttonState |= State_Sunken; else if ( optionToolButton->activeSubControls & SC_ToolButtonMenu ) buttonState |= State_MouseOver; } bool selected = buttonState & State_MouseOver && option->state & State_Enabled; bool checked = buttonState & State_On; bool sunken = buttonState & State_Sunken; if ( selected || checked || sunken ) { if ( sunken || selected && checked ) drawHighlightFrameMac( painter, widget, option, buttonRect ); else if ( checked ) drawHighlightFrameMac( painter, widget, option, buttonRect ); else drawHighlightFrameMac( painter, widget, option, buttonRect ); } QStyleOptionToolButton optionLabel = *optionToolButton; optionLabel.state = buttonState; int fw = pixelMetric( PM_DefaultFrameWidth, option, widget ); optionLabel.rect = buttonRect.adjusted( fw, fw, -fw, -fw ); drawControl( CE_ToolButtonLabel, &optionLabel, painter, widget ); if ( optionToolButton->subControls & SC_ToolButtonMenu ) { QRect menuRect = subControlRect( control, option, SC_ToolButtonMenu, widget ); menuRect.adjust( -1, 0, 0, 0 ); if ( sunken || optionToolButton->state & State_Sunken && optionToolButton->activeSubControls & SC_ToolButtonMenu ) drawHighlightFrameMac( painter, widget, option, menuRect ); else if ( selected ) drawHighlightFrameMac( painter, widget, option, menuRect ); QStyleOptionToolButton optionArrow = *optionToolButton; optionArrow.rect = menuRect.adjusted( 2, 3, -5, -5 ); drawPrimitive( PE_IndicatorArrowDown, &optionArrow, painter, widget ); } else if ( optionToolButton->features & QStyleOptionToolButton::HasMenu ) { int size = pixelMetric( PM_MenuButtonIndicator, option, widget ); QRect rect = optionToolButton->rect; QStyleOptionToolButton optionArrow = *optionToolButton; optionArrow.rect = QRect( rect.right() + 4 - size, rect.height() - size + 4, size - 5, size - 5 ); drawPrimitive( PE_IndicatorArrowDown, &optionArrow, painter, widget ); } return; } break; } default: break; } QProxyStyle::drawComplexControl( control, option, painter, widget ); } #endif // !defined( XMLUI_NO_STYLE_MAC ) fraqtive-0.4.8.1/src/xmlui/macstyle.h000066400000000000000000000046611440132223600174260ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_MACSTYLE_H #define XMLUI_MACSTYLE_H #include #if !defined( Q_OS_MAC ) || defined( QT_NO_STYLE_AQUA ) #define XMLUI_NO_STYLE_MAC #endif #if !defined( XMLUI_NO_STYLE_MAC ) #include namespace XmlUi { /** * Better Qt style for Mac. * * The style override default QToolButton rendering which are ugly on mac os x. */ class MacStyle : public QProxyStyle { Q_OBJECT public: /** * Constructor. */ MacStyle(); /** * Destructor. */ ~MacStyle(); public: // overrides void drawComplexControl( ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const; }; } #endif // !defined( XMLUI_NO_STYLE_MAC ) #endif fraqtive-0.4.8.1/src/xmlui/node_p.h000066400000000000000000000051111440132223600170400ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_NODE_H #define XMLUI_NODE_H #include #include namespace XmlUi { enum NodeType { Unknown, Root, Strip, Section, Grid, Row, Menu, Group, Action, Separator, Merge }; class Node { public: Node() : m_type( Unknown ) { } Node( NodeType type ) : m_type( type ) { } public: void setType( NodeType type ) { m_type = type; } NodeType type() const { return m_type; } void setId( const QString& id ) { m_id = id; } const QString& id() const { return m_id; } void setChildren( const QList& children ) { m_children = children; } const QList& children() const { return m_children; } void addChild( const Node& node ) { m_children.append( node ); } private: NodeType m_type; QString m_id; QList m_children; }; } #endif fraqtive-0.4.8.1/src/xmlui/toolstrip.cpp000066400000000000000000000571461440132223600202050ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #include "toolstrip.h" #include "toolstrip_p.h" #include #include #include #include #include #include #include #include #include #include using namespace XmlUi; ToolStrip::ToolStrip( QWidget* parent ) : QWidget( parent ), m_sectionLayout( NULL ), m_gridLayout( NULL ), m_gridRow( 0 ), m_gridColumn( 0 ), m_rowLayout( NULL ) { m_layout = new ToolStripLayout( this ); } ToolStrip::~ToolStrip() { } void ToolStrip::setHeaderWidget( QWidget* widget ) { delete m_layout->headerWidget(); if ( widget ) m_layout->setHeaderWidget( widget ); } QWidget* ToolStrip::headerWidget() const { return m_layout->headerWidget(); } void ToolStrip::addToolAction( QAction* action ) { QToolButton* button; if ( m_rowLayout ) { button = createButton( action, SmallButton ); m_rowLayout->addWidget( button ); } else if ( m_gridLayout ) { button = createButton( action, MediumButton ); m_gridLayout->addWidget( button, m_gridRow++, m_gridColumn ); if ( m_gridRow == 2 ) { m_gridRow = 0; m_gridColumn++; } } else if ( m_sectionLayout ) { button = createButton( action, LargeButton ); m_sectionLayout->addWidget( button ); } else { button = createButton( action, MediumButton ); m_layout->addWidget( button ); } m_toolButtons.append( button ); } void ToolStrip::addSeparator() { m_layout->addItem( new QSpacerItem( 7, 0 ) ); } void ToolStrip::beginSection( const QString& title ) { m_sectionLayout = new ToolStripSectionLayout( title ); m_layout->addLayout( m_sectionLayout ); } void ToolStrip::endSection() { m_sectionLayout = NULL; } void ToolStrip::beginGrid() { m_gridLayout = new QGridLayout(); m_gridLayout->setMargin( 0 ); m_gridLayout->setSpacing( 0 ); m_sectionLayout->addLayout( m_gridLayout ); m_gridColumn = 0; m_gridRow = 0; } void ToolStrip::endGrid() { m_gridLayout = NULL; } void ToolStrip::beginRow() { m_rowLayout = new QHBoxLayout(); m_rowLayout->setMargin( 0 ); m_rowLayout->setSpacing( 0 ); m_gridLayout->addLayout( m_rowLayout, m_gridRow++, m_gridColumn ); if ( m_gridRow == 2 ) { m_gridRow = 0; m_gridColumn++; } } void ToolStrip::endRow() { m_rowLayout->addStretch( 1 ); m_rowLayout = NULL; } void ToolStrip::clearToolActions() { while ( !m_toolButtons.isEmpty() ) { QToolButton* button = m_toolButtons.takeFirst(); button->hide(); button->deleteLater(); } m_layout->clear(); } void ToolStrip::addAuxiliaryAction( QAction* action ) { QToolButton* button = createButton( action, SmallButton ); m_layout->addAuxiliaryButton( button ); } void ToolStrip::clearAuxiliaryActions() { m_layout->clearAuxiliaryButtons(); } void ToolStrip::setContentsMargins( int left, int top, int right, int bottom ) { m_layout->setContentsMargins( left, top, right, bottom ); } void ToolStrip::execMenu( QAction* action ) { foreach ( QToolButton* button, m_toolButtons ) { if ( button->defaultAction() == action ) { button->setDown( true ); action->menu()->exec( button->mapToGlobal( button->rect().bottomLeft() + QPoint( 0, 1 ) ) ); button->setDown( false ); break; } } } QToolButton* ToolStrip::createButton( QAction* action, ButtonSize size ) { ActionButton* button = new ActionButton( this ); switch ( size ) { case SmallButton: button->setToolButtonStyle( Qt::ToolButtonIconOnly ); button->setIconSize( QSize( 16, 16 ) ); break; case MediumButton: button->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); button->setIconSize( QSize( 16, 16 ) ); break; case LargeButton: button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); button->setIconSize( QSize( 22, 22 ) ); break; } button->setDefaultAction( action ); button->adjustText(); if ( ToolStripAction* tsAction = qobject_cast( action ) ) button->setPopupMode( tsAction->popupMode() ); return button; } void ToolStrip::childEvent( QChildEvent* e ) { QWidget::childEvent( e ); if ( e->type() == QEvent::ChildRemoved && e->child() == m_layout->headerWidget() ) m_layout->setHeaderWidget( NULL ); } static void drawSeparator( const QRect& rect, QPainter* painter, QWidget* widget ) { #if ( QT_VERSION >= 0x040500 ) QStyleOptionFrameV3 option; option.init( widget ); option.frameShape = QFrame::VLine; option.state |= QStyle::State_Sunken; option.rect = rect; option.lineWidth = 1; widget->style()->drawControl( QStyle::CE_ShapedFrame, &option, painter, widget ); #else int x = ( rect.left() + rect.right() ) / 2; qDrawShadeLine( painter, QPoint( x, rect.top() ), QPoint( x, rect.bottom() ), widget->palette(), true, 1, 0 ); #endif } void ToolStrip::paintEvent( QPaintEvent* /*e*/ ) { QPainter painter( this ); for ( int i = 0; i < m_layout->count(); i++ ) { QLayout* childLayout = m_layout->itemAt( i )->layout(); if ( childLayout ) { ToolStripSectionLayout* sectionLayout = qobject_cast( childLayout ); if ( sectionLayout && !sectionLayout->isCollapsed() ) sectionLayout->drawSection( &painter, this ); } QSpacerItem* spacer = m_layout->itemAt( i )->spacerItem(); if ( spacer ) { QRect rect = spacer->geometry(); if ( !rect.isEmpty() ) drawSeparator( rect, &painter, this ); } } } ToolStripAction::ToolStripAction( const QString& text, QObject* parent ) : QAction( text, parent ), m_popupMode( QToolButton::MenuButtonPopup ) { } ToolStripAction::ToolStripAction( const QIcon& icon, const QString& text, QObject* parent ) : QAction( icon, text, parent ), m_popupMode( QToolButton::MenuButtonPopup ) { } ToolStripAction::~ToolStripAction() { } void ToolStripAction::setPopupMode( QToolButton::ToolButtonPopupMode mode ) { m_popupMode = mode; } ToolStripLayout::ToolStripLayout( QWidget* parent ) : QLayout( parent ), m_headerWidget( NULL ), m_dirty( true ), m_simpleLayout( true ), m_auxWidth( 0 ), m_auxWidthNoChevron( 0 ) { setContentsMargins( 0, 0, 0, 0 ); m_chevronButton = new ChevronButton( parent ); addChildWidget( m_chevronButton ); } ToolStripLayout::~ToolStripLayout() { clear(); } void ToolStripLayout::setHeaderWidget( QWidget* widget ) { if ( widget ) addChildWidget( widget ); m_headerWidget = widget; invalidate(); } void ToolStripLayout::addLayout( ToolStripSectionLayout* layout ) { addChildLayout( layout ); addItem( layout ); } void ToolStripLayout::addAuxiliaryButton( QToolButton* button ) { addChildWidget( button ); m_auxiliaryButtons.append( button ); invalidate(); } void ToolStripLayout::clear() { while ( !m_items.isEmpty() ) delete m_items.takeFirst(); invalidate(); } void ToolStripLayout::clearAuxiliaryButtons() { while ( !m_auxiliaryButtons.isEmpty() ) { QToolButton* button = m_auxiliaryButtons.takeFirst(); button->hide(); button->deleteLater(); } invalidate(); } Qt::Orientations ToolStripLayout::expandingDirections() const { return Qt::Horizontal; } QSize ToolStripLayout::sizeHint() const { if ( m_dirty ) const_cast( this )->calculateSize(); return m_sizeHint; } QSize ToolStripLayout::minimumSize() const { if ( m_dirty ) const_cast( this )->calculateSize(); return m_minimumSize; } QSize ToolStripLayout::maximumSize() const { if ( m_dirty ) const_cast( this )->calculateSize(); return m_maximumSize; } void ToolStripLayout::calculateSize() { m_simpleLayout = true; int width = 0; int height = 0; if ( m_headerWidget ) { QSize size = m_headerWidget->sizeHint(); width = size.width(); height = size.height(); m_simpleLayout = false; } for ( int i = 0; i < m_items.count(); i++ ) { QSize size; if ( ToolStripSectionLayout* layout = layoutAt( i ) ) { size = layout->sizeHint(); m_simpleLayout = false; } else if ( QToolButton* button = buttonAt( i ) ) { size = button->sizeHint(); } else if ( QSpacerItem* spacer = itemAt( i )->spacerItem() ) { size = spacer->sizeHint(); } width += size.width(); height = qMax( height, size.height() ); } int auxWidth = 0; int auxHeight = 0; QSize chevronSize = m_chevronButton->sizeHint(); foreach ( QToolButton* button, m_auxiliaryButtons ) { QSize size = button->sizeHint(); auxWidth += size.width(); auxHeight = qMax( auxHeight, size.height() ); } if ( m_simpleLayout ) { m_auxWidthNoChevron = auxWidth > 0 ? auxWidth + 3 : 0; m_auxWidth = m_auxWidthNoChevron + chevronSize.width() + 3; } else { m_auxWidthNoChevron = auxWidth > 0 ? auxWidth + 6 : 0; m_auxWidth = qMax( m_auxWidthNoChevron, chevronSize.width() + 6 ); auxHeight += chevronSize.height() + 9; } int ml, mt, mr, mb; getContentsMargins( &ml, &mt, &mr, &mb ); m_sizeHint = QSize( width + m_auxWidthNoChevron + ml + mr, qMax( height, auxHeight ) + mt + mb ); m_minimumSize = QSize( m_auxWidth + ml + mr, qMax( height, auxHeight ) + mt + mb ); m_maximumSize = QSize( QLAYOUTSIZE_MAX, qMax( height, auxHeight ) + mt + mb ); m_dirty = false; } int ToolStripLayout::count() const { return m_items.count(); } QLayoutItem* ToolStripLayout::itemAt( int index ) const { return ( index >= 0 && index < m_items.count() ) ? m_items.at( index ) : NULL; } void ToolStripLayout::addItem( QLayoutItem* item ) { m_items.append( item ); invalidate(); } QLayoutItem* ToolStripLayout::takeAt( int index ) { QLayoutItem* item = m_items.takeAt( index ); invalidate(); return item; } ToolStripSectionLayout* ToolStripLayout::layoutAt( int index ) const { QLayoutItem* item = itemAt( index ); if ( item && item->layout() ) return qobject_cast( item->layout() ); return NULL; } QToolButton* ToolStripLayout::buttonAt( int index ) const { QLayoutItem* item = itemAt( index ); if ( item && item->widget() ) return qobject_cast( item->widget() ); return NULL; } static void addActions( QLayoutItem* item, QMenu* menu ) { QLayout* layout = item->layout(); if ( layout ) { for ( int i = 0; i < layout->count(); i++ ) addActions( layout->itemAt( i ), menu ); } QWidget* widget = item->widget(); if ( widget ) { QToolButton* button = qobject_cast( widget ); if ( button && button->defaultAction() ) menu->addAction( button->defaultAction() ); } } void ToolStripLayout::setGeometry( const QRect& rect ) { if ( !m_dirty && geometry() == rect ) return; calculateSize(); QLayout::setGeometry( rect ); QRect contents = contentsRect(); int left = contents.left(); bool collapsed = false; if ( m_headerWidget ) { QSize size = m_headerWidget->sizeHint(); if ( left + size.width() > contents.right() - ( m_items.isEmpty() ? m_auxWidthNoChevron : m_auxWidth ) ) collapsed = true; m_headerWidget->setVisible( !collapsed ); if ( !collapsed ) { m_headerWidget->setGeometry( QRect( contents.left(), contents.top(), size.width(), contents.height() ) ); left += size.width(); } } m_chevronButton->menu()->clear(); for ( int i = 0; i < m_items.count(); i++ ) { QSize size; if ( ToolStripSectionLayout* layout = layoutAt( i ) ) size = layout->sizeHint(); else if ( QToolButton* button = buttonAt( i ) ) size = button->sizeHint(); else if ( QSpacerItem* spacer = itemAt( i )->spacerItem() ) size = spacer->sizeHint(); if ( !collapsed && left + size.width() > contents.right() - m_auxWidth + 1 ) { if ( i < m_items.count() - 1 || left + size.width() > contents.right() - m_auxWidthNoChevron + 1 ) { if ( i > 0 ) { if ( QSpacerItem* lastSpacer = itemAt( i - 1 )->spacerItem() ) { left -= 7; lastSpacer->setGeometry( QRect( left, contents.top(), 0, contents.height() ) ); } } collapsed = true; } } if ( ToolStripSectionLayout* layout = layoutAt( i ) ) { layout->setCollapsed( collapsed ); if ( collapsed ) { if ( !m_chevronButton->menu()->isEmpty() ) m_chevronButton->menu()->addSeparator(); addActions( layout, m_chevronButton->menu() ); } } else if ( QToolButton* button = buttonAt( i ) ) { button->setVisible( !collapsed ); if ( collapsed && button->defaultAction() ) m_chevronButton->menu()->addAction( button->defaultAction() ); } else if ( QSpacerItem* spacer = itemAt( i )->spacerItem() ) { if ( collapsed ) { spacer->setGeometry( QRect( left, contents.top(), 0, contents.height() ) ); if ( !m_chevronButton->menu()->isEmpty() ) m_chevronButton->menu()->addSeparator(); } } if ( !collapsed ) { itemAt( i )->setGeometry( QRect( left, contents.top(), size.width(), contents.height() ) ); left += size.width(); } } int right = contents.right() + 1; for ( int i = m_auxiliaryButtons.count() - 1; i >= 0; i-- ) { QToolButton* button = m_auxiliaryButtons.at( i ); QSize size = button->sizeHint(); if ( m_simpleLayout ) button->setGeometry( QRect( right - size.width(), contents.top(), size.width(), size.height() ) ); else button->setGeometry( QRect( right - size.width() - 3, contents.top() + 3, size.width(), size.height() ) ); right -= size.width(); } if ( !collapsed || m_chevronButton->menu()->isEmpty() ) { m_chevronButton->hide(); } else { m_chevronButton->show(); QSize size = m_chevronButton->sizeHint(); if ( m_simpleLayout ) m_chevronButton->setGeometry( QRect( left + 3, contents.top(), size.width(), size.height() ) ); else m_chevronButton->setGeometry( QRect( left + 3, contents.bottom() - size.height() - 2, size.width(), size.height() ) ); } } void ToolStripLayout::invalidate() { m_dirty = true; QLayout::invalidate(); if ( parentWidget() ) parentWidget()->update(); } ToolStripSectionLayout::ToolStripSectionLayout( const QString& title ) : QLayout(), m_titleText( title ), m_collapsed( false ), m_dirty( true ) { setContentsMargins( 0, 0, 0, 0 ); } ToolStripSectionLayout::~ToolStripSectionLayout() { } void ToolStripSectionLayout::addLayout( QLayout* layout ) { addChildLayout( layout ); addItem( layout ); } void ToolStripSectionLayout::drawSection( QPainter* painter, QWidget* widget ) { drawSeparator( m_separatorRect, painter, widget ); widget->style()->drawItemText( painter, m_titleRect, Qt::AlignCenter, widget->palette(), true, m_titleText, QPalette::Text ); } static void setWidgetsVisible( QLayoutItem* item, bool visible ) { QLayout* layout = item->layout(); if ( layout ) { for ( int i = 0; i < layout->count(); i++ ) setWidgetsVisible( layout->itemAt( i ), visible ); } QWidget* widget = item->widget(); if ( widget ) widget->setVisible( visible ); } void ToolStripSectionLayout::setCollapsed( bool collapsed ) { if ( m_collapsed != collapsed ) { m_collapsed = collapsed; setWidgetsVisible( this, !collapsed ); } } Qt::Orientations ToolStripSectionLayout::expandingDirections() const { return 0; } QSize ToolStripSectionLayout::sizeHint() const { if ( m_dirty ) const_cast( this )->calculateSize(); return m_sizeHint; } QSize ToolStripSectionLayout::minimumSize() const { return sizeHint(); } QSize ToolStripSectionLayout::maximumSize() const { return sizeHint(); } static int calculateWidth( QLayoutItem* item ) { if ( item == NULL ) return 0; QLayout* layout = item->layout(); if ( layout ) { int width = 0; QGridLayout* gridLayout = qobject_cast( layout ); if ( gridLayout ) { for ( int column = 0; column < gridLayout->columnCount(); column++ ) { int maxWidth = 0; for ( int row = 0; row < gridLayout->rowCount(); row++ ) maxWidth = qMax( maxWidth, calculateWidth( gridLayout->itemAtPosition( row, column ) ) ); width += maxWidth; } } else { for ( int i = 0; i < layout->count(); i++ ) width += calculateWidth( layout->itemAt( i ) ); } return width; } QWidget* widget = item->widget(); if ( widget ) return widget->sizeHint().width(); return 0; } void ToolStripSectionLayout::calculateSize() { QFontMetrics fontMetrics = parentWidget()->fontMetrics(); QStyleOptionToolButton option; option.initFrom( parentWidget() ); option.iconSize = QSize( 22, 22 ); option.state |= QStyle::State_AutoRaise; option.subControls = QStyle::SC_ToolButton; option.toolButtonStyle = Qt::ToolButtonTextUnderIcon; QSize buttonSize = parentWidget()->style()->sizeFromContents( QStyle::CT_ToolButton, &option, QSize( 22, 22 + 4 + fontMetrics.height() * 2 ), parentWidget() ); int width = calculateWidth( const_cast( this ) ); m_titleSize = fontMetrics.size( 0, m_titleText ); m_sizeHint = QSize( qMax( width, m_titleSize.width() ) + 9, buttonSize.height() + m_titleSize.height() + 9 ); m_dirty = false; } int ToolStripSectionLayout::count() const { return m_items.count(); } QLayoutItem* ToolStripSectionLayout::itemAt( int index ) const { return ( index >= 0 && index < m_items.count() ) ? m_items.at( index ) : NULL; } void ToolStripSectionLayout::addItem( QLayoutItem* item ) { m_items.append( item ); invalidate(); } QLayoutItem* ToolStripSectionLayout::takeAt( int index ) { QLayoutItem* item = m_items.takeAt( index ); invalidate(); return item; } void ToolStripSectionLayout::setGeometry( const QRect& rect ) { if ( !m_dirty && geometry() == rect ) return; if ( m_dirty ) calculateSize(); QLayout::setGeometry( rect ); int left = rect.left() + 3; foreach ( QLayoutItem* item, m_items ) { QSize size = item->sizeHint(); item->setGeometry( QRect( left, rect.top() + 3, size.width(), rect.height() - m_titleSize.height() - 9 ) ); left += size.width(); } m_titleRect = QRect( rect.left() + 3, rect.bottom() - m_titleSize.height() - 2, rect.width() - 9, m_titleSize.height() ); m_separatorRect = QRect( rect.right() - 2, rect.top(), 3, rect.height() ); } void ToolStripSectionLayout::invalidate() { m_dirty = true; QLayout::invalidate(); } ChevronButton::ChevronButton( QWidget* parent ) : QToolButton( parent ) { setAutoRaise( true ); setMenu( new QMenu( this ) ); setPopupMode( QToolButton::InstantPopup ); setFocusPolicy( Qt::NoFocus ); QPixmap chevron = style()->standardPixmap( QStyle::SP_ToolBarHorizontalExtensionButton ); setIcon( chevron ); setIconSize( QSize( chevron.width(), 16 ) ); } ChevronButton::~ChevronButton() { } void ChevronButton::paintEvent( QPaintEvent* /*e*/ ) { QStylePainter painter( this ); QStyleOptionToolButton option; initStyleOption( &option ); option.features &= ~QStyleOptionToolButton::HasMenu; painter.drawComplexControl( QStyle::CC_ToolButton, option ); } ActionButton::ActionButton( QWidget* parent ) : QToolButton( parent ) { setAutoRaise( true ); setFocusPolicy( Qt::NoFocus ); } ActionButton::~ActionButton() { } void ActionButton::adjustText() { if ( toolButtonStyle() == Qt::ToolButtonTextUnderIcon ) { QString text = defaultAction()->iconText(); if ( !text.contains( '\n' ) ) { QFontMetrics metrics( font() ); if ( metrics.width( text ) > 40 ) { int mid = text.length() / 2; int after = text.indexOf( ' ', mid ); int before = text.lastIndexOf( ' ', mid ); if ( before < 0 && after < 0 ) text.append( '\n' ); else if ( after >= 0 && ( before < 0 || ( after - mid ) < ( mid - before ) ) ) text.replace( after, 1, '\n' ); else text.replace( before, 1, '\n' ); } else { text.append( '\n' ); } setText( text ); } } QKeySequence shortcut = defaultAction()->shortcut(); if ( !shortcut.isEmpty() ) { setToolTip( QString( "%1 (%2)" ).arg( defaultAction()->toolTip(), shortcut.toString( QKeySequence::NativeText ) ) ); } else if ( popupMode() == QToolButton::MenuButtonPopup && defaultAction()->menu() != NULL ) { QAction* defAction = defaultAction()->menu()->defaultAction(); if ( defAction != NULL ) { shortcut = defAction->shortcut(); if ( !shortcut.isEmpty() ) setToolTip( QString( "%1 (%2)" ).arg( defaultAction()->toolTip(), shortcut.toString( QKeySequence::NativeText ) ) ); } } } void ActionButton::actionEvent( QActionEvent* e ) { QToolButton::actionEvent( e ); if ( e->type() == QEvent::ActionChanged && e->action() == defaultAction() ) adjustText(); } fraqtive-0.4.8.1/src/xmlui/toolstrip.h000066400000000000000000000127521440132223600176440ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_TOOLSTRIP_H #define XMLUI_TOOLSTRIP_H #include #include #include namespace XmlUi { class ToolStripLayout; class ToolStripSectionLayout; } class QBoxLayout; class QGridLayout; namespace XmlUi { /** * Widget containing tool buttons. * * This widget can be used as a replacement of the menu bar and toolbars. * It displays tool buttons of different size layed out and grouped in sections. * The tool strip can be populated with actions using the Builder object. */ class ToolStrip : public QWidget { Q_OBJECT public: /** * Constructor. * @param parent The parent widget. */ ToolStrip( QWidget* parent ); /** * Destructor. */ ~ToolStrip(); public: /** * Set the header widget displayed in the left part of the tool strip. */ void setHeaderWidget( QWidget* widget ); /** * Return the header widget. */ QWidget* headerWidget() const; /** * Add a tool button associated with given action. * @param action The action to add. */ void addToolAction( QAction* action ); /** * Add a separator between buttons. */ void addSeparator(); /** * Begin a section containing actions. * @param title The title of the section. */ void beginSection( const QString& title ); /** * End the current section. */ void endSection(); /** * Begin a grid layout inside a section. */ void beginGrid(); /** * End the current grid layout. */ void endGrid(); /** * Begin a horizontal row of small buttons in a grid layout. */ void beginRow(); /** * End the current row. */ void endRow(); /** * Remove all tool buttons and sections. * The header widget and auxiliary actions are not removed. */ void clearToolActions(); /** * Add a tool button associated with given action in the top right corner * of the tool strip. * @param action The action to add. */ void addAuxiliaryAction( QAction* action ); /** * Remove all auxiliary actions. */ void clearAuxiliaryActions(); /** * Set the margins for tool strip contents. */ void setContentsMargins( int left, int top, int right, int bottom ); /** * Execute the popup menu associated with given action. */ void execMenu( QAction* action ); protected: // overrides void childEvent( QChildEvent* e ); void paintEvent( QPaintEvent* e ); private: enum ButtonSize { SmallButton, MediumButton, LargeButton }; private: QToolButton* createButton( QAction* action, ButtonSize size ); private: ToolStripLayout* m_layout; ToolStripSectionLayout* m_sectionLayout; QGridLayout* m_gridLayout; int m_gridRow; int m_gridColumn; QBoxLayout* m_rowLayout; QList m_toolButtons; }; /** * Action with extended properties. */ class ToolStripAction : public QAction { Q_OBJECT public: /** * Constructor. * @param text The text of the action. * @param parent The parent object. */ ToolStripAction( const QString& text, QObject* parent ); /** * Constructor. * @param icon The icon of the action. * @param text The text of the action. * @param parent The parent object. */ ToolStripAction( const QIcon& icon, const QString& text, QObject* parent ); /** * Destructor. */ ~ToolStripAction(); public: /** * Set the menu popup mode for the tool button. */ void setPopupMode( QToolButton::ToolButtonPopupMode mode ); /** * Return the menu popup mode for the tool button. */ QToolButton::ToolButtonPopupMode popupMode() const { return m_popupMode; } private: QToolButton::ToolButtonPopupMode m_popupMode; }; } #endif fraqtive-0.4.8.1/src/xmlui/toolstrip_p.h000066400000000000000000000106611440132223600201600ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_TOOLSTRIP_P_H #define XMLUI_TOOLSTRIP_P_H #include "toolstrip.h" #include #include namespace XmlUi { class ToolStripLayout : public QLayout { Q_OBJECT public: ToolStripLayout( QWidget* parent ); ~ToolStripLayout(); public: void setHeaderWidget( QWidget* widget ); QWidget* headerWidget() const { return m_headerWidget; } void addLayout( ToolStripSectionLayout* layout ); void addAuxiliaryButton( QToolButton* button ); void clear(); void clearAuxiliaryButtons(); public: // overrides Qt::Orientations expandingDirections() const; QSize sizeHint() const; QSize minimumSize() const; QSize maximumSize() const; int count() const; QLayoutItem* itemAt( int index ) const; void addItem( QLayoutItem* item ); QLayoutItem* takeAt( int index ); void setGeometry( const QRect& rect ); void invalidate(); private: void calculateSize(); ToolStripSectionLayout* layoutAt( int index ) const; QToolButton* buttonAt( int index ) const; private: QWidget* m_headerWidget; QList m_items; QList m_auxiliaryButtons; QToolButton* m_chevronButton; bool m_dirty; bool m_simpleLayout; QSize m_sizeHint; QSize m_minimumSize; QSize m_maximumSize; int m_auxWidth; int m_auxWidthNoChevron; }; class ToolStripSectionLayout : public QLayout { Q_OBJECT public: ToolStripSectionLayout( const QString& title ); ~ToolStripSectionLayout(); public: void addLayout( QLayout* layout ); void drawSection( QPainter* painter, QWidget* widget ); void setCollapsed( bool collapsed ); bool isCollapsed() const { return m_collapsed; } public: // overrides Qt::Orientations expandingDirections() const; QSize sizeHint() const; QSize minimumSize() const; QSize maximumSize() const; int count() const; QLayoutItem* itemAt( int index ) const; void addItem( QLayoutItem* item ); QLayoutItem* takeAt( int index ); void setGeometry( const QRect& rect ); void invalidate(); private: void calculateSize(); private: QList m_items; QString m_titleText; QRect m_titleRect; QRect m_separatorRect; bool m_collapsed; bool m_dirty; QSize m_sizeHint; QSize m_titleSize; }; class ChevronButton : public QToolButton { Q_OBJECT public: ChevronButton( QWidget* parent ); ~ChevronButton(); protected: // overrides void paintEvent( QPaintEvent* e ); }; class ActionButton : public QToolButton { Q_OBJECT public: ActionButton( QWidget* parent ); ~ActionButton(); public: void adjustText(); protected: // overrides void actionEvent( QActionEvent* e ); }; } #endif fraqtive-0.4.8.1/src/xmlui/windowsstyle.cpp000066400000000000000000000520471440132223600207140ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #include "windowsstyle.h" #if !defined( XMLUI_NO_STYLE_WINDOWS ) #include "gradientwidget.h" #include "toolstrip.h" #include #include #include #include #include #include #include #include #include #include #include using namespace XmlUi; WindowsStyle::WindowsStyle() : QProxyStyle() { } WindowsStyle::~WindowsStyle() { } static QColor blendColors( const QColor& src, const QColor& dest, double alpha ) { double red = alpha * src.red() + ( 1.0 - alpha ) * dest.red(); double green = alpha * src.green() + ( 1.0 - alpha ) * dest.green(); double blue = alpha * src.blue() + ( 1.0 - alpha ) * dest.blue(); return QColor( (int)( red + 0.5 ), (int)( green + 0.5 ), (int)( blue + 0.5 ) ); } void WindowsStyle::polish( QPalette& palette ) { QProxyStyle::polish( palette ); QColor button = palette.color( QPalette::Button ); QColor base = palette.color( QPalette::Base ); QColor text = palette.color( QPalette::Text ); QColor dark = palette.color( QPalette::Dark ); QColor light = palette.color( QPalette::Light ); QColor shadow = palette.color( QPalette::Shadow ); QColor highlight = palette.color( QPalette::Highlight ); highlight = QColor::fromHsv( highlight.hue(), 204, 255 ).toRgb(); m_colorBackgroundBegin = button; m_colorBackgroundEnd = blendColors( button, base, 0.205 ); m_colorMenuBorder = blendColors( text, dark, 0.2 ); m_colorMenuBackground = blendColors( button, base, 0.143 ); m_colorBarBegin = blendColors( button, base, 0.2 ); m_colorBarEnd = blendColors( button, dark, 0.8 ); m_colorSeparator = blendColors( dark, base, 0.5 ); m_colorItemBorder = highlight; m_colorItemBackgroundBegin = blendColors( highlight, base, 0.2 ); m_colorItemBackgroundMiddle = blendColors( highlight, base, 0.4 ); m_colorItemBackgroundEnd = blendColors( highlight, light, 0.1 ); m_colorItemCheckedBegin = blendColors( highlight, base, 0.2 ); m_colorItemCheckedMiddle = blendColors( highlight, light, 0.1 ); m_colorItemCheckedEnd = blendColors( highlight, base, 0.4 ); m_colorItemSunkenBegin = blendColors( highlight, base, 0.3 ); m_colorItemSunkenMiddle = blendColors( highlight, base, 0.5 ); m_colorItemSunkenEnd = blendColors( highlight, light, 0.2 ); m_colorToolStripLabel = blendColors( highlight, shadow, 0.3 ); } void WindowsStyle::polish( QWidget* widget ) { if ( qobject_cast( widget ) ) widget->setAttribute( Qt::WA_StyledBackground ); if ( qobject_cast( widget ) ) widget->setAttribute( Qt::WA_StyledBackground ); if ( qobject_cast( widget ) ) { QPalette palette = widget->palette(); palette.setColor( QPalette::Text, m_colorToolStripLabel ); widget->setPalette( palette ); } QProxyStyle::polish( widget ); } void WindowsStyle::unpolish( QWidget* widget ) { if ( qobject_cast( widget ) ) widget->setAttribute( Qt::WA_StyledBackground, false ); if ( qobject_cast( widget ) ) widget->setAttribute( Qt::WA_StyledBackground, false ); if ( qobject_cast( widget ) ) widget->setPalette( QApplication::palette( widget ) ); QProxyStyle::unpolish( widget ); } int WindowsStyle::pixelMetric( PixelMetric metric, const QStyleOption* option, const QWidget* widget ) const { switch ( metric ) { case PM_MenuPanelWidth: return 1; case PM_MenuHMargin: return 0; case PM_MenuVMargin: return 1; case PM_MenuButtonIndicator: return 12; default: break; } return QProxyStyle::pixelMetric( metric, option, widget ); } QSize WindowsStyle::sizeFromContents( ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget ) const { switch ( type ) { case CT_Menu: return contentsSize; case CT_MenuItem: if ( const QStyleOptionMenuItem* menuItem = qstyleoption_cast( option ) ) { if ( menuItem->menuItemType == QStyleOptionMenuItem::Separator ) return QSize( 10, 3 ); int space = 32 + 16; if ( menuItem->text.contains( '\t' ) ) space += 12; if ( menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem ) { QFontMetrics metrics( menuItem->font ); QFont fontBold = menuItem->font; fontBold.setBold( true ); QFontMetrics metricsBold( fontBold ); space += metricsBold.width( menuItem->text ) - metrics.width( menuItem->text ); } return QSize( contentsSize.width() + space, 22 ); } break; case CT_ToolButton: if ( const QStyleOptionToolButton* optionToolButton = qstyleoption_cast( option ) ) { QSize size = contentsSize + QSize( 7, 6 ); if ( !( optionToolButton->subControls & SC_ToolButtonMenu ) && ( optionToolButton->features & QStyleOptionToolButton::HasMenu ) ) size += QSize( 5, 0 ); return size; } break; default: break; } return QProxyStyle::sizeFromContents( type, option, contentsSize, widget ); } void WindowsStyle::drawPrimitive( PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { switch ( element ) { case PE_Widget: if ( qobject_cast( widget ) ) { QRect rect = option->rect; if ( QStatusBar* statusBar = widget->findChild() ) { rect.adjust( 0, 0, 0, -statusBar->height() ); painter->setPen( option->palette.light().color() ); painter->drawLine( rect.bottomLeft() + QPoint( 0, 1 ), rect.bottomRight() + QPoint( 0, 1 ) ); } QLinearGradient gradient( option->rect.topLeft(), option->rect.topRight() ); gradient.setColorAt( 0.0, m_colorBackgroundBegin ); gradient.setColorAt( 0.6, m_colorBackgroundEnd ); painter->fillRect( rect, gradient ); return; } if ( qobject_cast( widget ) ) { QLinearGradient gradient( option->rect.topLeft(), option->rect.topRight() ); gradient.setColorAt( 0.0, m_colorBackgroundBegin ); gradient.setColorAt( 0.6, m_colorBackgroundEnd ); painter->fillRect( option->rect, gradient ); return; } break; case PE_FrameMenu: painter->setPen( m_colorMenuBorder ); painter->setBrush( Qt::NoBrush ); painter->drawRect( option->rect.adjusted( 0, 0, -1, -1 ) ); if ( const QMenu* menu = qobject_cast( widget ) ) { if ( const QMenuBar* menuBar = qobject_cast( menu->parent() ) ) { QRect rect = menuBar->actionGeometry( menu->menuAction() ); if ( !rect.isEmpty() ) { painter->setPen( m_colorMenuBackground ); painter->drawLine( 1, 0, rect.width() - 2, 0 ); } } } return; default: break; } QProxyStyle::drawPrimitive( element, option, painter, widget ); } static void drawHighlightFrame( QPainter* painter, const QRect& rect, const QColor& begin, const QColor& middle, const QColor& end, const QColor& border, const QColor& inner, bool roundLeft, bool roundRight ) { painter->save(); QRect frameRect = rect.adjusted( 0, 0, -1, -1 ); QLinearGradient gradient( frameRect.topLeft(), frameRect.bottomLeft() ); gradient.setColorAt( 0.0, begin ); gradient.setColorAt( 0.5, middle ); gradient.setColorAt( 1.0, end ); QRegion region = rect; if ( roundLeft ) { region -= QRect( rect.topLeft(), QSize( 1, 1 ) ); region -= QRect( rect.bottomLeft(), QSize( 1, 1 ) ); } if ( roundRight ) { region -= QRect( rect.topRight(), QSize( 1, 1 ) ); region -= QRect( rect.bottomRight(), QSize( 1, 1 ) ); } painter->setClipRegion( region ); painter->setPen( border ); painter->setBrush( gradient ); painter->drawRect( frameRect ); painter->setPen( inner ); painter->setBrush( QBrush() ); painter->drawRect( frameRect.adjusted( 1, 1, -1, -1 ) ); if ( roundLeft ) { painter->drawPoint( rect.left() + 2, rect.top() + 2 ); painter->drawPoint( rect.left() + 2, rect.bottom() - 2 ); } if ( roundRight ) { painter->drawPoint( rect.right() - 2, rect.top() + 2 ); painter->drawPoint( rect.right() - 2, rect.bottom() - 2 ); } painter->setPen( border ); if ( roundLeft ) { painter->drawPoint( rect.left() + 1, rect.top() + 1 ); painter->drawPoint( rect.left() + 1, rect.bottom() - 1 ); } if ( roundRight ) { painter->drawPoint( rect.right() - 1, rect.top() + 1 ); painter->drawPoint( rect.right() - 1, rect.bottom() - 1 ); } painter->restore(); } void WindowsStyle::drawControl( ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const { switch ( element ) { case CE_ShapedFrame: if ( qobject_cast( widget ) ) { painter->setPen( m_colorSeparator ); painter->drawLine( ( option->rect.left() + option->rect.right() ) / 2, option->rect.top(), ( option->rect.left() + option->rect.right() ) / 2, option->rect.bottom() ); return; } break; case CE_MenuEmptyArea: painter->fillRect( option->rect, m_colorMenuBackground ); return; case CE_MenuItem: { painter->save(); painter->fillRect( option->rect, m_colorMenuBackground ); if ( option->state & QStyle::State_Selected && option->state & QStyle::State_Enabled ) { painter->setPen( m_colorItemBorder ); painter->setBrush( m_colorItemBackgroundBegin ); QRect rect = option->rect.adjusted( 1, 0, -1, 0 ); drawHighlightFrame( painter, rect, m_colorItemBackgroundBegin, m_colorItemBackgroundMiddle, m_colorItemBackgroundEnd, m_colorItemBorder, m_colorItemBackgroundEnd, true, true ); } else { painter->setPen( m_colorSeparator ); painter->drawLine( option->rect.left() + 25, option->rect.top(), option->rect.left() + 25, option->rect.bottom() ); } if ( const QStyleOptionMenuItem* optionItem = qstyleoption_cast( option ) ) { if ( optionItem->menuItemType == QStyleOptionMenuItem::Separator ) { painter->setPen( m_colorSeparator ); painter->drawLine( option->rect.left() + 32, ( option->rect.top() + option->rect.bottom() ) / 2, option->rect.right(), ( option->rect.top() + option->rect.bottom() ) / 2 ); painter->restore(); return; } QRect checkRect = option->rect.adjusted( 2, 1, -2, -2 ); checkRect.setWidth( 20 ); if ( optionItem->checked && option->state & QStyle::State_Enabled ) { painter->setPen( m_colorItemBorder ); if ( option->state & QStyle::State_Selected && option->state & QStyle::State_Enabled ) painter->setBrush( m_colorItemSunkenBegin ); else painter->setBrush( m_colorItemCheckedBegin ); painter->drawRect( checkRect ); } if ( !optionItem->icon.isNull() ) { QIcon::Mode mode; if ( optionItem->state & State_Enabled ) mode = ( optionItem->state & State_Selected ) ? QIcon::Active : QIcon::Normal; else mode = QIcon::Disabled; QIcon::State state = optionItem->checked ? QIcon::On : QIcon::Off; QPixmap pixmap = optionItem->icon.pixmap( pixelMetric( PM_SmallIconSize, option, widget ), mode, state ); QRect rect = pixmap.rect(); rect.moveCenter( checkRect.center() ); painter->drawPixmap( rect.topLeft(), pixmap ); } else if ( optionItem->checked ) { QStyleOption optionCheckMark; optionCheckMark.initFrom( widget ); optionCheckMark.rect = checkRect; if ( !( option->state & State_Enabled ) ) optionCheckMark.palette.setBrush( QPalette::Text, optionCheckMark.palette.brush( QPalette::Disabled, QPalette::Text ) ); drawPrimitive( PE_IndicatorMenuCheckMark, &optionCheckMark, painter, widget ); } QFont font = optionItem->font; if ( optionItem->menuItemType == QStyleOptionMenuItem::DefaultItem ) font.setBold( true ); painter->setFont( font ); QRect textRect = option->rect.adjusted( 32, 1, -16, -1 ); int flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; if ( !styleHint( SH_UnderlineShortcut, option, widget ) ) flags |= Qt::TextHideMnemonic; QString text = optionItem->text; int pos = text.indexOf( '\t' ); if ( pos >= 0 ) { drawItemText( painter, textRect, flags | Qt::AlignRight, option->palette, option->state & State_Enabled, text.mid( pos + 1 ), QPalette::Text ); text = text.left( pos ); } drawItemText( painter, textRect, flags, option->palette, option->state & State_Enabled, text, QPalette::Text ); if ( optionItem->menuItemType == QStyleOptionMenuItem::SubMenu ) { QStyleOption optionArrow; optionArrow.initFrom( widget ); optionArrow.rect = option->rect.adjusted( 0, 4, -4, -4 ); optionArrow.rect.setLeft( option->rect.right() - 12 ); optionArrow.state = option->state & State_Enabled; drawPrimitive( PE_IndicatorArrowRight, &optionArrow, painter, widget ); } } painter->restore(); return; } case CE_Splitter: if ( qobject_cast( widget->window() ) ) return; break; default: break; } QProxyStyle::drawControl( element, option, painter, widget ); } void WindowsStyle::drawComplexControl( ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const { switch ( control ) { case CC_ToolButton: if ( option->state & State_AutoRaise ) { if ( const QStyleOptionToolButton* optionToolButton = qstyleoption_cast( option ) ) { QRect buttonRect = subControlRect( control, option, SC_ToolButton, widget ); QStyle::State buttonState = option->state & ~State_Sunken; if ( option->state & State_Sunken ) { if ( optionToolButton->activeSubControls & SC_ToolButton ) buttonState |= State_Sunken; else if ( optionToolButton->activeSubControls & SC_ToolButtonMenu ) buttonState |= State_MouseOver; } bool selected = buttonState & State_MouseOver && option->state & State_Enabled; bool checked = buttonState & State_On; bool sunken = buttonState & State_Sunken; if ( selected || checked || sunken ) { bool roundRight = !( optionToolButton->subControls & SC_ToolButtonMenu ); if ( sunken || selected && checked ) drawHighlightFrame( painter, buttonRect, m_colorItemSunkenBegin, m_colorItemSunkenMiddle, m_colorItemSunkenEnd, m_colorItemBorder, m_colorItemSunkenBegin, true, roundRight ); else if ( checked ) drawHighlightFrame( painter, buttonRect, m_colorItemCheckedBegin, m_colorItemCheckedMiddle, m_colorItemCheckedEnd, m_colorItemBorder, m_colorItemCheckedEnd, true, roundRight ); else drawHighlightFrame( painter, buttonRect, m_colorItemBackgroundBegin, m_colorItemBackgroundMiddle, m_colorItemBackgroundEnd, m_colorItemBorder, m_colorItemBackgroundEnd, true, roundRight ); } QStyleOptionToolButton optionLabel = *optionToolButton; optionLabel.state = buttonState; int fw = pixelMetric( PM_DefaultFrameWidth, option, widget ); optionLabel.rect = buttonRect.adjusted( fw, fw, -fw, -fw ); drawControl( CE_ToolButtonLabel, &optionLabel, painter, widget ); if ( optionToolButton->subControls & SC_ToolButtonMenu ) { QRect menuRect = subControlRect( control, option, SC_ToolButtonMenu, widget ); menuRect.adjust( -1, 0, 0, 0 ); if ( sunken || optionToolButton->state & State_Sunken && optionToolButton->activeSubControls & SC_ToolButtonMenu ) drawHighlightFrame( painter, menuRect, m_colorItemSunkenBegin, m_colorItemSunkenMiddle, m_colorItemSunkenEnd, m_colorItemBorder, m_colorItemSunkenBegin, false, true ); else if ( selected ) drawHighlightFrame( painter, menuRect, m_colorItemBackgroundBegin, m_colorItemBackgroundMiddle, m_colorItemBackgroundEnd, m_colorItemBorder, m_colorItemBackgroundEnd, false, true ); QStyleOptionToolButton optionArrow = *optionToolButton; optionArrow.rect = menuRect.adjusted( 2, 3, -1, -3 ); drawPrimitive( PE_IndicatorArrowDown, &optionArrow, painter, widget ); } else if ( optionToolButton->features & QStyleOptionToolButton::HasMenu ) { int size = pixelMetric( PM_MenuButtonIndicator, option, widget ); QRect rect = optionToolButton->rect; QStyleOptionToolButton optionArrow = *optionToolButton; optionArrow.rect = QRect( rect.right() + 4 - size, rect.height() - size + 4, size - 5, size - 5 ); drawPrimitive( PE_IndicatorArrowDown, &optionArrow, painter, widget ); } return; } break; } default: break; } QProxyStyle::drawComplexControl( control, option, painter, widget ); } #endif // !defined( XMLUI_NO_STYLE_WINDOWS ) fraqtive-0.4.8.1/src/xmlui/windowsstyle.h000066400000000000000000000072601440132223600203560ustar00rootroot00000000000000/**************************************************************************** * Simple XML-based UI builder for Qt4 * Copyright (C) 2007-2012 Michał Męciński * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of the * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ #ifndef XMLUI_WINDOWSSTYLE_H #define XMLUI_WINDOWSSTYLE_H #include #if !defined( Q_OS_WIN ) || ( QT_VERSION < 0x040600 ) || defined( QT_NO_STYLE_WINDOWSVISTA ) #define XMLUI_NO_STYLE_WINDOWS #endif #if !defined( XMLUI_NO_STYLE_WINDOWS ) #include namespace XmlUi { /** * Modern Qt style for Windows. * * The style imitates the look of MS Office. */ class WindowsStyle : public QProxyStyle { Q_OBJECT public: /** * Constructor. */ WindowsStyle(); /** * Destructor. */ ~WindowsStyle(); public: // overrides void polish( QPalette& palette ); void polish( QWidget* widget ); void unpolish( QWidget* widget ); int pixelMetric( PixelMetric metric, const QStyleOption* option, const QWidget* widget ) const; QSize sizeFromContents( ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget ) const; void drawPrimitive( PrimitiveElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const; void drawControl( ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget ) const; void drawComplexControl( ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget ) const; private: QColor m_colorBackgroundBegin; QColor m_colorBackgroundEnd; QColor m_colorMenuBorder; QColor m_colorMenuBackground; QColor m_colorBarBegin; QColor m_colorBarEnd; QColor m_colorSeparator; QColor m_colorItemBorder; QColor m_colorItemBackgroundBegin; QColor m_colorItemBackgroundMiddle; QColor m_colorItemBackgroundEnd; QColor m_colorItemCheckedBegin; QColor m_colorItemCheckedMiddle; QColor m_colorItemCheckedEnd; QColor m_colorItemSunkenBegin; QColor m_colorItemSunkenMiddle; QColor m_colorItemSunkenEnd; QColor m_colorToolStripLabel; }; } #endif // !defined( XMLUI_NO_STYLE_WINDOWS ) #endif fraqtive-0.4.8.1/src/xmlui/xmlui.pri000066400000000000000000000007321440132223600173010ustar00rootroot00000000000000HEADERS += $$PWD/builder.h \ $$PWD/client.h \ $$PWD/gradientwidget.h \ $$PWD/node_p.h \ $$PWD/toolstrip.h \ $$PWD/toolstrip_p.h SOURCES += $$PWD/builder.cpp \ $$PWD/client.cpp \ $$PWD/gradientwidget.cpp \ $$PWD/toolstrip.cpp win32 { HEADERS += $$PWD/windowsstyle.h SOURCES += $$PWD/windowsstyle.cpp } mac { HEADERS += $$PWD/macstyle.h SOURCES += $$PWD/macstyle.cpp }