diff --git a/authors b/authors deleted file mode 100755 index 6830e9047..000000000 --- a/authors +++ /dev/null @@ -1,9 +0,0 @@ -Gabor Horvath - -Contributors (ideas, mockups, testing, forum activity, etc.): - -Patrik Brunner -Maciek Dworak -David M. Gyurko -Arturs Jekabsons -Karl Loncarek diff --git a/clean b/clean deleted file mode 100755 index 51f1d2ab8..000000000 --- a/clean +++ /dev/null @@ -1,17 +0,0 @@ -rm CMakeCache.txt -rm install_manifest.txt -rm -R ./CMakeFiles -rm -R ./rtengine/CMakeFiles -rm -R ./rtexif/CMakeFiles -rm -R ./rtgui/CMakeFiles -rm ./cmake* -rm ./rtengine/cmake* -rm ./rtexif/cmake* -rm ./rtgui/cmake* -rm ./Makefile -rm ./rtengine/Makefile -rm ./rtexif/Makefile -rm ./rtgui/Makefile -rm ./rtengine/librtengine.so -rm ./rtgui/rth -rm ./rtexif/librtexif.a diff --git a/compile b/compile deleted file mode 100755 index eede01e9f..000000000 --- a/compile +++ /dev/null @@ -1,38 +0,0 @@ - -Windows -------- - -Requirements: -- MinGW + MSYS -- CMake -- GTK and GTKMM development environments - -Compile: -- Start MSYS -- Enter the root directory of the RawTherapee source tree -- Type: cmake -G "MSYS Makefiles" . -- Type: make install -- You find the compiled program in the release directory - -Linux ------ - -Requirements: -- CMake -- GTK and GTKMM development packages -- libtiff, libpng, libjpeg, lcms, libiptcdata development packages -- ...did I forget something? - -On Ubuntu/Debian the requirements can be installed by running: -sudo apt-get install build-essential cmake libgtk2.0-dev libgtkmm-2.4-dev libtiff-dev libpng-dev libjpeg-dev liblcms-dev libiptcdata-dev subversion - -Compile: -- Enter the root directory of the RawTherapee source tree -- Type: cmake . -- Type: make install -- You find the compiled program in the release directory (you can copy it -anywhere you want) - -...If you have problems with the compilation, identified the reason and fixed -the bug, please send me the updated build scripts (CMakeLists.txt files) to: -hgabor@rawtherapee.com diff --git a/copying b/copying deleted file mode 100755 index 94a9ed024..000000000 --- a/copying +++ /dev/null @@ -1,674 +0,0 @@ - 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 -. diff --git a/options.lin b/options.lin deleted file mode 100755 index e33a10c45..000000000 --- a/options.lin +++ /dev/null @@ -1,94 +0,0 @@ - -[General] -StoreLastProfile=true -StartupDirectory=last -StartupPath= -DateFormat=%y/%m/%d -AdjusterDelay=0 -DualProcSupport=true -MultiUser=true -Language=english -Theme=gray -Version=231 -FirstRun=false - -[External Editor] -EditorKind=1 -GimpDir= -PhotoshopDir= -CustomEditor= - -[File Browser] -BrowseOnlyRaw=false -BrowserShowsDate=true -BrowserShowsExif=true -BrowserShowsHidden=false -ThumbnailSize=240 -MaxPreviewHeight=400 -MaxCacheEntries=20000 -ThumbnailFormat=5 -CacheMemPolicy=0 -ParseExtensions=jpg;tif;tiff;png;crw;cr2;crf;nef;raf;pef;dng;arw;sr2;mrw;raw;orf;kdc;rwz;rw2;mef; -ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; -ThumbnailArrangement=2 -ThumbnailInterpolation=1 -LiveThumbnails=true -FavoriteDirs= -RenameTemplates= -RenameUseTemplates=false -ThumbnailZoomRatios=0.2;0.3;0.45;0.6;0.8;1; -OverlayedFileNames=true - -[Clipping Indication] -HighlightThreshold=253 -ShadowThreshold=8 -BlinkClipped=false - -[Output] -Format=jpg -JpegQuality=100 -PngCompression=6 -PngBps=8 -TiffBps=8 -SaveProcParams=false -PathTemplate=%p1/converted/%f -PathFolder= -UsePathTemplate=true -LastSaveAsPath= - -[Profiles] -Directory=profiles -RawDefault=default -ImgDefault=neutral -SaveParamsWithFile=false -SaveParamsToCache=true -LoadParamsFromLocation=0 - -[GUI] -FileBrowserHeight=250 -ToolPanelWidth=270 -HistoryPanelWidth=230 -LastPreviewScale=5 -LastCropSize=1 -ShowHistory=true -ShowFilePanelState=2 -ShowInfo=true -ShowClippedHighlights=false -ShowClippedShadows=false -FrameColor=0 -ProcessingQueueEnbled=false -ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0; - -[Algorithms] -DemosaicMethod=hphd -ColorCorrection=1 - -[Crop Settings] -Ratio=3:2 -FixRatio=true -DPI=600 - -[Color Management] -ICCDirectory= -MonitorProfile= -Intent=1 diff --git a/options.win b/options.win deleted file mode 100755 index 2b0d27458..000000000 --- a/options.win +++ /dev/null @@ -1,94 +0,0 @@ - -[General] -StoreLastProfile=true -StartupDirectory=last -StartupPath= -DateFormat=%y/%m/%d -AdjusterDelay=0 -DualProcSupport=true -MultiUser=true -Language=english -Theme=gray -Version=231 -FirstRun=false - -[External Editor] -EditorKind=1 -GimpDir=C:\\Program Files\\GIMP-2.0 -PhotoshopDir=C:\\Program Files\\Adobe\\Adobe Photoshop CS3 -CustomEditor=start - -[File Browser] -BrowseOnlyRaw=false -BrowserShowsDate=true -BrowserShowsExif=true -BrowserShowsHidden=false -ThumbnailSize=240 -MaxPreviewHeight=400 -MaxCacheEntries=20000 -ThumbnailFormat=5 -CacheMemPolicy=0 -ParseExtensions=jpg;tif;tiff;png;crw;cr2;crf;nef;raf;pef;dng;arw;sr2;mrw;raw;orf;kdc;rwz;rw2;mef; -ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; -ThumbnailArrangement=2 -ThumbnailInterpolation=1 -LiveThumbnails=true -FavoriteDirs= -RenameTemplates= -RenameUseTemplates=false -ThumbnailZoomRatios=0.2;0.3;0.45;0.6;0.8;1; -OverlayedFileNames=true - -[Clipping Indication] -HighlightThreshold=253 -ShadowThreshold=8 -BlinkClipped=false - -[Output] -Format=jpg -JpegQuality=100 -PngCompression=6 -PngBps=8 -TiffBps=8 -SaveProcParams=false -PathTemplate=%p1/converted/%f -PathFolder= -UsePathTemplate=true -LastSaveAsPath= - -[Profiles] -Directory=profiles -RawDefault=default -ImgDefault=neutral -SaveParamsWithFile=false -SaveParamsToCache=true -LoadParamsFromLocation=0 - -[GUI] -FileBrowserHeight=250 -ToolPanelWidth=270 -HistoryPanelWidth=230 -LastPreviewScale=5 -LastCropSize=1 -ShowHistory=true -ShowFilePanelState=2 -ShowInfo=true -ShowClippedHighlights=false -ShowClippedShadows=false -FrameColor=0 -ProcessingQueueEnbled=false -ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0; - -[Algorithms] -DemosaicMethod=hphd -ColorCorrection=1 - -[Crop Settings] -Ratio=3:2 -FixRatio=true -DPI=600 - -[Color Management] -ICCDirectory= -MonitorProfile= -Intent=1 diff --git a/rawzor_mac/librwz_sdk_64.dylib b/rawzor_mac/librwz_sdk_64.dylib new file mode 100755 index 000000000..cd1331686 Binary files /dev/null and b/rawzor_mac/librwz_sdk_64.dylib differ diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 012149a1b..79dd20984 100755 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -10,7 +10,7 @@ set (RTENGINESOURCEFILES colortemp.cc curves.cc dcraw.cc gauss.cc iccstore.cc image8.cc image16.cc imagedata.cc imageio.cc improcfun.cc init.cc dcrop.cc loadinitial.cc procparams.cc rawimagesource.cc shmap.cc simpleprocess.cc refreshmap.cc stdimagesource.cc myfile.cc iccjpeg.c hlmultipliers.cc improccoordinator.cc - helpers.cc processingjob.cc rtthumbnail.cc utils.cc bilateral2.cc) + processingjob.cc rtthumbnail.cc utils.cc bilateral2.cc) if (BUILD_SHARED) add_library (rtengine SHARED ${RTENGINESOURCEFILES}) diff --git a/rtengine/bilateral2.h b/rtengine/bilateral2.h index 1ba7d0eac..a4fa0d55e 100755 --- a/rtengine/bilateral2.h +++ b/rtengine/bilateral2.h @@ -27,8 +27,8 @@ #include #include -#define ELEM(a,b) (src[i-a][j-b] * ec[src[i-a][j-b]-src[i][j]+0x10000]) -#define SULY(a,b) (ec[src[i-a][j-b]-src[i][j]+0x10000]) +#define ELEM(a,b) (src[i - a][j - b] * ec[src[i - a][j - b]-src[i][j]+0x10000]) +#define SULY(a,b) (ec[src[i - a][j - b]-src[i][j]+0x10000]) #define BL_BEGIN(a,b) double scale = (a); \ int* ec = new int [0x20000]; \ diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 10546fbe7..cc8956099 100755 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -163,7 +163,7 @@ void Crop::update (int todo, bool internal) { if (settings->verbose) printf ("C-TRANSFORM: %d\n", t3.etime(t2)); if ((todo & M_BLURMAP) && params.sh.enabled) { - double radius = sqrt (SKIPS(parent->fw,skip)*SKIPS(parent->fw,skip)+SKIPS(parent->fh,skip)*SKIPS(parent->fh,skip)) / 2.0; + double radius = sqrt (double(SKIPS(parent->fw,skip)*SKIPS(parent->fw,skip)+SKIPS(parent->fh,skip)*SKIPS(parent->fh,skip))) / 2.0; double shradius = radius / 1800.0 * params.sh.radius; cshmap->update (baseCrop, (unsigned short**)cbuffer, shradius, parent->ipf.lumimul, params.sh.hq); cshmap->forceStat (parent->shmap->max, parent->shmap->min, parent->shmap->avg); diff --git a/rtengine/helpers.cc b/rtengine/helpers.cc deleted file mode 100755 index 63a242d58..000000000 --- a/rtengine/helpers.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#include -#include - -using namespace rtengine; -using namespace rtengine::procparams; - -std::string* create_stdstring (char* txt) { return new std::string (txt); } -Glib::ustring* create_gustring (char* txt) { return new Glib::ustring (txt); } -void set_stdstring (std::string& s, char* txt) { s = txt; } -void set_gustring (Glib::ustring& s, char* txt) { s = txt; } -char* get_stdstring (std::string& s) { return strdup (s.c_str()); } -char* get_gustring (Glib::ustring& s) { return strdup (s.c_str()); } - -void clear_double_vector (std::vector& d) { d.clear(); } -void append_double_vector (std::vector& d, double dd) { d.push_back(dd); } -void resize_double_vector (std::vector& d, int size) { d.resize (size); } -double get_double_vector (std::vector& d, int i) { return d[i]; } -void set_double_vector (std::vector& d, int i, double x) { d[i] = x; } -int size_double_vector (std::vector& d) { return d.size(); } - -void clear_gustring_vector (std::vector& d) { d.clear(); } -void append_gustring_vector (std::vector& d, const Glib::ustring& dd) { d.push_back(dd); } -void resize_gustring_vector (std::vector& d, int size) { d.resize (size); } -Glib::ustring& get_gustring_vector (std::vector& d, int i) { return d[i]; } -void set_gustring_vector (std::vector& d, int i, const Glib::ustring& x) { d[i] = x; } -int size_gustring_vector (std::vector& d) { return d.size(); } - -void clear_exifpair_vector (std::vector& d) { d.clear(); } -void append_exifpair_vector (std::vector& d, const ExifPair& dd) { d.push_back(dd); } -void resize_exifpair_vector (std::vector& d, int size) { d.resize (size); } -ExifPair& get_exifpair_vector (std::vector& d, int i) { return d[i]; } -void set_exifpair_vector (std::vector& d, int i, const ExifPair& x) { d[i] = x; } -int size_exifpair_vector (std::vector& d) { return d.size(); } - -void clear_iptcpair_vector (std::vector& d) { d.clear(); } -void append_iptcpair_vector (std::vector& d, const IPTCPair& dd) { d.push_back(dd); } -void resize_iptcpair_vector (std::vector& d, int size) { d.resize (size); } -IPTCPair& get_iptcpair_vector (std::vector& d, int i) { return d[i]; } -void set_iptcpair_vector (std::vector& d, int i, const IPTCPair& x) { d[i] = x; } -int size_iptcpair_vector (std::vector& d) { return d.size(); } - -int sizeof_stdstring () { return sizeof(std::string); } -int sizeof_gustring () { return sizeof(Glib::ustring); } -int sizeof_double_vector () { return sizeof(std::vector); } -int sizeof_gustring_vector () { return sizeof(std::vector); } -int sizeof_exifpair_vector () { return sizeof(std::vector); } -int sizeof_iptcpair_vector () { return sizeof(std::vector); } - - diff --git a/rtengine/helpers.h b/rtengine/helpers.h deleted file mode 100755 index e6e454c32..000000000 --- a/rtengine/helpers.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#include -#include -#include - -using namespace rtengine; -using namespace rtengine::procparams; - -std::string* create_stdstring (char* txt); -Glib::ustring* create_gustring (char* txt); -void set_stdstring (std::string& s, char* txt); -void set_gustring (Glib::ustring& s, char* txt); -char* get_stdstring (std::string& s); -char* get_gustring (Glib::ustring& s); - -void clear_double_vector (std::vector& d); -void append_double_vector (std::vector& d, double dd); -void resize_double_vector (std::vector& d, int size); -double get_double_vector (std::vector& d, int i); -void set_double_vector (std::vector& d, int i, double x); -int size_double_vector (std::vector& d); - -void clear_gustring_vector (std::vector& d); -void append_gustring_vector (std::vector& d, const Glib::ustring& dd); -void resize_gustring_vector (std::vector& d, int size); -Glib::ustring& get_gustring_vector (std::vector& d, int i); -void set_gustring_vector (std::vector& d, int i, const Glib::ustring& x); -int size_gustring_vector (std::vector& d); - -void clear_exifpair_vector (std::vector& d); -void append_exifpair_vector (std::vector& d, const ExifPair& dd); -void resize_exifpair_vector (std::vector& d, int size); -ExifPair& get_exifpair_vector (std::vector& d, int i); -void set_exifpair_vector (std::vector& d, int i, const ExifPair& x); -int size_exifpair_vector (std::vector& d); - -void clear_iptcpair_vector (std::vector& d); -void append_iptcpair_vector (std::vector& d, const IPTCPair& dd); -void resize_iptcpair_vector (std::vector& d, int size); -IPTCPair& get_iptcpair_vector (std::vector& d, int i); -void set_iptcpair_vector (std::vector& d, int i, const IPTCPair& x); -int size_iptcpair_vector (std::vector& d); - -int sizeof_stdstring (); -int sizeof_gustring (); -int sizeof_double_vector (); -int sizeof_gustring_vector (); -int sizeof_exifpair_vector (); -int sizeof_iptcpair_vector (); - diff --git a/rtengine/iimage.h b/rtengine/iimage.h index 54a8e2014..03ef519e9 100755 --- a/rtengine/iimage.h +++ b/rtengine/iimage.h @@ -31,42 +31,42 @@ namespace rtengine { public: /** Returns a mutex that can is useful in many situations. No image operations shuold be performed without locking this mutex. * @return The mutex */ - virtual Glib::Mutex& getMutex (); - virtual cmsHPROFILE getProfile (); + virtual Glib::Mutex& getMutex ()=0; + virtual cmsHPROFILE getProfile ()=0; /** Returns the width of the image. * @return The width of the image */ - virtual int getWidth (); + virtual int getWidth ()=0; /** Returns the height of the image. * @return The height of the image */ - virtual int getHeight (); + virtual int getHeight ()=0; /** Returns the bits per pixel of the image. * @return The bits per pixel of the image */ - virtual int getBitsPerPixel (); + virtual int getBitsPerPixel ()=0; /** Saves the image to file. It autodetects the format (jpg, tif, png are supported). * @param fname is the name of the file @return the error code, 0 if none */ - virtual int saveToFile (Glib::ustring fname); + virtual int saveToFile (Glib::ustring fname)=0; /** Saves the image to file in a png format. * @param fname is the name of the file * @param compression is the amount of compression (0-6), -1 corresponds to the default * @param bps can be 8 or 16 depending on the bits per pixels the output file will have @return the error code, 0 if none */ - virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1); + virtual int saveAsPNG (Glib::ustring fname, int compression = -1, int bps = -1)=0; /** Saves the image to file in a jpg format. * @param fname is the name of the file * @param quality is the quality of the jpeg (0...100), set it to -1 to use default @return the error code, 0 if none */ - virtual int saveAsJPEG (Glib::ustring fname, int quality = 100); + virtual int saveAsJPEG (Glib::ustring fname, int quality = 100)=0; /** Saves the image to file in a tif format. * @param fname is the name of the file * @param bps can be 8 or 16 depending on the bits per pixels the output file will have @return the error code, 0 if none */ - virtual int saveAsTIFF (Glib::ustring fname, int bps = -1); + virtual int saveAsTIFF (Glib::ustring fname, int bps = -1)=0; /** Sets the progress listener if you want to follow the progress of the image saving operations (optional). * @param pl is the pointer to the class implementing the ProgressListener interface */ - virtual void setSaveProgressListener (ProgressListener* pl); + virtual void setSaveProgressListener (ProgressListener* pl)=0; /** Free the image */ - virtual void free (); + virtual void free ()=0; }; /** This class represents an image having a classical 8 bits/pixel representation */ @@ -74,7 +74,7 @@ namespace rtengine { public: /** Returns the pixel data, in r/g/b order from top left to bottom right continously. * @return a pointer to the pixel data */ - virtual const unsigned char* getData (); + virtual const unsigned char* getData ()=0; }; /** This class represents an image having a 16 bits/pixel planar representation. @@ -83,13 +83,13 @@ namespace rtengine { public: /** Returns the "red" plane data. * @return the two dimensional array of the red plane */ - virtual unsigned short** getRPlane (); + virtual unsigned short** getRPlane ()=0; /** Returns the "green" plane data. * @return the two dimensional array of the green plane */ - virtual unsigned short** getGPlane (); + virtual unsigned short** getGPlane ()=0; /** Returns the "blue" plane data. * @return the two dimensional array of the blue plane */ - virtual unsigned short** getBPlane (); + virtual unsigned short** getBPlane ()=0; }; } diff --git a/rtengine/image16.cc b/rtengine/image16.cc index bb435d65e..6da578a38 100755 --- a/rtengine/image16.cc +++ b/rtengine/image16.cc @@ -22,10 +22,6 @@ using namespace rtengine; -unsigned short** IImage16::getRPlane () {} -unsigned short** IImage16::getGPlane () {} -unsigned short** IImage16::getBPlane () {} - Image16::Image16 () : r (NULL), g (NULL), b (NULL), data (NULL), unaligned (NULL) { } diff --git a/rtengine/image8.cc b/rtengine/image8.cc index 34d1e4973..697b31c9f 100755 --- a/rtengine/image8.cc +++ b/rtengine/image8.cc @@ -21,7 +21,6 @@ using namespace rtengine; -const unsigned char* IImage8::getData () {} Image8::Image8 () : width(-1), height(-1), data(NULL) { diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 82b3fe8bd..ecc93cc09 100755 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -41,18 +41,6 @@ Glib::ustring safe_locale_to_utf8 (const std::string& src); using namespace rtengine; using namespace rtengine::procparams; -Glib::Mutex& IImage::getMutex () {} -cmsHPROFILE IImage::getProfile () {} -int IImage::getWidth () {} -int IImage::getHeight () {} -int IImage::getBitsPerPixel () {} -int IImage::saveToFile (Glib::ustring fname) {} -int IImage::saveAsPNG (Glib::ustring fname, int compression, int bps) { } -int IImage::saveAsJPEG (Glib::ustring fname, int quality) {} -int IImage::saveAsTIFF (Glib::ustring fname, int bps) {} -void IImage::setSaveProgressListener (ProgressListener* pl) {} -void IImage::free () {} - Glib::ustring ImageIO::errorMsg[6] = {"Success", "Cannot read file.", "Invalid header.","Error while reading header.","File reading error", "Image format not supported."}; void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const std::vector& exif, const std::vector& iptcc) { diff --git a/rtengine/imageio.h b/rtengine/imageio.h index 8880fcf64..a48bd819e 100755 --- a/rtengine/imageio.h +++ b/rtengine/imageio.h @@ -57,10 +57,10 @@ class ImageIO { void setProgressListener (ProgressListener* l) { pl = l; } - virtual int getW () {} - virtual int getH () {} - virtual void allocate (int width, int height) {} - virtual int getBPS () {} + virtual int getW () =0; + virtual int getH () =0; + virtual void allocate (int width, int height) =0; + virtual int getBPS () =0; virtual void getScanline (int row, unsigned char* buffer, int bps) {} virtual void setScanline (int row, unsigned char* buffer, int bps) {} diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index a44746112..c9795abeb 100755 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -65,11 +65,11 @@ class ImageSource : public InitialImage { ImageSource () : references (1), embProfile(NULL), idata(NULL) {} virtual ~ImageSource () {} - virtual int load (Glib::ustring fname) {} + virtual int load (Glib::ustring fname) =0; virtual void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hlp, ColorManagementParams cmp) {} - virtual ColorTemp getWB () {} - virtual ColorTemp getAutoWB () {} - virtual ColorTemp getSpotWB (std::vector red, std::vector green, std::vector& blue, int tran) {} + virtual ColorTemp getWB () =0; + virtual ColorTemp getAutoWB () =0; + virtual ColorTemp getSpotWB (std::vector red, std::vector green, std::vector& blue, int tran) =0; virtual double getDefGain () { return 1.0; } @@ -78,7 +78,7 @@ class ImageSource : public InitialImage { virtual void getFullSize (int& w, int& h, int tr = TR_NONE) {} virtual void getSize (int tran, PreviewProps pp, int& w, int& h) {} - virtual ImageData* getImageData () {} + virtual ImageData* getImageData () =0; virtual void setProgressListener (ProgressListener* pl) {} void increaseRef () { references++; } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 48e70ac66..ebbad1bc4 100755 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -143,7 +143,7 @@ void ImProcCoordinator::updatePreviewImage (int todo) { progress ("Preparing shadow/highlight map...",100*readyphase/numofphases); if ((todo & M_BLURMAP) && params.sh.enabled) { - double radius = sqrt (pW*pW+pH*pH) / 2.0; + double radius = sqrt (double(pW*pW+pH*pH)) / 2.0; double shradius = radius / 1800.0 * params.sh.radius; shmap->update (oprevi, (unsigned short**)buffer, shradius, ipf.lumimul, params.sh.hq); } diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 10fbe422c..42d38170d 100755 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -1346,7 +1346,7 @@ bool ImProcFunctions::transCoord (const ProcParams* params, int W, int H, std::v red.clear (); green.clear (); blue.clear (); - bool needstransform = fabs(params->rotate.degree)>1e-15 || fabs(params->distortion.amount)>1e-15 || fabs(params->cacorrection.red)>1e-15 || fabs(params->cacorrection.blue)>1e-15; + bool needstransform = 0;// fabs(params->rotate.degree)>1e-15 || fabs(params->distortion.amount)>1e-15 || fabs(params->cacorrection.red)>1e-15 || fabs(params->cacorrection.blue)>1e-15; if (!needstransform) { if (clipresize) { // Apply resizing @@ -1533,12 +1533,12 @@ bool ImProcFunctions::transCoord (const ProcParams* params, int W, int H, int x, void ImProcFunctions::transform (Image16* original, Image16* transformed, const ProcParams* params, int cx, int cy, int sx, int sy, int oW, int oH) { STemp sizes; - sizes.cx = cx; - sizes.cy = cy; + sizes.cx = 0;//cx; + sizes.cy = 0;//cy; sizes.oW = oW; sizes.oH = oH; - sizes.sx = sx; - sizes.sy = sy; + sizes.sx = 0;//sx; + sizes.sy = 0;//sy; if (params->cacorrection.red==0 && params->cacorrection.blue==0) { if (settings->dualThreadEnabled) { @@ -1565,12 +1565,12 @@ void ImProcFunctions::transform (Image16* original, Image16* transformed, const void ImProcFunctions::simpltransform (Image16* original, Image16* transformed, const ProcParams* params, int cx, int cy, int sx, int sy, int oW, int oH) { STemp sizes; - sizes.cx = cx; - sizes.cy = cy; + sizes.cx = 0;//cx; + sizes.cy = 0;//cy; sizes.oW = oW; sizes.oH = oH; - sizes.sx = sx; - sizes.sy = sy; + sizes.sx = 0;//sx; + sizes.sy = 0;//sy; if (settings->dualThreadEnabled) { Glib::Thread *thread1 = Glib::Thread::create(sigc::bind(sigc::mem_fun(*this, &ImProcFunctions::simpltransform_), original, transformed, params, sizes, 0, transformed->height/2), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); @@ -1925,7 +1925,94 @@ void ImProcFunctions::resize (Image16* src, Image16* dst, ResizeParams params) { } void ImProcFunctions::resize_ (Image16* src, Image16* dst, ResizeParams params, int row_from, int row_to) { + if(params.scale < 0.5) + { + // small-scale algorithm by Ilia + // provides much better quality on small scales + // calculates mean value over source pixels which current destination pixel covers + // works only for scales < 1 + // for scales ~1 it is analogous to bilinear + // possibly, for even less scale factors (< 0.2 possibly) boundary pixels are not needed, omitting them can give a speedup + // this algorithm is much slower on small factors than others, because it uses all pixels of the SOURCE image + + double delta = 1.0 / params.scale; + double k = params.scale * params.scale; + + for(int i = row_from; i < row_to; i++) + { + // top and bottom boundary coordinates + double y0 = i * delta; + double y1 = (i + 1) * delta; + + int m0 = y0; + m0 = CLIPTO(m0, 0, src->height-1); + + int m1 = y1; + m1 = CLIPTO(m1, 0, src->height-1); + + // weights of boundary pixels + double wy0 = 1.0 - (y0 - m0); + double wy1 = y1 - m1; + + for(int j = 0; j < dst->width; j++) + { + // left and right boundary coordinates + double x0 = j * delta; + double x1 = (j + 1) * delta; + + int n0 = x0; + n0 = CLIPTO(n0, 0, src->width-1); + int n1 = x1; + n1 = CLIPTO(n1, 0, src->width-1); + + double wx0 = 1.0 - (x0 - n0); + double wx1 = x1 - n1; + + double r = 0; + double g = 0; + double b = 0; + // integration + // corners + r += wy0 * wx0 * src->r[m0][n0] + wy0 * wx1 * src->r[m0][n1] + wy1 * wx0 * src->r[m1][n0] + wy1 * wx1 * src->r[m1][n1]; + g += wy0 * wx0 * src->g[m0][n0] + wy0 * wx1 * src->g[m0][n1] + wy1 * wx0 * src->g[m1][n0] + wy1 * wx1 * src->g[m1][n1]; + b += wy0 * wx0 * src->b[m0][n0] + wy0 * wx1 * src->b[m0][n1] + wy1 * wx0 * src->b[m1][n0] + wy1 * wx1 * src->b[m1][n1]; + // top and bottom boundaries + for(int n = n0 + 1; n < n1; n++) + { + r += wy0 * src->r[m0][n] + wy1 * src->r[m1][n]; + g += wy0 * src->g[m0][n] + wy1 * src->g[m1][n]; + b += wy0 * src->b[m0][n] + wy1 * src->b[m1][n]; + } + // inner rows + for(int m = m0 + 1; m < m1; m++) + { + // left and right boundaries + r += wx0 * src->r[m][n0] + wx1 * src->r[m][n1]; + g += wx0 * src->g[m][n0] + wx1 * src->g[m][n1]; + b += wx0 * src->b[m][n0] + wx1 * src->b[m][n1]; + // inner pixels + for(int n = n0 + 1; n < n1; n++) + { + r += src->r[m][n]; + g += src->g[m][n]; + b += src->b[m][n]; + } + + } + + // overall weight is equal to the DST pixel area in SRC coordinates + r *= k; + g *= k; + b *= k; + + dst->r[i][j] = CLIP((int)r); + dst->g[i][j] = CLIP((int)g); + dst->b[i][j] = CLIP((int)b); + } + } + return; + } if(params.method == "Downscale (Better)") { // small-scale algorithm by Ilia diff --git a/rtengine/init.cc b/rtengine/init.cc index 7f6c94a6e..c14056106 100755 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -39,6 +39,7 @@ int init (const Settings* s) { dcrMutex = new Glib::Mutex; delete lcmsMutex; lcmsMutex = new Glib::Mutex; + return 0; } StagedImageProcessor* StagedImageProcessor::create (InitialImage* initialImage) { diff --git a/rtengine/pparamsmap.cc b/rtengine/pparamsmap.cc deleted file mode 100755 index 03310844b..000000000 --- a/rtengine/pparamsmap.cc +++ /dev/null @@ -1,166 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#include - -int main () { - - printf ("Member offsets in 'ProcParams':\n"); - - rtengine::procparams::ProcParams p; - - int d = (int) &p; - - printf ("%d\n", (int)&p.toneCurve.curve - d); - printf ("%d\n", (int)&p.toneCurve.brightness - d); - printf ("%d\n", (int)&p.toneCurve.black - d); - printf ("%d\n", (int)&p.toneCurve.contrast - d); - printf ("%d\n", (int)&p.toneCurve.shcompr - d); - printf ("%d\n", (int)&p.toneCurve.hlcompr - d); - printf ("%d\n", (int)&p.toneCurve.autoexp - d); - printf ("%d\n", (int)&p.toneCurve.clip - d); - printf ("%d\n", (int)&p.toneCurve.expcomp - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.lumaCurve.curve - d); - printf ("%d\n", (int)&p.lumaCurve.brightness - d); - printf ("%d\n", (int)&p.lumaCurve.black - d); - printf ("%d\n", (int)&p.lumaCurve.contrast - d); - printf ("%d\n", (int)&p.lumaCurve.shcompr - d); - printf ("%d\n", (int)&p.lumaCurve.hlcompr - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.sharpening.enabled - d); - printf ("%d\n", (int)&p.sharpening.radius - d); - printf ("%d\n", (int)&p.sharpening.amount - d); - printf ("%d\n", (int)&p.sharpening.threshold - d); - printf ("%d\n", (int)&p.sharpening.edgesonly - d); - printf ("%d\n", (int)&p.sharpening.edges_radius - d); - printf ("%d\n", (int)&p.sharpening.edges_tolerance - d); - printf ("%d\n", (int)&p.sharpening.halocontrol - d); - printf ("%d\n", (int)&p.sharpening.halocontrol_amount - d); - printf ("%d\n", (int)&p.sharpening.method - d); - printf ("%d\n", (int)&p.sharpening.deconvamount - d); - printf ("%d\n", (int)&p.sharpening.deconvradius - d); - printf ("%d\n", (int)&p.sharpening.deconviter - d); - printf ("%d\n", (int)&p.sharpening.deconvdamping - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.colorBoost.a - d); - printf ("%d\n", (int)&p.colorBoost.b - d); - printf ("%d\n", (int)&p.colorBoost.avoidclip - d); - printf ("%d\n", (int)&p.colorBoost.enable_saturationlimiter - d); - printf ("%d\n", (int)&p.colorBoost.saturationlimit - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.wb.method - d); - printf ("%d\n", (int)&p.wb.temperature - d); - printf ("%d\n", (int)&p.wb.green - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.colorShift.a - d); - printf ("%d\n", (int)&p.colorShift.b - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.lumaDenoise.enabled - d); - printf ("%d\n", (int)&p.lumaDenoise.radius - d); - printf ("%d\n", (int)&p.lumaDenoise.edgetolerance - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.colorDenoise.enabled - d); - printf ("%d\n", (int)&p.colorDenoise.radius - d); - printf ("%d\n", (int)&p.colorDenoise.edgetolerance - d); - printf ("%d\n", (int)&p.colorDenoise.edgesensitive - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.sh.enabled - d); - printf ("%d\n", (int)&p.sh.highlights - d); - printf ("%d\n", (int)&p.sh.htonalwidth - d); - printf ("%d\n", (int)&p.sh.shadows - d); - printf ("%d\n", (int)&p.sh.stonalwidth - d); - printf ("%d\n", (int)&p.sh.localcontrast - d); - printf ("%d\n", (int)&p.sh.radius - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.crop.enabled - d); - printf ("%d\n", (int)&p.crop.x - d); - printf ("%d\n", (int)&p.crop.y - d); - printf ("%d\n", (int)&p.crop.w - d); - printf ("%d\n", (int)&p.crop.h - d); - printf ("%d\n", (int)&p.crop.fixratio - d); - printf ("%d\n", (int)&p.crop.ratio - d); - printf ("%d\n", (int)&p.crop.orientation - d); - printf ("%d\n", (int)&p.crop.guide - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.coarse.rotate - d); - printf ("%d\n", (int)&p.coarse.hflip - d); - printf ("%d\n", (int)&p.coarse.vflip - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.rotate.degree - d); - printf ("%d\n", (int)&p.rotate.fill - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.distortion.amount - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.cacorrection.red - d); - printf ("%d\n", (int)&p.cacorrection.blue - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.vignetting.amount - d); - printf ("%d\n", (int)&p.vignetting.radius - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.chmixer.red[0] - d); - printf ("%d\n", (int)&p.chmixer.green[0] - d); - printf ("%d\n", (int)&p.chmixer.blue[0] - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.hlrecovery.enabled - d); - printf ("%d\n", (int)&p.hlrecovery.method - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.resize.scale - d); - printf ("%d\n", (int)&p.resize.method - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.icm.input - d); - printf ("%d\n", (int)&p.icm.gammaOnInput - d); - printf ("%d\n", (int)&p.icm.working - d); - printf ("%d\n", (int)&p.icm.output - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.exif - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.iptc - d); - printf ("---------\n"); - printf ("%d\n", (int)&p.version - d); - printf ("---------\n"); - printf ("sizeof 'ProcParams' = %d\n", sizeof(rtengine::procparams::ProcParams)); - - printf ("Member offsets in 'Settings':\n"); - rtengine::Settings s; - - d = (int) &s; - - printf ("%d\n", (int)&s.dualThreadEnabled - d); - printf ("%d\n", (int)&s.demosaicMethod - d); - printf ("%d\n", (int)&s.colorCorrectionSteps - d); - printf ("%d\n", (int)&s.iccDirectory - d); - printf ("%d\n", (int)&s.colorimetricIntent - d); - printf ("%d\n", (int)&s.monitorProfile - d); - printf ("---------\n"); - printf ("sizeof 'Settings' = %d\n", sizeof(rtengine::Settings)); - - printf ("Member offsets in 'RawMetaDataLocation':\n"); - rtengine::RawMetaDataLocation r; - - d = (int) &r; - - printf ("%d\n", (int)&r.exifBase - d); - printf ("%d\n", (int)&r.ciffBase - d); - printf ("%d\n", (int)&r.ciffLength - d); - printf ("---------\n"); - printf ("sizeof 'RawMetaDataLocation' = %d\n", sizeof(rtengine::RawMetaDataLocation)); - - -} - diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 42e078036..afd56c85f 100755 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -48,32 +48,32 @@ namespace rtengine { public: /** Checks the availability of exif metadata tags. * @return Returns true if image contains exif metadata tags */ - virtual bool hasExif () const {} + virtual bool hasExif () const =0; /** Returns the directory of exif metadata tags. * @return The directory of exif metadata tags */ - virtual const rtexif::TagDirectory* getExifData () const {} + virtual const rtexif::TagDirectory* getExifData () const =0; /** Checks the availability of IPTC tags. * @return Returns true if image contains IPTC tags */ - virtual bool hasIPTC () const {} + virtual bool hasIPTC () const =0; /** Returns the directory of IPTC tags. * @return The directory of IPTC tags */ - virtual const std::vector getIPTCData () const {} + virtual const std::vector getIPTCData () const =0; /** @return a struct containing the date and time of the image */ - virtual struct tm getDateTime () const {} + virtual struct tm getDateTime () const =0; /** @return the ISO of the image */ - virtual int getISOSpeed () const {} + virtual int getISOSpeed () const =0; /** @return the F number of the image */ - virtual double getFNumber () const {} + virtual double getFNumber () const =0; /** @return the focal length used at the exposure */ - virtual double getFocalLen () const {} + virtual double getFocalLen () const =0; /** @return the shutter speed */ - virtual double getShutterSpeed () const {} + virtual double getShutterSpeed () const =0; /** @return the maker of the camera */ - virtual std::string getMake () const {} + virtual std::string getMake () const =0; /** @return the model of the camera */ - virtual std::string getModel () const {} + virtual std::string getModel () const =0; /** @return the lens on the camera */ - virtual std::string getLens () const {} + virtual std::string getLens () const =0; /** Functions to convert between floating point and string representation of shutter and aperture */ static std::string apertureToString (double aperture); /** Functions to convert between floating point and string representation of shutter and aperture */ @@ -121,15 +121,15 @@ namespace rtengine { public: /** Returns the file name of the image. * @return The file name of the image */ - virtual Glib::ustring getFileName () {} + virtual Glib::ustring getFileName () =0; /** Returns the embedded icc profile of the image. * @return The handle of the embedded profile */ - virtual cmsHPROFILE getEmbeddedProfile () {} + virtual cmsHPROFILE getEmbeddedProfile () =0; /** Returns a class providing access to the exif and iptc metadata tags of the image. * @return An instance of the ImageMetaData class */ - virtual const ImageMetaData* getMetaData () {} + virtual const ImageMetaData* getMetaData () =0; /** This is a function used for internal purposes only. */ - virtual ImageSource* getImageSource () {} + virtual ImageSource* getImageSource () =0; /** This class has manual reference counting. You have to call this function each time to make a new reference to an instance. */ virtual void increaseRef () {} /** This class has manual reference counting. You have to call this function each time to remove a reference @@ -234,61 +234,61 @@ namespace rtengine { public: /** Returns the inital image corresponding to the image processor. * @return the inital image corresponding to the image processor */ - virtual InitialImage* getInitialImage () {} + virtual InitialImage* getInitialImage () =0; /** Returns the current processing parameters. * @param dst is the location where the image processing parameters are copied (it is assumed that the memory is allocated by the caller) */ - virtual void getParams (procparams::ProcParams* dst) {} + virtual void getParams (procparams::ProcParams* dst) =0; /** An essential member function. Call this when a setting has been changed. This function returns a pointer to the * processing parameters, that you have to update to reflect the changed situation. When ready, call the paramsUpdateReady * function to start the image update. * @param change is the ID of the changed setting */ - virtual procparams::ProcParams* getParamsForUpdate (ProcEvent change) {} + virtual procparams::ProcParams* getParamsForUpdate (ProcEvent change) =0; /** An essential member function. This indicates that you are ready with the update of the processing parameters you got * with the getParamsForUpdate call, so the image can be updated. This function returns immediately. * The image update starts immediately in the background. If it is ready, the result is passed to a PreviewImageListener * and to a DetailedCropListener (if enabled). */ - virtual void paramsUpdateReady () {} + virtual void paramsUpdateReady () =0; /** Stops image processing. When it returns, the image processing is already stopped. */ - virtual void stopProcessing () {} + virtual void stopProcessing () =0; /** Sets the scale of the preview image. The larger the number is, the faster the image updates are (typical values are 4-5). * @param scale is the scale of the preview image */ - virtual void setPreviewScale (int scale) {} + virtual void setPreviewScale (int scale) =0; /** Returns the scale of the preview image. * @return the current scale of the preview image */ - virtual int getPreviewScale () {} + virtual int getPreviewScale () =0; /** Performs a full update on the preview image. The resulting image is passed to the listener. */ - virtual void fullUpdatePreviewImage () {} + virtual void fullUpdatePreviewImage () =0; /** Performs a full update on the detailed crops corresponding to the image. The resulting images are passed to the listeners of the crops. */ - virtual void fullUpdateDetailedCrops () {} + virtual void fullUpdateDetailedCrops () =0; /** Returns the full width of the resulting image (in 1:1 scale). * @return the width of the final image */ - virtual int getFullWidth () {} + virtual int getFullWidth () =0; /** Returns the full height of the resulting image (in 1:1 scale). * @return the height of the final image */ - virtual int getFullHeight () {} + virtual int getFullHeight () =0; /** Returns the width of the preview image. * @return the width of the preview image */ - virtual int getPreviewWidth () {} + virtual int getPreviewWidth () =0; /** Returns the height of the preview image. * @return the height of the preview image */ - virtual int getPreviewHeight () {} + virtual int getPreviewHeight () =0; /** Creates and returns a Crop instance that acts as a window on the image */ - virtual DetailedCrop* createCrop () {} + virtual DetailedCrop* createCrop () =0; - virtual void getAutoWB (double& temp, double& green) {} - virtual void getCamWB (double& temp, double& green) {} - virtual void getSpotWB (int x, int y, int rectSize, double& temp, double& green) {} - virtual void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) {} + virtual void getAutoWB (double& temp, double& green) =0; + virtual void getCamWB (double& temp, double& green) =0; + virtual void getSpotWB (int x, int y, int rectSize, double& temp, double& green) =0; + virtual void getAutoCrop (double ratio, int &x, int &y, int &w, int &h) =0; - virtual void saveInputICCReference (const Glib::ustring& fname) {} + virtual void saveInputICCReference (const Glib::ustring& fname) =0; - virtual void setProgressListener (ProgressListener* l) {} - virtual void setSizeListener (SizeListener* l) {} - virtual void delSizeListener (SizeListener* l) {} - virtual void setAutoExpListener (AutoExpListener* l) {} - virtual void setHistogramListener (HistogramListener *l) {} - virtual void setPreviewImageListener (PreviewImageListener* l) {} + virtual void setProgressListener (ProgressListener* l) =0; + virtual void setSizeListener (SizeListener* l) =0; + virtual void delSizeListener (SizeListener* l) =0; + virtual void setAutoExpListener (AutoExpListener* l) =0; + virtual void setHistogramListener (HistogramListener *l) =0; + virtual void setPreviewImageListener (PreviewImageListener* l) =0; virtual ~StagedImageProcessor () {} @@ -368,7 +368,7 @@ namespace rtengine { * there is no jobs left. * @param img is the result of the last ProcessingJob * @return the next ProcessingJob to process */ - virtual ProcessingJob* imageReady (IImage16* img) {} + virtual ProcessingJob* imageReady (IImage16* img) =0; }; /** This function performs all the image processinf steps corresponding to the given ProcessingJob. It runs in the background, thus it returns immediately, * When it finishes, it calls the BatchProcessingListener with the resulting image and asks for the next job. It the listener gives a new job, it goes on diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 7ef7a973e..ed47494ee 100755 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -300,7 +300,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei buffer[i] = new unsigned short[fw]; } shmap = new SHMap (fw, fh); - double radius = sqrt (fw*fw+fh*fh) / 2.0; + double radius = sqrt (double(fw*fw+fh*fh)) / 2.0; double shradius = radius / 1800.0 * params.sh.radius; shmap->update (baseImg, buffer, shradius, ipf.lumimul, params.sh.hq); if (buffer) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 5edef48a0..ab9dccb8f 100755 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -25,6 +25,8 @@ #include #include +#undef THREAD_PRIORITY_NORMAL + namespace rtengine { IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl) { @@ -116,7 +118,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p SHMap* shmap = NULL; if (params.sh.enabled) { shmap = new SHMap (fw, fh); - double radius = sqrt (fw*fw+fh*fh) / 2.0; + double radius = sqrt (double(fw*fw+fh*fh)) / 2.0; double shradius = radius / 1800.0 * params.sh.radius; shmap->update (baseImg, (unsigned short**)buffer, shradius, ipf.lumimul, params.sh.hq); } diff --git a/rtengine/sizes.txt b/rtengine/sizes.txt deleted file mode 100755 index a207aaca4..000000000 --- a/rtengine/sizes.txt +++ /dev/null @@ -1,24 +0,0 @@ -sizes of procparams: - - ToneCurveParams 53+3 - CurveParams 36 - SharpeningParams 68 - ColorBoostParams 24 - WBParams 16 - ColorShiftParams 16 - LumaDenoiseParams 16 - ColorDenoiseParams 20 - SHParams 28 - CropParams 36 - CoarseTransformParams 12 - RotateParams 12 - DistortionParams 8 - CACorrParams 16 - VignettingParams 8 - ChannelMixerParams 36 - HRecParams 8 - ResizeParams 12 - ColorManagementParams 16 - std::vector 12 - std::vector 12 - diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 033beee4a..a61f3050d 100755 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -24,6 +24,7 @@ #include #include #include +#include namespace rtexif { @@ -1381,4 +1382,53 @@ short int int2_to_signed (short unsigned int i) { return u.s; } +/* Function to parse and extract focal length and aperture information from description + * @fullname must conform to the following formats + * mm f/ + * -mm f/ + * -mm f/- + * NB: no space between separator '-'; no space between focal length and 'mm' + */ +bool extractLensInfo(std::string &fullname,double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) +{ + minFocal=0.0; + maxFocal=0.0; + maxApertureAtMinFocal=0.0; + maxApertureAtMaxFocal=0.0; + + int iAperture = fullname.find("f/"); + if( iAperture != std::string::npos ){ + char meno; + std::istringstream apertures( std::string(fullname,iAperture+2) ); + apertures >> maxApertureAtMinFocal; + if( !apertures.eof()) + apertures >> meno; + if( !apertures.eof()) + apertures >> maxApertureAtMaxFocal; + if(maxApertureAtMinFocal >0. && maxApertureAtMaxFocal==0.) + maxApertureAtMaxFocal= maxApertureAtMinFocal; + + int eFocal = fullname.rfind("mm",iAperture); + if( eFocal != -1 ){ + int iFocal = fullname.rfind(' ',eFocal); // find first space leading focal length + if( iFocal == std::string::npos ) + iFocal = 0; + + std::istringstream focals( std::string(fullname,iFocal,eFocal-iFocal) ); + focals >> minFocal; + if( !focals.eof()) + focals >> meno; + if( !focals.eof()) + focals >> maxFocal; + if(minFocal >0. && maxFocal==0.0) + maxFocal=minFocal; + + return true; + } + return false; + } + return false; +} + + } diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index 3f029db33..eee6f2df9 100755 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -192,7 +192,12 @@ class StdInterpreter : public Interpreter { StdInterpreter () {} virtual std::string toString (Tag* t) { t->toString (buffer); - return std::string (buffer); + std::string s(buffer); + std::string::size_type p1 = s.find_first_not_of(' '); + if( p1 == std::string::npos ) + return s; + else + return s.substr(p1, s.find_last_not_of(' ')-p1+1); } virtual void fromString (Tag* t, const std::string& value) { if (t->getType()==SHORT || t->getType()==LONG) @@ -226,7 +231,7 @@ inline void sset2 (unsigned short v, unsigned char *s, ByteOrder order); inline void sset4 (int v, unsigned char *s, ByteOrder order); inline float int_to_float (int i); inline short int int2_to_signed (short unsigned int i); - +bool extractLensInfo(std::string &fullname,double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); extern const TagAttrib exifAttribs[]; extern const TagAttrib gpsAttribs[]; diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index 3bc0409b2..767e49996 100755 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -26,6 +26,9 @@ #include #include +#undef ABS +#define ABS(a) (((a) < 0) ? -(a) : (a)) + namespace rtexif { class SAOnOffInterpreter : public ChoiceInterpreter { @@ -141,197 +144,384 @@ class SAAntiBlurInterpreter : public ChoiceInterpreter { }; SAAntiBlurInterpreter saAntiBlurInterpreter; -class SALensIDInterpreter : public ChoiceInterpreter { +class SALensIDInterpreter : public Interpreter { + typedef std::multimap container_t; + typedef std::pair p_t; + protected: + container_t choices; public: SALensIDInterpreter () { - choices[0] = "Minolta AF 28-85mm F3.5-4.5"; - choices[1] = "Minolta AF 80-200mm F2.8 HS-APO G"; - choices[2] = "Minolta AF 28-70mm F2.8 G"; - choices[3] = "Minolta AF 28-80mm F4-5.6"; - choices[5] = "Minolta AF 35-70mm F3.5-4.5"; - choices[6] = "Minolta AF 24-85mm F3.5-4.5 [New]"; - choices[7] = "Minolta AF 100-300mm F4.5-5.6 APO [New]"; - choices[8] = "Minolta AF 70-210mm F4.5-5.6"; - choices[9] = "Minolta AF 50mm F3.5 Macro"; - choices[10] = "Minolta AF 28-105mm F3.5-4.5 [New]"; - choices[11] = "Minolta AF 300mm F4 HS-APO G"; - choices[12] = "Minolta AF 100mm F2.8 Soft Focus"; - choices[13] = "Minolta AF 75-300mm F4.5-5.6"; - choices[14] = "Minolta AF 100-400mm F4.5-6.7 APO"; - choices[15] = "Minolta AF 400mm F4.5 HS-APO G"; - choices[16] = "Minolta AF 17-35mm F3.5 G"; - choices[17] = "Minolta AF 20-35mm F3.5-4.5"; - choices[18] = "Minolta AF 28-80mm F3.5-5.6 II"; - choices[19] = "Minolta AF 35mm F1.4"; - choices[20] = "Minolta/Sony STF 135mm F2.8 [T4.5]"; - choices[22] = "Minolta AF 35-80mm F4-5.6"; - choices[23] = "Minolta AF 200mm F4 G APO Macro"; - choices[24] = "Minolta/Sony AF 24-105mm F3.5-4.5 (D)"; - choices[25] = "Minolta AF 100-300mm F4.5-5.6 (APO D)"; - choices[27] = "Minolta AF 85mm F1.4 G"; - choices[28] = "Minolta AF 100mm F2.8 Macro (D)"; - choices[29] = "Minolta AF 75-300mm F4.5-5.6 (D)"; - choices[30] = "Minolta AF 28-80mm F3.5-5.6 (D)"; - choices[31] = "Minolta/Sony AF 50mm F2.8 Macro (D) or AF 50mm F3.5 Macro"; - choices[32] = "Minolta AF 300mm F2.8 G"; - choices[33] = "Minolta/Sony AF 70-200mm F2.8 G (D) SSM"; - choices[35] = "Minolta AF 85mm F1.4 G (D) Limited"; - choices[36] = "Minolta AF 28-100mm F3.5-5.6 (D)"; - choices[38] = "Minolta AF 17-35mm F2.8-4 (D)"; - choices[39] = "Minolta AF 28-75mm F2.8 (D)"; - choices[40] = "Minolta/Sony AF DT 18-70mm F3.5-5.6 (D)"; - choices[41] = "Minolta/Sony AF DT 11-18mm F4.5-5.6 (D)"; - choices[42] = "Minolta AF DT 18-200mm F3.5-6.3 (D)"; - choices[43] = "Minolta AF 35mm F1.4 G"; - choices[44] = "Minolta AF 50mm F1.4"; - choices[45] = "Carl Zeiss Planar T* 85mm F1.4 ZA"; - choices[46] = "Carl Zeiss Vario-Sonnar T* DT 16-80mm F3.5-4.5 ZA"; - choices[47] = "Carl Zeiss Sonnar T* 135mm F1.8 ZA"; - choices[48] = "Carl Zeiss Vario-Sonnar T* 24-70mm F2.8 ZA SSM"; - choices[49] = "Sony AF DT 55-200mm F4-5.6"; - choices[50] = "Sony AF DT 18-250mm F3.5-6.3"; - choices[51] = "Sony AF DT 16-105mm F3.5-5.6 or 55-200mm f/4-5.5"; - choices[52] = "Sony AF 70-300mm F4.5-5.6 G SSM"; - choices[53] = "Sony AF 70-400mm F4.5-5.6 G SSM"; - choices[54] = "Carl Zeiss Vario-Sonnar T* 16-35mm F2.8 ZA SSM"; - choices[55] = "Sony DT 18-55mm F3.5-5.6 SAM"; - choices[56] = "Sony AF DT 55-200mm F4-5.6 SAM"; - choices[57] = "Sony AF DT 50mm F1.8 SAM"; - choices[58] = "Sony AF DT 30mm F2.8 SAM Macro"; - choices[59] = "Sony AF 28-75mm F2.8 SAM"; - choices[128] = "Tamron or Sigma Lens"; - choices[129] = "Tamron 200-400mm F5.6 or 70-300mm f/4-5.6 LD"; - choices[135] = "Vivitar 28-210mm F3.5-5.6"; - choices[136] = "Tokina EMZ M100 AF 100mm F3.5"; - choices[137] = "Cosina 70-210mm F2.8-4 AF"; - choices[138] = "Soligor 19-35mm F3.5-4.5"; - choices[142] = "Voigtlander 70-300mm F4.5-5.6"; - choices[146] = "Voigtlander Macro APO-Lanthar 125mm F2.5 SL"; - choices[255] = "Tamron Lens"; - choices[2550] = "Minolta AF 50mm F1.7"; - choices[2551] = "Minolta AF 35-70mm F4"; - choices[2552] = "Minolta AF 28-85mm F3.5-4.5 [New]"; - choices[2553] = "Minolta AF 28-135mm F4-4.5"; - choices[2554] = "Minolta AF 35-105mm F3.5-4.5"; - choices[2555] = "Minolta AF 70-210mm F4 Macro"; - choices[2556] = "Minolta AF 135mm F2.8"; - choices[2557] = "Minolta AF 28mm F2.8"; - choices[2558] = "Minolta AF 24-50mm F4"; - choices[2560] = "Minolta AF 100-200mm F4.5"; - choices[2561] = "Minolta AF 75-300mm F4.5-5.6"; - choices[2562] = "Minolta/Sony AF 50mm F1.4 [New]"; - choices[2563] = "Minolta AF 300mm F2.8 G"; - choices[2564] = "Minolta AF 50mm F2.8 Macro"; - choices[2565] = "Minolta AF 600mm F4"; - choices[2566] = "Minolta AF 24mm F2.8"; - choices[2572] = "Minolta/Sony AF 500mm F8 Reflex"; - choices[2578] = "Minolta AF 16mm F2.8 Fisheye or Sigma Lens"; - choices[2579] = "Minolta AF 20mm F2.8"; - choices[2581] = "Minolta/Sony AF 100mm F2.8 Macro or Sigma or Tamron"; - choices[2585] = "Minolta AF 35-105mm F3.5-4.5 New"; - choices[2588] = "Minolta AF 70-210mm F3.5-4.5"; - choices[2589] = "Minolta AF 80-200 F2.8 APO"; - choices[2591] = "Minolta AF 35mm F1.4"; - choices[2592] = "Minolta AF 85mm F1.4 G (D)"; - choices[2593] = "Minolta AF 200mm F2.8 G APO"; - choices[2594] = "Minolta AF 3x-1x F1.7-2.8 Macro"; - choices[2596] = "Minolta AF 28mm F2"; - choices[2597] = "Minolta AF 35mm F2"; - choices[2598] = "Minolta AF 100mm F2"; - choices[2604] = "Minolta AF 80-200mm F4.5-5.6"; - choices[2605] = "Minolta AF 35-80mm F4-5.6"; - choices[2606] = "Minolta AF 100-300mm F4.5-5.6 (D)"; - choices[2607] = "Minolta AF 35-80mm F4-5.6"; - choices[2608] = "Minolta AF 300mm F2.8 G"; - choices[2609] = "Minolta AF 600mm F4 HS-APO G"; - choices[2612] = "Minolta AF 200mm F2.8 G HS-APO"; - choices[2613] = "Minolta AF 50mm F1.7 New"; - choices[2615] = "Minolta AF 28-105mm F3.5-4.5 Power Zoom"; - choices[2616] = "Minolta AF 35-200mm F4.5-5.6 Power Zoom"; - choices[2618] = "Minolta AF 28-80mm F4-5.6 Power Zoom"; - choices[2619] = "Minolta AF 80-200mm F4.5-5.6 Power Zoom"; - choices[2620] = "Minolta AF 28-70mm F2.8 G"; - choices[2621] = "Minolta AF 100-300mm F4.5-5.6 Power Zoom"; - choices[2624] = "Minolta AF 35-80mm F4-5.6 Power Zoom"; - choices[2628] = "Minolta AF 80-200mm F2.8 G"; - choices[2629] = "Minolta AF 85mm F1.4 New"; - choices[2631] = "Minolta/Sony AF 100-300mm F4.5-5.6 APO"; - choices[2632] = "Minolta AF 24-50mm F4 New"; - choices[2638] = "Minolta AF 50mm F2.8 Macro New"; - choices[2639] = "Minolta AF 100mm F2.8 Macro"; - choices[2641] = "Minolta AF 20mm F2.8 New"; - choices[2642] = "Minolta AF 24mm F2.8 New"; - choices[2644] = "Minolta AF 100-400mm F4.5-6.7 APO"; - choices[2662] = "Minolta AF 50mm F1.4 New"; - choices[2667] = "Minolta AF 35mm F2 New"; - choices[2668] = "Minolta AF 28mm F2 New"; - choices[2672] = "Minolta AF 24-105mm F3.5-4.5 (D)"; - choices[4574] = "Minolta AF 200mm F2.8 G x2"; - choices[4575] = "1.4 x Teleconverter"; - choices[4585] = "Tamron - SP AF 300 F2.8 LD IF"; - choices[25501] = "Minolta AF 50mm F1.7"; - choices[25511] = "Minolta AF 35-70mm F4"; - choices[25521] = "Minolta AF 28-85mm F3.5-4.5 [New]"; - choices[25531] = "Minolta AF 28-135mm F4-4.5"; - choices[25541] = "Minolta AF 35-105mm F3.5-4.5"; - choices[25551] = "Minolta AF 70-210mm F4 Macro"; - choices[25561] = "Minolta AF 135mm F2.8"; - choices[25571] = "Minolta AF 28mm F2.8"; - choices[25581] = "Minolta AF 24-50mm F4"; - choices[25601] = "Minolta AF 100-200mm F4.5"; - choices[25611] = "Minolta AF 75-300mm F4.5-5.6"; - choices[25621] = "Minolta/Sony AF 50mm F1.4 [New]"; - choices[25631] = "Minolta AF 300mm F2.8 G"; - choices[25641] = "Minolta AF 50mm F2.8 Macro"; - choices[25651] = "Minolta AF 600mm F4"; - choices[25661] = "Minolta AF 24mm F2.8"; - choices[25721] = "Minolta/Sony AF 500mm F8 Reflex"; - choices[25781] = "Minolta AF 16mm F2.8 Fisheye"; - choices[25791] = "Minolta AF 20mm F2.8"; - choices[25811] = "Minolta/Sony AF 100mm F2.8 Macro New"; - choices[25851] = "Beroflex 35-135mm F3.5-4.5"; - choices[25858] = "Minolta AF 35-105mm F3.5-4.5 New"; - choices[25881] = "Minolta AF 70-210mm F3.5-4.5"; - choices[25891] = "Minolta AF 80-200 F2.8 APO"; - choices[25911] = "Minolta AF 35mm F1.4"; - choices[25921] = "Minolta AF 85mm F1.4 G (D)"; - choices[25931] = "Minolta AF 200mm F2.8 G APO"; - choices[25941] = "Minolta AF 3x-1x F1.7-2.8 Macro"; - choices[25961] = "Minolta AF 28mm F2"; - choices[25971] = "Minolta AF 35mm F2"; - choices[25981] = "Minolta AF 100mm F2"; - choices[26041] = "Minolta AF 80-200mm F4.5-5.6"; - choices[26051] = "Minolta AF 35-80mm F4-5.6"; - choices[26061] = "Minolta AF 100-300mm F4.5-5.6 (D)"; - choices[26071] = "Minolta AF 35-80mm F4-5.6"; - choices[26081] = "Minolta AF 300mm F2.8 G"; - choices[26091] = "Minolta AF 600mm F4 HS-APO G"; - choices[26121] = "Minolta AF 200mm F2.8 G HS-APO"; - choices[26131] = "Minolta AF 50mm F1.7 New"; - choices[26151] = "Minolta AF 28-105mm F3.5-4.5 Power Zoom"; - choices[26161] = "Minolta AF 35-200mm F4.5-5.6 Power Zoom"; - choices[26181] = "Minolta AF 28-80mm F4-5.6 Power Zoom"; - choices[26191] = "Minolta AF 80-200mm F4.5-5.6 Power Zoom"; - choices[26201] = "Minolta AF 28-70mm F2.8 G"; - choices[26211] = "Minolta AF 100-300mm F4.5-5.6 Power Zoom"; - choices[26241] = "Minolta AF 35-80mm F4-5.6 Power Zoom"; - choices[26281] = "Minolta AF 80-200mm F2.8 G"; - choices[26291] = "Minolta AF 85mm F1.4 New"; - choices[26311] = "Minolta/Sony AF 100-300mm F4.5-5.6 APO"; - choices[26321] = "Minolta AF 24-50mm F4 New"; - choices[26381] = "Minolta AF 50mm F2.8 Macro New"; - choices[26391] = "Minolta AF 100mm F2.8 Macro"; - choices[26411] = "Minolta AF 20mm F2.8 New"; - choices[26421] = "Minolta AF 24mm F2.8 New"; - choices[26441] = "Minolta AF 100-400mm F4.5-6.7 APO"; - choices[26621] = "Minolta AF 50mm F1.4 New"; - choices[26671] = "Minolta AF 35mm F2 New"; - choices[26681] = "Minolta AF 28mm F2 New"; - choices[26721] = "Minolta AF 24-105mm F3.5-4.5 (D)"; - choices[45671] = "Tokina 70-210mm F4-5.6"; - choices[45741] = "Minolta AF 200mm F2.8 G x2"; - choices[45851] = "Tamron - SP AF 300 F2.8 LD IF"; + choices.insert(p_t(0, "Minolta AF 28-85mm f/3.5-4.5")); + choices.insert(p_t(1, "Minolta AF 80-200mm f/2.8 HS-APO G")); + choices.insert(p_t(2, "Minolta AF 28-70mm f/2.8 G")); + choices.insert(p_t(3, "Minolta AF 28-80mm f/4-5.6")); + choices.insert(p_t(5, "Minolta AF 35-70mm f/3.5-4.5")); + choices.insert(p_t(6, "Minolta AF 24-85mm f/3.5-4.5 [New]")); + choices.insert(p_t(7, "Minolta AF 100-300mm f/4.5-5.6 APO [New]")); + choices.insert(p_t(7, "Sigma AF 100-300mm f/4 EX DG IF")); + choices.insert(p_t(8, "Minolta AF 70-210mm f/4.5-5.6")); + choices.insert(p_t(9, "Minolta AF 50mm f/3.5 Macro")); + choices.insert(p_t(10, "Minolta AF 28-105mm f/3.5-4.5 [New]")); + choices.insert(p_t(11, "Minolta AF 300mm f/4 HS-APO G")); + choices.insert(p_t(12, "Minolta AF 100mm f/2.8 Soft Focus")); + choices.insert(p_t(13, "Minolta AF 75-300mm f/4.5-5.6")); + choices.insert(p_t(14, "Minolta AF 100-400mm f/4.5-6.7 APO")); + choices.insert(p_t(15, "Minolta AF 400mm f/4.5 HS-APO G")); + choices.insert(p_t(16, "Minolta AF 17-35mm f/3.5 G")); + choices.insert(p_t(17, "Minolta AF 20-35mm f/3.5-4.5")); + choices.insert(p_t(18, "Minolta AF 28-80mm f/3.5-5.6 II")); + choices.insert(p_t(19, "Minolta AF 35mm f/1.4")); + choices.insert(p_t(20, "Minolta/Sony STF 135mm F2.8 [T4.5]")); + choices.insert(p_t(22, "Minolta AF 35-80mm f/4-5.6")); + choices.insert(p_t(23, "Minolta AF 200mm f/4 G APO Macro")); + choices.insert(p_t(24, "Minolta/Sony AF 24-105mm f/3.5-4.5 (D)")); + choices.insert(p_t(24, "Sigma 18-50mm f/2.8 EX DC Macro")); + choices.insert(p_t(24, "Sigma 17-70mm f/2.8-4.5 DC Macro")); + choices.insert(p_t(24, "Sigma 20-40mm f/2.8 EX DG Aspherical IF")); + choices.insert(p_t(24, "Sigma 18-200mm f/3.5-6.3 DC")); + choices.insert(p_t(24, "Tamron SP AF 28-75mm f/2.8 XR Di (IF) Macro")); + choices.insert(p_t(25, "Minolta AF 100-300mm f/4.5-5.6 APO D")); + choices.insert(p_t(25, "Sigma 100-300mm f/4 EX DG APO")); + choices.insert(p_t(25, "Sigma 70mm f/2.8 EX DG Macro")); + choices.insert(p_t(25, "Sigma 20mm f/1.8 EX DG Aspherical RF")); + choices.insert(p_t(25, "Sigma 30mm f/1.4 EX DG")); + choices.insert(p_t(27, "Minolta AF 85mm f71.4 G")); + choices.insert(p_t(28, "Minolta AF 100mm f/2.8 Macro (D)")); + choices.insert(p_t(28, "Tamron SP AF 90mm f/2.8 Di Macro ")); + choices.insert(p_t(29, "Minolta AF 75-300mm f/4.5-5.6 (D)")); + choices.insert(p_t(30, "Minolta AF 28-80mm f/3.5-5.6 (D)")); + choices.insert(p_t(30, "Sigma 10-20mm f/4-5.6 EX DC")); + choices.insert(p_t(30, "Sigma 12-24mm f/4.5-5.6 EX DG")); + choices.insert(p_t(30, "Sigma 28-70mm f/2.8 EX DG")); + choices.insert(p_t(30, "Sigma 55-200mm f/4-5.6 DC")); + choices.insert(p_t(31, "Minolta/Sony AF 50mm f/2.8 Macro (D)")); + choices.insert(p_t(32, "Minolta AF 300mm f/2.8 G")); + choices.insert(p_t(33, "Minolta/Sony AF 70-200mm f/2.8 G (D) SSM")); + choices.insert(p_t(35, "Minolta AF 85mm f/1.4 G (D) Limited")); + choices.insert(p_t(36, "Minolta AF 28-100mm f/3.5-5.6 (D)")); + choices.insert(p_t(38, "Minolta AF 17-35mm f/2.8-4 (D)")); + choices.insert(p_t(39, "Minolta AF 28-75mm f/2.8 (D)")); + choices.insert(p_t(40, "Minolta/Sony AF DT 18-70mm f/3.5-5.6 (D)")); + choices.insert(p_t(41, "Minolta/Sony AF DT 11-18mm f/4.5-5.6 (D)")); + choices.insert(p_t(42, "Minolta AF DT 18-200mm f/3.5-6.3 (D)")); + choices.insert(p_t(43, "Minolta AF 35mm f/1.4 G")); + choices.insert(p_t(44, "Sony AF 50mm f/1.4")); + choices.insert(p_t(45, "Carl Zeiss Planar T* 85mm f/1.4 ZA")); + choices.insert(p_t(46, "Carl Zeiss Vario-Sonnar T* DT 16-80mm f/3.5-4.5 ZA")); + choices.insert(p_t(47, "Carl Zeiss Sonnar T* 135mm F1.8 ZA")); + choices.insert(p_t(48, "Carl Zeiss Vario-Sonnar T* 24-70mm f/2.8 ZA SSM")); + choices.insert(p_t(49, "Sony AF DT 55-200mm f/4-5.6")); + choices.insert(p_t(50, "Sony AF DT 18-250mm f/3.5-6.3")); + choices.insert(p_t(51, "Sony AF DT 16-105mm f/3.5-5.6 or 55-200mm f/4-5.5")); + choices.insert(p_t(52, "Sony AF 70-300mm f/4.5-5.6 G SSM")); + choices.insert(p_t(53, "Sony AF 70-400mm f/4.5-5.6 G SSM")); + choices.insert(p_t(54, "Carl Zeiss Vario-Sonnar T* 16-35mm f/2.8 ZA SSM")); + choices.insert(p_t(55, "Sony DT 18-55mm f/3.5-5.6 SAM")); + choices.insert(p_t(56, "Sony AF DT 55-200mm f/4-5.6 SAM")); + choices.insert(p_t(57, "Sony AF DT 50mm f/1.8 SAM")); + choices.insert(p_t(58, "Sony AF DT 30mm f/2.8 SAM Macro")); + choices.insert(p_t(59, "Sony AF 28-75mm f/2.8 SAM")); + choices.insert(p_t(128, "Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF)")); + choices.insert(p_t(128, "Tamron AF 28-300mm f/3.5-6.3")); + choices.insert(p_t(128, "Tamron AF 28-200mm f/3.8-5.6 XR Di Aspherical (IF) Macro ")); + choices.insert(p_t(128, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF")); + choices.insert(p_t(128, "Sigma 10-20mm f/3.5 EX DC")); + choices.insert(p_t(128, "Sigma 70-200mm f/2.8 II EX DG APO Macro")); + choices.insert(p_t(129, "Tamron 200-400mm f/5.6 LD (IF)")); + choices.insert(p_t(129, "Tamron 70-300mm f/4-5.6 LD")); + choices.insert(p_t(135, "Vivitar 28-210mm f/3.5-5.6")); + choices.insert(p_t(136, "Tokina EMZ M100 AF 100mm f/3.5")); + choices.insert(p_t(137, "Cosina 70-210mm f/2.8-4 AF")); + choices.insert(p_t(138, "Soligor 19-35mm f/3.5-4.5")); + choices.insert(p_t(142, "Voigtlander 70-300mm f/4.5-5.6")); + choices.insert(p_t(146, "Voigtlander Macro APO-Lanthar 125mm f/2.5 SL")); + choices.insert(p_t(255, "Tamron SP AF 17-50mm f/2.8 XR Di II LD Aspherical")); + choices.insert(p_t(255, "Tamron AF 18-250mm f/3.5-6.3 XR Di II LD")); + choices.insert(p_t(255, "Tamron AF 55-200mm f/4-5.6 Di II")); + choices.insert(p_t(255, "Tamron AF 70-300mm f/4-5.6 Di LD Macro 1:2")); + choices.insert(p_t(255, "Tamron SP AF 200-500mm f/5.0-6.3 Di LD (IF)")); + choices.insert(p_t(255, "Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical (IF)")); + choices.insert(p_t(255, "Tamron SP AF 70-200mm f/2.8 Di LD Macro (IF)")); + choices.insert(p_t(255, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical (IF)")); + choices.insert(p_t(2550, "Minolta AF 50mm f/1.7")); + choices.insert(p_t(2551, "Minolta AF 35-70mm f/4")); + choices.insert(p_t(2551, "Sigma UC AF 28-70mm f/3.5-4.5")); + choices.insert(p_t(2551, "Sigma AF 28-70mm f/2.8")); + choices.insert(p_t(2551, "Sigma M-AF 70-200mm f/2.8 EX Aspherical")); + choices.insert(p_t(2551, "Quantaray M-AF 35-80mm f/4-5.6")); + choices.insert(p_t(2552, "Minolta AF 28-85mm f/3.5-4.5 [New]")); + choices.insert(p_t(2552, "Tokina 19-35mm f/3.5-4.5")); + choices.insert(p_t(2552, "Tokina 28-70mm f/2.8 AT-X")); + choices.insert(p_t(2552, "Tokina 80-400mm f/4.5-5.6 AT-X AF II 840")); + choices.insert(p_t(2552, "Tokina AF PRO 28-80mm f/2.8 AT-X 280")); + choices.insert(p_t(2552, "Tokina AT-X PRO II AF 28-70mm f/2.6-2.8 270")); + choices.insert(p_t(2552, "Tamron AF 19-35mm f/3.5-4.5")); + choices.insert(p_t(2552, "Angenieux AF 28-70mm f/2.6")); + choices.insert(p_t(2553, "Minolta AF 28-135mm f/4-4.5")); + choices.insert(p_t(2553, "Sigma ZOOM-alpha 35-135mm f/3.5-4.5")); + choices.insert(p_t(2553, "Sigma 28-105mm f/2.8-4 Aspherical")); + choices.insert(p_t(2554, "Minolta AF 35-105mm f/3.5-4.5")); + choices.insert(p_t(2555, "Minolta AF 70-210mm f/4 Macro")); + choices.insert(p_t(2555, "Sigma 70-210mm f/4-5.6 APO")); + choices.insert(p_t(2555, "Sigma M-AF 70-200mm f/2.8 EX APO")); + choices.insert(p_t(2555, "Sigma 75-200mm f/2.8-3.5")); + choices.insert(p_t(2556, "Minolta AF 135mm f/2.8")); + choices.insert(p_t(2557, "Minolta AF 28mm f/2.8")); + choices.insert(p_t(2558, "Minolta AF 24-50mm f/4")); + choices.insert(p_t(2560, "Minolta AF 100-200mm f/4.5")); + choices.insert(p_t(2561, "Minolta AF 75-300mm f/4.5-5.6")); + choices.insert(p_t(2561, "Sigma 70-300mm f/4-5.6 DL Macro")); + choices.insert(p_t(2561, "Sigma 300mm f/4 APO Macro")); + choices.insert(p_t(2561, "Sigma AF 500mm f/4.5 APO")); + choices.insert(p_t(2561, "Sigma AF 170-500mm f/5-6.3 APO Aspherical")); + choices.insert(p_t(2561, "Tokina AT-X AF 300mm f/4")); + choices.insert(p_t(2561, "Tokina AT-X AF 400mm f/5.6 SD")); + choices.insert(p_t(2561, "Tokina AF 730 II 75-300mm f/4.5-5.6")); + choices.insert(p_t(2562, "Minolta/Sony AF 50mm f/1.4 [New]")); + choices.insert(p_t(2563, "Minolta AF 300mm f/2.8 G")); + choices.insert(p_t(2563, "Sigma AF 50-500mm f/4-6.3 EX DG APO")); + choices.insert(p_t(2563, "Sigma AF 170-500mm f/5-6.3 APO Aspherical")); + choices.insert(p_t(2563, "Sigma AF 500mm f/4.5 EX DG APO")); + choices.insert(p_t(2563, "Sigma 400mm f/5.6 APO")); + choices.insert(p_t(2564, "Minolta AF 50mm f/2.8 Macro")); + choices.insert(p_t(2564, "Sigma 50mm f/2.8 EX Macro")); + choices.insert(p_t(2565, "Minolta AF 600mm f/4")); + choices.insert(p_t(2566, "Minolta AF 24mm f/2.8")); + choices.insert(p_t(2572, "Minolta/Sony AF 500mm f/8 Reflex")); + choices.insert(p_t(2578, "Minolta AF 16mm f/2.8 Fisheye")); + choices.insert(p_t(2578, "Sigma 8mm f/4 EX DG Fisheye")); + choices.insert(p_t(2578, "Sigma 14mm f/3.5")); + choices.insert(p_t(2578, "Sigma 15mm f/2.8 Fisheye")); + choices.insert(p_t(2579, "Minolta AF 20mm f/2.8")); + choices.insert(p_t(2581, "Minolta/Sony AF 100mm f/2.8 Macro")); + choices.insert(p_t(2581, "Sigma AF 90mm f/2.8 Macro")); + choices.insert(p_t(2581, "Sigma AF 105mm f/2.8 EX DG Macro")); + choices.insert(p_t(2581, "Sigma 180mm f/5.6 Macro")); + choices.insert(p_t(2581, "Tamron AF 90mm f/2.8 Macro")); + choices.insert(p_t(2585, "Minolta AF 35-105mm f/3.5-4.5 New")); + choices.insert(p_t(2585, "Tamron AF 24-135mm f/3.5-5.6")); + choices.insert(p_t(2588, "Minolta AF 70-210mm f/3.5-4.5")); + choices.insert(p_t(2589, "Minolta AF 80-200 f/2.8 APO")); + choices.insert(p_t(2589, "Tokina 80-200mm f/2.8")); + choices.insert(p_t(2591, "Minolta AF 35mm f/1.4")); + choices.insert(p_t(2592, "Minolta AF 85mm f/1.4 G (D)")); + choices.insert(p_t(2593, "Minolta AF 200mm f/2.8 G APO")); + choices.insert(p_t(2594, "Minolta AF 3x-1x f/1.7-2.8 Macro")); + choices.insert(p_t(2596, "Minolta AF 28mm f/2")); + choices.insert(p_t(2597, "Minolta AF 35mm f/2")); + choices.insert(p_t(2598, "Minolta AF 100mm f/2")); + choices.insert(p_t(2604, "Minolta AF 80-200mm f/4.5-5.6")); + choices.insert(p_t(2605, "Minolta AF 35-80mm f/4-5.6")); + choices.insert(p_t(2606, "Minolta AF 100-300mm f/4.5-5.6 (D)")); + choices.insert(p_t(2607, "Minolta AF 35-80mm f/4-5.6")); + choices.insert(p_t(2608, "Minolta AF 300mm f/2.8 G")); + choices.insert(p_t(2609, "Minolta AF 600mm f/4 HS-APO G")); + choices.insert(p_t(2612, "Minolta AF 200mm f/2.8 G HS-APO")); + choices.insert(p_t(2613, "Minolta AF 50mm f/1.7 New")); + choices.insert(p_t(2615, "Minolta AF 28-105mm f/3.5-4.5 Power Zoom")); + choices.insert(p_t(2616, "Minolta AF 35-200mm f/4.5-5.6 Power Zoom")); + choices.insert(p_t(2618, "Minolta AF 28-80mm f/4-5.6 Power Zoom")); + choices.insert(p_t(2619, "Minolta AF 80-200mm f/4.5-5.6 Power Zoom")); + choices.insert(p_t(2620, "Minolta AF 28-70mm f/2.8 G")); + choices.insert(p_t(2621, "Minolta AF 100-300mm f/4.5-5.6 Power Zoom")); + choices.insert(p_t(2624, "Minolta AF 35-80mm f/4-5.6 Power Zoom")); + choices.insert(p_t(2628, "Minolta AF 80-200mm f/2.8 G")); + choices.insert(p_t(2629, "Minolta AF 85mm f/1.4 New")); + choices.insert(p_t(2631, "Minolta/Sony AF 100-300mm f/4.5-5.6 APO")); + choices.insert(p_t(2632, "Minolta AF 24-50mm f/4 New")); + choices.insert(p_t(2638, "Minolta AF 50mm f/2.8 Macro New")); + choices.insert(p_t(2639, "Minolta AF 100mm f/2.8 Macro")); + choices.insert(p_t(2641, "Minolta AF 20mm f/2.8 New")); + choices.insert(p_t(2642, "Minolta AF 24mm f/2.8 New")); + choices.insert(p_t(2644, "Minolta AF 100-400mm f/4.5-6.7 APO")); + choices.insert(p_t(2662, "Minolta AF 50mm f/1.4 New")); + choices.insert(p_t(2667, "Minolta AF 35mm f/2 New")); + choices.insert(p_t(2668, "Minolta AF 28mm f/2 New")); + choices.insert(p_t(2672, "Minolta AF 24-105mm f/3.5-4.5 (D)")); + choices.insert(p_t(4574, "Minolta AF 200mm f/2.8 G x2")); + choices.insert(p_t(4575, "1.4 x Teleconverter")); + choices.insert(p_t(4585, "Tamron SP AF 300mm f/2.8 LD IF")); + choices.insert(p_t(6553, "Arax MC 35mm f/2.8 Tilt+Shift")); + choices.insert(p_t(6553, "Arax MC 80mm f/2.8 Tilt+Shift")); + choices.insert(p_t(6553, "Zenitar MF 16mm f/2.8 Fisheye M42")); + choices.insert(p_t(6553, "Samyang 500mm Mirror f/8")); + choices.insert(p_t(6553, "Pentacon Auto 135mm f/2.8")); + choices.insert(p_t(6553, "Pentacon Auto 29mm f/2.8")); + choices.insert(p_t(6553, "Helios 44-2 58mm f/2")); + choices.insert(p_t(25501, "Minolta AF 50mm f/1.7")); + choices.insert(p_t(25511, "Minolta AF 35-70mm f/4")); + choices.insert(p_t(25511, "Sigma UC AF 28-70mm f/3.5-4.5")); + choices.insert(p_t(25511, "Sigma AF 28-70mm f/2.8")); + choices.insert(p_t(25511, "Sigma M-AF 70-200mm f/2.8 EX Aspherical")); + choices.insert(p_t(25511, "Quantaray M-AF 35-80mm f/4-5.6")); + choices.insert(p_t(25521, "Minolta AF 28-85mm f/3.5-4.5 [New]")); + choices.insert(p_t(25521, "Tokina 19-35mm f/3.5-4.5")); + choices.insert(p_t(25521, "Tokina 28-70mm f/2.8 AT-X")); + choices.insert(p_t(25521, "Tokina 80-400mm f/4.5-5.6 AT-X AF II 840")); + choices.insert(p_t(25521, "Tokina AF PRO 28-80mm f/2.8 AT-X 280")); + choices.insert(p_t(25521, "Tokina AT-X PRO II AF 28-70mm f/2.6-2.8 270")); + choices.insert(p_t(25521, "Tamron AF 19-35mm f/3.5-4.5")); + choices.insert(p_t(25521, "Angenieux AF 28-70mm f/2.6")); + choices.insert(p_t(25531, "Minolta AF 28-135mm f/4-4.5")); + choices.insert(p_t(25531, "Sigma ZOOM-alpha 35-135mm f/3.5-4.5")); + choices.insert(p_t(25531, "Sigma 28-105mm f/2.8-4 Aspherical")); + choices.insert(p_t(25541, "Minolta AF 35-105mm f/3.5-4.5")); + choices.insert(p_t(25551, "Minolta AF 70-210mm f/4 Macro")); + choices.insert(p_t(25551, "Sigma 70-210mm f/4-5.6 APO")); + choices.insert(p_t(25551, "Sigma M-AF 70-200mm f/2.8 EX APO")); + choices.insert(p_t(25551, "Sigma 75-200mm f/2.8-3.5")); + choices.insert(p_t(25561, "Minolta AF 135mm f/2.8")); + choices.insert(p_t(25571, "Minolta AF 28mm f/2.8")); + choices.insert(p_t(25581, "Minolta AF 24-50mm f/4")); + choices.insert(p_t(25601, "Minolta AF 100-200mm f/4.5")); + choices.insert(p_t(25611, "Minolta AF 75-300mm f/4.5-5.6")); + choices.insert(p_t(25611, "Sigma 70-300mm f/4-5.6 DL Macro")); + choices.insert(p_t(25611, "Sigma 300mm f/4 APO Macro")); + choices.insert(p_t(25611, "Sigma AF 500mm f/4.5 APO")); + choices.insert(p_t(25611, "Sigma AF 170-500mm f/5-6.3 APO Aspherical")); + choices.insert(p_t(25611, "Tokina AT-X AF 300mm f/4")); + choices.insert(p_t(25611, "Tokina AT-X AF 400mm f/5.6 SD")); + choices.insert(p_t(25611, "Tokina AF 730 II 75-300mm f/4.5-5.6")); + choices.insert(p_t(25621, "Minolta AF 50mm f/1.4")); + choices.insert(p_t(25631, "Minolta AF 300mm f/2.8 G")); + choices.insert(p_t(25631, "Sigma AF 50-500mm f/4-6.3 EX DG APO")); + choices.insert(p_t(25631, "Sigma AF 170-500mm f/5-6.3 APO Aspherical")); + choices.insert(p_t(25631, "Sigma AF 500mm f/4.5 EX DG APO")); + choices.insert(p_t(25631, "Sigma 400mm f/5.6 APO")); + choices.insert(p_t(25641, "Minolta AF 50mm f/2.8 Macro")); + choices.insert(p_t(25641, "Sigma AF 50mm f/2.8 Macro")); + choices.insert(p_t(25651, "Minolta AF 600mm f/4")); + choices.insert(p_t(25661, "Minolta AF 24mm f/2.8")); + choices.insert(p_t(25721, "Minolta/Sony AF 500mm f/8 Reflex")); + choices.insert(p_t(25781, "Minolta AF 16mm f/2.8 Fisheye")); + choices.insert(p_t(25781, "Sigma 8mm f/4 EX DG Fisheye")); + choices.insert(p_t(25781, "Sigma 14mm f/3.5")); + choices.insert(p_t(25781, "Sigma 15mm f/2.8 Fisheye")); + choices.insert(p_t(25791, "Minolta AF 20mm f/2.8")); + choices.insert(p_t(25811, "Minolta/Sony AF 100mm f/2.8 Macro New")); + choices.insert(p_t(25811, "Sigma AF 90mm f/2.8 Macro")); + choices.insert(p_t(25811, "Sigma AF 105mm f/2.8 EX DG Macro")); + choices.insert(p_t(25811, "Sigma 180mm f/5.6 Macro")); + choices.insert(p_t(25811, "Tamron 90mm f/2.8 Macro")); + choices.insert(p_t(25851, "Beroflex 35-135mm f/3.5-4.5")); + choices.insert(p_t(25858, "Minolta AF 35-105mm f/3.5-4.5 New")); + choices.insert(p_t(25858, "Tamron 24-135mm f/3.5-5.6")); + choices.insert(p_t(25881, "Minolta AF 70-210mm f/3.5-4.5")); + choices.insert(p_t(25891, "Minolta AF 80-200 f/2.8 APO")); + choices.insert(p_t(25891, "Tokina 80-200mm f/2.8")); + choices.insert(p_t(25911, "Minolta AF 35mm f/1.4")); + choices.insert(p_t(25921, "Minolta AF 85mm f/1.4 G (D)")); + choices.insert(p_t(25931, "Minolta AF 200mm f/2.8 G APO")); + choices.insert(p_t(25941, "Minolta AF 3x-1x f/1.7-2.8 Macro")); + choices.insert(p_t(25961, "Minolta AF 28mm f/2")); + choices.insert(p_t(25971, "Minolta AF 35mm f/2")); + choices.insert(p_t(25981, "Minolta AF 100mm f/2")); + choices.insert(p_t(26041, "Minolta AF 80-200mm f/4.5-5.6")); + choices.insert(p_t(26051, "Minolta AF 35-80mm f/4-5.6")); + choices.insert(p_t(26061, "Minolta AF 100-300mm f/4.5-5.6 (D)")); + choices.insert(p_t(26071, "Minolta AF 35-80mm f/4-5.6")); + choices.insert(p_t(26081, "Minolta AF 300mm f/2.8 HS-APO G")); + choices.insert(p_t(26091, "Minolta AF 600mm f/4 HS-APO G")); + choices.insert(p_t(26121, "Minolta AF 200mm f/2.8 HS-APO G")); + choices.insert(p_t(26131, "Minolta AF 50mm f/1.7 New")); + choices.insert(p_t(26151, "Minolta AF 28-105mm f/3.5-4.5 Power Zoom")); + choices.insert(p_t(26161, "Minolta AF 35-200mm f/4.5-5.6 Power Zoom")); + choices.insert(p_t(26181, "Minolta AF 28-80mm f/4-5.6 Power Zoom")); + choices.insert(p_t(26191, "Minolta AF 80-200mm f/4.5-5.6 Power Zoom")); + choices.insert(p_t(26201, "Minolta AF 28-70mm f/2.8 G")); + choices.insert(p_t(26211, "Minolta AF 100-300mm f/4.5-5.6 Power Zoom")); + choices.insert(p_t(26241, "Minolta AF 35-80mm f/4-5.6 Power Zoom")); + choices.insert(p_t(26281, "Minolta AF 80-200mm f/2.8 G")); + choices.insert(p_t(26291, "Minolta AF 85mm f/1.4 New")); + choices.insert(p_t(26311, "Minolta/Sony AF 100-300mm f/4.5-5.6 APO")); + choices.insert(p_t(26321, "Minolta AF 24-50mm f/4 New")); + choices.insert(p_t(26381, "Minolta AF 50mm f/2.8 Macro New")); + choices.insert(p_t(26391, "Minolta AF 100mm f/2.8 Macro")); + choices.insert(p_t(26411, "Minolta AF 20mm f/2.8 New")); + choices.insert(p_t(26421, "Minolta AF 24mm f/2.8 New")); + choices.insert(p_t(26441, "Minolta AF 100-400mm f/4.5-6.7 APO")); + choices.insert(p_t(26621, "Minolta AF 50mm f/1.4 New")); + choices.insert(p_t(26671, "Minolta AF 35mm f/2 New")); + choices.insert(p_t(26681, "Minolta AF 28mm f/2 New")); + choices.insert(p_t(26721, "Minolta AF 24-105mm f/3.5-4.5 (D)")); + choices.insert(p_t(45671, "Tokina 70-210mm f/4-5.6")); + choices.insert(p_t(45741, "Minolta AF 200mm f/2.8 G x2")); + choices.insert(p_t(45851, "Tamron SP AF 300mm f/2.8 LD IF")); + choices.insert(p_t(45871, "Tamron SP AF 70-210mm f/2.8 LD")); + choices.insert(p_t(65535, "Arax MC 35mm f/2.8 Tilt+Shift")); + choices.insert(p_t(65535, "Arax MC 80mm f/2.8 Tilt+Shift")); + choices.insert(p_t(65535, "Zenitar MF 16mm f/2.8 Fisheye M42")); + choices.insert(p_t(65535, "Samyang 500mm f/8 Mirror")); + choices.insert(p_t(65535, "Pentacon Auto 135mm f/2.8")); + choices.insert(p_t(65535, "Pentacon Auto 29mm f/2.8")); + choices.insert(p_t(65535, "Helios 44-2 58mm f/2")); } + + + virtual std::string toString (Tag* t) + { + int lensID = t->toInt(); + size_t nFound = choices.count( lensID ); + container_t::iterator r; + switch( nFound ) + { + case 0: // lens Unknown + t->toString (buffer); + return std::string (buffer); + case 1: // lens found + r = choices.find ( lensID ); + return r->second; + default: + // More than one hit: we must guess + break; + } + + double maxApertureAtFocal = pow(2.0, t->getParent()->getParent()->getTag(0x9205)->toDouble()/2.0); // MaxApertureValue at focal Length + double focalLength = t->getParent()->getParent()->getTag(0x920A)->toDouble(); // Focal Length + double deltaMin = 1000.; + + /* Choose the best match: thanks to exiftool by Phil Harvey + * first throws for "out of focal range" and lower or upper aperture of the lens compared to MaxApertureAtFocal + * if the lens is not constant aperture, calculate aprox. aperture of the lens at focalLength + * and compare with actual aperture. + */ + std::string bestMatch("Unknown"); + std::ostringstream candidates; + for ( r = choices.lower_bound( lensID ); r != choices.upper_bound(lensID); r++ ){ + double a1,a2,f1,f2,lensAperture,dif; + + if( !extractLensInfo( r->second ,f1,f2,a1,a2) ) + continue; + if( f1 == 0. || a1 == 0.) + continue; + + if( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) + continue; + if( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 +0.15) + continue; + + if( a1 == a2 || f1 == f2) + lensAperture = a1; + else + lensAperture = exp( log(a1)+(log(a2)-log(a1))/(log(f2)-log(f1))*(log(focalLength)-log(f1)) ); + + dif = ABS(lensAperture - maxApertureAtFocal); + if( dif < deltaMin ){ + deltaMin = dif; + bestMatch = r->second; + } + if( dif < 0.15){ + if( candidates.tellp() ) + candidates << "\n or " << r->second; + else + candidates << r->second; + } + } + if( !candidates.tellp() ) + return bestMatch; + else + return candidates.str(); + } }; SALensIDInterpreter saLensIDInterpreter; diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index 8545a9166..6bbb5736b 100755 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -25,10 +25,9 @@ set (BASESOURCEFILES batchqueuebuttonset.cc browserfilter.cc exiffiltersettings.cc profilestore.cc partialpastedlg.cc) -# NOTE: this may be merged too if (WIN32) set (EXTRA_SRC windirmonitor.cc myicon.o) - include_directories (/usr/local/lib ../rtengine ${CMAKE_CURRENT_BINARY_DIR} . ../rtexif ${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} + include_directories ( ../rtengine ${CMAKE_CURRENT_BINARY_DIR} . ../rtexif ${EXTRA_INCDIR} ${GLIB2_INCLUDE_DIRS} ${GLIBMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${GIOMM_INCLUDE_DIRS}) link_directories (. ../rtexif ${EXTRA_LIBDIR} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} ${GTK_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${GIO_LIBRARY_DIRS} ${GIOMM_LIBRARY_DIRS}) diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 477821c7f..8151076ee 100755 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -20,6 +20,7 @@ #include #include #include +#include extern Glib::ustring argv0; @@ -115,14 +116,14 @@ void Adjuster::resetPressed () { double Adjuster::shapeValue (double a) { - return round(a*pow(10, digits)) / pow(10, digits); + return round(a*pow(double(10), digits)) / pow(double(10), digits); } void Adjuster::setLimits (double vmin, double vmax, double vstep, double vdefault) { sliderChange.block (true); spinChange.block (true); - for (digits=0; fabs(vstep*pow(10,digits)-floor(vstep*pow(10,digits)))>0.000000000001; digits++); + for (digits=0; fabs(vstep*pow(double(10),digits)-floor(vstep*pow(double(10),digits)))>0.000000000001; digits++); spin->set_digits (digits); spin->set_increments (vstep, 2.0*vstep); spin->set_range (vmin, vmax); diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index 2e968a47d..32c5f666a 100755 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -29,10 +29,10 @@ class BatchQueueListener { public: - virtual void queueSizeChanged (int qsize) {} - virtual void imageProcessingReady (Glib::ustring fname) {} - virtual void queueEmpty () {} - virtual bool canStartNext () {} + virtual void queueSizeChanged (int qsize) =0; + virtual void imageProcessingReady (Glib::ustring fname) =0; + virtual void queueEmpty () =0; + virtual bool canStartNext () =0; }; class FileCatalog; diff --git a/rtgui/batchqueuebuttonset b/rtgui/batchqueuebuttonset deleted file mode 100755 index ad92e1370..000000000 --- a/rtgui/batchqueuebuttonset +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _THUMBNAILBUTTONSET_ -#define _THUMBNAILBUTTONSET_ - -#include -#include -#include - -class ThumbBrowserEntry; -class ThumbnailButtonSet : public LWButtonSet { - - static bool iconsLoaded; - - public: - static Glib::RefPtr rankIcon; - static Glib::RefPtr gRankIcon; - static Glib::RefPtr unRankIcon; - static Glib::RefPtr trashIcon; - static Glib::RefPtr unTrashIcon; - static Glib::RefPtr processIcon; - - ThumbnailButtonSet (ThumbBrowserEntry* myEntry); - void setRank (int stars); - void setInTrash (bool inTrash); - -}; - -#endif diff --git a/rtgui/config.h b/rtgui/config.h deleted file mode 100644 index 1f7636241..000000000 --- a/rtgui/config.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2010 Lukas Jirkovsky - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ - -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#define DATA_SEARCH_PATH "/home/gabor/RawTherapee/test/share/rawtherapee" - -#endif diff --git a/rtgui/cropguilistener.h b/rtgui/cropguilistener.h index ca8574072..75248b9a8 100755 --- a/rtgui/cropguilistener.h +++ b/rtgui/cropguilistener.h @@ -22,15 +22,15 @@ class CropGUIListener { public: - virtual void cropMoved (int &x, int &y, int &w, int &h) {} - virtual void cropWidth1Resized (int &x, int &y, int &w, int &h) {} - virtual void cropWidth2Resized (int &x, int &y, int &w, int &h) {} - virtual void cropHeight1Resized (int &x, int &y, int &w, int &h) {} - virtual void cropHeight2Resized (int &x, int &y, int &w, int &h) {} - virtual void cropInit (int &x, int &y, int &w, int &h) {} - virtual void cropResized (int &x, int &y, int& x2, int& y2) {} - virtual void cropManipReady () {} - virtual double getRatio () {} + virtual void cropMoved (int &x, int &y, int &w, int &h) =0; + virtual void cropWidth1Resized (int &x, int &y, int &w, int &h) =0; + virtual void cropWidth2Resized (int &x, int &y, int &w, int &h) =0; + virtual void cropHeight1Resized (int &x, int &y, int &w, int &h) =0; + virtual void cropHeight2Resized (int &x, int &y, int &w, int &h) =0; + virtual void cropInit (int &x, int &y, int &w, int &h) =0; + virtual void cropResized (int &x, int &y, int& x2, int& y2) =0; + virtual void cropManipReady () =0; + virtual double getRatio () =0; }; #endif diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index ec56b9fdb..9e26c40a6 100755 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -17,6 +17,7 @@ * along with RawTherapee. If not, see . */ #include +#undef THREAD_PRIORITY_NORMAL using namespace rtengine; diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 871108485..37f90003b 100755 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -853,7 +853,7 @@ void CropWindow::drawDecoration (Cairo::RefPtr cr) { void CropWindow::drawStraightenGuide (Cairo::RefPtr cr) { if (action_x!=press_x || action_y!=press_y) { - double arg = (press_x-action_x) / sqrt((press_x-action_x)*(press_x-action_x)+(press_y-action_y)*(press_y-action_y)); + double arg = (press_x-action_x) / sqrt(double((press_x-action_x)*(press_x-action_x)+(press_y-action_y)*(press_y-action_y))); double sol1, sol2; double pi = M_PI; if (press_y>action_y) { diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 88201852f..7b955c00b 100755 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -472,7 +472,7 @@ void FileBrowserEntry::draw () { void FileBrowserEntry::drawStraightenGuide (Cairo::RefPtr cr) { if (action_x!=press_x || action_y!=press_y) { - double arg = (press_x-action_x) / sqrt((press_x-action_x)*(press_x-action_x)+(press_y-action_y)*(press_y-action_y)); + double arg = (press_x-action_x) / sqrt(double((press_x-action_x)*(press_x-action_x)+(press_y-action_y)*(press_y-action_y))); double sol1, sol2; double pi = M_PI; if (press_y>action_y) { diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 4b50cebd8..83c62395a 100755 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -119,6 +119,13 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb) : listener(NULL), fslist categoryButtons[i+2] = bRank[i]; categoryButtons[7] = bTrash; + exifInfo = Gtk::manage(new Gtk::ToggleButton ()); + exifInfo->set_image (*(new Gtk::Image (argv0+"/images/info.png"))); + exifInfo->set_relief (Gtk::RELIEF_NONE); + exifInfo->set_active( options.showFileNames ); + exifInfo->signal_toggled().connect(sigc::mem_fun(*this, &FileCatalog::exifInfoButtonToggled)); + buttonBar->pack_start (*exifInfo, Gtk::PACK_SHRINK); + // thumbnail zoom Gtk::HBox* zoomBox = new Gtk::HBox (); zoomInButton = new Gtk::Button (); @@ -170,6 +177,12 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb) : listener(NULL), fslist #endif } +void FileCatalog::exifInfoButtonToggled() +{ + options.showFileNames = exifInfo->get_active(); + fileBrowser->refreshThumbImages (); +} + void FileCatalog::on_realize() { Gtk::VBox::on_realize(); diff --git a/rtgui/filecatalog.h b/rtgui/filecatalog.h index fde5489d2..4e08ac32e 100755 --- a/rtgui/filecatalog.h +++ b/rtgui/filecatalog.h @@ -96,6 +96,7 @@ class FileCatalog : public Gtk::VBox, Gtk::ToggleButton* bRank[5]; Gtk::ToggleButton* bTrash; Gtk::ToggleButton* categoryButtons[8]; + Gtk::ToggleButton* exifInfo; sigc::connection bCateg[8]; Gtk::Image* iranked[5], *igranked[5]; @@ -171,7 +172,7 @@ class FileCatalog : public Gtk::VBox, void setFileSelectionChangeListener (FileSelectionChangeListener* l) { fslistener = l; } void setImageAreaToolListener (ImageAreaToolListener* l) { iatlistener = l; } void setFilterPanel (FilterPanel* fpanel); - + void exifInfoButtonToggled(); void categoryButtonToggled (Gtk::ToggleButton* b); void filterChanged (); void runFilterDialog (); diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index d7c7aba2d..5771a0575 100755 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -177,6 +177,7 @@ bool FilePanel::addBatchQueueJob (BatchQueueEntry* bqe) { if (parent) parent->addBatchQueueJob (bqe); + return true; } void FilePanel::optionsChanged () { diff --git a/rtgui/fileselectionlistener.h b/rtgui/fileselectionlistener.h index 57930c16d..97c92c4cd 100755 --- a/rtgui/fileselectionlistener.h +++ b/rtgui/fileselectionlistener.h @@ -25,8 +25,8 @@ class FileSelectionListener { public: - virtual bool fileSelected (Thumbnail* thm) {} - virtual bool addBatchQueueJob (BatchQueueEntry* bqe) {} + virtual bool fileSelected (Thumbnail* thm) =0; + virtual bool addBatchQueueJob (BatchQueueEntry* bqe) =0; }; #endif diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 4f22b571a..899fbb4c1 100755 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -460,6 +460,7 @@ bool HistogramArea::on_button_press_event (GdkEventButton* event) { renderHistogram (); queue_draw (); } + return true; } diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index 4542b1806..1de440231 100755 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -44,7 +44,7 @@ void LWButtonSet::getMinimalDimensions (int& w, int& h) { } } -int LWButtonSet::arrangeButtons (int x, int y, int w, int h) { +void LWButtonSet::arrangeButtons (int x, int y, int w, int h) { int mw, mh; getMinimalDimensions (mw, mh); diff --git a/rtgui/lwbuttonset.h b/rtgui/lwbuttonset.h index 4e7be5dcb..b8ea55fad 100755 --- a/rtgui/lwbuttonset.h +++ b/rtgui/lwbuttonset.h @@ -36,7 +36,7 @@ class LWButtonSet { void getMinimalDimensions (int& w, int& h); void getAllocatedDimensions (int& w, int& h); - int arrangeButtons (int x, int y, int w, int h); + void arrangeButtons (int x, int y, int w, int h); void setColors (const Gdk::Color& bg, const Gdk::Color& fg); bool motionNotify (int x, int y); bool pressNotify (int x, int y); diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index 6fcd5808b..9460be070 100755 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -17,8 +17,8 @@ * along with RawTherapee. If not, see . */ #include -#include -#include +#include +#include #define RADIUS 3 /* radius of the control points */ #define MIN_DISTANCE 8 /* min distance between control points */ diff --git a/rtgui/options.cc b/rtgui/options.cc index eac3c77a9..001d5369a 100755 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -112,6 +112,7 @@ void Options::setDefaults () { thumbnailZoomRatios.push_back (0.8); thumbnailZoomRatios.push_back (1.0); overlayedFileNames = true; + showFileNames = true; int babehav[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0}; baBehav = std::vector (babehav, babehav+ADDSET_PARAM_NUM); @@ -130,6 +131,7 @@ void Options::setDefaults () { Options* Options::copyFrom (Options* other) { *this = *other; + return this; } int Options::readFromFile (Glib::ustring fname) { @@ -218,6 +220,7 @@ if (keyFile.has_group ("File Browser")) { if (keyFile.has_key ("File Browser", "RenameUseTemplates")) renameUseTemplates = keyFile.get_boolean ("File Browser", "RenameUseTemplates"); if (keyFile.has_key ("File Browser", "ThumbnailZoomRatios"))thumbnailZoomRatios= keyFile.get_double_list ("File Browser", "ThumbnailZoomRatios"); if (keyFile.has_key ("File Browser", "OverlayedFileNames")) overlayedFileNames = keyFile.get_boolean ("File Browser", "OverlayedFileNames"); + if (keyFile.has_key ("File Browser", "ShowFileNames")) showFileNames = keyFile.get_boolean ("File Browser", "ShowFileNames"); } if (keyFile.has_group ("Clipping Indication")) { @@ -323,6 +326,7 @@ int Options::saveToFile (Glib::ustring fname) { Glib::ArrayHandle ptzoom = thumbnailZoomRatios; keyFile.set_double_list ("File Browser", "ThumbnailZoomRatios", ptzoom); keyFile.set_boolean ("File Browser", "OverlayedFileNames", overlayedFileNames); + keyFile.set_boolean ("File Browser", "ShowFileNames", showFileNames ); keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); diff --git a/rtgui/options.h b/rtgui/options.h index 0dffa164b..27c236b85 100755 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -119,6 +119,7 @@ class Options { std::vector thumbnailZoomRatios; bool overlayedFileNames; + bool showFileNames; Options (); diff --git a/rtgui/progressdialog.h b/rtgui/progressdialog.h index 4539ee357..48076194d 100755 --- a/rtgui/progressdialog.h +++ b/rtgui/progressdialog.h @@ -23,6 +23,8 @@ #include #include +#undef THREAD_PRIORITY_NORMAL + class PLDBridge : public rtengine::ProgressListener { Gtk::Dialog* dialog; diff --git a/rtgui/recentbrowser.cc.old b/rtgui/recentbrowser.cc.old deleted file mode 100755 index 42ab1c19b..000000000 --- a/rtgui/recentbrowser.cc.old +++ /dev/null @@ -1,59 +0,0 @@ -#include - -RecentBrowser::RecentBrowser () : listener (NULL) { - - scrollw = Gtk::manage (new Gtk::ScrolledWindow ()); - scrollw->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - - Gtk::Frame* frame = Gtk::manage (new Gtk::Frame ("Recent Folders")); - frame->add (*scrollw); - - pack_start (*frame); - - treeView = Gtk::manage (new Gtk::TreeView ()); - scrollw->add (*treeView); - - recentModel = Gtk::ListStore::create (recentColumns); - treeView->set_model (recentModel); - treeView->set_headers_visible (false); - - Gtk::CellRendererText *crt = Gtk::manage (new Gtk::CellRendererText()); - Gtk::TreeView::Column *col = Gtk::manage (new Gtk::TreeView::Column ("")); - col->pack_start (*crt, true); - col->add_attribute (crt->property_text (), recentColumns.dir); - col->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED); - crt->set_property ("xalign", 1.0); - - treeView->append_column (*col); - treeView->set_tooltip_column (0); - - treeView->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &RecentBrowser::selectionChanged)); - - show_all (); -} - -void RecentBrowser::selectionChanged () { - - Glib::RefPtr selection = treeView->get_selection(); - Gtk::TreeModel::iterator iter = selection->get_selected(); - if (iter && listener) - listener->selectDir (iter->get_value (recentColumns.dir)); -} - -void RecentBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile) { - - // check if the dirname is already in the list. If yes, remove it. - Gtk::TreeModel::iterator iter = recentModel->children ().begin(); - while (iter != recentModel->children().end()) { - if (iter->get_value (recentColumns.dir) == dirname) { - recentModel->erase (iter); - break; - } - iter++; - } - - // append dirname to the top of the list - iter = recentModel->prepend (); - iter->set_value (recentColumns.dir, dirname); -} - diff --git a/rtgui/recentbrowser.h.old b/rtgui/recentbrowser.h.old deleted file mode 100755 index f797ec13f..000000000 --- a/rtgui/recentbrowser.h.old +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _RECENTBROWSER_ -#define _RECENTBROWSER_ - -#include -#include -#include - -class RecentBrowser : public Gtk::VBox, public DirSelectionListener { - - class RecentColumns : public Gtk::TreeModel::ColumnRecord { - public: - Gtk::TreeModelColumn dir; - RecentColumns() { add(dir); } - }; - RecentColumns recentColumns; - Gtk::ScrolledWindow* scrollw; - Gtk::TreeView* treeView; - Glib::RefPtr recentModel; - DirBrowserRemoteInterface* listener; - - public: - - RecentBrowser (); - - void setDirBrowserRemoteInterface (DirBrowserRemoteInterface* l) { listener = l; } - - void selectionChanged (); - void dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile=""); -}; - -#endif - - diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 2f9f0da72..8643b876d 100755 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -36,8 +36,7 @@ RTWindow::RTWindow () { set_title("Raw Therapee "+versionString); property_allow_shrink() = true; - set_size_request (options.windowWidth, options.windowHeight); -// maximize (); + set_default_size(options.windowWidth, options.windowHeight); set_modal(false); set_resizable(true); property_destroy_with_parent().set_value(false); diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 4bf43c556..0dd697641 100755 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -483,8 +483,11 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) { } void ThumbBrowserBase::refreshThumbImages () { - for (int i=0; iresize (previewHeight); // TODO!!! Might be performance bottleneck fd[i]->refreshThumbnailImage (); + } redraw (); } diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index efc1eea2a..80ae72299 100755 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -106,7 +106,7 @@ class ThumbBrowserBase : public Gtk::VBox { virtual bool checkFilter (ThumbBrowserEntryBase* entry) { return true; } virtual void rightClicked (ThumbBrowserEntryBase* entry) {} virtual void doubleClicked (ThumbBrowserEntryBase* entry) {} - virtual bool keyPressed (GdkEventKey* event) {} + virtual bool keyPressed (GdkEventKey* event) {return true;} virtual void selectionChanged () {} virtual void redrawNeeded (ThumbBrowserEntryBase* entry) {} diff --git a/rtgui/thumbbrowserbase_old.cc b/rtgui/thumbbrowserbase_old.cc deleted file mode 100755 index 58e755897..000000000 --- a/rtgui/thumbbrowserbase_old.cc +++ /dev/null @@ -1,360 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#include -#include -#include -#include - -ThumbBrowserBase::ThumbBrowserBase () - : previewHeight(options.thumbSize), lastClicked(NULL) { - - signal_style_changed().connect( sigc::mem_fun(*this, &ThumbBrowserBase::styleChanged) ); -} - -void ThumbBrowserBase::arrangeFiles () { - - int N = fd.size (); - // apply filter - for (int i=0; ifiltered = !checkFilter (fd[i]); - - int rowHeight = 0; - // compute size of the items - for (int i=0; ifiltered && fd[i]->getMinimalHeight() > rowHeight) - rowHeight = fd[i]->getMinimalHeight (); - - if (arrangement==TB_Horizontal) { - - int numOfRows = 1; - if (get_parent () && rowHeight>0) { - Gtk::Allocation alloc = get_parent ()->get_allocation (); - numOfRows = (alloc.get_height()+rowHeight/2)/rowHeight; - if (numOfRows<1) - numOfRows = 1; - } - - int ct = 0; - int currx = 0; int curry = 0; - while (ctgetMinimalWidth() > maxw) - maxw = fd[ct+i]->getMinimalWidth (); - - // arrange items in the column - curry = 0; - for (int i=0; ctfiltered) - fd[ct++]->drawable = false; - if (ctsetPosition (currx, curry, maxw, rowHeight); - fd[ct]->drawable = true; - curry += rowHeight; - } - } - currx += maxw; - } - set_size_request (currx, numOfRows*rowHeight); - } - else { - int availWidth = 0; - if (get_parent ()) { - Gtk::Allocation alloc = get_parent ()->get_allocation (); - availWidth = alloc.get_width(); - } - - // initial number of columns - int numOfCols = 0; - int currColNum = 0; - int colsWidth = 0; - for (int i=0; ifiltered && colsWidth + fd[i]->getMinimalWidth() <= availWidth) { - colsWidth += fd[numOfCols]->getMinimalWidth (); - numOfCols++; - } - if (numOfCols<1) - numOfCols = 1; - std::vector colWidths; - for (; numOfCols>0; numOfCols--) { - // compute column widths - colWidths.resize (numOfCols); - for (int i=0; ifiltered && fd[i]->getMinimalWidth() > colWidths[j%numOfCols]) - colWidths[j%numOfCols] = fd[i]->getMinimalWidth (); - if (!fd[i]->filtered) - j++; - } - // if not wider than the space available, arrange it and we are ready - colsWidth = 0; - for (int i=0; ifiltered) - fd[ct++]->drawable = false; - if (ctsetPosition (currx, curry, colWidths[i%numOfCols], rowHeight); - fd[ct]->drawable = true; - currx += colWidths[i%numOfCols]; - } - } - curry += rowHeight; - } - set_size_request (colsWidth, curry); - } -} - - -void ThumbBrowserBase::on_realize() -{ - Cairo::FontOptions cfo; - cfo.set_antialias (Cairo::ANTIALIAS_SUBPIXEL); - get_pango_context()->set_cairo_font_options (cfo); - - add_events(Gdk::LEAVE_NOTIFY_MASK); - Gtk::DrawingArea::on_realize(); - Glib::RefPtr window = get_window(); - add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK); - - gc_ = Gdk::GC::create(window); -} - -void ThumbBrowserBase::styleChanged (const Glib::RefPtr& style) { - - refreshAll (); -} - -bool ThumbBrowserBase::on_expose_event(GdkEventExpose* event) { - - Gtk::Viewport* vp = (Gtk::Viewport*) get_parent (); - Gtk::ScrolledWindow* sw = (Gtk::ScrolledWindow*) vp->get_parent (); - - int px = (int)(sw->get_hscrollbar()->get_value ()); - int py = (int)(sw->get_vscrollbar()->get_value ()); - int pw = vp->get_width (); - int ph = vp->get_height (); - Glib::RefPtr window = get_window(); - - window->clear(); - // draw thumbnails - Glib::RefPtr context = get_pango_context (); - context->set_font_description (get_style()->get_font()); - for (int i=0; idrawable || !fd[i]->insideWindow (px, py, pw, ph)) - continue; - fd[i]->draw (this); - } - return true; -} - -bool ThumbBrowserBase::on_button_press_event (GdkEventButton* event) { - - Gtk::Viewport* vp = (Gtk::Viewport*) get_parent (); - Gtk::ScrolledWindow* sw = (Gtk::ScrolledWindow*) vp->get_parent (); - - int px = (int)(sw->get_hscrollbar()->get_value ()); - int py = (int)(sw->get_vscrollbar()->get_value ()); - int pw = vp->get_width (); - int ph = vp->get_height (); - - ThumbBrowserEntryBase* fileDescr = NULL; - bool handled = false; - for (int i=0; idrawable && fd[i]->insideWindow (px, py, pw, ph)) { - if (fd[i]->inside ((int)event->x, (int)event->y)) - fileDescr = fd[i]; - bool b = fd[i]->pressNotify (this, (int)event->x, (int)event->y); - handled = handled || b; - } - if (handled || (fileDescr && fileDescr->processing)) - return true; - - if (selected.size()==1 && event->type==GDK_2BUTTON_PRESS && event->button==1) - doubleClicked (selected[0]); - else if (event->button==1 && event->type==GDK_BUTTON_PRESS) { - if (fileDescr && event->state & GDK_SHIFT_MASK) { - if (selected.size()==0) { - selected.push_back (fileDescr); - fileDescr->selected = true; - lastClicked = fileDescr; - } - else { - // find the start and the end of the selection interval - int startx = fd.size()-1; - if (lastClicked) { - for (; startx>=0; startx--) - if (fd[startx]==lastClicked) - break; - } - else { - for (; startx>=0; startx--) - if (fd[startx]==selected[0]) - break; - } - int endx = 0; - for (; endxselected = false; - selected.clear (); - // select thumbnails in the interval - for (int i=startx; i<=endx; i++) { - fd[i]->selected = true; - selected.push_back (fd[i]); - } - } - } - else if (fileDescr && event->state & GDK_CONTROL_MASK) { - std::vector::iterator i = std::find (selected.begin(), selected.end(), fileDescr); - if (i!=selected.end()) { - (*i)->selected = false; - selected.erase (i); - } - else { - selected.push_back (fileDescr); - fileDescr->selected = true; - } - lastClicked = fileDescr; - } - else { - for (int i=0; iselected = false; - selected.clear (); - if (fileDescr) { - selected.push_back (fileDescr); - fileDescr->selected = true; - } - lastClicked = fileDescr; - } - } - else if (fileDescr && event->button==3 && event->type==GDK_BUTTON_PRESS) { - if (!fileDescr->selected) { - for (int i=0; iselected = false; - selected.clear (); - fileDescr->selected = true; - selected.push_back (fileDescr); - lastClicked = fileDescr; - } - rightClicked (fileDescr); - } - Glib::RefPtr window = get_window(); - - GdkRectangle rect; - rect.x = 0; - rect.y = 0; - window->get_size (rect.width, rect.height); - - gdk_window_invalidate_rect (window->gobj(), &rect, true); - gdk_window_process_updates (window->gobj(), true); - - return true; -} - -bool ThumbBrowserBase::on_button_release_event (GdkEventButton* event) { - - Gtk::Viewport* vp = (Gtk::Viewport*) get_parent (); - Gtk::ScrolledWindow* sw = (Gtk::ScrolledWindow*) vp->get_parent (); - - int px = (int)(sw->get_hscrollbar()->get_value ()); - int py = (int)(sw->get_vscrollbar()->get_value ()); - int pw = vp->get_width (); - int ph = vp->get_height (); - - for (int i=0; idrawable && fd[i]->insideWindow (px, py, pw, ph)) - fd[i]->releaseNotify (this, (int)event->x, (int)event->y); - return true; -} - -bool ThumbBrowserBase::on_motion_notify_event (GdkEventMotion* event) { - - Gtk::Viewport* vp = (Gtk::Viewport*) get_parent (); - Gtk::ScrolledWindow* sw = (Gtk::ScrolledWindow*) vp->get_parent (); - - int px = (int)(sw->get_hscrollbar()->get_value ()); - int py = (int)(sw->get_vscrollbar()->get_value ()); - int pw = vp->get_width (); - int ph = vp->get_height (); - - for (int i=0; idrawable && fd[i]->insideWindow (px, py, pw, ph)) - fd[i]->motionNotify (this, (int)event->x, (int)event->y); - return true; -} - -void ThumbBrowserBase::resized (Gtk::Allocation& req) { - arrangeFiles (); -} - -void ThumbBrowserBase::redraw () { - - arrangeFiles (); - queue_draw (); -} - -void ThumbBrowserBase::setPreviewHeight (int h) { - - previewHeight = h; - for (int i=0; iinitSizes (this, previewHeight); - arrangeFiles (); -} - -void ThumbBrowserBase::refreshAll () { - - for (int i=0; iforceHeight (options.thumbSize); - fd[i]->updateImg (); - fd[i]->initSizes (this, options.thumbSize); - } - redraw (); -} - -void ThumbBrowserBase::setOpenedFileName (const Glib::ustring& fname) { - - fileInEditor = fname; - for (int i=0; iframed = fd[i]->filename==fileInEditor; -} - -void ThumbBrowserBase::setArrangement (Arrangement a) { - - arrangement = a; - redraw (); -} diff --git a/rtgui/thumbbrowserbase_old.h b/rtgui/thumbbrowserbase_old.h deleted file mode 100755 index d594be85d..000000000 --- a/rtgui/thumbbrowserbase_old.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#ifndef _THUMBNAILBROWSERBASE_ -#define _THUMBNAILBROWSERBASE_ - -#include -#include - -class ThumbBrowserBase : public Gtk::DrawingArea { - - public: - - enum Arrangement {TB_Horizontal, TB_Vertical}; - - protected: - - Glib::RefPtr gc_; - - std::vector fd; - std::vector selected; - ThumbBrowserEntryBase* lastClicked; - - int previewHeight; - - Glib::ustring fileInEditor; - Arrangement arrangement; - - void arrangeFiles (); - - public: - - ThumbBrowserBase (); - - void setPreviewHeight (int h); - const std::vector& getEntries () { return fd; } - void styleChanged (const Glib::RefPtr& style); - void redraw (); // arrange files and draw area - void refreshAll (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw - void resized (Gtk::Allocation& req); - void setOpenedFileName (const Glib::ustring& fname); - - virtual void on_realize(); - virtual bool on_expose_event(GdkEventExpose* event); - virtual bool on_button_press_event (GdkEventButton* event); - virtual bool on_button_release_event (GdkEventButton* event); - virtual bool on_motion_notify_event (GdkEventMotion* event); - - void setArrangement (Arrangement a); - virtual bool checkFilter (ThumbBrowserEntryBase* entry) { return true; } - virtual void rightClicked (ThumbBrowserEntryBase* entry) {} - virtual void doubleClicked (ThumbBrowserEntryBase* entry) {} - -}; - -#endif diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index 0bb377c21..3ee3feae9 100755 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -112,7 +112,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () { int istartx = prex; int istarty = prey; - if (options.overlayedFileNames) { + if (options.showFileNames && options.overlayedFileNames) { cr->begin_new_path (); cr->rectangle (istartx, istarty, prew, fnlabh+dtlabh+exlabh+2*iofs_y); if ((texts.get_red_p()+texts.get_green_p()+texts.get_blue_p())/3 > 0.5) @@ -146,62 +146,64 @@ void ThumbBrowserEntryBase::updateBackBuffer () { } } - int textposx_fn, textposx_ex, textposx_dt, textposy, textw; - if (!options.overlayedFileNames) { - textposx_fn = exp_width/2 - fnlabw/2; - if (textposx_fn<0) textposx_fn = 0; - textposx_ex = exp_width/2 - exlabw/2; - if (textposx_ex<0) textposx_ex = 0; - textposx_dt = exp_width/2 - dtlabw/2; - if (textposx_dt<0) textposx_dt = 0; - textposy = upperMargin + bsHeight + 2*borderWidth + preh + borderWidth + textGap; - textw = exp_width - 2*textGap; - gc_->set_foreground (selected ? texts : textn); - } - else { - textposx_fn = istartx; - textposx_ex = istartx; - textposx_dt = istartx; - textposy = istarty; - textw = prew - (istartx - prex); - gc_->set_foreground (texts); - } + if( options.showFileNames ){ + int textposx_fn, textposx_ex, textposx_dt, textposy, textw; + if (!options.overlayedFileNames) { + textposx_fn = exp_width/2 - fnlabw/2; + if (textposx_fn<0) textposx_fn = 0; + textposx_ex = exp_width/2 - exlabw/2; + if (textposx_ex<0) textposx_ex = 0; + textposx_dt = exp_width/2 - dtlabw/2; + if (textposx_dt<0) textposx_dt = 0; + textposy = upperMargin + bsHeight + 2*borderWidth + preh + borderWidth + textGap; + textw = exp_width - 2*textGap; + gc_->set_foreground (selected ? texts : textn); + } + else { + textposx_fn = istartx; + textposx_ex = istartx; + textposx_dt = istartx; + textposy = istarty; + textw = prew - (istartx - prex); + gc_->set_foreground (texts); + } - // draw file name - Glib::RefPtr context = w->get_pango_context () ; - Pango::FontDescription fontd = context->get_font_description (); - fontd.set_weight (Pango::WEIGHT_BOLD); - if (italicstyle) - fontd.set_style (Pango::STYLE_ITALIC); - else - fontd.set_style (Pango::STYLE_NORMAL); + // draw file name + Glib::RefPtr context = w->get_pango_context () ; + Pango::FontDescription fontd = context->get_font_description (); + fontd.set_weight (Pango::WEIGHT_BOLD); + if (italicstyle) + fontd.set_style (Pango::STYLE_ITALIC); + else + fontd.set_style (Pango::STYLE_NORMAL); - context->set_font_description (fontd); - Glib::RefPtr fn = w->create_pango_layout (dispname); - fn->set_width (textw*Pango::SCALE); - fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); - backBuffer->draw_layout(gc_, textposx_fn, textposy, fn); - - fontd.set_weight (Pango::WEIGHT_NORMAL); - fontd.set_style (Pango::STYLE_NORMAL); - context->set_font_description (fontd); + context->set_font_description (fontd); + Glib::RefPtr fn = w->create_pango_layout (dispname); + fn->set_width (textw*Pango::SCALE); + fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); + backBuffer->draw_layout(gc_, textposx_fn, textposy, fn); - // draw date/time label - int tpos = fnlabh; - if (options.fbShowDateTime && datetimeline!="") { - fn = w->create_pango_layout (datetimeline); - fn->set_width (textw*Pango::SCALE); - fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); - backBuffer->draw_layout(gc_, textposx_dt, textposy + tpos, fn); - tpos += dtlabh; - } - // draw basic exif info - if (options.fbShowBasicExif && exifline!="") { - fn = w->create_pango_layout (exifline); - fn->set_width (textw*Pango::SCALE); - fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); - backBuffer->draw_layout (gc_, textposx_ex, textposy + tpos, fn); - tpos += exlabh; + fontd.set_weight (Pango::WEIGHT_NORMAL); + fontd.set_style (Pango::STYLE_NORMAL); + context->set_font_description (fontd); + + // draw date/time label + int tpos = fnlabh; + if (options.fbShowDateTime && datetimeline!="") { + fn = w->create_pango_layout (datetimeline); + fn->set_width (textw*Pango::SCALE); + fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); + backBuffer->draw_layout(gc_, textposx_dt, textposy + tpos, fn); + tpos += dtlabh; + } + // draw basic exif info + if (options.fbShowBasicExif && exifline!="") { + fn = w->create_pango_layout (exifline); + fn->set_width (textw*Pango::SCALE); + fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); + backBuffer->draw_layout (gc_, textposx_ex, textposy + tpos, fn); + tpos += exlabh; + } } } @@ -265,7 +267,7 @@ void ThumbBrowserEntryBase::resize (int h) { // calculate the height remaining for the thumbnail image preh = height - upperMargin - 2*borderWidth - lowerMargin - bsh; int infow, infoh; - if (!options.overlayedFileNames) { + if (options.showFileNames && !options.overlayedFileNames) { // dimensions of the info text getTextSizes (infow, infoh); preh -= infoh + textGap; @@ -273,7 +275,7 @@ void ThumbBrowserEntryBase::resize (int h) { calcThumbnailSize (); width = prew + 2*sideMargin + 2*borderWidth; - if (!options.overlayedFileNames) { + if (options.showFileNames && !options.overlayedFileNames) { width = prew + 2*sideMargin + 2*borderWidth; if (width - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -extern "C" { -#include -extern jmp_buf jpeg_jmp_buf; -extern GLOBAL(struct jpeg_error_mgr *) -my_jpeg_std_error (struct jpeg_error_mgr * err); -extern GLOBAL(void) -my_jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile); -} -#include -#include - -using namespace rtengine::procparams; -using namespace rtengine; - -Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheFileStruct* cf, int fpos) - : cachemgr(cm), cfs(cf), tImgData(NULL), tw(-1), th(-1), pparamsValid(false), filePos(fpos), fname(fname), - lastImg(NULL), ref(1), enqueueNumber(0), tpp(NULL), needsReProcessing(true) { - - mutex = new Glib::Mutex (); - - loadProcParams (); - if (options.liveThumbnails!=cfs->thumbProcessed) { - cfs->thumbProcessed = options.liveThumbnails; - generateThumbnailImage (false); - } - if (!tImgData || !tpp) - loadThumbnail (options.thumbCacheMemPolicy==MP_Memory); -} - -Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5, CacheFileStruct* cf, int fpos) - : cachemgr(cm), cfs(cf), pparamsValid(false), filePos(fpos), lastImg(NULL), tImgData(NULL), fname(fname), - ref(1), enqueueNumber(0), tpp(NULL), needsReProcessing(true) { - - mutex = new Glib::Mutex (); - - memcpy (cfs->MD5, md5.c_str(), 32); - cfs->ppformat = 0; - cfs->preinterp = 0; - cfs->accessed = -1; - cfs->rank = 0; - cfs->stage = 0; - cfs->thumbnail = FT_Invalid; - cfs->recentlySaved = false; - cfs->thumbProcessed = options.liveThumbnails; - - generateThumbnailImage (false); -} - -void Thumbnail::generateThumbnailImage (bool useLock) { - - mutex->lock (); - - if (cfs->thumbProcessed) - generateProcessedThumbnailImage (useLock); - else - generatePreviewThumbnailImage (useLock); - - mutex->unlock (); -} - -void Thumbnail::generatePreviewThumbnailImage (bool useLock) { - -// delete everything loaded into memory - delete tpp; - tpp = NULL; - delete [] lastImg; - lastImg = NULL; - tw = -1; - th = options.maxThumbnailHeight; - delete [] tImgData; - tImgData = NULL; - -// generate thumbnail image - int lastdot = fname.find_last_of ('.'); - if (lastdot==Glib::ustring::npos) - return; - - cfs->thumbnail = (int) options.thumbnailFormat; - Glib::ustring ext = fname.substr (lastdot); - cfs->supported = false; - cfs->exifValid = 0; - cfs->timeValid = 0; - if (ext.lowercase()==".jpg") { - // try to load it as jpeg - int thumbW, thumbH; - int res = loadJPEGThumbnail (0, tImgData, tw, th); - if (!res) { - cfs->format = (int) FT_Jpeg; - infoFromImage (fname); - cfs->supported = true; - } - else { - // try to let it load by dcraw - rtengine::RawMetaDataLocation ri; - res = getRawFileBasicInfo (fname, ri, cfs->rotate, thumbW, thumbH, cfs->thumbOffset, cfs->thumbImgType); - if (!res) { - cfs->format = (int) FT_Raw; - infoFromImage (fname, &ri); - cfs->supported = true; - if (cfs->thumbImgType == 1) - loadJPEGThumbnail (cfs->thumbOffset, tImgData, tw, th, cfs->rotate); - else if (cfs->thumbImgType == 2) - loadPPMThumbnail (cfs->thumbOffset, thumbW, thumbH, tImgData, tw, th, cfs->rotate); - else { - cfs->thumbnail = (int) FT_None; - tw = th * thumbW / thumbH; - } - - } - } - } - else if (ext.lowercase()==".tif" || ext.lowercase()==".tiff") { - // try to detect it as raw file first - int thumbW, thumbH; - rtengine::RawMetaDataLocation ri; - if (!getRawFileBasicInfo (fname, ri, cfs->rotate, thumbW, thumbH, cfs->thumbOffset, cfs->thumbImgType)) { - cfs->format = (int) FT_Raw; - infoFromImage (fname, &ri); - cfs->supported = true; - if (cfs->thumbImgType == 1) - loadJPEGThumbnail (cfs->thumbOffset, tImgData, tw, th, cfs->rotate); - else if (cfs->thumbImgType == 2) - loadPPMThumbnail (cfs->thumbOffset, thumbW, thumbH, tImgData, tw, th, cfs->rotate); - else { - cfs->thumbnail = (int) FT_None; - tw = th * thumbW / thumbH; - } - } - else if (!loadTIFFThumbnail (tImgData, tw, th)) { - cfs->format = (int) FT_Tiff; - infoFromImage (fname); - cfs->supported = true; - } - } - else if (ext.lowercase()==".png") { - int res = loadPNGThumbnail (tImgData, tw, th); - if (!res) { - cfs->format = (int) FT_Png; - cfs->supported = true; - } - } - else { - int thumbW, thumbH; - rtengine::RawMetaDataLocation ri; - if (!getRawFileBasicInfo (fname, ri, cfs->rotate, thumbW, thumbH, cfs->thumbOffset, cfs->thumbImgType)) { - cfs->format = (int) FT_Raw; - infoFromImage (fname, &ri); - cfs->supported = true; - if (cfs->thumbImgType == 1) - loadJPEGThumbnail (cfs->thumbOffset, tImgData, tw, th, cfs->rotate); - else if (cfs->thumbImgType == 2) - loadPPMThumbnail (cfs->thumbOffset, thumbW, thumbH, tImgData, tw, th, cfs->rotate); - else { - cfs->thumbnail = (int) FT_None; - tw = th * thumbW / thumbH; - } - } - } - - cfs->thumbProcessed = 0; -// save thumbnail image to cache - if (cfs->supported) { - saveThumbnail (); - if (options.thumbCacheMemPolicy==MP_Memory) { - delete [] tImgData; - tImgData = NULL; - } - } - updateCache (true, true, useLock); -} - -void Thumbnail::generateProcessedThumbnailImage (bool useLock) { - -// delete everything loaded into memory - delete tpp; - tpp = NULL; - delete [] lastImg; - lastImg = NULL; - tw = -1; - th = options.maxThumbnailHeight; - delete [] tImgData; - tImgData = NULL; - -// generate thumbnail image - int lastdot = fname.find_last_of ('.'); - if (lastdot==Glib::ustring::npos) - return; - - cfs->thumbnail = (int) options.thumbnailFormat; - Glib::ustring ext = fname.substr (lastdot); - cfs->supported = false; - cfs->exifValid = 0; - cfs->timeValid = 0; - - delete tpp; - tpp = NULL; - if (ext.lowercase()==".jpg" || ext.lowercase()==".tif" || ext.lowercase()==".tiff" || ext.lowercase()==".png") - tpp = ThumbnailProcessingParameters::loadFromImage (fname, tw, th, 1); - - if (tpp) { - if (ext.lowercase()==".jpg") { - cfs->format = (int) FT_Jpeg; - infoFromImage (fname); - } - else if (ext.lowercase()==".tif" || ext.lowercase()==".tiff") { - cfs->format = (int) FT_Tiff; - infoFromImage (fname); - } - else if (ext.lowercase()==".png") - cfs->format = (int) FT_Png; - } - else { - rtengine::RawMetaDataLocation ri; - tpp = ThumbnailProcessingParameters::loadFromRaw (fname, ri, tw, th, 1); - if (tpp) { - cfs->format = (int) FT_Raw; - infoFromImage (fname, &ri); - } - } - if (tpp) { - cfs->supported = true; - cfs->camwbRed = tpp->camwbRed; - cfs->camwbGreen = tpp->camwbGreen; - cfs->camwbBlue = tpp->camwbBlue; - cfs->autowbTemp = tpp->autowbTemp; - cfs->autowbGreen = tpp->autowbGreen; - cfs->aeHistCompression = tpp->aeHistCompression; - cfs->embProfileLength = tpp->embProfileLength; - cfs->redMultiplier = tpp->redMultiplier; - cfs->greenMultiplier = tpp->greenMultiplier; - cfs->blueMultiplier = tpp->blueMultiplier; - cfs->scale = tpp->scale; - cfs->defGain = tpp->defGain; - cfs->scaleForSave = tpp->scaleForSave; - cfs->gammaCorrected = tpp->gammaCorrected; - memcpy (cfs->colorMatrix, tpp->colorMatrix, sizeof (cfs->colorMatrix)); -/* IImage8* res = tpp->processImage (getProcParams ()); - tw = res->getWidth (); - th = res->getHeight (); - tImgData = new unsigned char [tw*th*3]; - memcpy (tImgData, res->getData (), tw*th*3); - res->free ();*/ - } - - cfs->thumbProcessed = 1; -// save thumbnail image to cache - if (cfs->supported) { - saveThumbnail (); - if (options.thumbCacheMemPolicy==MP_Memory) { - delete tpp; - tpp = NULL; -// delete [] tImgData; -// tImgData = NULL; - } - } - - updateCache (true, true, useLock); - needsReProcessing = true; -} - -bool Thumbnail::isSupported () { - - return cfs->supported; -} - -const ProcParams& Thumbnail::getProcParams () { - - if (pparamsValid) - return pparams; - else { - rtengine::procparams::ProcParams* pp = profileStore.getDefaultProcParams (getType()==FT_Raw); - if (pp) - return *pp; - } - return pparams; // there is no valid pp to return, but we have to return something -} - -void Thumbnail::loadProcParams () { - - pparamsValid = false; - if (options.paramsLoadLocation==PLL_Input) { - // try to load it from pp2 file next to the image file - int ppres = pparams.load (removeExtension(fname) + ".pp2"); - pparamsValid = !ppres && pparams.version>=220; - // if no success, load it from the cache - if (!pparamsValid) - pparamsValid = !pparams.load (getCacheFileName ("profiles")+".pp2"); - } - else { - // try to load it from cache - pparamsValid = !pparams.load (getCacheFileName ("profiles")+".pp2"); - // if no success, load it from pp2 file next to the image file - if (!pparamsValid) { - int ppres = pparams.load (removeExtension(fname) + ".pp2"); - pparamsValid = !ppres && pparams.version>=220; - } - } -} - -void Thumbnail::clearProcParams () { - - cfs->recentlySaved = false; - cfs->ppformat = 0; - pparamsValid = false; - needsReProcessing = true; - // remove pp2 file from cache - Glib::ustring fname_ = getCacheFileName ("profiles")+".pp2"; - if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS)) - ::g_remove (fname_.c_str()); - // remove pp2 file located next to the file - fname_ = removeExtension(fname) + ".pp2"; - if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS)) - ::g_remove (fname_.c_str()); -} - -bool Thumbnail::hasProcParams () { - - return pparamsValid; -} - -void Thumbnail::setProcParams (const ProcParams& pp, bool updateCacheNow) { - - if (pparams!=pp) - cfs->recentlySaved = false; - - pparams = pp; - pparamsValid = true; - needsReProcessing = true; - if (updateCacheNow) - pparams.save (getCacheFileName ("profiles")+".pp2"); -} - -bool Thumbnail::isRecentlySaved () { - - return cfs->recentlySaved; -} - -void Thumbnail::imageDeveloped () { - - cfs->recentlySaved = true; - updateCache (false, false); -} - -void Thumbnail::imageEnqueued () { - - enqueueNumber++; -} - -void Thumbnail::imageRemovedFromQueue () { - - enqueueNumber--; -} - -bool Thumbnail::isEnqueued () { - - return enqueueNumber > 0; -} - -void Thumbnail::increaseRef () { ref++; } -void Thumbnail::decreaseRef () { ref--; if (!ref) cachemgr->closeThumbnail (this); } - -void Thumbnail::getThumbnailSize (int &w, int &h, int fixwh) { // fixwh = 0: fix w and calculate h, =1: fix h and calculate w - - mutex->lock (); - - if (fixwh==1) - w = tw * h / th; - else if (fixwh==0) - h = th * w / tw; - - mutex->unlock (); -} - -unsigned char* Thumbnail::getThumbnailImage (int &w, int &h, int fixwh) { // fixwh = 0: fix w and calculate h, =1: fix h and calculate w - - getThumbnailSize (w, h, fixwh); - - mutex->lock (); - - // if the result of last query fits the needs, we just have to return it - if (lastImg && lastW==w && lastH==h && !(cfs->thumbProcessed && needsReProcessing)) { - mutex->unlock (); - return lastImg; - } - else - delete [] lastImg; - - if (!cfs->thumbProcessed) { - // if thumbnail not loaed yet, load it - if (!tImgData) { - loadThumbnail (); - if (!tImgData) { - if (fixwh==1) - w = tw * h / th; - else if (fixwh==0) - h = th * w / tw; - mutex->unlock (); - return NULL; - } - } - lastW = w; - lastH = h; - lastImg = new unsigned char [lastW*lastH*3]; - thumbInterp (tImgData, tw, th, lastImg, w, h); - } - else { - if (!tpp) - loadThumbnail (); - IImage8* res = tpp->processImage (getProcParams (), h, TI_Bilinear); - lastW = w = res->getWidth (); - lastH = h = res->getHeight (); - lastImg = new unsigned char [lastW*lastH*3]; - memcpy (lastImg, res->getData(), lastW*lastH*3); - res->free (); - needsReProcessing = false; - } - - // if we have to spare with memory, delete full res thumb image from memory - if (options.thumbCacheMemPolicy==MP_Memory) { - delete [] tImgData; - delete tpp; - tpp = NULL; - tImgData = NULL; - } - - mutex->unlock (); - return lastImg; -} - -Glib::ustring Thumbnail::getExifString () { - - if (!cfs->exifValid) - return ""; - - std::ostringstream s; - s << "f/" << ImageData::apertureToString(cfs->fnumber) << " "; - s << ImageData::shutterToString(cfs->shutter) << "s "; - s << "ISO" << cfs->iso; - - return s.str(); -} - -Glib::ustring Thumbnail::getDateTimeString () { - - if (!cfs->timeValid) - return ""; - std::string dateFormat = options.dateFormat; - std::ostringstream ostr; - bool spec = false; - for (int i=0; iyear; - spec = false; - } - else if (spec && dateFormat[i]=='m') { - ostr << (int)cfs->month; - spec = false; - } - else if (spec && dateFormat[i]=='d') { - ostr << (int)cfs->day; - spec = false; - } - else if (dateFormat[i]=='%') - spec = true; - else { - ostr << (char)dateFormat[i]; - spec = false; - } - ostr << " " << (int)cfs->hour << ":" << (int)cfs->min << ":" << (int)cfs->sec; - return ostr.str (); -} - -ThFileType Thumbnail::getType () { - - return (ThFileType) cfs->format; -} - -void Thumbnail::infoFromImage (const Glib::ustring& fname, rtengine::RawMetaDataLocation* rml) { - - ImageMetaData* idata = ImageMetaData::fromFile (fname, rml); - if (!idata) - return; - cfs->timeValid = false; - cfs->exifValid = false; - if (idata->hasExif()) { - cfs->shutter = idata->getShutterSpeed (); - cfs->fnumber = idata->getFNumber (); - cfs->focalLen = idata->getFocalLen (); - cfs->iso = idata->getISOSpeed (); - cfs->year = 1900 + idata->getDateTime().tm_year; - cfs->month = idata->getDateTime().tm_mon + 1; - cfs->day = idata->getDateTime().tm_mday; - cfs->hour = idata->getDateTime().tm_hour; - cfs->min = idata->getDateTime().tm_min; - cfs->sec = idata->getDateTime().tm_sec; - cfs->timeValid = true; - cfs->exifValid = true; - cfs->lens = idata->getLens(); - cfs->camera = idata->getMake() + " " + idata->getModel(); - } - delete idata; -} - -void Thumbnail::loadThumbnail (bool sizeOnly) { - - mutex->lock (); - - delete tImgData; - delete tpp; - tImgData = NULL; - tpp = NULL; - needsReProcessing = true; - - if (cfs->thumbnail == FT_None) - return; - - unsigned char* data = NULL; - Glib::ustring fname = getCacheFileName ("images"); - int imgType = 0; - if (Glib::file_test (fname+".cust", Glib::FILE_TEST_EXISTS)) - imgType = 1; - else if (Glib::file_test (fname+".jpg", Glib::FILE_TEST_EXISTS)) - imgType = 2; - - - FILE* f = g_fopen (fname.c_str(), "rb"); - if (!f || !imgType) { - if (f) - fclose(f); - mutex->unlock (); - generateThumbnailImage (); - if (cfs->supported) - loadThumbnail (sizeOnly); - else - return; - } - else if (imgType==1) { - fread (&tw, 1, sizeof (int), f); - fread (&th, 1, sizeof (int), f); - if (!sizeOnly) { - data = new unsigned char [tw*th*3]; - fread (data, tw*th, 3, f); - } - fclose (f); - } - else if (imgType==2) { - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - if (!setjmp(jpeg_jmp_buf)) { - cinfo.err = my_jpeg_std_error (&jerr); - jpeg_create_decompress (&cinfo); - my_jpeg_stdio_src (&cinfo,f); - jpeg_read_header (&cinfo, TRUE); - tw = cinfo.image_width; - th = cinfo.image_height; - if (!sizeOnly) { - cinfo.dct_method = JDCT_FASTEST; - cinfo.do_fancy_upsampling = 1; - jpeg_start_decompress(&cinfo); - data = new unsigned char [tw*th*3]; - while (cinfo.output_scanline < cinfo.output_height) { - unsigned char* row = data + cinfo.output_scanline*tw*3; - jpeg_read_scanlines (&cinfo, &row, 1); - } - jpeg_finish_decompress (&cinfo); - } - jpeg_destroy_decompress (&cinfo); - fclose (f); - } - else { - fclose (f); - mutex->unlock (); - return; - } - } - if (!cfs->thumbProcessed) { - tImgData = data; - } - else if (!sizeOnly) { - tpp = new ThumbnailProcessingParameters (); - tpp->data = data; - tpp->width = tw; - tpp->height = th; - tpp->camwbRed = cfs->camwbRed; - tpp->camwbGreen = cfs->camwbGreen; - tpp->camwbBlue = cfs->camwbBlue; - tpp->autowbTemp = cfs->autowbTemp; - tpp->autowbGreen = cfs->autowbGreen; - tpp->aeHistCompression = cfs->aeHistCompression; - FILE* f = fopen (getCacheFileName ("aehistograms").c_str(), "rb"); - if (!f) - tpp->aeHistogram = NULL; - else { - tpp->aeHistogram = new int[65536>>tpp->aeHistCompression]; - fread (tpp->aeHistogram, 1, (65536>>tpp->aeHistCompression)*sizeof(int), f); - fclose (f); - } - tpp->embProfileLength = cfs->embProfileLength; - Glib::ustring pfName = getCacheFileName ("embprofiles")+".icc"; - f = fopen (pfName.c_str(), "rb"); - if (!f) { - tpp->embProfileData = NULL; - tpp->embProfile = NULL; - } - else { - tpp->embProfileData = new unsigned char[tpp->embProfileLength]; - fread (tpp->embProfileData, 1, tpp->embProfileLength, f); - fclose (f); - tpp->embProfile = cmsOpenProfileFromMem (tpp->embProfileData, tpp->embProfileLength); - } - tpp->redMultiplier = cfs->redMultiplier; - tpp->greenMultiplier = cfs->greenMultiplier; - tpp->blueMultiplier = cfs->blueMultiplier; - tpp->scale = cfs->scale; - tpp->defGain = cfs->defGain; - tpp->scaleForSave = cfs->scaleForSave; - tpp->gammaCorrected = cfs->gammaCorrected; - tpp->isRaw = (cfs->format == (int) FT_Raw); - memcpy (tpp->colorMatrix, cfs->colorMatrix, sizeof (tpp->colorMatrix)); - tpp->init (); - } - mutex->unlock (); -} - -void Thumbnail::saveThumbnail () { - - if (!tImgData && !tpp) - return; - - unsigned char* data = tImgData; - int w = tw, h = th; - - if (cfs->thumbProcessed && tpp) { - data = tpp->data; - w = tpp->width; - h = tpp->height; - } - - if (data) { - if (cfs->thumbnail == FT_Custom) { - Glib::ustring fname = getCacheFileName ("images")+".cust"; - FILE* f = g_fopen (fname.c_str(), "wb"); - if (!f) - return; - fwrite (&w, 1, sizeof (int), f); - fwrite (&h, 1, sizeof (int), f); - fwrite (data, w*h, 3, f); - fclose (f); - } - else if (cfs->thumbnail == FT_Jpeg) { - Glib::ustring fname = getCacheFileName ("images")+".jpg"; - FILE* f = g_fopen (fname.c_str(), "wb"); - if (!f) - return; - jpeg_compress_struct cinfo; - jpeg_error_mgr jerr; - cinfo.err = jpeg_std_error (&jerr); - jpeg_create_compress (&cinfo); - jpeg_stdio_dest (&cinfo, f); - cinfo.image_width = w; - cinfo.image_height = h; - cinfo.in_color_space = JCS_RGB; - cinfo.input_components = 3; - jpeg_set_defaults (&cinfo); - cinfo.write_JFIF_header = FALSE; - jpeg_set_quality (&cinfo, 85, true); - jpeg_start_compress(&cinfo, TRUE); - int rowlen = w*3; - while (cinfo.next_scanline < cinfo.image_height) { - unsigned char* row = data + cinfo.next_scanline*w*3; - if (jpeg_write_scanlines (&cinfo, &row, 1) < 1) { - jpeg_finish_compress (&cinfo); - jpeg_destroy_compress (&cinfo); - fclose (f); - return; - } - } - jpeg_finish_compress (&cinfo); - jpeg_destroy_compress (&cinfo); - fclose (f); - } - } - - if (tpp) { - // save aehistogram - if (tpp->aeHistogram) { - FILE* f = fopen (getCacheFileName ("aehistograms").c_str(), "wb"); - if (f) { - fwrite (tpp->aeHistogram, 1, (65536>>tpp->aeHistCompression)*sizeof(int), f); - fclose (f); - } - } - // save embedded profile - if (tpp->embProfileLength) { - Glib::ustring pfName = getCacheFileName ("embprofiles")+".icc"; - FILE* f = fopen (pfName.c_str(), "wb"); - if (f) { - fwrite (tpp->embProfileData, 1, tpp->embProfileLength, f); - fclose (f); - } - } - } -} - -void Thumbnail::updateCache (bool savePparams, bool saveThumbImg, bool useLock) { - - if (filePos>=0) { - - if (pparamsValid) - cfs->ppformat = 1; - else - cfs->ppformat = 0; - - if (pparamsValid && savePparams) { - if (options.saveParamsCache) - pparams.save (getCacheFileName ("profiles")); - if (options.saveParamsFile) - pparams.save (removeExtension(fname) + ".pp2"); - } - - cachemgr->saveThumbnail (this, useLock); - } -} - -Thumbnail::~Thumbnail () { - - delete [] lastImg; - delete [] tImgData; -} - -Glib::ustring Thumbnail::getCacheFileName (Glib::ustring subdir) { - - Glib::ustring cfn = cachemgr->getBaseDir() + "/" + subdir + "/"; - for (int i=0; i<32; i++) - cfn += cfs->MD5[i]; - return cfn; -} - -int Thumbnail::loadJPEGThumbnail (int offset, unsigned char* &data, int &width, int &height, int degree, int fixwh) { - - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - - data = NULL; - - FILE* f = g_fopen (fname.c_str(), "rb"); - - if (!f) - return 2; - fseek (f, offset, SEEK_SET); - - if (!setjmp(jpeg_jmp_buf)) { - - cinfo.err = my_jpeg_std_error (&jerr); - jpeg_create_decompress (&cinfo); - my_jpeg_stdio_src (&cinfo,f); - jpeg_read_header (&cinfo, TRUE); - cinfo.dct_method = JDCT_FASTEST; - cinfo.scale_num = 1; - - if (fixwh==1) { - if (degree==0 || degree==180) - width = height * cinfo.image_width / cinfo.image_height; - else - width = height * cinfo.image_height / cinfo.image_width; - } - else { - if (degree==0 || degree==180) - height = width * cinfo.image_height / cinfo.image_width; - else - height = width * cinfo.image_width / cinfo.image_height; - } - - if (cinfo.image_width > 8*width && cinfo.image_height > 8*height ) - cinfo.scale_denom = 8; - else if (cinfo.image_width > 4*width && cinfo.image_height > 4*height ) - cinfo.scale_denom = 4; - else if (cinfo.image_width > 2*width && cinfo.image_height > 2*height ) - cinfo.scale_denom = 2; - else - cinfo.scale_denom = 1; - - cinfo.do_fancy_upsampling = 1; - jpeg_start_decompress(&cinfo); - unsigned char* fullData = new unsigned char [3*cinfo.output_height*cinfo.output_width]; - unsigned char* row = fullData; - for (int i=0; iio_ptr); - if (check != length) - png_error(png_ptr, "Read Error"); -} - -int Thumbnail::loadPNGThumbnail (unsigned char* &data, int &width, int &height, int fixwh) { - - - data = NULL; - - FILE *file=g_fopen(fname.c_str(),"rb"); - if (!file) return 2; - - //reading PNG header - unsigned char header[8]; - fread(header,1,8,file); - if (!png_check_sig(header,8)) { - fclose(file); - return 3; - } - //initializing main structures - png_structp png= png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); - if (!png) { - fclose(file); - return 4; - } - png_infop info= png_create_info_struct(png); - png_infop end_info = png_create_info_struct(png); - if (!end_info || !info) { - png_destroy_read_struct(&png,&info,&end_info); - fclose(file); - return 5; - } - - if (setjmp(png_jmpbuf(png))) { - png_destroy_read_struct(&png,&info,&end_info); - fclose(file); - return 3; - } - - //set up png read - png_set_read_fn(png, file, png_read_data); - png_set_sig_bytes(png,8); - - png_read_info(png,info); - - //retrieving image information - unsigned long fwidth, fheight; - int bit_depth,color_type,interlace_type,compression_type,filter_method; - png_get_IHDR(png,info,&fwidth,&fheight,&bit_depth,&color_type,&interlace_type, - &compression_type, &filter_method); - - //converting to 32bpp format - if (color_type==PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png); - - if (color_type==PNG_COLOR_TYPE_GRAY || color_type==PNG_COLOR_TYPE_GRAY_ALPHA) - png_set_gray_to_rgb(png); - - if (png_get_valid(png,info,PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png); - - if (interlace_type!=PNG_INTERLACE_NONE) { - fclose (file); - return 6; - } - - if (color_type & PNG_COLOR_MASK_ALPHA) - png_set_strip_alpha(png); - - if (bit_depth==16) - png_set_strip_16(png); - - //setting gamma - double gamma; - if (png_get_gAMA(png,info,&gamma)) - png_set_gamma(png, 2.0, gamma); - else - png_set_gamma(png, 1.0, 1.0); - - //updating png info struct - png_read_update_info(png,info); - png_get_IHDR(png,info,&fwidth,&fheight,&bit_depth,&color_type,&interlace_type, - &compression_type, &filter_method); - - if (color_type & PNG_COLOR_MASK_ALPHA) - png_set_strip_alpha(png); - if (bit_depth==16) - png_set_strip_16(png); - - png_read_update_info(png,info); - png_get_IHDR(png,info,&fwidth,&fheight,&bit_depth,&color_type,&interlace_type, - &compression_type, &filter_method); - - png_timep time; - cfs->timeValid = png_get_tIME (png, info, &time); - cfs->exifValid = 0; - cfs->year = time->year; - cfs->month = time->month; - cfs->day = time->day; - cfs->hour = time->hour; - cfs->min = time->minute; - cfs->sec = time->second; - - if (fixwh==1) - width = height * fwidth / fheight; - else - height = width * fheight / fwidth; - - unsigned char* fullData = new unsigned char [3*fheight*fwidth]; - unsigned char* row = fullData; - for (int i=0; i> 8; - } - TIFFClose(in); - delete [] linebuffer; - } - else if (bitspersample == 8) { - for (int i=0; i - * - * RawTherapee 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. - * - * RawTherapee 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 RawTherapee. If not, see . - */ -#ifndef _THUMBNAIL_ -#define _THUMBNAIL_ - -#include -#include -#include -#include -#include -#include - -class CacheManager; -class Thumbnail { - - Glib::Mutex* mutex; - - Glib::ustring fname; // file name corresponding to the thumbnail - CacheImageData* cfs; // cache entry corresponding to the thumbnail - CacheManager* cachemgr; // parent - int ref; // variable for reference counting - int enqueueNumber; // the number of instances in the batch queue corresponding to this thumbnail - - // if the thumbnail is in non-processed mode, these fields hold the thumbnail image: - unsigned char* tImgData; - int tw, th; // dimensions of timgdata (it stores tpp->width and tpp->height in processed mode for simplicity) - - // if the thumbnail is in processed mode, this class holds its data: - rtengine::ThumbnailProcessingParameters* tpp; - - rtengine::procparams::ProcParams pparams; - bool pparamsValid; - bool pparamsSet; - bool needsReProcessing; - - // these are the data of the result image of the last getthumbnailimage call (for caching purposes) - unsigned char* lastImg; - int lastW; - int lastH; - - void infoFromImage (const Glib::ustring& fname, rtengine::RawMetaDataLocation* rml=NULL); - void loadThumbnail (bool sizeOnly=false); - void saveThumbnail (); - void generateProcessedThumbnailImage (bool useLock=true); - void generatePreviewThumbnailImage (bool useLock=true); - - - Glib::ustring getCacheFileName (Glib::ustring subdir); - - public: - Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf); - Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5); - ~Thumbnail (); - - bool hasProcParams (); - const rtengine::procparams::ProcParams& getProcParams (); - void setProcParams (const rtengine::procparams::ProcParams& pp, bool updateCacheNow=true); - void clearProcParams (); - void loadProcParams (); - - bool isRecentlySaved (); - void imageDeveloped (); - void imageEnqueued (); - void imageRemovedFromQueue (); - bool isEnqueued (); - - unsigned char* getThumbnailImage (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w - void getThumbnailSize (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w - void generateThumbnailImage (bool useLock=true); - - Glib::ustring getExifString (); - Glib::ustring getDateTimeString (); - - ThFileType getType (); - Glib::ustring getFileName () { return fname; } - void setFileName (const Glib::ustring fn) { fname = fn; } - - bool isSupported (); - - void saveToCache (FILE* f, bool full); - - void setFilePos (int fp) { filePos = fp; } - int getFilePos () { return filePos; } - - int getRank () { return cfs->rank; } - void setRank (int rank) { cfs->rank = rank; } - int getStage () { return cfs->stage; } - void setStage (int stage) { cfs->stage = stage; } - - void increaseRef (); - void decreaseRef (); - - void updateCache (bool pparams=true, bool thumbImg=true, bool useLock=true); - - const CacheFileStruct* getCacheFileStruct () const { return cfs; } - - int loadJPEGThumbnail (int offset, unsigned char* &data, int &width, int &height, int degree=0, int fixwh=1); - int loadPPMThumbnail (int offset, int iw, int ih, unsigned char* &data, int &width, int &height, int degree=0, int fixwh=1); - int loadPNGThumbnail (unsigned char* &data, int &width, int &height, int fixwh=1); - int loadTIFFThumbnail (unsigned char* &data, int &width, int &height, int fixwh=1); -}; - - -#endif - diff --git a/rtstart b/rtstart deleted file mode 100755 index 2bc895444..000000000 --- a/rtstart +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -export LD_LIBRARY_PATH=`dirname "$0"` -`dirname "$0"`/rt \ No newline at end of file diff --git a/tools/osx/Icons.icns b/tools/osx/Icons.icns new file mode 100644 index 000000000..d06b7199e Binary files /dev/null and b/tools/osx/Icons.icns differ diff --git a/tools/osx/Info.plist b/tools/osx/Info.plist new file mode 100644 index 000000000..4020ef513 --- /dev/null +++ b/tools/osx/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + start + CFBundleIconFile + Icons.icns + CFBundleIdentifier + com.rawtherapee.rawtherapee + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + RawTherapee + CFBundlePackageType + APPL + CFBundleShortVersionString + 3.0a + CFBundleSignature + APPL + CFBundleVersion + 3.0 Alpha + NSAppleScriptEnabled + NO + + diff --git a/tools/osx/make-app-bundle b/tools/osx/make-app-bundle new file mode 100755 index 000000000..388f1082f --- /dev/null +++ b/tools/osx/make-app-bundle @@ -0,0 +1,100 @@ +#!/bin/bash +# Function checkLink: +# args: $1 - file +# +# Will loop through all dynamic links for $file, and update each to be relative. +function checkLink { + #echo "checkLink called with $1 $2" + local FILE=$1 + + otool -L $FILE | grep -v "${APP}" | grep -v '/usr/lib' | grep -v '/System/' | grep -v "@executable_path" | cut -f 1 -d ' ' | while read X + do + local NAME=${LIB}/`basename "$X"` + if [ ! -f "${NAME}" ] + then + cp $X "${NAME}" + + #Recursively update the linkage of libraries + checkLink "${NAME}" + fi + done +} + +APP=RawTherapee.app +CONTENTS=${APP}/Contents +RESOURCES=${CONTENTS}/Resources +MACOS=${CONTENTS}/MacOS +BIN=${MACOS}/bin +ETC=${MACOS}/etc +LIB=${MACOS}/lib +SHARE=${MACOS}/share +RELEASE=release +DMG=${RELEASE}/RawTherapee.dmg +EXECUTABLE=rt + +#Find where MacPorts is installed. We take a known binary (cmake), which is in /bin, and +# go up a level to get the main install folder. +MACPORTS_PREFIX=`which cmake` +MACPORTS_PREFIX=`dirname $MACPORTS_PREFIX` +MACPORTS_PREFIX=`dirname $MACPORTS_PREFIX` + +if [ ! -d ${RELEASE} ]; then + echo "Please run this from the root of the project; i.e. './tools/osx/make-app-bundle'." + exit +fi + +if [ -d "${APP}" ]; then + echo "Removing old application..." + rm -rf "${APP}" +fi +if [ -f ${DMG} ]; then + echo "Removing old disk image..." + rm "${DMG}" +fi + +echo "Making application directory structure..." +mkdir -p "${RESOURCES}" +mkdir -p "${ETC}" +mkdir -p "${LIB}" +mkdir -p "${SHARE}/mime" + +#Copy over non-explicitly linked libraries +echo "Copying libraries from ${MACPORTS_PREFIX}..." +cp -R ${MACPORTS_PREFIX}/lib/pango ${LIB} +cp -R ${MACPORTS_PREFIX}/lib/gtk-2.0 ${LIB} + +#Copy over mimes (if a mime is copied, and nobody hears, is it really copied?) +echo "Copying shared files from ${MACPORTS_PREFIX}..." +cp -R ${MACPORTS_PREFIX}/share/mime/* ${SHARE}/mime + +#Copy over etc files, and modify as needed +echo "Copying configuration files from ${MACPORTS_PREFIX} and modifying for standalone app bundle..." +cp -R $MACPORTS_PREFIX/etc/gtk-2.0 ${ETC} +cp -R $MACPORTS_PREFIX/etc/pango ${ETC} +ESCAPED_MACPORTS_PREFIX=`echo ${MACPORTS_PREFIX} | sed -e 's/\\//\\\\\\//g'` +sed -i .bak -e "s/${ESCAPED_MACPORTS_PREFIX}/@executable_path/g" ${ETC}/gtk-2.0/gdk-pixbuf.loaders ${ETC}/pango/pango.modules +echo -e "[Pango]\nModuleFiles = /tmp/${EXECUTABLE}_pango.modules" > ${ETC}/pango/pangorc + + +#Copy over the release files +echo "Copying release files..." +cp -R release/* ${MACOS} + +#Copy application-specific stuff like icons and startup script +echo "Creating required application bundle files..." +cp ./tools/osx/Info.plist ${CONTENTS} +cp tools/osx/Icons.icns ${RESOURCES} +cp tools/osx/start ${MACOS} + +#Copy and relink the explicitly defined libraries +echo "Recursively copying libraries referenced by executable..." +checkLink "${MACOS}/${EXECUTABLE}" + + +#Make a .dmg for distribution and delete the .app +echo "Creating distribution .dmg..." +hdiutil create -srcdir ${APP} ${DMG} +echo "Cleaning up..." +rm -rf ${APP} + +echo "All done!" diff --git a/tools/osx/start b/tools/osx/start new file mode 100755 index 000000000..fe0024178 --- /dev/null +++ b/tools/osx/start @@ -0,0 +1,20 @@ +#!/bin/bash + +CWD=`dirname "$0"` +echo $CWD + +export DYLD_LIBRARY_PATH="${CWD}/lib:$DYLD_LIBRARY_PATH" +export GTK_DATA_PREFIX="${CWD}" +export GTK_DATA_DIRS="${CWD}" +export GTK_EXE_PREFIX="${CWD}" +export GTK_PATH="${CWD}" + +export GTK2_RC_FILES="${CWD}/etc/gtk-2.0/gtkrc" +export GTK_IM_MODULE_FILE="${CWD}/gtk-2.0/gtk.immodules" +export GDK_PIXBUF_MODULE_FILE="${CWD}/etc/gtk-2.0/gdk-pixbuf.loaders" +export PANGO_RC_FILE="${CWD}/etc/pango/pangorc" + +cp "${CWD}/etc/pango/pango.modules" /tmp/rt_pango.modules + +"${CWD}/rt" +