diff --git a/AUTHORS.txt b/AUTHORS.txt index 133bc4a10..9033f39e8 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -1,6 +1,6 @@ Project initiator: - Gabor Horvath + Gábor Horváth Developement contributors, in last name alphabetical order: diff --git a/About-Apple.cmake b/About-Apple.cmake new file mode 100644 index 000000000..c9c379c16 --- /dev/null +++ b/About-Apple.cmake @@ -0,0 +1,23 @@ +# this will generate a target that will never exist, so it will (should) be executed on each build +#WARNING: Actually, only Gcc is supported + +string (TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) + +set (OUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/AboutThisBuild.txt") +set (VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/rtgui/version.h") +set (SHELL "/bin/bash") + +add_custom_target (AboutFile ALL + COMMAND for i in \$\( hg branch \)\; do echo Branch: $i >${OUT_FILE}\; done + COMMAND hg parents --template=\"Version: {latesttag}_{latesttagdistance}\\nChangset: {node}\\n\" >>${OUT_FILE} + COMMAND for i in \$\( gcc -dumpversion \) \;do echo Compiler: GCC $i >>${OUT_FILE} \; done + COMMAND echo Processor: ${PROC_LABEL} >>${OUT_FILE} + COMMAND echo Gtkmm: V${GTKMM_VERSION} >>${OUT_FILE} + COMMAND echo Build flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} >>${OUT_FILE} + COMMAND echo Link flags: ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} >>${OUT_FILE} + COMMAND if [ \"${OPTION_OMP}\" = \"ON\" ] \; then echo OpenMP support: Yes >>${OUT_FILE} \;else echo OpenMP support: No >>${OUT_FILE} \;fi + COMMAND if [ \"${WITH_MYFILE_MMAP}\" = \"ON\" ] \; then echo MMAP support: Yes >>${OUT_FILE} \; else echo MMAP support: No >>${OUT_FILE} \;fi + COMMAND if [ \"${WITH_RAWZOR}\" = \"ON\" ] \; then echo Rawzor support: Yes >>${OUT_FILE} \;else echo Rawzor support: No >>${OUT_FILE} \;fi + COMMAND hg parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} + COMMENT "Creating the about file" +) diff --git a/About-Linux.cmake b/About-Linux.cmake new file mode 100644 index 000000000..c9c379c16 --- /dev/null +++ b/About-Linux.cmake @@ -0,0 +1,23 @@ +# this will generate a target that will never exist, so it will (should) be executed on each build +#WARNING: Actually, only Gcc is supported + +string (TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) + +set (OUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/AboutThisBuild.txt") +set (VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/rtgui/version.h") +set (SHELL "/bin/bash") + +add_custom_target (AboutFile ALL + COMMAND for i in \$\( hg branch \)\; do echo Branch: $i >${OUT_FILE}\; done + COMMAND hg parents --template=\"Version: {latesttag}_{latesttagdistance}\\nChangset: {node}\\n\" >>${OUT_FILE} + COMMAND for i in \$\( gcc -dumpversion \) \;do echo Compiler: GCC $i >>${OUT_FILE} \; done + COMMAND echo Processor: ${PROC_LABEL} >>${OUT_FILE} + COMMAND echo Gtkmm: V${GTKMM_VERSION} >>${OUT_FILE} + COMMAND echo Build flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} >>${OUT_FILE} + COMMAND echo Link flags: ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} >>${OUT_FILE} + COMMAND if [ \"${OPTION_OMP}\" = \"ON\" ] \; then echo OpenMP support: Yes >>${OUT_FILE} \;else echo OpenMP support: No >>${OUT_FILE} \;fi + COMMAND if [ \"${WITH_MYFILE_MMAP}\" = \"ON\" ] \; then echo MMAP support: Yes >>${OUT_FILE} \; else echo MMAP support: No >>${OUT_FILE} \;fi + COMMAND if [ \"${WITH_RAWZOR}\" = \"ON\" ] \; then echo Rawzor support: Yes >>${OUT_FILE} \;else echo Rawzor support: No >>${OUT_FILE} \;fi + COMMAND hg parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} + COMMENT "Creating the about file" +) diff --git a/About-Windows.cmake b/About-Windows.cmake new file mode 100644 index 000000000..6b75dfcb7 --- /dev/null +++ b/About-Windows.cmake @@ -0,0 +1,22 @@ +# this will generate a target that will never exist, so it will (should) be executed on each build +#WARNING: Actually, only Gcc is supported + +string (TOUPPER ${CMAKE_BUILD_TYPE} UPPER_CMAKE_BUILD_TYPE) + +set (OUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/AboutThisBuild.txt") +set (VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/rtgui/version.h") + +add_custom_target (AboutFile ALL + COMMAND for /F \"tokens=*\" %%i in \('hg branch'\) do echo Branch: %%i >${OUT_FILE} + COMMAND hg parents --template=\"Version: {latesttag}_{latesttagdistance}\\nChangset: {node}\\n\" >>${OUT_FILE} + COMMAND for /F \"tokens=*\" %%i in \('gcc -dumpversion'\) do echo Compiler: GCC%%i >>${OUT_FILE} + COMMAND \(echo Processor: ${PROC_LABEL}\) >>${OUT_FILE} + COMMAND \(echo Gtkmm: V${GTKMM_VERSION}\) >>${OUT_FILE} + COMMAND \(echo Build flags: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} \) >>${OUT_FILE} + COMMAND \(echo Link flags: ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${UPPER_CMAKE_BUILD_TYPE}} \) >>${OUT_FILE} + COMMAND (if ${OPTION_OMP}==ON \(echo OpenMP support: Yes\) else \(echo OpenMP support: No\)) >>${OUT_FILE} + COMMAND (if ${WITH_MYFILE_MMAP}==ON \(echo MMAP support: Yes\) else \(echo MMAP support: No\)) >>${OUT_FILE} + COMMAND (if ${WITH_RAWZOR}==ON \(echo Rawzor support: Yes\) else \(echo Rawzor support: No\)) >>${OUT_FILE} + COMMAND hg parents --template=\"// This file is automatically generated by the Makefile \; DO NOT EDIT!\\n// You can \(should\) also tell mercurial to ignore it.\\n\\n\#ifndef _VERSION_\\n\#define _VERSION_\\n\\n\#define VERSION \\"{latesttag}.{latesttagdistance}\\"\\n\#define TAGDISTANCE {latesttagdistance}\\n\\n\#endif\\n\" >${VERSION_FILE} + COMMENT "Creating the about file" +) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e5fcb9b2..a677a6692 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,34 @@ cmake_minimum_required(VERSION 2.6) +# the default target is 'Debug' set (CMAKE_BUILD_TYPE Debug CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel.") +# set the default target processor to 'native', i.e. the one of your own machine. The complete list of targets is in ProcessorTargets.cmake +# you can override the cpu list by setting PROC_TARGET_NUMBER to 0, but you have to provide at least +# the PROC_LABEL value (set to "undefined" by default) in order to provide downloadable builds, +# and evetually provide PROC_FLAGS if you want to manually set the processor specific flags +set (PROC_TARGET_NUMBER 2 CACHE STRING "Selected target processor from the list above (taken from ProcessorTargets.cmake)") + +# The following line set special compilation flags for RTEngine, and will be added to CMAKE_CXX_FLAGS +# It were moved away from rtengine/CMakefiles.txt, because some users may want to remove -ffast_math : +# this flag speeds up the floating-point operations, but with a little bite less precisions. This default value +# gives the same result/behaviour as before. +set (RTENGINE_CXX_FLAGS "-ffast-math -funroll-loops" CACHE STRING "Special compilation flags for RTEngine") + +#loading the processor targets list +set (PROC_LABEL "undefined") +set (PROC_FLAGS "") +if (PROC_TARGET_NUMBER GREATER 0) + include (ProcessorTargets.cmake) + set (PROC_LABEL ${PROC_TARGET_${PROC_TARGET_NUMBER}_LABEL}) + set (PROC_FLAGS ${PROC_TARGET_${PROC_TARGET_NUMBER}_FLAGS}) +endif (PROC_TARGET_NUMBER GREATER 0) + +# adding the proc flags to the build flags +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROC_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROC_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PROC_FLAGS}") + if (APPLE) # SET (CMAKE_OSX_ARCHITECTURES "i386;x86_64;" ) # SET (CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386;x86_64;" ) @@ -44,6 +71,30 @@ if (NOT DEFINED LIBDIR) endif (WIN32 OR APPLE) endif (NOT DEFINED LIBDIR) +if (NOT DEFINED DOCDIR) + if (WIN32 OR APPLE) + set (DOCDIR ${CMAKE_CURRENT_SOURCE_DIR}/release/doc) + else (WIN32 OR APPLE) + set (DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc) + endif (WIN32 OR APPLE) +endif (NOT DEFINED DOCDIR) + +if (NOT DEFINED CREDITSDIR) + if (WIN32 OR APPLE) + set (CREDITSDIR ${CMAKE_CURRENT_SOURCE_DIR}/release) + else (WIN32 OR APPLE) + set (CREDITSDIR ${CMAKE_INSTALL_PREFIX}/share/doc) + endif (WIN32 OR APPLE) +endif (NOT DEFINED CREDITSDIR) + +if (NOT DEFINED LICENCEDIR) + if (WIN32 OR APPLE) + set (LICENCEDIR ${CMAKE_CURRENT_SOURCE_DIR}/release) + else (WIN32 OR APPLE) + set (LICENCEDIR ${CMAKE_INSTALL_PREFIX}/share/doc) + endif (WIN32 OR APPLE) +endif (NOT DEFINED LICENCEDIR) + # check for libraries find_package(PkgConfig) pkg_check_modules (GTK REQUIRED gtk+-2.0>=2.12) @@ -82,6 +133,16 @@ else (WIN32) find_package (ZLIB REQUIRED) endif (WIN32) +#generating AboutThisBuild.txt +if (WIN32) + include (About-Windows.cmake) +elseif (APPLE) + include (About-Apple.cmake) +else (WIN32) + include (About-Linux.cmake) +endif (WIN32) +add_dependencies(AboutFile Debug Release MinSizeRel RelWithDebInfo) + # link rawzor if (WITH_RAWZOR) if (WIN32) @@ -144,7 +205,9 @@ if (UNIX) install (PROGRAMS rtstart DESTINATION ${BINDIR}) endif (UNIX) -install (FILES AUTHORS.txt LICENSE.txt DESTINATION ${BINDIR}) +install (FILES AUTHORS.txt DESTINATION ${CREDITSDIR}) +install (FILES LICENSE.txt DESTINATION ${LICENCEDIR}) +install (FILES AboutThisBuild.txt DESTINATION ${BINDIR}) add_subdirectory (rtexif) add_subdirectory (rtengine) diff --git a/LICENSE.txt b/LICENSE.txt index 94a9ed024..0d50270ac 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,26 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + RawTherapee + + +Copyright ©2004-2011 Gábor Horváth + +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 below for more details. + + + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + + Copyright ©2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -619,56 +638,3 @@ 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/ProcessorTargets.cmake b/ProcessorTargets.cmake new file mode 100644 index 000000000..4ef65a44c --- /dev/null +++ b/ProcessorTargets.cmake @@ -0,0 +1,33 @@ +# We have to create a label variable if we want to display it in AboutThisBuild.txt... + +# This first choice should be used for official releases +set(PROC_TARGET_1_LABEL "generic x86" CACHE STRING "Processor-1 label - should be used for official Windows release") +set(PROC_TARGET_1_FLAGS "-mtune=generic" CACHE STRING "Processor-1 flags") + +# This second choice should be used for your own build only +set(PROC_TARGET_2_LABEL "native" CACHE STRING "Processor-2 label - use it for your own build") +set(PROC_TARGET_2_FLAGS "-march=native" CACHE STRING "Processor-2 flags") + +# The later choices is intended to be used if you want to provide specific builds, but it should match your own processor +# You can cross compile but you have to know what you're doing, this mechanism has not been designed for that + +set(PROC_TARGET_3_LABEL "pentium/no-sse" CACHE STRING "Processor-3 label - use it to provide a pentium/no sse optimized build, if you have this processor") +set(PROC_TARGET_3_FLAGS "-march=pentium -mfpmath=387" CACHE STRING "Processor-3 flags") + +set(PROC_TARGET_4_LABEL "pentium4" CACHE STRING "Processor-4 label - use it to provide a pentium4 optimized build, if you have this processor") +set(PROC_TARGET_4_FLAGS "-march=pentium4 -mfpmath=sse" CACHE STRING "Processor-4 flags") + +set(PROC_TARGET_5_LABEL "core2" CACHE STRING "Processor-5 label - use it to provide a core2 optimized build, if you have this processor") +set(PROC_TARGET_5_FLAGS "-march=core2 -mfpmath=sse" CACHE STRING "Processor-5 flags") + +set(PROC_TARGET_6_LABEL "corei7" CACHE STRING "Processor-6 label - use it to provide a corei7 optimized build, if you have this processor") +set(PROC_TARGET_6_FLAGS "-march=corei7 -mfpmath=sse" CACHE STRING "Processor-6 flags") + +set(PROC_TARGET_7_LABEL "athlon-4" CACHE STRING "Processor-7 label - use it to provide a athlon-4 optimized build, if you have this processor") +set(PROC_TARGET_7_FLAGS "-march=athlon-4 -mfpmath=sse" CACHE STRING "Processor-7 flags") + +set(PROC_TARGET_8_LABEL "athlon64" CACHE STRING "Processor-8 label - use it to provide a athlon64 optimized build, if you have this processor") +set(PROC_TARGET_8_FLAGS "-march=pentium2 -mtune=athlon64 -mfpmath=sse" CACHE STRING "Processor-8 flags") + +#set(PROC_TARGET__LABEL "" CACHE STRING "Processor- label") +#set(PROC_TARGET__FLAGS "" CACHE STRING "Processor- flags") diff --git a/rtdata/images/splash.png b/rtdata/images/splash.png index 3eeae46c8..8b1559a72 100644 Binary files a/rtdata/images/splash.png and b/rtdata/images/splash.png differ diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 9c6d6a927..68d8921b7 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1,5 +1,9 @@ #00 Français #01 1.3.2008: Initial translation by Hombre +ABOUT_TAB_BUILD;Version +ABOUT_TAB_CREDITS;Crédits +ABOUT_TAB_LICENSE;License +ABOUT_TAB_SPLASH;Splash ADJUSTER_RESET_TO_DEFAULT;Réglages par défaut BATCHQUEUE_AUTOSTART;Démarrage auto BATCH_PROCESSING;Traitement par lot diff --git a/rtdata/languages/default b/rtdata/languages/default index a46fc3889..1e88749ca 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1,5 +1,9 @@ #00 default translation file #01 Developers should add translations to this file and then run 'generateDifferences.sh' script to update other locales. +ABOUT_TAB_BUILD;Version +ABOUT_TAB_CREDITS;Credits +ABOUT_TAB_LICENSE;License +ABOUT_TAB_SPLASH;Splash ADJUSTER_RESET_TO_DEFAULT;Reset to default BATCHQUEUE_AUTOSTART;Auto start BATCH_PROCESSING;Batch processing diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index a1862d947..8422de6d9 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -1,30 +1,30 @@ - -include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../rtexif - ${EXTRA_INCDIR} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} - ${GLIBMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/../rtgui ${GTKMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}) -link_directories (${CMAKE_CURRENT_SOURCE_DIR}/../rtexif ${EXTRA_LIBDIR} ${GTHREAD_LIBRARY_DIRS} - ${GOBJECT_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} - ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS}) - -set (RTENGINESOURCEFILES colortemp.cc curves.cc dcraw.cc iccstore.cc dfmanager.cc rawimage.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 - processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc - iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc - jpeg_memsrc.c jdatasrc.c - PF_correct_RT.cc - wavelet_dec.cc ipequalizer.cc dirpyrLab_denoise.cc dirpyrLab_equalizer.cc dirpyr_equalizer.cc) - -add_library (rtengine ${RTENGINESOURCEFILES}) -#It may be nice to store library version too -IF (BUILD_SHARED_LIBS) - install (TARGETS rtengine DESTINATION ${LIBDIR}) -ENDIF (BUILD_SHARED_LIBS) - -set_target_properties (rtengine PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -funroll-loops") - -target_link_libraries (rtengine rtexif ${EXTRA_LIB} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES} - ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES} - ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES}) + +include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../rtexif + ${EXTRA_INCDIR} ${GTHREAD_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS} + ${GLIBMM_INCLUDE_DIRS} ${IPTCDATA_INCLUDE_DIRS} ${LCMS_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/../rtgui ${GTKMM_INCLUDE_DIRS} ${GTK_INCLUDE_DIRS}) +link_directories (${CMAKE_CURRENT_SOURCE_DIR}/../rtexif ${EXTRA_LIBDIR} ${GTHREAD_LIBRARY_DIRS} + ${GOBJECT_LIBRARY_DIRS} ${GLIB2_LIBRARY_DIRS} ${GLIBMM_LIBRARY_DIRS} + ${IPTCDATA_LIBRARY_DIRS} ${LCMS_LIBRARY_DIRS}) + +set (RTENGINESOURCEFILES colortemp.cc curves.cc dcraw.cc iccstore.cc dfmanager.cc rawimage.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 + processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc + iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc + jpeg_memsrc.c jdatasrc.c + PF_correct_RT.cc + wavelet_dec.cc ipequalizer.cc dirpyrLab_denoise.cc dirpyrLab_equalizer.cc dirpyr_equalizer.cc) + +add_library (rtengine ${RTENGINESOURCEFILES}) +#It may be nice to store library version too +IF (BUILD_SHARED_LIBS) + install (TARGETS rtengine DESTINATION ${LIBDIR}) +ENDIF (BUILD_SHARED_LIBS) + +set_target_properties (rtengine PROPERTIES COMPILE_FLAGS "${RTENGINE_CXX_FLAGS}") + +target_link_libraries (rtengine rtexif ${EXTRA_LIB} ${GOBJECT_LIBRARIES} ${GTHREAD_LIBRARIES} + ${GLIB2_LIBRARIES} ${GLIBMM_LIBRARIES} ${LCMS_LIBRARIES} ${IPTCDATA_LIBRARIES} + ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${ZLIB_LIBRARIES}) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index d94bacdd7..aedb1e22b 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -221,14 +222,14 @@ raw.preser=0.0; exif.clear (); iptc.clear (); - version = 249; + version = TAGDISTANCE; } int ProcParams::save (Glib::ustring fname) const { SafeKeyFile keyFile; - keyFile.set_integer ("Version", "Version", 20101019); + keyFile.set_integer ("Version", "Version", TAGDISTANCE); // save tonecurve: keyFile.set_boolean ("Exposure", "Auto", toneCurve.autoexp); @@ -492,7 +493,7 @@ int ProcParams::load (Glib::ustring fname) { // load tonecurve: -version = 200; +version = TAGDISTANCE; if (keyFile.has_group ("Version")) { if (keyFile.has_key ("Version", "Version")) version = keyFile.get_integer ("Version", "Version"); } diff --git a/rtgui/options.cc b/rtgui/options.cc index 9e3bd43b6..0294e59b3 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -1,511 +1,512 @@ -/* - * 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 -#include -#include -#include -#include - -Options options; -Glib::ustring versionString = "v3.0 alpha 1"; -Glib::ustring paramFileExtension = ".pp3"; - -Options::Options () { - - setDefaults (); -} - -const char *DefaultLanguage = "English (US)"; - -void Options::setDefaults () { - - font = "sans, 10"; - windowWidth = 900; - windowHeight = 560; - windowMaximized = false; - firstRun = true; - savesParamsAtExit = true; - saveFormat.format = "jpg"; - saveFormat.jpegQuality = 100; - saveFormat.pngCompression = 6; - saveFormat.pngBits = 8; - saveFormat.tiffBits = 8; - saveFormat.tiffUncompressed = true; - saveFormat.saveParams = false; - savePathTemplate = "%p1/converted/%f"; - savePathFolder = ""; - saveUsePathTemplate = true; - defProfRaw = "default"; - defProfImg = "neutral"; - dateFormat = "%y-%m-%d"; - startupDir = 1; - startupPath = ""; - profilePath = "profiles"; - dirBrowserWidth = 200; - dirBrowserHeight = 150; - toolPanelWidth = 300; - browserToolPanelWidth = 300; - browserToolPanelHeight = 300; - historyPanelWidth = 150; - lastScale = 4; - lastCropSize = 1; - fbOnlyRaw = false; - fbShowDateTime = true; - fbShowBasicExif = true; - fbShowHidden = false; - fbArrangement = 0; - multiUser = false; - version = 290; - thumbSize = 80; - thumbSizeTab = 80; - showHistory = true; - showFilePanelState = 0; - showInfo = false; - cropDPI = 300; - showClippedHighlights = false; - showClippedShadows = false; - highlightThreshold = 254; - shadowThreshold = 0; - bgcolor = 0; - blinkClipped = true; - language = DefaultLanguage; - lastSaveAsPath = ""; - theme = ""; - useSystemTheme = false; - maxThumbnailHeight = 400; - maxCacheEntries = 10000; - thumbnailFormat = FT_Custom16; - thumbInterp = 1; - autoSuffix = false; - saveParamsFile = false; - saveParamsCache = true; - paramsLoadLocation = PLL_Cache; - procQueueEnabled = true; - gimpDir = "C:\\Program Files\\GIMP-2.0"; - psDir = "C:\\Program Files\\Adobe\\Adobe Photoshop CS3"; - customEditorProg = "start"; - editorToSendTo = 1; - liveThumbnails = true; - tpOpen.clear (); - //crvOpen.clear (); - parseExtensions.clear (); - parseExtensionsEnabled.clear (); - renameUseTemplates = false; - renameTemplates.clear (); - thumbnailZoomRatios.clear (); - thumbnailZoomRatios.push_back (0.2); - thumbnailZoomRatios.push_back (0.3); - thumbnailZoomRatios.push_back (0.45); - thumbnailZoomRatios.push_back (0.6); - thumbnailZoomRatios.push_back (0.8); - thumbnailZoomRatios.push_back (1.0); - overlayedFileNames = true; - showFileNames = true; - tabbedUI = false; - multiDisplayMode = 0; - - cutOverlayBrush = std::vector (4); - cutOverlayBrush[3] = 0.667; - - 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); - - rtSettings.dualThreadEnabled = true; - rtSettings.darkFramesPath = ""; -#ifdef WIN32 - rtSettings.iccDirectory = "C:/WINDOWS/System32/spool/drivers/color"; -#else - rtSettings.iccDirectory = "/usr/share/color/icc"; -#endif - rtSettings.colorimetricIntent = 1; - rtSettings.monitorProfile = ""; - rtSettings.verbose = false; -} - -Options* Options::copyFrom (Options* other) { - - *this = *other; - return this; -} - -int Options::readFromFile (Glib::ustring fname) { - - rtengine::SafeKeyFile keyFile; - - try { - if( !Glib::file_test(fname,Glib::FILE_TEST_EXISTS)) - return 1; - if (!keyFile.load_from_file (fname)) - return 1; - } - catch (Glib::FileError) { - return 1; - } - - setDefaults (); - -if (keyFile.has_group ("General")) { - if (keyFile.has_key ("General", "TabbedEditor")) tabbedUI= keyFile.get_boolean ("General", "TabbedEditor"); - if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "home") - startupDir = STARTUPDIR_HOME; - else if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "current") - startupDir = STARTUPDIR_CURRENT; - else if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "last") - startupDir = STARTUPDIR_LAST; - else - startupDir = STARTUPDIR_CUSTOM; - - if (keyFile.has_key ("General", "StartupPath")) startupPath = keyFile.get_string ("General", "StartupPath"); - if (keyFile.has_key ("General", "DateFormat")) dateFormat = keyFile.get_string ("General", "DateFormat"); - if (keyFile.has_key ("General", "AdjusterDelay")) Adjuster::delay = keyFile.get_integer ("General", "AdjusterDelay"); - if (keyFile.has_key ("General", "StoreLastProfile")) savesParamsAtExit = keyFile.get_boolean ("General", "StoreLastProfile"); - if (keyFile.has_key ("General", "DualProcSupport")) rtSettings.dualThreadEnabled = keyFile.get_boolean ("General", "DualProcSupport"); - if (keyFile.has_key ("General", "MultiUser")) multiUser = keyFile.get_boolean ("General", "MultiUser"); -// if (keyFile.has_key ("General", "Version")) version = keyFile.get_integer ("General", "Version"); - if (keyFile.has_key ("General", "Language")) language = keyFile.get_string ("General", "Language"); - if (keyFile.has_key ("General", "Theme")) theme = keyFile.get_string ("General", "Theme"); - if (keyFile.has_key ("General", "UseSystemTheme")) useSystemTheme = keyFile.get_boolean ("General", "UseSystemTheme"); - if (keyFile.has_key ("General", "FirstRun")) firstRun = keyFile.get_boolean ("General", "FirstRun"); - if( keyFile.has_key ("General", "DarkFramesPath")) rtSettings.darkFramesPath = keyFile.get_string("General", "DarkFramesPath"); - if( keyFile.has_key ("General", "Verbose")) rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); -} - -if (keyFile.has_group ("External Editor")) { - if (keyFile.has_key ("External Editor", "EditorKind")) editorToSendTo = keyFile.get_integer ("External Editor", "EditorKind"); - if (keyFile.has_key ("External Editor", "GimpDir")) gimpDir = keyFile.get_string ("External Editor", "GimpDir"); - if (keyFile.has_key ("External Editor", "PhotoshopDir")) psDir = keyFile.get_string ("External Editor", "PhotoshopDir"); - if (keyFile.has_key ("External Editor", "CustomEditor")) customEditorProg = keyFile.get_string ("External Editor", "CustomEditor"); -} - -if (keyFile.has_group ("Output")) { - if (keyFile.has_key ("Output", "Format")) saveFormat.format = keyFile.get_string ("Output", "Format"); - if (keyFile.has_key ("Output", "JpegQuality")) saveFormat.jpegQuality = keyFile.get_integer ("Output", "JpegQuality"); - if (keyFile.has_key ("Output", "PngCompression")) saveFormat.pngCompression = keyFile.get_integer ("Output", "PngCompression"); - if (keyFile.has_key ("Output", "PngBps")) saveFormat.pngBits = keyFile.get_integer ("Output", "PngBps"); - if (keyFile.has_key ("Output", "TiffBps")) saveFormat.tiffBits = keyFile.get_integer ("Output", "TiffBps"); - if (keyFile.has_key ("Output", "TiffUncompressed")) saveFormat.tiffUncompressed= keyFile.get_boolean ("Output", "TiffUncompressed"); - if (keyFile.has_key ("Output", "SaveProcParams")) saveFormat.saveParams = keyFile.get_boolean ("Output", "SaveProcParams"); - if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path"); - if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate"); - if (keyFile.has_key ("Output", "PathFolder")) savePathFolder = keyFile.get_string ("Output", "PathFolder"); - if (keyFile.has_key ("Output", "AutoSuffix")) autoSuffix = keyFile.get_boolean("Output", "AutoSuffix"); - if (keyFile.has_key ("Output", "UsePathTemplate")) saveUsePathTemplate = keyFile.get_boolean("Output", "UsePathTemplate"); - if (keyFile.has_key ("Output", "LastSaveAsPath")) lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath"); - if (keyFile.has_key ("Output", "OverwriteOutputFile")) overwriteOutputFile = keyFile.get_boolean("Output", "OverwriteOutputFile"); -} - -if (keyFile.has_group ("Profiles")) { - if (keyFile.has_key ("Profiles", "Directory")) profilePath = keyFile.get_string ("Profiles", "Directory"); - if (keyFile.has_key ("Profiles", "RawDefault")) defProfRaw = keyFile.get_string ("Profiles", "RawDefault"); - if (keyFile.has_key ("Profiles", "ImgDefault")) defProfImg = keyFile.get_string ("Profiles", "ImgDefault"); - if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile"); - if (keyFile.has_key ("Profiles", "SaveParamsToCache")) saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache"); - if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation"); - if (keyFile.has_key ("Profiles", "CustomProfileBuilder")) customProfileBuilder = keyFile.get_string ("Profiles", "CustomProfileBuilder"); -} - -if (keyFile.has_group ("File Browser")) { - if (keyFile.has_key ("File Browser", "ThumbnailSize")) thumbSize = keyFile.get_integer ("File Browser", "ThumbnailSize"); - if (keyFile.has_key ("File Browser", "ThumbnailSizeTab")) thumbSizeTab = keyFile.get_integer ("File Browser", "ThumbnailSizeTab"); - if (keyFile.has_key ("File Browser", "BrowseOnlyRaw")) fbOnlyRaw = keyFile.get_boolean ("File Browser", "BrowseOnlyRaw"); - if (keyFile.has_key ("File Browser", "BrowserShowsDate")) fbShowDateTime = keyFile.get_boolean ("File Browser", "BrowserShowsDate"); - if (keyFile.has_key ("File Browser", "BrowserShowsExif")) fbShowBasicExif = keyFile.get_boolean ("File Browser", "BrowserShowsExif"); - if (keyFile.has_key ("File Browser", "BrowserShowsHidden")) fbShowHidden = keyFile.get_boolean ("File Browser", "BrowserShowsHidden"); - if (keyFile.has_key ("File Browser", "MaxPreviewHeight")) maxThumbnailHeight = keyFile.get_integer ("File Browser", "MaxPreviewHeight"); - if (keyFile.has_key ("File Browser", "MaxCacheEntries")) maxCacheEntries = keyFile.get_integer ("File Browser", "MaxCacheEntries"); - if (keyFile.has_key ("File Browser", "ThumbnailFormat")) thumbnailFormat = (ThFileType)keyFile.get_integer ("File Browser", "ThumbnailFormat"); - if (keyFile.has_key ("File Browser", "ParseExtensions")) parseExtensions = keyFile.get_string_list ("File Browser", "ParseExtensions"); - if (keyFile.has_key ("File Browser", "ParseExtensionsEnabled")) parseExtensionsEnabled = keyFile.get_integer_list ("File Browser", "ParseExtensionsEnabled"); - if (keyFile.has_key ("File Browser", "ThumbnailArrangement")) fbArrangement = keyFile.get_integer ("File Browser", "ThumbnailArrangement"); - if (keyFile.has_key ("File Browser", "ThumbnailInterpolation")) thumbInterp = keyFile.get_integer ("File Browser", "ThumbnailInterpolation"); - if (keyFile.has_key ("File Browser", "LiveThumbnails")) liveThumbnails = keyFile.get_boolean ("File Browser", "LiveThumbnails"); - if (keyFile.has_key ("File Browser", "FavoriteDirs")) favoriteDirs = keyFile.get_string_list ("File Browser", "FavoriteDirs"); - if (keyFile.has_key ("File Browser", "RenameTemplates")) renameTemplates = keyFile.get_string_list ("File Browser", "RenameTemplates"); - 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_key ("File Browser", "InternalThumbIfUntouched")) internalThumbIfUntouched = keyFile.get_boolean ("File Browser", "InternalThumbIfUntouched"); -} - -if (keyFile.has_group ("Clipping Indication")) { - if (keyFile.has_key ("Clipping Indication", "HighlightThreshold")) highlightThreshold= keyFile.get_integer ("Clipping Indication", "HighlightThreshold"); - if (keyFile.has_key ("Clipping Indication", "ShadowThreshold")) shadowThreshold = keyFile.get_integer ("Clipping Indication", "ShadowThreshold"); - if (keyFile.has_key ("Clipping Indication", "BlinkClipped")) blinkClipped = keyFile.get_boolean ("Clipping Indication", "BlinkClipped"); -} - -if (keyFile.has_group ("GUI")) { - if (keyFile.has_key ("GUI", "Font")) font = keyFile.get_string ("GUI", "Font"); - if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth"); - if (keyFile.has_key ("GUI", "WindowHeight")) windowHeight = keyFile.get_integer ("GUI", "WindowHeight"); - if (keyFile.has_key ("GUI", "WindowMaximized")) windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized"); - if (keyFile.has_key ("GUI", "DirBrowserWidth")) dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth"); - if (keyFile.has_key ("GUI", "DirBrowserHeight")) dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight"); - if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth"); - if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight"); - if (keyFile.has_key ("GUI", "ToolPanelWidth")) toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth"); - if (keyFile.has_key ("GUI", "BrowserToolPanelWidth"))browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth"); - if (keyFile.has_key ("GUI", "BrowserToolPanelHeight"))browserToolPanelHeight = keyFile.get_integer ("GUI", "BrowserToolPanelHeight"); - if (keyFile.has_key ("GUI", "HistoryPanelWidth")) historyPanelWidth = keyFile.get_integer ("GUI", "HistoryPanelWidth"); - if (keyFile.has_key ("GUI", "LastPreviewScale")) lastScale = keyFile.get_integer ("GUI", "LastPreviewScale"); - if (keyFile.has_key ("GUI", "LastCropSize")) lastCropSize = keyFile.get_integer ("GUI", "LastCropSize"); - if (keyFile.has_key ("GUI", "ShowHistory")) showHistory = keyFile.get_boolean ("GUI", "ShowHistory"); - if (keyFile.has_key ("GUI", "ShowFilePanelState")) showFilePanelState= keyFile.get_integer ("GUI", "ShowFilePanelState"); - if (keyFile.has_key ("GUI", "ShowInfo")) showInfo = keyFile.get_boolean ("GUI", "ShowInfo"); - if (keyFile.has_key ("GUI", "MainNBVertical")) mainNBVertical = keyFile.get_boolean ("GUI", "MainNBVertical"); - if (keyFile.has_key ("GUI", "ShowClippedHighlights"))showClippedHighlights = keyFile.get_boolean ("GUI", "ShowClippedHighlights"); - if (keyFile.has_key ("GUI", "ShowClippedShadows")) showClippedShadows= keyFile.get_boolean ("GUI", "ShowClippedShadows"); - if (keyFile.has_key ("GUI", "FrameColor")) bgcolor = keyFile.get_integer ("GUI", "FrameColor"); - if (keyFile.has_key ("GUI", "ProcessingQueueEnbled"))procQueueEnabled = keyFile.get_boolean ("GUI", "ProcessingQueueEnbled"); - if (keyFile.has_key ("GUI", "ToolPanelsExpanded")) tpOpen = keyFile.get_integer_list ("GUI", "ToolPanelsExpanded"); - if (keyFile.has_key ("GUI", "MultiDisplayMode")) multiDisplayMode = keyFile.get_integer ("GUI", "MultiDisplayMode"); - //if (keyFile.has_key ("GUI", "CurvePanelsExpanded")) crvOpen = keyFile.get_integer_list ("GUI", "CurvePanelsExpanded"); - if (keyFile.has_key ("GUI", "CutOverlayBrush")) cutOverlayBrush = keyFile.get_double_list ("GUI", "CutOverlayBrush"); -} - - - -if (keyFile.has_group ("Crop Settings")) { - if (keyFile.has_key ("Crop Settings", "DPI")) cropDPI = keyFile.get_integer ("Crop Settings", "DPI"); -} - -if (keyFile.has_group ("Color Management")) { - if (keyFile.has_key ("Color Management", "ICCDirectory")) rtSettings.iccDirectory = keyFile.get_string ("Color Management", "ICCDirectory"); - if (keyFile.has_key ("Color Management", "MonitorProfile")) rtSettings.monitorProfile = keyFile.get_string ("Color Management", "MonitorProfile"); - if (keyFile.has_key ("Color Management", "Intent")) rtSettings.colorimetricIntent = keyFile.get_integer("Color Management", "Intent"); -} - -if (keyFile.has_group ("Batch Processing")) { - if (keyFile.has_key ("Batch Processing", "AdjusterBehavior")) baBehav = keyFile.get_integer_list ("Batch Processing", "AdjusterBehavior"); -} - - return 0; -} - -int Options::saveToFile (Glib::ustring fname) { - - rtengine::SafeKeyFile keyFile; - keyFile.set_boolean ("General", "TabbedEditor", tabbedUI); - - keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit); - if (startupDir==STARTUPDIR_HOME) - keyFile.set_string ("General", "StartupDirectory", "home"); - else if (startupDir==STARTUPDIR_CURRENT) - keyFile.set_string ("General", "StartupDirectory", "current"); - else if (startupDir==STARTUPDIR_CUSTOM) - keyFile.set_string ("General", "StartupDirectory", "custom"); - else if (startupDir==STARTUPDIR_LAST) - keyFile.set_string ("General", "StartupDirectory", "last"); - keyFile.set_string ("General", "StartupPath", startupPath); - keyFile.set_string ("General", "DateFormat", dateFormat); - keyFile.set_integer ("General", "AdjusterDelay", Adjuster::delay); - keyFile.set_boolean ("General", "DualProcSupport", rtSettings.dualThreadEnabled); - keyFile.set_boolean ("General", "MultiUser", multiUser); - keyFile.set_string ("General", "Language", language); - keyFile.set_string ("General", "Theme", theme); - keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme); - keyFile.set_integer ("General", "Version", 290); - keyFile.set_boolean ("General", "FirstRun", firstRun); - keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); - keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); - - keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); - keyFile.set_string ("External Editor", "GimpDir", gimpDir); - keyFile.set_string ("External Editor", "PhotoshopDir", psDir); - keyFile.set_string ("External Editor", "CustomEditor", customEditorProg); - - - keyFile.set_boolean ("File Browser", "BrowseOnlyRaw", fbOnlyRaw); - keyFile.set_boolean ("File Browser", "BrowserShowsDate", fbShowDateTime); - keyFile.set_boolean ("File Browser", "BrowserShowsExif", fbShowBasicExif); - keyFile.set_boolean ("File Browser", "BrowserShowsHidden", fbShowHidden); - keyFile.set_integer ("File Browser", "ThumbnailSize", thumbSize); - keyFile.set_integer ("File Browser", "ThumbnailSizeTab", thumbSizeTab); - keyFile.set_integer ("File Browser", "MaxPreviewHeight", maxThumbnailHeight); - keyFile.set_integer ("File Browser", "MaxCacheEntries", maxCacheEntries); - keyFile.set_integer ("File Browser", "ThumbnailFormat", (int)thumbnailFormat); - Glib::ArrayHandle pext = parseExtensions; - keyFile.set_string_list ("File Browser", "ParseExtensions", pext); - Glib::ArrayHandle pextena = parseExtensionsEnabled; - keyFile.set_integer_list ("File Browser", "ParseExtensionsEnabled", pextena); - keyFile.set_integer ("File Browser", "ThumbnailArrangement", fbArrangement); - keyFile.set_integer ("File Browser", "ThumbnailInterpolation", thumbInterp); - keyFile.set_boolean ("File Browser", "LiveThumbnails", liveThumbnails); - Glib::ArrayHandle pfav = favoriteDirs; - keyFile.set_string_list ("File Browser", "FavoriteDirs", pfav); - Glib::ArrayHandle pren = renameTemplates; - keyFile.set_string_list ("File Browser", "RenameTemplates", pren); - keyFile.set_boolean ("File Browser", "RenameUseTemplates", renameUseTemplates); - 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_boolean ("File Browser", "InternalThumbIfUntouched", internalThumbIfUntouched ); - - keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); - keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); - keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); - - keyFile.set_string ("Output", "Format", saveFormat.format); - keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); - keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); - keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); - keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); - keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); - keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); - keyFile.set_string ("Output", "PathTemplate", savePathTemplate); - keyFile.set_string ("Output", "PathFolder", savePathFolder); - keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix); - keyFile.set_boolean ("Output", "UsePathTemplate", saveUsePathTemplate); - keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath); - keyFile.set_boolean ("Output", "OverwriteOutputFile", overwriteOutputFile); - - keyFile.set_string ("Profiles", "Directory", profilePath); - keyFile.set_string ("Profiles", "RawDefault", defProfRaw); - keyFile.set_string ("Profiles", "ImgDefault", defProfImg); - keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); - keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); - keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); - keyFile.set_string ("Profiles", "CustomProfileBuilder", customProfileBuilder); - - keyFile.set_string ("GUI", "Font", font); - keyFile.set_integer ("GUI", "WindowWidth", windowWidth); - keyFile.set_integer ("GUI", "WindowHeight", windowHeight); - keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); - keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); - keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); - keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth); - keyFile.set_integer ("GUI", "SaveAsDialogHeight", saveAsDialogHeight); - keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth); - keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth); - keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight); - keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth); - keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); - keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); - keyFile.set_boolean ("GUI", "ShowHistory", showHistory); - keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); - keyFile.set_boolean ("GUI", "ShowInfo", showInfo); - keyFile.set_boolean ("GUI", "MainNBVertical", mainNBVertical); - keyFile.set_boolean ("GUI", "ShowClippedHighlights", showClippedHighlights); - keyFile.set_boolean ("GUI", "ShowClippedShadows", showClippedShadows); - keyFile.set_integer ("GUI", "FrameColor", bgcolor); - keyFile.set_boolean ("GUI", "ProcessingQueueEnbled", procQueueEnabled); - Glib::ArrayHandle tpopen = tpOpen; - keyFile.set_integer_list ("GUI", "ToolPanelsExpanded", tpopen); - keyFile.set_integer ("GUI", "MultiDisplayMode", multiDisplayMode); - keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); - - //Glib::ArrayHandle crvopen = crvOpen; - //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); - - keyFile.set_integer ("Crop Settings", "DPI", cropDPI); - - keyFile.set_string ("Color Management", "ICCDirectory", rtSettings.iccDirectory); - keyFile.set_string ("Color Management", "MonitorProfile", rtSettings.monitorProfile); - keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent); - - Glib::ArrayHandle bab = baBehav; - keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); - - - FILE *f = g_fopen (fname.c_str(), "wt"); - if (f==NULL) - return 1; - else { - fprintf (f, "%s", keyFile.to_data().c_str()); - fclose (f); - return 0; - } -} - -Glib::ustring Options::rtdir; -Glib::ustring Options::cacheBaseDir; - -void Options::load () { - - rtdir = Glib::ustring(g_get_user_config_dir ())+"/RawTherapeeAlpha"; - options.readFromFile (argv0+"/options"); - cacheBaseDir = argv0 + "/cache"; - if (options.multiUser) { - int r = options.readFromFile (rtdir + "/options"); - if (r && !g_mkdir_with_parents (rtdir.c_str(), 511)) { - Glib::ustring profdir = rtdir + "/profiles"; - g_mkdir_with_parents (profdir.c_str(), 511); - options.saveToFile (rtdir + "/options"); - } -#ifdef _WIN32 - cacheBaseDir = rtdir + "/cache"; -#else - cacheBaseDir = Glib::ustring(g_get_user_cache_dir()) + "/RawTherapee"; -#endif - } - - //We handle languages using a hierarchy of translations. The top of the hierarchy is default. This includes a default translation for all items - // (most likely using simple English). The next level is the language: for instance, English, French, Chinese, etc. This file should contain a - // generic translation for all items which differ from default. Finally there is the locale. This is region-specific items which differ from the - // language file. These files must be name in the format (), where Language is the name of the language which it inherits from, - // and LC is the locale code. Some examples of this would be English (US) (American English), French (FR) (Franch French), French (CA) (Canadian - // French), etc. - // - // Each level will only contain the differences between itself and its parent translation. For instance, English (UK) or English (CA) may - // include the translation "HISTORY_MSG_34;Avoid Colour Clipping" where English would translate it as "HISTORY_MSG_34;Avoid Color Clipping" (note - // the difference in the spelling of 'colour'). - // - // It is important that when naming the translation files, that you stick to the format or (). We depend on that to figure - // out which are the parent translations. Furthermore, there must be a file for each locale () -- you cannot have - // 'French (CA)' unless there is a file 'French'. - - Glib::ustring defaultTranslation = argv0 + "/languages/default"; - Glib::ustring languageTranslation = ""; - Glib::ustring localeTranslation = ""; - - if (!options.language.empty()){ - std::vector langPortions = Glib::Regex::split_simple(" ", options.language); - if (langPortions.size() >= 1){ - languageTranslation = argv0 + "/languages/" + langPortions.at(0); - } - if (langPortions.size() >= 2){ - localeTranslation = argv0 + "/languages/" + options.language; - } - } - - langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation))); - - rtengine::init (&options.rtSettings); -} - -void Options::save () { - - if (options.multiUser==false) { - options.saveToFile (argv0+"/options"); - } - else { - options.saveToFile (rtdir + "/options"); - } -} - -bool Options::is_extention_enabled (Glib::ustring ext) { - for (int j=0; j<(int)parseExtensions.size(); j++) - if (parseExtensions[j].casefold() == ext.casefold()) - return j>=(int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j]; - return false; -} +/* + * 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 +#include +#include +#include +#include +#include + +Options options; +Glib::ustring versionString = VERSION; +Glib::ustring paramFileExtension = ".pp3"; + +Options::Options () { + + setDefaults (); +} + +const char *DefaultLanguage = "English (US)"; + +void Options::setDefaults () { + + font = "sans, 10"; + windowWidth = 900; + windowHeight = 560; + windowMaximized = false; + firstRun = true; + savesParamsAtExit = true; + saveFormat.format = "jpg"; + saveFormat.jpegQuality = 100; + saveFormat.pngCompression = 6; + saveFormat.pngBits = 8; + saveFormat.tiffBits = 8; + saveFormat.tiffUncompressed = true; + saveFormat.saveParams = false; + savePathTemplate = "%p1/converted/%f"; + savePathFolder = ""; + saveUsePathTemplate = true; + defProfRaw = "default"; + defProfImg = "neutral"; + dateFormat = "%y-%m-%d"; + startupDir = 1; + startupPath = ""; + profilePath = "profiles"; + dirBrowserWidth = 200; + dirBrowserHeight = 150; + toolPanelWidth = 300; + browserToolPanelWidth = 300; + browserToolPanelHeight = 300; + historyPanelWidth = 150; + lastScale = 4; + lastCropSize = 1; + fbOnlyRaw = false; + fbShowDateTime = true; + fbShowBasicExif = true; + fbShowHidden = false; + fbArrangement = 0; + multiUser = false; + version = TAGDISTANCE; + thumbSize = 80; + thumbSizeTab = 80; + showHistory = true; + showFilePanelState = 0; + showInfo = false; + cropDPI = 300; + showClippedHighlights = false; + showClippedShadows = false; + highlightThreshold = 254; + shadowThreshold = 0; + bgcolor = 0; + blinkClipped = true; + language = DefaultLanguage; + lastSaveAsPath = ""; + theme = ""; + useSystemTheme = false; + maxThumbnailHeight = 400; + maxCacheEntries = 10000; + thumbnailFormat = FT_Custom16; + thumbInterp = 1; + autoSuffix = false; + saveParamsFile = false; + saveParamsCache = true; + paramsLoadLocation = PLL_Cache; + procQueueEnabled = true; + gimpDir = "C:\\Program Files\\GIMP-2.0"; + psDir = "C:\\Program Files\\Adobe\\Adobe Photoshop CS3"; + customEditorProg = "start"; + editorToSendTo = 1; + liveThumbnails = true; + tpOpen.clear (); + //crvOpen.clear (); + parseExtensions.clear (); + parseExtensionsEnabled.clear (); + renameUseTemplates = false; + renameTemplates.clear (); + thumbnailZoomRatios.clear (); + thumbnailZoomRatios.push_back (0.2); + thumbnailZoomRatios.push_back (0.3); + thumbnailZoomRatios.push_back (0.45); + thumbnailZoomRatios.push_back (0.6); + thumbnailZoomRatios.push_back (0.8); + thumbnailZoomRatios.push_back (1.0); + overlayedFileNames = true; + showFileNames = true; + tabbedUI = false; + multiDisplayMode = 0; + + cutOverlayBrush = std::vector (4); + cutOverlayBrush[3] = 0.667; + + 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); + + rtSettings.dualThreadEnabled = true; + rtSettings.darkFramesPath = ""; +#ifdef WIN32 + rtSettings.iccDirectory = "C:/WINDOWS/System32/spool/drivers/color"; +#else + rtSettings.iccDirectory = "/usr/share/color/icc"; +#endif + rtSettings.colorimetricIntent = 1; + rtSettings.monitorProfile = ""; + rtSettings.verbose = false; +} + +Options* Options::copyFrom (Options* other) { + + *this = *other; + return this; +} + +int Options::readFromFile (Glib::ustring fname) { + + rtengine::SafeKeyFile keyFile; + + try { + if( !Glib::file_test(fname,Glib::FILE_TEST_EXISTS)) + return 1; + if (!keyFile.load_from_file (fname)) + return 1; + } + catch (Glib::FileError) { + return 1; + } + + setDefaults (); + +if (keyFile.has_group ("General")) { + if (keyFile.has_key ("General", "TabbedEditor")) tabbedUI= keyFile.get_boolean ("General", "TabbedEditor"); + if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "home") + startupDir = STARTUPDIR_HOME; + else if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "current") + startupDir = STARTUPDIR_CURRENT; + else if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "last") + startupDir = STARTUPDIR_LAST; + else + startupDir = STARTUPDIR_CUSTOM; + + if (keyFile.has_key ("General", "StartupPath")) startupPath = keyFile.get_string ("General", "StartupPath"); + if (keyFile.has_key ("General", "DateFormat")) dateFormat = keyFile.get_string ("General", "DateFormat"); + if (keyFile.has_key ("General", "AdjusterDelay")) Adjuster::delay = keyFile.get_integer ("General", "AdjusterDelay"); + if (keyFile.has_key ("General", "StoreLastProfile")) savesParamsAtExit = keyFile.get_boolean ("General", "StoreLastProfile"); + if (keyFile.has_key ("General", "DualProcSupport")) rtSettings.dualThreadEnabled = keyFile.get_boolean ("General", "DualProcSupport"); + if (keyFile.has_key ("General", "MultiUser")) multiUser = keyFile.get_boolean ("General", "MultiUser"); +// if (keyFile.has_key ("General", "Version")) version = keyFile.get_integer ("General", "Version"); + if (keyFile.has_key ("General", "Language")) language = keyFile.get_string ("General", "Language"); + if (keyFile.has_key ("General", "Theme")) theme = keyFile.get_string ("General", "Theme"); + if (keyFile.has_key ("General", "UseSystemTheme")) useSystemTheme = keyFile.get_boolean ("General", "UseSystemTheme"); + if (keyFile.has_key ("General", "FirstRun")) firstRun = keyFile.get_boolean ("General", "FirstRun"); + if( keyFile.has_key ("General", "DarkFramesPath")) rtSettings.darkFramesPath = keyFile.get_string("General", "DarkFramesPath"); + if( keyFile.has_key ("General", "Verbose")) rtSettings.verbose = keyFile.get_boolean ( "General", "Verbose"); +} + +if (keyFile.has_group ("External Editor")) { + if (keyFile.has_key ("External Editor", "EditorKind")) editorToSendTo = keyFile.get_integer ("External Editor", "EditorKind"); + if (keyFile.has_key ("External Editor", "GimpDir")) gimpDir = keyFile.get_string ("External Editor", "GimpDir"); + if (keyFile.has_key ("External Editor", "PhotoshopDir")) psDir = keyFile.get_string ("External Editor", "PhotoshopDir"); + if (keyFile.has_key ("External Editor", "CustomEditor")) customEditorProg = keyFile.get_string ("External Editor", "CustomEditor"); +} + +if (keyFile.has_group ("Output")) { + if (keyFile.has_key ("Output", "Format")) saveFormat.format = keyFile.get_string ("Output", "Format"); + if (keyFile.has_key ("Output", "JpegQuality")) saveFormat.jpegQuality = keyFile.get_integer ("Output", "JpegQuality"); + if (keyFile.has_key ("Output", "PngCompression")) saveFormat.pngCompression = keyFile.get_integer ("Output", "PngCompression"); + if (keyFile.has_key ("Output", "PngBps")) saveFormat.pngBits = keyFile.get_integer ("Output", "PngBps"); + if (keyFile.has_key ("Output", "TiffBps")) saveFormat.tiffBits = keyFile.get_integer ("Output", "TiffBps"); + if (keyFile.has_key ("Output", "TiffUncompressed")) saveFormat.tiffUncompressed= keyFile.get_boolean ("Output", "TiffUncompressed"); + if (keyFile.has_key ("Output", "SaveProcParams")) saveFormat.saveParams = keyFile.get_boolean ("Output", "SaveProcParams"); + if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path"); + if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate"); + if (keyFile.has_key ("Output", "PathFolder")) savePathFolder = keyFile.get_string ("Output", "PathFolder"); + if (keyFile.has_key ("Output", "AutoSuffix")) autoSuffix = keyFile.get_boolean("Output", "AutoSuffix"); + if (keyFile.has_key ("Output", "UsePathTemplate")) saveUsePathTemplate = keyFile.get_boolean("Output", "UsePathTemplate"); + if (keyFile.has_key ("Output", "LastSaveAsPath")) lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath"); + if (keyFile.has_key ("Output", "OverwriteOutputFile")) overwriteOutputFile = keyFile.get_boolean("Output", "OverwriteOutputFile"); +} + +if (keyFile.has_group ("Profiles")) { + if (keyFile.has_key ("Profiles", "Directory")) profilePath = keyFile.get_string ("Profiles", "Directory"); + if (keyFile.has_key ("Profiles", "RawDefault")) defProfRaw = keyFile.get_string ("Profiles", "RawDefault"); + if (keyFile.has_key ("Profiles", "ImgDefault")) defProfImg = keyFile.get_string ("Profiles", "ImgDefault"); + if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile"); + if (keyFile.has_key ("Profiles", "SaveParamsToCache")) saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache"); + if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation"); + if (keyFile.has_key ("Profiles", "CustomProfileBuilder")) customProfileBuilder = keyFile.get_string ("Profiles", "CustomProfileBuilder"); +} + +if (keyFile.has_group ("File Browser")) { + if (keyFile.has_key ("File Browser", "ThumbnailSize")) thumbSize = keyFile.get_integer ("File Browser", "ThumbnailSize"); + if (keyFile.has_key ("File Browser", "ThumbnailSizeTab")) thumbSizeTab = keyFile.get_integer ("File Browser", "ThumbnailSizeTab"); + if (keyFile.has_key ("File Browser", "BrowseOnlyRaw")) fbOnlyRaw = keyFile.get_boolean ("File Browser", "BrowseOnlyRaw"); + if (keyFile.has_key ("File Browser", "BrowserShowsDate")) fbShowDateTime = keyFile.get_boolean ("File Browser", "BrowserShowsDate"); + if (keyFile.has_key ("File Browser", "BrowserShowsExif")) fbShowBasicExif = keyFile.get_boolean ("File Browser", "BrowserShowsExif"); + if (keyFile.has_key ("File Browser", "BrowserShowsHidden")) fbShowHidden = keyFile.get_boolean ("File Browser", "BrowserShowsHidden"); + if (keyFile.has_key ("File Browser", "MaxPreviewHeight")) maxThumbnailHeight = keyFile.get_integer ("File Browser", "MaxPreviewHeight"); + if (keyFile.has_key ("File Browser", "MaxCacheEntries")) maxCacheEntries = keyFile.get_integer ("File Browser", "MaxCacheEntries"); + if (keyFile.has_key ("File Browser", "ThumbnailFormat")) thumbnailFormat = (ThFileType)keyFile.get_integer ("File Browser", "ThumbnailFormat"); + if (keyFile.has_key ("File Browser", "ParseExtensions")) parseExtensions = keyFile.get_string_list ("File Browser", "ParseExtensions"); + if (keyFile.has_key ("File Browser", "ParseExtensionsEnabled")) parseExtensionsEnabled = keyFile.get_integer_list ("File Browser", "ParseExtensionsEnabled"); + if (keyFile.has_key ("File Browser", "ThumbnailArrangement")) fbArrangement = keyFile.get_integer ("File Browser", "ThumbnailArrangement"); + if (keyFile.has_key ("File Browser", "ThumbnailInterpolation")) thumbInterp = keyFile.get_integer ("File Browser", "ThumbnailInterpolation"); + if (keyFile.has_key ("File Browser", "LiveThumbnails")) liveThumbnails = keyFile.get_boolean ("File Browser", "LiveThumbnails"); + if (keyFile.has_key ("File Browser", "FavoriteDirs")) favoriteDirs = keyFile.get_string_list ("File Browser", "FavoriteDirs"); + if (keyFile.has_key ("File Browser", "RenameTemplates")) renameTemplates = keyFile.get_string_list ("File Browser", "RenameTemplates"); + 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_key ("File Browser", "InternalThumbIfUntouched")) internalThumbIfUntouched = keyFile.get_boolean ("File Browser", "InternalThumbIfUntouched"); +} + +if (keyFile.has_group ("Clipping Indication")) { + if (keyFile.has_key ("Clipping Indication", "HighlightThreshold")) highlightThreshold= keyFile.get_integer ("Clipping Indication", "HighlightThreshold"); + if (keyFile.has_key ("Clipping Indication", "ShadowThreshold")) shadowThreshold = keyFile.get_integer ("Clipping Indication", "ShadowThreshold"); + if (keyFile.has_key ("Clipping Indication", "BlinkClipped")) blinkClipped = keyFile.get_boolean ("Clipping Indication", "BlinkClipped"); +} + +if (keyFile.has_group ("GUI")) { + if (keyFile.has_key ("GUI", "Font")) font = keyFile.get_string ("GUI", "Font"); + if (keyFile.has_key ("GUI", "WindowWidth")) windowWidth = keyFile.get_integer ("GUI", "WindowWidth"); + if (keyFile.has_key ("GUI", "WindowHeight")) windowHeight = keyFile.get_integer ("GUI", "WindowHeight"); + if (keyFile.has_key ("GUI", "WindowMaximized")) windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized"); + if (keyFile.has_key ("GUI", "DirBrowserWidth")) dirBrowserWidth = keyFile.get_integer ("GUI", "DirBrowserWidth"); + if (keyFile.has_key ("GUI", "DirBrowserHeight")) dirBrowserHeight = keyFile.get_integer ("GUI", "DirBrowserHeight"); + if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth"); + if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight"); + if (keyFile.has_key ("GUI", "ToolPanelWidth")) toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth"); + if (keyFile.has_key ("GUI", "BrowserToolPanelWidth"))browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth"); + if (keyFile.has_key ("GUI", "BrowserToolPanelHeight"))browserToolPanelHeight = keyFile.get_integer ("GUI", "BrowserToolPanelHeight"); + if (keyFile.has_key ("GUI", "HistoryPanelWidth")) historyPanelWidth = keyFile.get_integer ("GUI", "HistoryPanelWidth"); + if (keyFile.has_key ("GUI", "LastPreviewScale")) lastScale = keyFile.get_integer ("GUI", "LastPreviewScale"); + if (keyFile.has_key ("GUI", "LastCropSize")) lastCropSize = keyFile.get_integer ("GUI", "LastCropSize"); + if (keyFile.has_key ("GUI", "ShowHistory")) showHistory = keyFile.get_boolean ("GUI", "ShowHistory"); + if (keyFile.has_key ("GUI", "ShowFilePanelState")) showFilePanelState= keyFile.get_integer ("GUI", "ShowFilePanelState"); + if (keyFile.has_key ("GUI", "ShowInfo")) showInfo = keyFile.get_boolean ("GUI", "ShowInfo"); + if (keyFile.has_key ("GUI", "MainNBVertical")) mainNBVertical = keyFile.get_boolean ("GUI", "MainNBVertical"); + if (keyFile.has_key ("GUI", "ShowClippedHighlights"))showClippedHighlights = keyFile.get_boolean ("GUI", "ShowClippedHighlights"); + if (keyFile.has_key ("GUI", "ShowClippedShadows")) showClippedShadows= keyFile.get_boolean ("GUI", "ShowClippedShadows"); + if (keyFile.has_key ("GUI", "FrameColor")) bgcolor = keyFile.get_integer ("GUI", "FrameColor"); + if (keyFile.has_key ("GUI", "ProcessingQueueEnbled"))procQueueEnabled = keyFile.get_boolean ("GUI", "ProcessingQueueEnbled"); + if (keyFile.has_key ("GUI", "ToolPanelsExpanded")) tpOpen = keyFile.get_integer_list ("GUI", "ToolPanelsExpanded"); + if (keyFile.has_key ("GUI", "MultiDisplayMode")) multiDisplayMode = keyFile.get_integer ("GUI", "MultiDisplayMode"); + //if (keyFile.has_key ("GUI", "CurvePanelsExpanded")) crvOpen = keyFile.get_integer_list ("GUI", "CurvePanelsExpanded"); + if (keyFile.has_key ("GUI", "CutOverlayBrush")) cutOverlayBrush = keyFile.get_double_list ("GUI", "CutOverlayBrush"); +} + + + +if (keyFile.has_group ("Crop Settings")) { + if (keyFile.has_key ("Crop Settings", "DPI")) cropDPI = keyFile.get_integer ("Crop Settings", "DPI"); +} + +if (keyFile.has_group ("Color Management")) { + if (keyFile.has_key ("Color Management", "ICCDirectory")) rtSettings.iccDirectory = keyFile.get_string ("Color Management", "ICCDirectory"); + if (keyFile.has_key ("Color Management", "MonitorProfile")) rtSettings.monitorProfile = keyFile.get_string ("Color Management", "MonitorProfile"); + if (keyFile.has_key ("Color Management", "Intent")) rtSettings.colorimetricIntent = keyFile.get_integer("Color Management", "Intent"); +} + +if (keyFile.has_group ("Batch Processing")) { + if (keyFile.has_key ("Batch Processing", "AdjusterBehavior")) baBehav = keyFile.get_integer_list ("Batch Processing", "AdjusterBehavior"); +} + + return 0; +} + +int Options::saveToFile (Glib::ustring fname) { + + rtengine::SafeKeyFile keyFile; + keyFile.set_boolean ("General", "TabbedEditor", tabbedUI); + + keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit); + if (startupDir==STARTUPDIR_HOME) + keyFile.set_string ("General", "StartupDirectory", "home"); + else if (startupDir==STARTUPDIR_CURRENT) + keyFile.set_string ("General", "StartupDirectory", "current"); + else if (startupDir==STARTUPDIR_CUSTOM) + keyFile.set_string ("General", "StartupDirectory", "custom"); + else if (startupDir==STARTUPDIR_LAST) + keyFile.set_string ("General", "StartupDirectory", "last"); + keyFile.set_string ("General", "StartupPath", startupPath); + keyFile.set_string ("General", "DateFormat", dateFormat); + keyFile.set_integer ("General", "AdjusterDelay", Adjuster::delay); + keyFile.set_boolean ("General", "DualProcSupport", rtSettings.dualThreadEnabled); + keyFile.set_boolean ("General", "MultiUser", multiUser); + keyFile.set_string ("General", "Language", language); + keyFile.set_string ("General", "Theme", theme); + keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme); + keyFile.set_integer ("General", "Version", TAGDISTANCE); + keyFile.set_boolean ("General", "FirstRun", firstRun); + keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath); + keyFile.set_boolean ("General", "Verbose", rtSettings.verbose); + + keyFile.set_integer ("External Editor", "EditorKind", editorToSendTo); + keyFile.set_string ("External Editor", "GimpDir", gimpDir); + keyFile.set_string ("External Editor", "PhotoshopDir", psDir); + keyFile.set_string ("External Editor", "CustomEditor", customEditorProg); + + + keyFile.set_boolean ("File Browser", "BrowseOnlyRaw", fbOnlyRaw); + keyFile.set_boolean ("File Browser", "BrowserShowsDate", fbShowDateTime); + keyFile.set_boolean ("File Browser", "BrowserShowsExif", fbShowBasicExif); + keyFile.set_boolean ("File Browser", "BrowserShowsHidden", fbShowHidden); + keyFile.set_integer ("File Browser", "ThumbnailSize", thumbSize); + keyFile.set_integer ("File Browser", "ThumbnailSizeTab", thumbSizeTab); + keyFile.set_integer ("File Browser", "MaxPreviewHeight", maxThumbnailHeight); + keyFile.set_integer ("File Browser", "MaxCacheEntries", maxCacheEntries); + keyFile.set_integer ("File Browser", "ThumbnailFormat", (int)thumbnailFormat); + Glib::ArrayHandle pext = parseExtensions; + keyFile.set_string_list ("File Browser", "ParseExtensions", pext); + Glib::ArrayHandle pextena = parseExtensionsEnabled; + keyFile.set_integer_list ("File Browser", "ParseExtensionsEnabled", pextena); + keyFile.set_integer ("File Browser", "ThumbnailArrangement", fbArrangement); + keyFile.set_integer ("File Browser", "ThumbnailInterpolation", thumbInterp); + keyFile.set_boolean ("File Browser", "LiveThumbnails", liveThumbnails); + Glib::ArrayHandle pfav = favoriteDirs; + keyFile.set_string_list ("File Browser", "FavoriteDirs", pfav); + Glib::ArrayHandle pren = renameTemplates; + keyFile.set_string_list ("File Browser", "RenameTemplates", pren); + keyFile.set_boolean ("File Browser", "RenameUseTemplates", renameUseTemplates); + 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_boolean ("File Browser", "InternalThumbIfUntouched", internalThumbIfUntouched ); + + keyFile.set_integer ("Clipping Indication", "HighlightThreshold", highlightThreshold); + keyFile.set_integer ("Clipping Indication", "ShadowThreshold", shadowThreshold); + keyFile.set_boolean ("Clipping Indication", "BlinkClipped", blinkClipped); + + keyFile.set_string ("Output", "Format", saveFormat.format); + keyFile.set_integer ("Output", "JpegQuality", saveFormat.jpegQuality); + keyFile.set_integer ("Output", "PngCompression", saveFormat.pngCompression); + keyFile.set_integer ("Output", "PngBps", saveFormat.pngBits); + keyFile.set_integer ("Output", "TiffBps", saveFormat.tiffBits); + keyFile.set_boolean ("Output", "TiffUncompressed", saveFormat.tiffUncompressed); + keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); + keyFile.set_string ("Output", "PathTemplate", savePathTemplate); + keyFile.set_string ("Output", "PathFolder", savePathFolder); + keyFile.set_boolean ("Output", "AutoSuffix", autoSuffix); + keyFile.set_boolean ("Output", "UsePathTemplate", saveUsePathTemplate); + keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath); + keyFile.set_boolean ("Output", "OverwriteOutputFile", overwriteOutputFile); + + keyFile.set_string ("Profiles", "Directory", profilePath); + keyFile.set_string ("Profiles", "RawDefault", defProfRaw); + keyFile.set_string ("Profiles", "ImgDefault", defProfImg); + keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); + keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); + keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); + keyFile.set_string ("Profiles", "CustomProfileBuilder", customProfileBuilder); + + keyFile.set_string ("GUI", "Font", font); + keyFile.set_integer ("GUI", "WindowWidth", windowWidth); + keyFile.set_integer ("GUI", "WindowHeight", windowHeight); + keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); + keyFile.set_integer ("GUI", "DirBrowserWidth", dirBrowserWidth); + keyFile.set_integer ("GUI", "DirBrowserHeight", dirBrowserHeight); + keyFile.set_integer ("GUI", "SaveAsDialogWidth", saveAsDialogWidth); + keyFile.set_integer ("GUI", "SaveAsDialogHeight", saveAsDialogHeight); + keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth); + keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth); + keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight); + keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth); + keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); + keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); + keyFile.set_boolean ("GUI", "ShowHistory", showHistory); + keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); + keyFile.set_boolean ("GUI", "ShowInfo", showInfo); + keyFile.set_boolean ("GUI", "MainNBVertical", mainNBVertical); + keyFile.set_boolean ("GUI", "ShowClippedHighlights", showClippedHighlights); + keyFile.set_boolean ("GUI", "ShowClippedShadows", showClippedShadows); + keyFile.set_integer ("GUI", "FrameColor", bgcolor); + keyFile.set_boolean ("GUI", "ProcessingQueueEnbled", procQueueEnabled); + Glib::ArrayHandle tpopen = tpOpen; + keyFile.set_integer_list ("GUI", "ToolPanelsExpanded", tpopen); + keyFile.set_integer ("GUI", "MultiDisplayMode", multiDisplayMode); + keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); + + //Glib::ArrayHandle crvopen = crvOpen; + //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); + + keyFile.set_integer ("Crop Settings", "DPI", cropDPI); + + keyFile.set_string ("Color Management", "ICCDirectory", rtSettings.iccDirectory); + keyFile.set_string ("Color Management", "MonitorProfile", rtSettings.monitorProfile); + keyFile.set_integer ("Color Management", "Intent", rtSettings.colorimetricIntent); + + Glib::ArrayHandle bab = baBehav; + keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); + + + FILE *f = g_fopen (fname.c_str(), "wt"); + if (f==NULL) + return 1; + else { + fprintf (f, "%s", keyFile.to_data().c_str()); + fclose (f); + return 0; + } +} + +Glib::ustring Options::rtdir; +Glib::ustring Options::cacheBaseDir; + +void Options::load () { + + rtdir = Glib::ustring(g_get_user_config_dir ())+"/RawTherapeeAlpha"; + options.readFromFile (argv0+"/options"); + cacheBaseDir = argv0 + "/cache"; + if (options.multiUser) { + int r = options.readFromFile (rtdir + "/options"); + if (r && !g_mkdir_with_parents (rtdir.c_str(), 511)) { + Glib::ustring profdir = rtdir + "/profiles"; + g_mkdir_with_parents (profdir.c_str(), 511); + options.saveToFile (rtdir + "/options"); + } +#ifdef _WIN32 + cacheBaseDir = rtdir + "/cache"; +#else + cacheBaseDir = Glib::ustring(g_get_user_cache_dir()) + "/RawTherapee"; +#endif + } + + //We handle languages using a hierarchy of translations. The top of the hierarchy is default. This includes a default translation for all items + // (most likely using simple English). The next level is the language: for instance, English, French, Chinese, etc. This file should contain a + // generic translation for all items which differ from default. Finally there is the locale. This is region-specific items which differ from the + // language file. These files must be name in the format (), where Language is the name of the language which it inherits from, + // and LC is the locale code. Some examples of this would be English (US) (American English), French (FR) (Franch French), French (CA) (Canadian + // French), etc. + // + // Each level will only contain the differences between itself and its parent translation. For instance, English (UK) or English (CA) may + // include the translation "HISTORY_MSG_34;Avoid Colour Clipping" where English would translate it as "HISTORY_MSG_34;Avoid Color Clipping" (note + // the difference in the spelling of 'colour'). + // + // It is important that when naming the translation files, that you stick to the format or (). We depend on that to figure + // out which are the parent translations. Furthermore, there must be a file for each locale () -- you cannot have + // 'French (CA)' unless there is a file 'French'. + + Glib::ustring defaultTranslation = argv0 + "/languages/default"; + Glib::ustring languageTranslation = ""; + Glib::ustring localeTranslation = ""; + + if (!options.language.empty()){ + std::vector langPortions = Glib::Regex::split_simple(" ", options.language); + if (langPortions.size() >= 1){ + languageTranslation = argv0 + "/languages/" + langPortions.at(0); + } + if (langPortions.size() >= 2){ + localeTranslation = argv0 + "/languages/" + options.language; + } + } + + langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation))); + + rtengine::init (&options.rtSettings); +} + +void Options::save () { + + if (options.multiUser==false) { + options.saveToFile (argv0+"/options"); + } + else { + options.saveToFile (rtdir + "/options"); + } +} + +bool Options::is_extention_enabled (Glib::ustring ext) { + for (int j=0; j<(int)parseExtensions.size(); j++) + if (parseExtensions[j].casefold() == ext.casefold()) + return j>=(int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j]; + return false; +} diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 9853a1c04..73e11850f 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -952,7 +952,7 @@ void Preferences::selectStartupDir () { void Preferences::aboutPressed () { - Splash* splash = new Splash (-1); + Splash* splash = new Splash (); splash->set_transient_for (*this); splash->set_modal (true); splash->show (); diff --git a/rtgui/splash.cc b/rtgui/splash.cc index 222742409..f6bdf2214 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -18,6 +18,7 @@ */ #include #include +#include #include extern Glib::ustring argv0; @@ -44,26 +45,131 @@ void SplashImage::on_realize () { bool SplashImage::on_expose_event (GdkEventExpose* event) { - Glib::RefPtr window = get_window(); + Glib::RefPtr window = get_window(); pixbuf->render_to_drawable (window, gc_, 0, 0, 0, 0, pixbuf->get_width(), pixbuf->get_height(), Gdk::RGB_DITHER_NONE, 0, 0); Cairo::FontOptions cfo; cfo.set_antialias (Cairo::ANTIALIAS_SUBPIXEL); - Glib::RefPtr context = get_pango_context () ; + Glib::RefPtr context = get_pango_context (); context->set_cairo_font_options (cfo); Pango::FontDescription fontd = context->get_font_description (); - fontd.set_weight (Pango::WEIGHT_SEMIBOLD); - fontd.set_size (12*Pango::SCALE); + fontd.set_weight (Pango::WEIGHT_LIGHT); + fontd.set_absolute_size (12*Pango::SCALE); context->set_font_description (fontd); + Gdk::Color *textColor = new Gdk::Color(); + textColor->set_rgb(0, 0, 0); + gc_->set_foreground(*textColor); - version = create_pango_layout (versionString); int w, h; + version = create_pango_layout (versionString); version->get_pixel_size (w, h); - window->draw_layout(gc_, pixbuf->get_width() - w - 28, 44-h, version); + window->draw_layout(gc_, pixbuf->get_width() - w - 4, pixbuf->get_height() - h - 4, version); return true; } +Splash::Splash () { + + set_title (M("GENERAL_ABOUT")); + set_border_width (4); + + Gtk::Notebook* nb = Gtk::manage (new Gtk::Notebook ()); + get_vbox()->pack_start (*nb); + + // Tab 1: the image + splashImage = new SplashImage (); + nb->append_page (*splashImage, M("ABOUT_TAB_SPLASH")); + splashImage->show (); + + // Tab 2: the informations about the current version + std::string buildFileName = Glib::build_filename (argv0, "AboutThisBuild.txt"); + if ( Glib::file_test(buildFileName, (Glib::FILE_TEST_EXISTS)) ) { + FILE *f = g_fopen (buildFileName.c_str(), "rt"); + if (f != NULL) { + char* buffer = new char[1024]; + std::ostringstream ostr; + while (fgets (buffer, 1024, f)) + ostr << buffer; + delete [] buffer; + fclose (f); + + Glib::RefPtr textBuffer = Gtk::TextBuffer::create(); + textBuffer->set_text((Glib::ustring)(ostr.str())); + + Gtk::ScrolledWindow *buildSW = Gtk::manage (new Gtk::ScrolledWindow()); + Gtk::TextView *buildTV = Gtk::manage (new Gtk::TextView (textBuffer)); + buildTV->set_editable(false); + buildSW->add(*buildTV); + nb->append_page (*buildSW, M("ABOUT_TAB_BUILD")); + } + } + + // Tab 3: the credits +#if defined _WIN32 || defined __APPLE__ + std::string creditsFileName = Glib::build_filename (argv0, "AUTHORS.txt"); +#else + std::string creditsFileName = Glib::build_filename (argv0, "share/doc/AUTHORS.txt"); +#endif + if ( Glib::file_test(creditsFileName, (Glib::FILE_TEST_EXISTS)) ) { + FILE *f = g_fopen (creditsFileName.c_str(), "rt"); + if (f != NULL) { + char* buffer = new char[1024]; + std::ostringstream ostr; + while (fgets (buffer, 1024, f)) + ostr << buffer; + delete [] buffer; + fclose (f); + + Glib::RefPtr textBuffer = Gtk::TextBuffer::create(); + textBuffer->set_text((Glib::ustring)(ostr.str())); + + Gtk::ScrolledWindow *creditsSW = Gtk::manage (new Gtk::ScrolledWindow()); + Gtk::TextView *creditsTV = Gtk::manage (new Gtk::TextView (textBuffer)); + creditsTV->set_editable(false); + creditsSW->add(*creditsTV); + nb->append_page (*creditsSW, M("ABOUT_TAB_CREDITS")); + } + } + + // Tab 4: the license +#if defined _WIN32 || defined __APPLE__ + std::string licenseFileName = Glib::build_filename (argv0, "LICENSE.txt"); +#else + std::string licenseFileName = Glib::build_filename (argv0, "share/doc/LICENSE.txt"); +#endif + if ( Glib::file_test(licenseFileName, (Glib::FILE_TEST_EXISTS)) ) { + FILE *f = g_fopen (licenseFileName.c_str(), "rt"); + if (f != NULL) { + char* buffer = new char[1024]; + std::ostringstream ostr; + while (fgets (buffer, 1024, f)) + ostr << buffer; + delete [] buffer; + fclose (f); + + Glib::RefPtr textBuffer = Gtk::TextBuffer::create(); + textBuffer->set_text((Glib::ustring)(ostr.str())); + + Gtk::ScrolledWindow *licenseSW = Gtk::manage (new Gtk::ScrolledWindow()); + Gtk::TextView *creditsTV = Gtk::manage (new Gtk::TextView (textBuffer)); + creditsTV->set_editable(false); + licenseSW->add(*creditsTV); + nb->append_page (*licenseSW, M("ABOUT_TAB_LICENSE")); + } + } + + + set_position (Gtk::WIN_POS_CENTER); + //add_events(Gdk::BUTTON_RELEASE_MASK); + set_resizable (true); + + nb->set_current_page (0); + + show_all_children (); + set_modal (true); + set_keep_above (true); +} + Splash::Splash (int maxtime) { set_title (M("GENERAL_ABOUT")); @@ -71,7 +177,6 @@ Splash::Splash (int maxtime) { splashImage = new SplashImage (); // add (*splashImage); get_vbox()->pack_start (*splashImage); - set_has_separator (false); splashImage->show (); if (maxtime>0) diff --git a/rtgui/splash.h b/rtgui/splash.h index 2afa2c9a5..9418be06c 100644 --- a/rtgui/splash.h +++ b/rtgui/splash.h @@ -42,6 +42,7 @@ class Splash : public Gtk::Dialog { public: Splash (int maxtime); + Splash (); bool on_timer (); virtual bool on_button_release_event (GdkEventButton* event);