From 89d2bdce5b930fb20ec5c2ad764962a0dd16fa3a Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Fri, 19 Aug 2022 16:47:28 +0200 Subject: [PATCH] Initial commit for real hidpi support Note: This commit has only been tested on MacOS Changes: - Icons now use the native hidpi support from Gtk (through Icon Theme) - Icons are now directly generated from scalable file (i.e. SVG file) - Widget sizes are scaled based on DPI and scale factor - Font size is scaled based on DPI and scale factor --- CMakeLists.txt | 14 +- rtdata/CMakeLists.txt | 25 +- rtdata/images/{svg => }/splash.svg | 0 rtdata/images/{svg => }/splash_template.svg | 0 rtdata/images/svg/index.theme | 55 +++ rtgui/adjuster.cc | 9 +- rtgui/batchqueue.cc | 6 +- rtgui/batchqueuebuttonset.cc | 12 +- rtgui/batchqueuebuttonset.h | 6 +- rtgui/batchqueueentry.cc | 12 +- rtgui/batchqueueentry.h | 3 +- rtgui/batchqueuepanel.cc | 18 +- rtgui/blackwhite.cc | 22 +- rtgui/cacorrection.cc | 8 +- rtgui/chmixer.cc | 20 +- rtgui/coarsepanel.cc | 8 +- rtgui/colorappearance.cc | 66 +-- rtgui/colortoning.cc | 58 +-- rtgui/controllines.cc | 20 +- rtgui/controllines.h | 4 +- rtgui/controlspotpanel.cc | 20 +- rtgui/crop.cc | 8 +- rtgui/cropwindow.cc | 58 ++- rtgui/cursormanager.cc | 99 ++--- rtgui/cursormanager.h | 1 - rtgui/curveeditor.cc | 14 +- rtgui/curveeditorgroup.cc | 13 +- rtgui/darkframe.cc | 2 +- rtgui/diagonalcurveeditorsubgroup.cc | 40 +- rtgui/dirbrowser.cc | 40 +- rtgui/dirbrowser.h | 16 +- rtgui/distortion.cc | 8 +- rtgui/editorpanel.cc | 52 +-- rtgui/editwidgets.cc | 34 +- rtgui/editwidgets.h | 36 +- rtgui/editwindow.cc | 59 +-- rtgui/editwindow.h | 3 - rtgui/exifpanel.cc | 25 +- rtgui/exifpanel.h | 9 +- rtgui/exportpanel.cc | 4 +- rtgui/fattaltonemap.cc | 6 +- rtgui/favoritbrowser.cc | 7 +- rtgui/filebrowser.cc | 6 +- rtgui/filebrowserentry.cc | 36 +- rtgui/filebrowserentry.h | 11 +- rtgui/filecatalog.cc | 82 ++-- rtgui/filethumbnailbuttonset.cc | 40 +- rtgui/filethumbnailbuttonset.h | 14 +- rtgui/filmnegative.cc | 16 +- rtgui/filterpanel.cc | 2 +- rtgui/flatcurveeditorsubgroup.cc | 14 +- rtgui/flatfield.cc | 2 +- rtgui/gradient.cc | 6 +- rtgui/guiutils.cc | 133 +++--- rtgui/guiutils.h | 18 +- rtgui/histogrampanel.cc | 84 ++-- rtgui/history.cc | 4 +- rtgui/iccprofilecreator.cc | 19 +- rtgui/icmpanel.cc | 34 +- rtgui/imagearea.cc | 8 +- rtgui/indclippedpanel.cc | 39 +- rtgui/indclippedpanel.h | 8 +- rtgui/inspector.cc | 10 +- rtgui/iptcpanel.cc | 16 +- rtgui/labgrid.cc | 60 +-- rtgui/lensgeom.cc | 2 +- rtgui/lensprofile.cc | 32 +- rtgui/locallabtools.cc | 128 +++--- rtgui/locallabtools2.cc | 290 +++++++------- rtgui/lwbutton.cc | 10 +- rtgui/lwbutton.h | 8 +- rtgui/main.cc | 13 +- rtgui/mycurve.cc | 14 +- rtgui/mydiagonalcurve.cc | 10 +- rtgui/myflatcurve.cc | 8 +- rtgui/perspective.cc | 40 +- rtgui/placesbrowser.cc | 6 +- rtgui/popupcommon.cc | 15 +- rtgui/preferences.cc | 30 +- rtgui/previewmodepanel.cc | 91 ++--- rtgui/previewmodepanel.h | 25 +- rtgui/previewwindow.cc | 10 +- rtgui/profilepanel.cc | 24 +- rtgui/profilepanel.h | 4 +- rtgui/rawcacorrection.cc | 8 +- rtgui/retinex.cc | 8 +- rtgui/rotate.cc | 6 +- rtgui/rtimage.cc | 201 +--------- rtgui/rtimage.h | 38 +- rtgui/rtscalable.cc | 423 ++++++++++---------- rtgui/rtscalable.h | 62 +-- rtgui/rtsurface.cc | 274 +++++++++---- rtgui/rtsurface.h | 82 ++-- rtgui/rtwindow.cc | 167 ++++---- rtgui/shcselector.cc | 20 +- rtgui/splash.cc | 79 ++-- rtgui/splash.h | 3 +- rtgui/spot.cc | 16 +- rtgui/thresholdadjuster.cc | 2 +- rtgui/thresholdselector.cc | 10 +- rtgui/thumbbrowserbase.cc | 10 +- rtgui/toolbar.cc | 16 +- rtgui/toolpanel.cc | 2 +- rtgui/toolpanelcoord.cc | 26 +- rtgui/wavelet.cc | 70 ++-- rtgui/whitebalance.cc | 98 ++--- rtgui/whitebalance.h | 6 +- rtgui/zoompanel.cc | 12 +- 108 files changed, 1949 insertions(+), 2032 deletions(-) rename rtdata/images/{svg => }/splash.svg (100%) rename rtdata/images/{svg => }/splash_template.svg (100%) create mode 100644 rtdata/images/svg/index.theme diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a55ca6d5..53480968c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ endif() # Warning for GCC vectorization issues, which causes problems #5749 and #6384: if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "10.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.2") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0"))) - message(STATUS "WARNING: gcc ${CMAKE_CXX_COMPILER_VERSION} is known to miscompile RawTherapee when using -ftree-loop-vectorize, forcing the option to be off") + message(STATUS "WARNING: gcc ${CMAKE_CXX_COMPILER_VERSION} is known to miscompile RawTherapee when using -ftree-loop-vectorize, forcing the option to be off") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-tree-loop-vectorize") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-loop-vectorize") endif() @@ -438,13 +438,9 @@ endif() # Check for libraries: find_package(PkgConfig) -if(WIN32) - pkg_check_modules(GTK REQUIRED gtk+-3.0>=3.22.24) - pkg_check_modules(GTKMM REQUIRED gtkmm-3.0>=3.22) -else() - pkg_check_modules(GTK REQUIRED gtk+-3.0>=3.16) - pkg_check_modules(GTKMM REQUIRED gtkmm-3.0>=3.16) -endif() +# Gtk version shall be greater than 3.24.3 for fixed Hi-DPI support +pkg_check_modules(GTK REQUIRED gtk+-3.0>=3.24.3) +pkg_check_modules(GTKMM REQUIRED gtkmm-3.0>=3.24) if(GTK_VERSION VERSION_GREATER "3.24.1" AND GTK_VERSION VERSION_LESS "3.24.7") if(GTK_VERSION VERSION_EQUAL "3.24.5") @@ -471,7 +467,7 @@ pkg_check_modules(GTHREAD REQUIRED gthread-2.0>=2.48) pkg_check_modules(GOBJECT REQUIRED gobject-2.0>=2.48) pkg_check_modules(SIGC REQUIRED sigc++-2.0>=2.3.1) pkg_check_modules(LENSFUN REQUIRED lensfun>=0.2) -pkg_check_modules(RSVG REQUIRED librsvg-2.0>=2.40) +pkg_check_modules(RSVG REQUIRED librsvg-2.0>=2.46) if(WIN32) add_definitions(-DWIN32) diff --git a/rtdata/CMakeLists.txt b/rtdata/CMakeLists.txt index eb4b5e934..5597f51b7 100644 --- a/rtdata/CMakeLists.txt +++ b/rtdata/CMakeLists.txt @@ -8,8 +8,7 @@ file(GLOB FONTS "fonts/*") set(PROFILESDIR "profiles") set(THEMEDIR "themes") -file(GLOB IMG_SVG LIST_DIRECTORIES false "images/svg/*") -file(GLOB IMG_PNG LIST_DIRECTORIES false "images/png/*") +file(GLOB IMG_SVG LIST_DIRECTORIES false "images/svg/*.svg") file(GLOB IMG_ICO LIST_DIRECTORIES false "images/*") if(WIN32) @@ -27,16 +26,17 @@ endif() if(UNIX) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/rawtherapee.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/rawtherapee.desktop") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/rawtherapee.desktop" DESTINATION ${DESKTOPDIR}) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-16.png" DESTINATION "${ICONSDIR}/hicolor/16x16/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-24.png" DESTINATION "${ICONSDIR}/hicolor/24x24/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-32.png" DESTINATION "${ICONSDIR}/hicolor/32x32/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-48.png" DESTINATION "${ICONSDIR}/hicolor/48x48/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-64.png" DESTINATION "${ICONSDIR}/hicolor/64x64/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-128.png" DESTINATION "${ICONSDIR}/hicolor/128x128/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-256.png" DESTINATION "${ICONSDIR}/hicolor/256x256/apps" RENAME rawtherapee.png) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/rt-logo.svg" DESTINATION "${ICONSDIR}/hicolor/scalable/apps" RENAME rawtherapee.svg) endif() +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-16.png" DESTINATION "${ICONSDIR}/rawtherapee/16x16/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-24.png" DESTINATION "${ICONSDIR}/rawtherapee/24x24/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-32.png" DESTINATION "${ICONSDIR}/rawtherapee/32x32/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-48.png" DESTINATION "${ICONSDIR}/rawtherapee/48x48/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-64.png" DESTINATION "${ICONSDIR}/rawtherapee/64x64/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-128.png" DESTINATION "${ICONSDIR}/rawtherapee/128x128/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/rawtherapee-logo-256.png" DESTINATION "${ICONSDIR}/rawtherapee/256x256/app_icons" RENAME rawtherapee.png) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/rt-logo.svg" DESTINATION "${ICONSDIR}/rawtherapee/scalable/app_icons" RENAME rawtherapee.svg) + install(FILES ${LANGUAGEFILES} DESTINATION "${DATADIR}/languages") install(FILES ${SOUNDFILES} DESTINATION "${DATADIR}/sounds") install(FILES ${INPUTICCFILES} DESTINATION "${DATADIR}/iccprofiles/input") @@ -50,8 +50,9 @@ endif() install(DIRECTORY "${PROFILESDIR}" DESTINATION "${DATADIR}" FILES_MATCHING PATTERN "*.pp3") install(DIRECTORY "${THEMEDIR}" DESTINATION "${DATADIR}") -install(FILES ${IMG_SVG} DESTINATION "${DATADIR}/images") -install(FILES ${IMG_PNG} DESTINATION "${DATADIR}/images") +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/png/empty.png" DESTINATION "${ICONSDIR}/rawtherapee/24x24/apps") +install(FILES ${IMG_SVG} DESTINATION "${ICONSDIR}/rawtherapee/scalable/apps") +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/images/svg/Index.theme" DESTINATION "${ICONSDIR}/rawtherapee") install(FILES ${IMG_ICO} DESTINATION "${DATADIR}/images") if(APPLE) diff --git a/rtdata/images/svg/splash.svg b/rtdata/images/splash.svg similarity index 100% rename from rtdata/images/svg/splash.svg rename to rtdata/images/splash.svg diff --git a/rtdata/images/svg/splash_template.svg b/rtdata/images/splash_template.svg similarity index 100% rename from rtdata/images/svg/splash_template.svg rename to rtdata/images/splash_template.svg diff --git a/rtdata/images/svg/index.theme b/rtdata/images/svg/index.theme new file mode 100644 index 000000000..c862ff01f --- /dev/null +++ b/rtdata/images/svg/index.theme @@ -0,0 +1,55 @@ +[Icon Theme] +Name=RawTherapee +Comment=RawTherapee icon theme +Inherits=Adwaita +Directories=16x16/app_icons,24x24/app_icons,32x32/app_icons,48x48/app_icons,64x64/app_icons,128x128/app_icons,256x256/app_icons,scalable/app_icons,scalable/apps + + +[16x16/app_icons] +Size=16 +Context=ApplicationIcons +Type=Threshold + +[24x24/app_icons] +Size=24 +Context=ApplicationIcons +Type=Threshold + +[32x32/app_icons] +Size=32 +Context=ApplicationIcons +Type=Threshold + +[48x48/app_icons] +Size=48 +Context=ApplicationIcons +Type=Threshold + +[64x64/app_icons] +Size=64 +Context=ApplicationIcons +Type=Threshold + +[128x128/app_icons] +Size=128 +Context=ApplicationIcons +Type=Threshold + +[256x256/app_icons] +Size=256 +Context=ApplicationIcons +Type=Threshold + +[scalable/app_icons] +MinSize=16 +Size=128 +MaxSize=256 +Context=ApplicationIcons +Type=Scalable + +[scalable/apps] +MinSize=16 +Size=128 +MaxSize=256 +Context=Applications +Type=Scalable diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index a2f96cac3..c7077ddcf 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -24,6 +24,7 @@ #include "multilangmgr.h" #include "options.h" #include "rtimage.h" +#include "rtscalable.h" #include "../rtengine/rt_math.h" namespace { @@ -92,7 +93,7 @@ Adjuster::Adjuster( reset = Gtk::manage(new Gtk::Button()); - reset->add(*Gtk::manage(new RTImage("undo-small.png", "redo-small.png"))); + reset->add(*Gtk::manage(new RTImage("undo-small", Gtk::ICON_SIZE_BUTTON))); setExpandAlignProperties(reset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); reset->set_relief(Gtk::RELIEF_NONE); reset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT")); @@ -104,7 +105,7 @@ Adjuster::Adjuster( setExpandAlignProperties(spin, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); spin->set_input_purpose(Gtk::INPUT_PURPOSE_DIGITS); - reset->set_size_request(-1, spin->get_height() > MIN_RESET_BUTTON_HEIGHT ? spin->get_height() : MIN_RESET_BUTTON_HEIGHT); + reset->set_size_request(-1, RTScalable::scalePixelSize(spin->get_height() > MIN_RESET_BUTTON_HEIGHT ? spin->get_height() : MIN_RESET_BUTTON_HEIGHT)); slider = Gtk::manage(new MyHScale()); setExpandAlignProperties(slider, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); slider->set_draw_value(false); @@ -192,7 +193,7 @@ void Adjuster::addAutoButton (const Glib::ustring &tooltip) { if (!automatic) { automatic = Gtk::manage(new Gtk::CheckButton()); - //automatic->add (*Gtk::manage (new RTImage ("gears.png"))); + //automatic->add (*Gtk::manage (new RTImage ("gears"))); automatic->set_tooltip_markup(tooltip.length() ? Glib::ustring::compose("%1\n\n%2", M("GENERAL_AUTO"), tooltip) : M("GENERAL_AUTO")); setExpandAlignProperties(automatic, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); autoChange = automatic->signal_toggled().connect( sigc::mem_fun(*this, &Adjuster::autoToggled) ); @@ -615,7 +616,7 @@ void Adjuster::setLogScale(double base, double pivot, bool anchorMiddle) logPivot = pivot; logAnchorMiddle = anchorMiddle; setSliderValue(cur); - + sliderChange.block(false); spinChange.block(false); } diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 19da96fb5..463ac7cde 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -57,16 +57,16 @@ BatchQueue::BatchQueue (FileCatalog* aFileCatalog) : processing(nullptr), fileCa pmenu.attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1); p++; - pmenu.attach (*Gtk::manage(head = new MyImageMenuItem (M("FILEBROWSER_POPUPMOVEHEAD"), "goto-start-small.png")), 0, 1, p, p + 1); + pmenu.attach (*Gtk::manage(head = new MyImageMenuItem (M("FILEBROWSER_POPUPMOVEHEAD"), "goto-start-small")), 0, 1, p, p + 1); p++; - pmenu.attach (*Gtk::manage(tail = new MyImageMenuItem (M("FILEBROWSER_POPUPMOVEEND"), "goto-end-small.png")), 0, 1, p, p + 1); + pmenu.attach (*Gtk::manage(tail = new MyImageMenuItem (M("FILEBROWSER_POPUPMOVEEND"), "goto-end-small")), 0, 1, p, p + 1); p++; pmenu.attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1); p++; - pmenu.attach (*Gtk::manage(cancel = new MyImageMenuItem (M("FILEBROWSER_POPUPCANCELJOB"), "cancel-small.png")), 0, 1, p, p + 1); + pmenu.attach (*Gtk::manage(cancel = new MyImageMenuItem (M("FILEBROWSER_POPUPCANCELJOB"), "cancel-small")), 0, 1, p, p + 1); pmenu.show_all (); diff --git a/rtgui/batchqueuebuttonset.cc b/rtgui/batchqueuebuttonset.cc index 969a55079..f68a7b4e7 100644 --- a/rtgui/batchqueuebuttonset.cc +++ b/rtgui/batchqueuebuttonset.cc @@ -25,9 +25,9 @@ bool BatchQueueButtonSet::iconsLoaded = false; -Cairo::RefPtr BatchQueueButtonSet::cancelIcon; -Cairo::RefPtr BatchQueueButtonSet::headIcon; -Cairo::RefPtr BatchQueueButtonSet::tailIcon; +std::shared_ptr BatchQueueButtonSet::cancelIcon = std::shared_ptr(nullptr); +std::shared_ptr BatchQueueButtonSet::headIcon = std::shared_ptr(nullptr); +std::shared_ptr BatchQueueButtonSet::tailIcon = std::shared_ptr(nullptr); Glib::ustring BatchQueueButtonSet::moveHeadToolTip; Glib::ustring BatchQueueButtonSet::moveEndToolTip; @@ -37,9 +37,9 @@ BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry) { if (!iconsLoaded) { - cancelIcon = Cairo::RefPtr(new RTSurface("cancel-small.png")); - headIcon = Cairo::RefPtr(new RTSurface("goto-start-small.png")); - tailIcon = Cairo::RefPtr(new RTSurface("goto-end-small.png")); + cancelIcon = std::shared_ptr(new RTSurface("cancel-small", Gtk::ICON_SIZE_BUTTON)); + headIcon = std::shared_ptr(new RTSurface("goto-start-small", Gtk::ICON_SIZE_BUTTON)); + tailIcon = std::shared_ptr(new RTSurface("goto-end-small", Gtk::ICON_SIZE_BUTTON)); moveHeadToolTip = M("FILEBROWSER_POPUPMOVEHEAD"); moveEndToolTip = M("FILEBROWSER_POPUPMOVEEND"); cancelJobToolTip = M("FILEBROWSER_POPUPCANCELJOB"); diff --git a/rtgui/batchqueuebuttonset.h b/rtgui/batchqueuebuttonset.h index fb45df518..2ff96c914 100644 --- a/rtgui/batchqueuebuttonset.h +++ b/rtgui/batchqueuebuttonset.h @@ -31,9 +31,9 @@ class BatchQueueButtonSet : public LWButtonSet static bool iconsLoaded; public: - static Cairo::RefPtr cancelIcon; - static Cairo::RefPtr headIcon; - static Cairo::RefPtr tailIcon; + static std::shared_ptr cancelIcon; + static std::shared_ptr headIcon; + static std::shared_ptr tailIcon; static Glib::ustring moveHeadToolTip; static Glib::ustring moveEndToolTip; diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index 31a6f40c7..6ab6ccf83 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -22,7 +22,7 @@ #include "guiutils.h" #include "threadutils.h" -#include "rtimage.h" +#include "rtsurface.h" #include "multilangmgr.h" #include "thumbbrowserbase.h" #include "thumbnail.h" @@ -31,7 +31,7 @@ #include "../rtengine/rtengine.h" bool BatchQueueEntry::iconsLoaded(false); -Glib::RefPtr BatchQueueEntry::savedAsIcon; +std::shared_ptr BatchQueueEntry::savedAsIcon; BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm, bool overwrite) : ThumbBrowserEntryBase(fname), @@ -59,7 +59,7 @@ BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine: #endif if (!iconsLoaded) { - savedAsIcon = RTImage::createPixbufFromFile ("save-small.png"); + savedAsIcon = std::shared_ptr(new RTPixbuf("save-small", Gtk::ICON_SIZE_BUTTON)); iconsLoaded = true; } @@ -159,7 +159,7 @@ std::vector> BatchQueueEntry::getIconsOnImageArea () std::vector > ret; if (!outFileName.empty()) { - ret.push_back (savedAsIcon); + ret.push_back (savedAsIcon->get()); } return ret; @@ -168,8 +168,8 @@ std::vector> BatchQueueEntry::getIconsOnImageArea () void BatchQueueEntry::getIconSize (int& w, int& h) const { - w = savedAsIcon->get_width (); - h = savedAsIcon->get_height (); + w = savedAsIcon->get()->get_width (); + h = savedAsIcon->get()->get_height (); } diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index f06b65046..6b57614e8 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -29,6 +29,7 @@ #include "../rtengine/noncopyable.h" class Thumbnail; +class RTPixbuf; namespace rtengine { @@ -61,7 +62,7 @@ class BatchQueueEntry final : public ThumbBrowserEntryBase, public BQEntryUpdate public: - static Glib::RefPtr savedAsIcon; + static std::shared_ptr savedAsIcon; rtengine::ProcessingJob* job; const std::unique_ptr params; diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index 8a6dd25b4..f44c54cd0 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -89,7 +89,7 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr) hb3->pack_start (*outdirFolderButton); outdirFolderButton->signal_pressed().connect( sigc::mem_fun(*this, &BatchQueuePanel::pathFolderButtonPressed) ); outdirFolderButton->set_label(makeFolderLabel(options.savePathFolder)); - Gtk::Image* folderImg = Gtk::manage (new RTImage ("folder-closed.png")); + Gtk::Image* folderImg = Gtk::manage (new RTImage ("folder-closed", Gtk::ICON_SIZE_LARGE_TOOLBAR)); folderImg->show (); outdirFolderButton->set_image (*folderImg); outdirFolder = nullptr; @@ -152,13 +152,13 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr) zoomLabel->set_use_markup (true); zoomBox->pack_start (*zoomLabel, Gtk::PACK_SHRINK, 4); zoomInButton = Gtk::manage (new Gtk::Button ()); - zoomInButton->set_image (*Gtk::manage (new RTImage ("magnifier-plus.png"))); + zoomInButton->set_image (*Gtk::manage (new RTImage ("magnifier-plus", Gtk::ICON_SIZE_LARGE_TOOLBAR))); zoomInButton->signal_pressed().connect (sigc::mem_fun(*batchQueue, &BatchQueue::zoomIn)); zoomInButton->set_relief (Gtk::RELIEF_NONE); zoomInButton->set_tooltip_markup (M("FILEBROWSER_ZOOMINHINT")); zoomBox->pack_end (*zoomInButton, Gtk::PACK_SHRINK); zoomOutButton = Gtk::manage (new Gtk::Button ()); - zoomOutButton->set_image (*Gtk::manage (new RTImage ("magnifier-minus.png"))); + zoomOutButton->set_image (*Gtk::manage (new RTImage ("magnifier-minus", Gtk::ICON_SIZE_LARGE_TOOLBAR))); zoomOutButton->signal_pressed().connect (sigc::mem_fun(*batchQueue, &BatchQueue::zoomOut)); zoomOutButton->set_relief (Gtk::RELIEF_NONE); zoomOutButton->set_tooltip_markup (M("FILEBROWSER_ZOOMOUTHINT")); @@ -208,13 +208,13 @@ void BatchQueuePanel::updateTab (int qsize, int forceOrientation) Gtk::Label* l; if(!qsize ) { - grid->attach_next_to(*Gtk::manage (new RTImage ("gears.png")), Gtk::POS_TOP, 1, 1); + grid->attach_next_to(*Gtk::manage (new RTImage ("gears", Gtk::ICON_SIZE_LARGE_TOOLBAR)), Gtk::POS_TOP, 1, 1); l = Gtk::manage (new Gtk::Label (Glib::ustring(" ") + M("MAIN_FRAME_QUEUE")) ); } else if (qStartStop->get_active()) { - grid->attach_next_to(*Gtk::manage (new RTImage ("gears-play.png")), Gtk::POS_TOP, 1, 1); + grid->attach_next_to(*Gtk::manage (new RTImage ("gears-play", Gtk::ICON_SIZE_LARGE_TOOLBAR)), Gtk::POS_TOP, 1, 1); l = Gtk::manage (new Gtk::Label (Glib::ustring(" ") + M("MAIN_FRAME_QUEUE") + " [" + Glib::ustring::format( qsize ) + "]")); } else { - grid->attach_next_to(*Gtk::manage (new RTImage ("gears-pause.png")), Gtk::POS_TOP, 1, 1); + grid->attach_next_to(*Gtk::manage (new RTImage ("gears-pause", Gtk::ICON_SIZE_LARGE_TOOLBAR)), Gtk::POS_TOP, 1, 1); l = Gtk::manage (new Gtk::Label (Glib::ustring(" ") + M("MAIN_FRAME_QUEUE") + " [" + Glib::ustring::format( qsize ) + "]" )); } @@ -228,13 +228,13 @@ void BatchQueuePanel::updateTab (int qsize, int forceOrientation) } } else { if (!qsize ) { - grid->attach_next_to(*Gtk::manage (new RTImage ("gears.png")), Gtk::POS_RIGHT, 1, 1); + grid->attach_next_to(*Gtk::manage (new RTImage ("gears")), Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage (new Gtk::Label (M("MAIN_FRAME_QUEUE") )), Gtk::POS_RIGHT, 1, 1); } else if (qStartStop->get_active()) { - grid->attach_next_to(*Gtk::manage (new RTImage ("gears-play.png")), Gtk::POS_RIGHT, 1, 1); + grid->attach_next_to(*Gtk::manage (new RTImage ("gears-play")), Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage (new Gtk::Label (M("MAIN_FRAME_QUEUE") + " [" + Glib::ustring::format( qsize ) + "]" )), Gtk::POS_RIGHT, 1, 1); } else { - grid->attach_next_to(*Gtk::manage (new RTImage ("gears-pause.png")), Gtk::POS_RIGHT, 1, 1); + grid->attach_next_to(*Gtk::manage (new RTImage ("gears-pause")), Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage (new Gtk::Label (M("MAIN_FRAME_QUEUE") + " [" + Glib::ustring::format( qsize ) + "]" )), Gtk::POS_RIGHT, 1, 1); } diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index 7b54f09d2..215f28503 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -187,18 +187,18 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB //----------- RGB / ROYGCBPM Mixer ------------------------------ - imgIcon[0] = Gtk::manage (new RTImage ("circle-red-small.png")); - imgIcon[1] = Gtk::manage (new RTImage ("circle-orange-small.png")); - imgIcon[2] = Gtk::manage (new RTImage ("circle-yellow-small.png")); - imgIcon[3] = Gtk::manage (new RTImage ("circle-green-small.png")); - imgIcon[4] = Gtk::manage (new RTImage ("circle-cyan-small.png")); - imgIcon[5] = Gtk::manage (new RTImage ("circle-blue-small.png")); - imgIcon[6] = Gtk::manage (new RTImage ("circle-purple-small.png")); - imgIcon[7] = Gtk::manage (new RTImage ("circle-magenta-small.png")); + imgIcon[0] = Gtk::manage (new RTImage ("circle-red-small")); + imgIcon[1] = Gtk::manage (new RTImage ("circle-orange-small")); + imgIcon[2] = Gtk::manage (new RTImage ("circle-yellow-small")); + imgIcon[3] = Gtk::manage (new RTImage ("circle-green-small")); + imgIcon[4] = Gtk::manage (new RTImage ("circle-cyan-small")); + imgIcon[5] = Gtk::manage (new RTImage ("circle-blue-small")); + imgIcon[6] = Gtk::manage (new RTImage ("circle-purple-small")); + imgIcon[7] = Gtk::manage (new RTImage ("circle-magenta-small")); - imgIcon[8] = Gtk::manage (new RTImage ("circle-empty-red-small.png")); - imgIcon[9] = Gtk::manage (new RTImage ("circle-empty-green-small.png")); - imgIcon[10] = Gtk::manage (new RTImage ("circle-empty-blue-small.png")); + imgIcon[8] = Gtk::manage (new RTImage ("circle-empty-red-small")); + imgIcon[9] = Gtk::manage (new RTImage ("circle-empty-green-small")); + imgIcon[10] = Gtk::manage (new RTImage ("circle-empty-blue-small")); mixerVBox->pack_start (*Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL))); diff --git a/rtgui/cacorrection.cc b/rtgui/cacorrection.cc index 971c0a284..79df63963 100644 --- a/rtgui/cacorrection.cc +++ b/rtgui/cacorrection.cc @@ -30,10 +30,10 @@ using namespace rtengine::procparams; CACorrection::CACorrection () : FoldableToolPanel(this, "cacorrection", M("TP_CACORRECTION_LABEL")) { - Gtk::Image* icaredL = Gtk::manage (new RTImage ("circle-red-cyan-small.png")); - Gtk::Image* icaredR = Gtk::manage (new RTImage ("circle-cyan-red-small.png")); - Gtk::Image* icablueL = Gtk::manage (new RTImage ("circle-blue-yellow-small.png")); - Gtk::Image* icablueR = Gtk::manage (new RTImage ("circle-yellow-blue-small.png")); + Gtk::Image* icaredL = Gtk::manage (new RTImage ("circle-red-cyan-small")); + Gtk::Image* icaredR = Gtk::manage (new RTImage ("circle-cyan-red-small")); + Gtk::Image* icablueL = Gtk::manage (new RTImage ("circle-blue-yellow-small")); + Gtk::Image* icablueR = Gtk::manage (new RTImage ("circle-yellow-blue-small")); red = Gtk::manage (new Adjuster (M("TP_CACORRECTION_RED"), -0.005, 0.005, 0.0001, 0, icaredL, icaredR)); red->setAdjusterListener (this); diff --git a/rtgui/chmixer.cc b/rtgui/chmixer.cc index 619d7be3e..c64b7f252 100644 --- a/rtgui/chmixer.cc +++ b/rtgui/chmixer.cc @@ -28,15 +28,15 @@ using namespace rtengine::procparams; ChMixer::ChMixer (): FoldableToolPanel(this, "chmixer", M("TP_CHMIXER_LABEL"), false, true) { - imgIcon[0] = Gtk::manage (new RTImage ("circle-red-small.png")); - imgIcon[1] = Gtk::manage (new RTImage ("circle-green-red-small.png")); - imgIcon[2] = Gtk::manage (new RTImage ("circle-blue-red-small.png")); - imgIcon[3] = Gtk::manage (new RTImage ("circle-red-green-small.png")); - imgIcon[4] = Gtk::manage (new RTImage ("circle-green-small.png")); - imgIcon[5] = Gtk::manage (new RTImage ("circle-blue-green-small.png")); - imgIcon[6] = Gtk::manage (new RTImage ("circle-red-blue-small.png")); - imgIcon[7] = Gtk::manage (new RTImage ("circle-green-blue-small.png")); - imgIcon[8] = Gtk::manage (new RTImage ("circle-blue-small.png")); + imgIcon[0] = Gtk::manage (new RTImage ("circle-red-small")); + imgIcon[1] = Gtk::manage (new RTImage ("circle-green-red-small")); + imgIcon[2] = Gtk::manage (new RTImage ("circle-blue-red-small")); + imgIcon[3] = Gtk::manage (new RTImage ("circle-red-green-small")); + imgIcon[4] = Gtk::manage (new RTImage ("circle-green-small")); + imgIcon[5] = Gtk::manage (new RTImage ("circle-blue-green-small")); + imgIcon[6] = Gtk::manage (new RTImage ("circle-red-blue-small")); + imgIcon[7] = Gtk::manage (new RTImage ("circle-green-blue-small")); + imgIcon[8] = Gtk::manage (new RTImage ("circle-blue-small")); Gtk::Label* rlabel = Gtk::manage (new Gtk::Label ()); rlabel->set_markup (Glib::ustring("\t") + M("TP_CHMIXER_RED") + Glib::ustring(":")); @@ -108,7 +108,7 @@ void ChMixer::read (const ProcParams* pp, const ParamsEdited* pedited) disableListener (); setEnabled(pp->chmixer.enabled); - + if (pedited) { for (int i = 0; i < 3; i++) { red[i]->setEditedState (pedited->chmixer.red[i] ? Edited : UnEdited); diff --git a/rtgui/coarsepanel.cc b/rtgui/coarsepanel.cc index c64d53017..48f8041df 100644 --- a/rtgui/coarsepanel.cc +++ b/rtgui/coarsepanel.cc @@ -31,25 +31,25 @@ CoarsePanel::CoarsePanel () : ToolPanel (), oldhflip(false), oldvflip(false) degree = 0; degreechanged = true; - Gtk::Image* rotateli = Gtk::manage (new RTImage ("rotate-left-90.png")); + Gtk::Image* rotateli = Gtk::manage (new RTImage ("rotate-left-90", Gtk::ICON_SIZE_LARGE_TOOLBAR)); rotate_left = Gtk::manage (new Gtk::Button ()); rotate_left->add (*rotateli); rotate_left->set_relief(Gtk::RELIEF_NONE); pack_start (*rotate_left); - Gtk::Image* rotateri = Gtk::manage (new RTImage ("rotate-right-90.png")); + Gtk::Image* rotateri = Gtk::manage (new RTImage ("rotate-right-90", Gtk::ICON_SIZE_LARGE_TOOLBAR)); rotate_right = Gtk::manage (new Gtk::Button ()); rotate_right->add (*rotateri); rotate_right->set_relief(Gtk::RELIEF_NONE); pack_start (*rotate_right); - Gtk::Image* fliphi = Gtk::manage (new RTImage ("flip-horizontal.png")); + Gtk::Image* fliphi = Gtk::manage (new RTImage ("flip-horizontal", Gtk::ICON_SIZE_LARGE_TOOLBAR)); hflip = Gtk::manage (new Gtk::ToggleButton ()); hflip->add (*fliphi); hflip->set_relief(Gtk::RELIEF_NONE); pack_start (*hflip); - Gtk::Image* flipvi = Gtk::manage (new RTImage ("flip-vertical.png")); + Gtk::Image* flipvi = Gtk::manage (new RTImage ("flip-vertical", Gtk::ICON_SIZE_LARGE_TOOLBAR)); vflip = Gtk::manage (new Gtk::ToggleButton ()); vflip->add (*flipvi); vflip->set_relief(Gtk::RELIEF_NONE); diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index f579da6e6..8c2a79d63 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -234,7 +234,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" genFrame->set_tooltip_markup (M ("TP_COLORAPP_GEN_TOOLTIP")); genVBox = Gtk::manage ( new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); genVBox->set_spacing (2); - + complexmethod = Gtk::manage (new MyComboBoxText ()); complexmethod->append(M("TP_WAVELET_COMPNORMAL")); complexmethod->append(M("TP_WAVELET_COMPEXPERT")); @@ -245,7 +245,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" complexHBox->pack_start(*complexLabel, Gtk::PACK_SHRINK, 4); complexHBox->pack_start(*complexmethod); genVBox->pack_start (*complexHBox, Gtk::PACK_SHRINK); - + modelmethod = Gtk::manage (new MyComboBoxText ()); modelmethod->append(M("TP_COLORAPP_MOD02")); modelmethod->append(M("TP_COLORAPP_MOD16")); @@ -268,7 +268,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" catHBox->pack_start(*catLabel, Gtk::PACK_SHRINK, 4); catHBox->pack_start(*catmethod); genVBox->pack_start (*catHBox, Gtk::PACK_SHRINK); - + presetcat02 = Gtk::manage (new Gtk::CheckButton (M ("TP_COLORAPP_PRESETCAT02"))); presetcat02->set_tooltip_markup (M("TP_COLORAPP_PRESETCAT02_TIP")); presetcat02conn = presetcat02->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::presetcat02pressed)); @@ -324,7 +324,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" wbmHBox = Gtk::manage (new Gtk::Box ()); - + wbmHBox->set_spacing (2); wbmHBox->set_tooltip_markup (M ("TP_COLORAPP_MODEL_TOOLTIP")); Gtk::Label* wbmLab = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_MODEL") + ":")); @@ -358,10 +358,10 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" illumHBox->pack_start (*illum); p1VBox->pack_start (*illumHBox); - Gtk::Image* itempL = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* itempR = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* igreenL = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenR = Gtk::manage (new RTImage ("circle-green-small.png")); + Gtk::Image* itempL = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* itempR = Gtk::manage (new RTImage ("circle-yellow-small")); + Gtk::Image* igreenL = Gtk::manage (new RTImage ("circle-magenta-small")); + Gtk::Image* igreenR = Gtk::manage (new RTImage ("circle-green-small")); tempsc = Gtk::manage (new Adjuster (M ("TP_WBALANCE_TEMPERATURE"), MINTEMP0, MAXTEMP0, 5, CENTERTEMP0, itempL, itempR, &wbSlider2Temp, &wbTemp2Slider)); @@ -649,10 +649,10 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" p3VBox = Gtk::manage ( new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); p3VBox->set_spacing (2); - Gtk::Image* itempL1 = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* itempR1 = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* igreenL1 = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenR1 = Gtk::manage (new RTImage ("circle-green-small.png")); + Gtk::Image* itempL1 = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* itempR1 = Gtk::manage (new RTImage ("circle-yellow-small")); + Gtk::Image* igreenL1 = Gtk::manage (new RTImage ("circle-magenta-small")); + Gtk::Image* igreenR1 = Gtk::manage (new RTImage ("circle-green-small")); adaplum = Gtk::manage (new Adjuster (M ("TP_COLORAPP_ABSOLUTELUMINANCE"), MINLA0, MAXLA0, 0.01, 16.));//, NULL, NULL, &wbSlider2la, &wbla2Slider)); adaplum->setLogScale(500, 0); @@ -662,8 +662,8 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" adaplum->set_tooltip_markup (M ("TP_COLORAPP_VIEWING_ABSOLUTELUMINANCE_TOOLTIP")); p3VBox->pack_start (*adaplum); -// Gtk::Image* iblueredL = Gtk::manage (new RTImage ("circle-blue-small.png")); -// Gtk::Image* iblueredR = Gtk::manage (new RTImage ("circle-red-small.png")); +// Gtk::Image* iblueredL = Gtk::manage (new RTImage ("circle-blue-small")); +// Gtk::Image* iblueredR = Gtk::manage (new RTImage ("circle-red-small")); degreeout = Gtk::manage (new Adjuster (M ("TP_COLORAPP_CIECAT_DEGREE"), 0., 100., 1., 90.)); @@ -675,10 +675,10 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" degreeout->addAutoButton (M ("TP_COLORAPP_CAT02ADAPTATION_TOOLTIP")); p3VBox->pack_start (*degreeout); /* - Gtk::Image* itempL1 = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* itempR1 = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* igreenL1 = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenR1 = Gtk::manage (new RTImage ("circle-green-small.png")); + Gtk::Image* itempL1 = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* itempR1 = Gtk::manage (new RTImage ("circle-yellow-small")); + Gtk::Image* igreenL1 = Gtk::manage (new RTImage ("circle-magenta-small")); + Gtk::Image* igreenR1 = Gtk::manage (new RTImage ("circle-green-small")); */ tempout = Gtk::manage (new Adjuster (M ("TP_WBALANCE_TEMPERATURE"), MINTEMP0, MAXTEMP0, 5, CENTERTEMP0, itempR1, itempL1, &wbSlider2Temp, &wbTemp2Slider)); greenout = Gtk::manage (new Adjuster (M ("TP_WBALANCE_GREEN"), MINGREEN0, MAXGREEN0, 0.001, 1.0, igreenR1, igreenL1)); @@ -742,7 +742,7 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel (this, "colorappearance" //reset button neutral = Gtk::manage (new Gtk::Button (M ("TP_COLORAPP_NEUTRAL"))); setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - RTImage *resetImg = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); + RTImage* const resetImg = Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON)); setExpandAlignProperties (resetImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); neutral->set_image (*resetImg); neutral->set_tooltip_text (M ("TP_COLORAPP_NEUTRAL_TIP")); @@ -887,7 +887,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) nexttemp = pp->wb.temperature; nextgreen = 1.; //pp->wb.green; - + if (pedited) { degree->setEditedState (pedited->colorappearance.degree ? Edited : UnEdited); degreeout->setEditedState (pedited->colorappearance.degreeout ? Edited : UnEdited); @@ -959,7 +959,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) } else if (pp->colorappearance.complexmethod == "expert") { complexmethod->set_active(1); } - + modelmethod->set_active(0); if (pp->colorappearance.modelmethod == "02") { @@ -1374,7 +1374,7 @@ void ColorAppearance::updateGUIToMode(int mode) badpixsl->hide(); datacie->hide(); } else { - alHBox->show(); + alHBox->show(); wbmHBox->show(); curveEditorG->show(); curveEditorG2->show(); @@ -1416,7 +1416,7 @@ void ColorAppearance::convertParamToNormal() } void ColorAppearance::complexmethodChanged() -{ +{ if (complexmethod->get_active_row_number() == 0) { updateGUIToMode(0); convertParamToNormal(); @@ -1431,7 +1431,7 @@ void ColorAppearance::complexmethodChanged() } void ColorAppearance::modelmethodChanged() -{ +{ if (listener && (multiImage || getEnabled())) { listener->panelChanged(EvCATmodel, modelmethod->get_active_text()); @@ -1439,7 +1439,7 @@ void ColorAppearance::modelmethodChanged() } void ColorAppearance::catmethodChanged() -{ +{ if (catmethod->get_active_row_number() == 1) { disableListener(); @@ -1488,7 +1488,7 @@ void ColorAppearance::catmethodChanged() degreeout->setValue(90); ybout->setValue(18); tempout->setValue (nexttemp); - + /* if(tempout->getAutoValue()) { tempout->resetValue (false); } else { @@ -1498,7 +1498,7 @@ void ColorAppearance::catmethodChanged() */ greenout->setValue (nextgreen); enableListener(); - + } else if (catmethod->get_active_row_number() == 0) { disableListener(); degree->setAutoValue (true); @@ -1756,7 +1756,7 @@ void ColorAppearance::presetcat02pressed () //keep in case of... degreeout->setValue(90); ybout->setValue(18); tempout->setValue (nexttemp); - + /* if(tempout->getAutoValue()) { tempout->resetValue (false); } else { @@ -1816,7 +1816,7 @@ void ColorAppearance::presetcat02pressed () //keep in case of... tempout->resetValue (false); greenout->resetValue (false); enableListener(); - + } if (batchMode) { if (presetcat02->get_inconsistent()) { @@ -2005,7 +2005,7 @@ void ColorAppearance::adapCamChanged (double cadap) if(presetcat02->get_active()){ return; } - + idle_register.add( [this, cadap]() -> bool { @@ -2020,7 +2020,7 @@ void ColorAppearance::adapCamChanged (double cadap) void ColorAppearance::wbCamChanged (double temp, double tin) { - + idle_register.add( [this, temp, tin]() -> bool { @@ -2132,7 +2132,7 @@ void ColorAppearance::adjusterAutoToggled(Adjuster* a) tempout->setAutoValue (true); } } -*/ +*/ if (multiImage) { if (degree->getAutoInconsistent()) { degree->setAutoInconsistent (false); @@ -2276,7 +2276,7 @@ void ColorAppearance::wbmodelChanged () tempsc->hide(); greensc->hide(); tempsc->setValue (5003); - greensc->setValue (1); + greensc->setValue (1); } if (wbmodel->get_active_row_number() == 2) { diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index 0140c5b62..43332a500 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -127,8 +127,8 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR pack_start( *opacityCurveEditorG, Gtk::PACK_SHRINK, 2); //---------Chroma curve 1 -------------------- - iby = Gtk::manage (new RTImage ("circle-yellow-blue-small.png")); - irg = Gtk::manage (new RTImage ("circle-green-red-small.png")); + iby = Gtk::manage (new RTImage ("circle-yellow-blue-small")); + irg = Gtk::manage (new RTImage ("circle-green-red-small")); clCurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_CHROMAC")); clCurveEditorG->setCurveListener (this); @@ -169,7 +169,7 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR //--------------------- Reset curves ----------------------------- /* Each curve can reset to a different curve, so this button only save one click now... so we remove it. neutralCurves = Gtk::manage (new Gtk::Button (M("TP_COLORTONING_NEUTRALCUR"))); - RTImage *resetImgc = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); + RTImage *resetImgc = Gtk::manage (new RTImage ("undo-small")); neutralCurves->set_image(*resetImgc); neutralCurves->set_tooltip_text (M("TP_COLORTONING_NEUTRALCUR_TIP")); neutralcurvesconn = neutralCurves->signal_pressed().connect( sigc::mem_fun(*this, &ColorToning::neutralCurves_pressed) ); @@ -249,26 +249,26 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR Gtk::Box* chanMixerMidBox = Gtk::manage (new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); Gtk::Box* chanMixerShadowsBox = Gtk::manage (new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); - Gtk::Image* iblueR = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iyelL = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* imagL = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenR = Gtk::manage (new RTImage ("circle-green-small.png")); - Gtk::Image* icyanL = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iredR = Gtk::manage (new RTImage ("circle-red-small.png")); + Gtk::Image* iblueR = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* iyelL = Gtk::manage (new RTImage ("circle-yellow-small")); + Gtk::Image* imagL = Gtk::manage (new RTImage ("circle-magenta-small")); + Gtk::Image* igreenR = Gtk::manage (new RTImage ("circle-green-small")); + Gtk::Image* icyanL = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* iredR = Gtk::manage (new RTImage ("circle-red-small")); - Gtk::Image* iblueRm = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iyelLm = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* imagLm = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenRm = Gtk::manage (new RTImage ("circle-green-small.png")); - Gtk::Image* icyanLm = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iredRm = Gtk::manage (new RTImage ("circle-red-small.png")); + Gtk::Image* iblueRm = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* iyelLm = Gtk::manage (new RTImage ("circle-yellow-small")); + Gtk::Image* imagLm = Gtk::manage (new RTImage ("circle-magenta-small")); + Gtk::Image* igreenRm = Gtk::manage (new RTImage ("circle-green-small")); + Gtk::Image* icyanLm = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* iredRm = Gtk::manage (new RTImage ("circle-red-small")); - Gtk::Image* iblueRh = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iyelLh = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* imagLh = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenRh = Gtk::manage (new RTImage ("circle-green-small.png")); - Gtk::Image* icyanLh = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iredRh = Gtk::manage (new RTImage ("circle-red-small.png")); + Gtk::Image* iblueRh = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* iyelLh = Gtk::manage (new RTImage ("circle-yellow-small")); + Gtk::Image* imagLh = Gtk::manage (new RTImage ("circle-magenta-small")); + Gtk::Image* igreenRh = Gtk::manage (new RTImage ("circle-green-small")); + Gtk::Image* icyanLh = Gtk::manage (new RTImage ("circle-blue-small")); + Gtk::Image* iredRh = Gtk::manage (new RTImage ("circle-red-small")); redhigh = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., icyanLh, iredRh )); greenhigh = Gtk::manage (new Adjuster ("", -100., 100., 1., 0., imagLh , igreenRh)); @@ -299,7 +299,7 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR chanMixerHLFrame->set_label_align (0.025, 0.5); chanMixerMidFrame->set_label_align (0.025, 0.5); chanMixerShadowsFrame->set_label_align (0.025, 0.5); - + chanMixerHLFrame->add(*chanMixerHLBox); chanMixerMidFrame->add(*chanMixerMidBox); chanMixerShadowsFrame->add(*chanMixerShadowsBox); @@ -393,23 +393,23 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR hb->pack_start(*labRegionList, Gtk::PACK_EXPAND_WIDGET); Gtk::Box* vb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); labRegionAdd = Gtk::manage(new Gtk::Button()); - labRegionAdd->add(*Gtk::manage(new RTImage("add-small.png"))); + labRegionAdd->add(*Gtk::manage(new RTImage("add-small", Gtk::ICON_SIZE_BUTTON))); labRegionAdd->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionAddPressed)); add_button(labRegionAdd, vb); labRegionRemove = Gtk::manage(new Gtk::Button()); - labRegionRemove->add(*Gtk::manage(new RTImage("remove-small.png"))); + labRegionRemove->add(*Gtk::manage(new RTImage("remove-small", Gtk::ICON_SIZE_BUTTON))); labRegionRemove->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionRemovePressed)); add_button(labRegionRemove, vb); labRegionUp = Gtk::manage(new Gtk::Button()); - labRegionUp->add(*Gtk::manage(new RTImage("arrow-up-small.png"))); + labRegionUp->add(*Gtk::manage(new RTImage("arrow-up-small", Gtk::ICON_SIZE_BUTTON))); labRegionUp->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionUpPressed)); add_button(labRegionUp, vb); labRegionDown = Gtk::manage(new Gtk::Button()); - labRegionDown->add(*Gtk::manage(new RTImage("arrow-down-small.png"))); + labRegionDown->add(*Gtk::manage(new RTImage("arrow-down-small", Gtk::ICON_SIZE_BUTTON))); labRegionDown->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionDownPressed)); add_button(labRegionDown, vb); labRegionCopy = Gtk::manage(new Gtk::Button()); - labRegionCopy->add(*Gtk::manage(new RTImage("arrow-right-small.png"))); + labRegionCopy->add(*Gtk::manage(new RTImage("arrow-right-small", Gtk::ICON_SIZE_BUTTON))); labRegionCopy->signal_clicked().connect(sigc::mem_fun(*this, &ColorToning::labRegionCopyPressed)); add_button(labRegionCopy, vb); hb->pack_start(*vb, Gtk::PACK_SHRINK); @@ -717,7 +717,7 @@ void ColorToning::write (ProcParams* pp, ParamsEdited* pedited) pp->colorToning.strength = strength->getIntValue(); double zerox = 0.; double zeroy = 0.; - + labgrid->getParams(pp->colorToning.labgridALow, pp->colorToning.labgridBLow, pp->colorToning.labgridAHigh, pp->colorToning.labgridBHigh, zerox, zeroy, zerox, zeroy); pp->colorToning.labgridALow *= ColorToningParams::LABGRID_CORR_MAX; pp->colorToning.labgridAHigh *= ColorToningParams::LABGRID_CORR_MAX; @@ -1570,7 +1570,7 @@ void ColorToning::labRegionShow(int idx, bool list_only) disableListener(); } rtengine::procparams::ColorToningParams::LabCorrectionRegion dflt; - auto &r = labRegionData[idx]; + auto &r = labRegionData[idx]; if (!list_only) { labRegionAB->setParams(0, 0, r.a, r.b,0, 0, 0, 0, false); labRegionSaturation->setValue(r.saturation); diff --git a/rtgui/controllines.cc b/rtgui/controllines.cc index d28ef12ca..3ef144295 100644 --- a/rtgui/controllines.cc +++ b/rtgui/controllines.cc @@ -92,14 +92,14 @@ ControlLineManager::ControlLineManager(): canvas_area->topLeft = Coord(0, 0); mouseOverGeometry.push_back(canvas_area.get()); - line_icon_h = Cairo::RefPtr(new RTSurface( - "bidirectional-arrow-horizontal-hicontrast.png")); - line_icon_v = Cairo::RefPtr(new RTSurface( - "bidirectional-arrow-vertical-hicontrast.png")); - line_icon_h_prelight = Cairo::RefPtr(new RTSurface( - "bidirectional-arrow-horizontal-prelight.png")); - line_icon_v_prelight = Cairo::RefPtr(new RTSurface( - "bidirectional-arrow-vertical-prelight.png")); + line_icon_h = std::shared_ptr(new RTSurface( + "bidirectional-arrow-horizontal-hicontrast", Gtk::ICON_SIZE_BUTTON)); + line_icon_v = std::shared_ptr(new RTSurface( + "bidirectional-arrow-vertical-hicontrast", Gtk::ICON_SIZE_BUTTON)); + line_icon_h_prelight = std::shared_ptr(new RTSurface( + "bidirectional-arrow-horizontal-prelight", Gtk::ICON_SIZE_BUTTON)); + line_icon_v_prelight = std::shared_ptr(new RTSurface( + "bidirectional-arrow-vertical-prelight", Gtk::ICON_SIZE_BUTTON)); } ControlLineManager::~ControlLineManager() = default; @@ -438,8 +438,8 @@ void ControlLineManager::addLine(Coord begin, Coord end, line->begin = begin; line->end = end; - const Cairo::RefPtr null_surface = - Cairo::RefPtr(nullptr); + const std::shared_ptr null_surface = + std::shared_ptr(nullptr); icon_h = std::make_shared(line_icon_h, null_surface, line_icon_h_prelight, diff --git a/rtgui/controllines.h b/rtgui/controllines.h index 9e850da1c..e440f838f 100644 --- a/rtgui/controllines.h +++ b/rtgui/controllines.h @@ -60,8 +60,8 @@ protected: bool drawing_line; bool edited; std::size_t horizontalCount, verticalCount; - Cairo::RefPtr line_icon_h, line_icon_v; - Cairo::RefPtr line_icon_h_prelight, line_icon_v_prelight; + std::shared_ptr line_icon_h, line_icon_v; + std::shared_ptr line_icon_h_prelight, line_icon_v_prelight; int prev_obj; int selected_object; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 400309512..1e986eed7 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -72,14 +72,14 @@ ControlSpotPanel::ControlSpotPanel(): struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1.0, 12.0, 0.1, 4.0))), thresh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRESDELTAE"), 0.0, 10.0, 0.1, 2.0))), iter_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_PROXI"), 0.2, 10.0, 0.1, 2.0))), - balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), - balanh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALANH"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee-logo-16.png")), Gtk::manage(new RTImage("circle-red-green-small.png"))))), - colorde_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORDE"), -15, 15, 2, 5, Gtk::manage(new RTImage("circle-blue-yellow-small.png")), Gtk::manage(new RTImage("circle-gray-green-small.png"))))), + balan_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALAN"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee")), Gtk::manage(new RTImage("circle-white-small"))))), + balanh_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BALANH"), 0.2, 2.5, 0.1, 1.0, Gtk::manage(new RTImage("rawtherapee")), Gtk::manage(new RTImage("circle-red-green-small"))))), + colorde_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORDE"), -15, 15, 2, 5, Gtk::manage(new RTImage("circle-blue-yellow-small")), Gtk::manage(new RTImage("circle-gray-green-small"))))), colorscope_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_COLORSCOPE"), 0., 100.0, 1., 30.))), avoidrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_AVOIDRAD"), 0., 30.0, 0.1, 0.7))), scopemask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCOPEMASK"), 0, 100, 1, 60))), denoichmask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DENOIMASK"), 0., 100., 0.5, 0))), - lumask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMASK"), -50, 30, 1, 10, Gtk::manage(new RTImage("circle-yellow-small.png")), Gtk::manage(new RTImage("circle-gray-small.png")) ))), + lumask_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LUMASK"), -50, 30, 1, 10, Gtk::manage(new RTImage("circle-yellow-small")), Gtk::manage(new RTImage("circle-gray-small")) ))), hishow_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_PREVSHOW")))), activ_(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_ACTIVSPOT")))), @@ -121,7 +121,7 @@ ControlSpotPanel::ControlSpotPanel(): prevMethodconn_ = prevMethod_->signal_changed().connect( sigc::mem_fun( *this, &ControlSpotPanel::prevMethodChanged)); - + // ctboxprevmethod->pack_start(*prevMethod_); pack_start(*ctboxprevmethod); @@ -253,7 +253,7 @@ ControlSpotPanel::ControlSpotPanel(): sensiexclu_->setAdjusterListener(this); structexclu_->setAdjusterListener(this); structexclu_->setLogScale(10, 0); - + excluBox->pack_start(*sensiexclu_); excluBox->pack_start(*structexclu_); excluFrame->add(*excluBox); @@ -385,7 +385,7 @@ ControlSpotPanel::ControlSpotPanel(): expShapeDetect_->add(*artifBox, false); pack_start(*expShapeDetect_, false, false); ToolParamBlock* const artifBox2 = Gtk::manage(new ToolParamBlock()); - + artifBox2->pack_start(*preview_); artifBox2->pack_start(*colorscope_); pack_start(*artifBox2); @@ -401,7 +401,7 @@ ControlSpotPanel::ControlSpotPanel(): sigc::mem_fun(*this, &ControlSpotPanel::avoidChanged)); avoidmunConn_ = avoidmun_->signal_toggled().connect( sigc::mem_fun(*this, &ControlSpotPanel::avoidmunChanged)); - + Gtk::Frame* const avFrame = Gtk::manage(new Gtk::Frame()); ToolParamBlock* const avbox = Gtk::manage(new ToolParamBlock()); avFrame->set_label_align(0.025, 0.5); @@ -455,7 +455,7 @@ ControlSpotPanel::ControlSpotPanel(): ctboxwavmethod->pack_start(*wavMethod_); specCaseBox->pack_start(*ctboxwavmethod); - + expSpecCases_->add(*specCaseBox, false); pack_start(*expSpecCases_, false, false); @@ -1297,7 +1297,7 @@ void ControlSpotPanel::updateParamVisibility() ctboxshape->show(); } - + } void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) diff --git a/rtgui/crop.cc b/rtgui/crop.cc index 853cec255..bf26dcc63 100644 --- a/rtgui/crop.cc +++ b/rtgui/crop.cc @@ -174,12 +174,12 @@ Crop::Crop(): selectCrop = Gtk::manage (new Gtk::Button (M("TP_CROP_SELECTCROP"))); setExpandAlignProperties(selectCrop, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); selectCrop->get_style_context()->add_class("independent"); - selectCrop->set_image (*Gtk::manage (new RTImage ("crop-small.png"))); + selectCrop->set_image (*Gtk::manage (new RTImage ("crop-small", Gtk::ICON_SIZE_BUTTON))); resetCrop = Gtk::manage (new Gtk::Button (M("TP_CROP_RESETCROP"))); setExpandAlignProperties(resetCrop, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); resetCrop->get_style_context()->add_class("independent"); - resetCrop->set_image (*Gtk::manage (new RTImage ("undo-small.png"))); + resetCrop->set_image (*Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON))); methodgrid->attach (*xlab, 0, 0, 1, 1); methodgrid->attach (*x, 1, 0, 1, 1); @@ -592,11 +592,11 @@ void Crop::doresetCrop () yDirty = true; wDirty = true; hDirty = true; - + // Reset ratio, ratio lock and orientation as well ratio->set_active(0); orientation->set_active(2); - fixr->set_active(true); + fixr->set_active(true); int X = 0; int Y = 0; diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index c7d7348b3..a5f332f9f 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -64,7 +64,21 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet Glib::RefPtr context = parent->get_pango_context () ; Pango::FontDescription fontd = context->get_font_description (); fontd.set_weight (Pango::WEIGHT_BOLD); - fontd.set_size(8 * Pango::SCALE); + // Absolute size is defined in "Pango units" and shall be multiplied by + // Pango::SCALE from "px" + const int fontSize = 8; + const int absoluteFontSize = fontSize * Pango::SCALE; + // Guessing that absolute pixel size is given for a 96 DPI reference: +#ifndef __APPLE__ + const double fontScale = static_cast(RTScalable::getDPI()) + / static_cast(RTScalable::pangoDPI) + * RTScalable::getScale(); // Refer to notes in rtscalable.h +#else + // On MacOS, font is already scaled by the System library + // Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c + const double fontScale = 1.; +#endif + fontd.set_absolute_size (static_cast(absoluteFontSize) * fontScale); context->set_font_description (fontd); Glib::RefPtr cllayout = parent->create_pango_layout("1000%"); @@ -80,11 +94,11 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet closett = "Close"; initialized = true; } - bZoomOut = new LWButton(Cairo::RefPtr(new RTSurface("magnifier-minus-small.png")), 0, nullptr, LWButton::Left, LWButton::Center, &zoomOuttt); - bZoomIn = new LWButton(Cairo::RefPtr(new RTSurface("magnifier-plus-small.png")), 1, nullptr, LWButton::Left, LWButton::Center, &zoomIntt); - bZoom100 = new LWButton(Cairo::RefPtr(new RTSurface("magnifier-1to1-small.png")), 2, nullptr, LWButton::Left, LWButton::Center, &zoom100tt); - //bZoomFit = new LWButton (Cairo::RefPtr(new RTSurface("magnifier-fit.png")), 3, NULL, LWButton::Left, LWButton::Center, "Zoom Fit"); - bClose = new LWButton(Cairo::RefPtr(new RTSurface("cancel-small.png")), 4, nullptr, LWButton::Right, LWButton::Center, &closett); + bZoomOut = new LWButton(std::shared_ptr(new RTSurface("magnifier-minus-small", Gtk::ICON_SIZE_BUTTON)), 0, nullptr, LWButton::Left, LWButton::Center, &zoomOuttt); + bZoomIn = new LWButton(std::shared_ptr(new RTSurface("magnifier-plus-small", Gtk::ICON_SIZE_BUTTON)), 1, nullptr, LWButton::Left, LWButton::Center, &zoomIntt); + bZoom100 = new LWButton(std::shared_ptr(new RTSurface("magnifier-1to1-small", Gtk::ICON_SIZE_BUTTON)), 2, nullptr, LWButton::Left, LWButton::Center, &zoom100tt); + //bZoomFit = new LWButton (std::shared_ptr(new RTSurface("magnifier-fit", Gtk::ICON_SIZE_BUTTON)), 3, NULL, LWButton::Left, LWButton::Center, "Zoom Fit"); + bClose = new LWButton(std::shared_ptr(new RTSurface("cancel-small", Gtk::ICON_SIZE_BUTTON)), 4, nullptr, LWButton::Right, LWButton::Center, &closett); buttonSet.add (bZoomOut); buttonSet.add (bZoomIn); @@ -2451,7 +2465,21 @@ void CropWindow::drawDecoration (Cairo::RefPtr cr) Glib::RefPtr context = iarea->get_pango_context () ; Pango::FontDescription fontd = context->get_font_description (); fontd.set_weight (Pango::WEIGHT_BOLD); - fontd.set_size(8 * Pango::SCALE); + // Absolute size is defined in "Pango units" and shall be multiplied by + // Pango::SCALE from "px" + const int fontSize = 8; + const int absoluteFontSize = fontSize * Pango::SCALE; + // Guessing that absolute pixel size is given for a 96 DPI reference: +#ifndef __APPLE__ + const double fontScale = static_cast(RTScalable::getDPI()) + / static_cast(RTScalable::pangoDPI) + * RTScalable::getScale(); // Refer to notes in rtscalable.h +#else + // On MacOS, font is already scaled by the System library + // Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c + const double fontScale = 1.; +#endif + fontd.set_absolute_size (static_cast(absoluteFontSize) * fontScale); context->set_font_description (fontd); Glib::RefPtr cllayout = iarea->create_pango_layout(cropLabel); int iw, ih; @@ -2515,7 +2543,21 @@ void CropWindow::drawStraightenGuide (Cairo::RefPtr cr) Glib::RefPtr context = iarea->get_pango_context () ; Pango::FontDescription fontd = context->get_font_description (); fontd.set_weight (Pango::WEIGHT_BOLD); - fontd.set_size (8 * Pango::SCALE); + // Absolute size is defined in "Pango units" and shall be multiplied by + // Pango::SCALE from "px" + const int fontSize = 8; + const int absoluteFontSize = fontSize * Pango::SCALE; + // Guessing that absolute pixel size is given for a 96 DPI reference: +#ifndef __APPLE__ + const double fontScale = static_cast(RTScalable::getDPI()) + / static_cast(RTScalable::pangoDPI) + * RTScalable::getScale(); // Refer to notes in rtscalable.h +#else + // On MacOS, font is already scaled by the System library + // Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c + const double fontScale = 1.; +#endif + fontd.set_absolute_size (static_cast(absoluteFontSize) * fontScale); context->set_font_description (fontd); Glib::RefPtr deglayout = iarea->create_pango_layout(Glib::ustring::compose ("%1 deg", Glib::ustring::format(std::setprecision(2), rot_deg))); diff --git a/rtgui/cursormanager.cc b/rtgui/cursormanager.cc index e915150aa..f683e9964 100644 --- a/rtgui/cursormanager.cc +++ b/rtgui/cursormanager.cc @@ -17,8 +17,7 @@ * along with RawTherapee. If not, see . */ #include "cursormanager.h" - -#include "rtimage.h" +#include "rtsurface.h" CursorManager mainWindowCursorManager; CursorManager editWindowCursorManager; @@ -35,74 +34,46 @@ void CursorManager::init (Glib::RefPtr mainWindow) #endif - Glib::RefPtr add = RTImage::createPixbufFromFile("crosshair-small.png"); - Glib::RefPtr colPick = RTImage::createPixbufFromFile("color-picker-hicontrast.png"); - Glib::RefPtr colPickAdd = RTImage::createPixbufFromFile("color-picker-add-hicontrast.png"); - Glib::RefPtr cropDraw = RTImage::createPixbufFromFile("crop-point-hicontrast.png"); - Glib::RefPtr crosshair = RTImage::createPixbufFromFile("crosshair-hicontrast.png"); - Glib::RefPtr empty = RTImage::createPixbufFromFile("empty.png"); - Glib::RefPtr handClosed = RTImage::createPixbufFromFile("hand-closed-hicontrast.png"); - Glib::RefPtr handOpen = RTImage::createPixbufFromFile("hand-open-hicontrast.png"); - Glib::RefPtr moveBL = RTImage::createPixbufFromFile("node-move-sw-ne-hicontrast.png"); - Glib::RefPtr moveBR = RTImage::createPixbufFromFile("node-move-nw-se-hicontrast.png"); - Glib::RefPtr moveL = RTImage::createPixbufFromFile("node-move-x-hicontrast.png"); - Glib::RefPtr moveR = RTImage::createPixbufFromFile("node-move-x-hicontrast.png"); - Glib::RefPtr moveTL = RTImage::createPixbufFromFile("node-move-nw-se-hicontrast.png"); - Glib::RefPtr moveTR = RTImage::createPixbufFromFile("node-move-sw-ne-hicontrast.png"); - Glib::RefPtr moveX = RTImage::createPixbufFromFile("node-move-x-hicontrast.png"); - Glib::RefPtr moveXY = RTImage::createPixbufFromFile("node-move-xy-hicontrast.png"); - Glib::RefPtr moveY = RTImage::createPixbufFromFile("node-move-y-hicontrast.png"); - Glib::RefPtr rotate = RTImage::createPixbufFromFile("rotate-aroundnode-hicontrast.png"); - Glib::RefPtr wait = RTImage::createPixbufFromFile("gears.png"); // Currently unused, create *-hicontrast once used. + auto createCursor = [this] (const Glib::ustring &name, const Gdk::CursorType &fb_cursor) -> Glib::RefPtr + { + // Gdk Cursor Theme is not supported on some OS (ex : MacOS) + // Cursor is retrieved from theme thanks to an RTSurface + auto cursor_surf = RTSurface(name, Gtk::ICON_SIZE_MENU); + auto cursor = Gdk::Cursor::create(this->display, + cursor_surf.get(), + cursor_surf.getWidth() / 2, + cursor_surf.getHeight() / 2); - double s = RTScalable::getTweakedDPI() / RTScalable::baseDPI; // RTScalable::getDPI() might be preferable, however it imply a lot of work to support this option + if (!cursor) { + cursor = Gdk::Cursor::create(this->display, fb_cursor); + } - cAdd = add ? Gdk::Cursor::create(display, add, (int)(8.*s), (int)(8.*s)) : Gdk::Cursor::create(display, Gdk::PLUS); - cAddPicker = colPickAdd ? Gdk::Cursor::create(display, colPickAdd, (int)(4.*s), (int)(21.*s)) : Gdk::Cursor::create(display, Gdk::PLUS); - cCropDraw = cropDraw ? Gdk::Cursor::create(display, cropDraw, (int)(3.*s), (int)(3.*s)) : Gdk::Cursor::create(display, Gdk::DIAMOND_CROSS); - cCrosshair = crosshair ? Gdk::Cursor::create(display, crosshair, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::CROSSHAIR); - cEmpty = empty ? Gdk::Cursor::create(display, empty, 12, 12) /* PNG: do not scale */ : Gdk::Cursor::create(display, Gdk::BLANK_CURSOR); - cHandClosed = handClosed ? Gdk::Cursor::create(display, handClosed, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::HAND1); - cHandOpen = handOpen ? Gdk::Cursor::create(display, handOpen, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::HAND2); - cMoveBL = moveBL ? Gdk::Cursor::create(display, moveBL, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::BOTTOM_LEFT_CORNER); - cMoveBR = moveBR ? Gdk::Cursor::create(display, moveBR, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::BOTTOM_RIGHT_CORNER); - cMoveL = moveL ? Gdk::Cursor::create(display, moveL, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::SB_LEFT_ARROW); - cMoveR = moveR ? Gdk::Cursor::create(display, moveR, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::SB_RIGHT_ARROW); - cMoveTL = moveTL ? Gdk::Cursor::create(display, moveTL, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::TOP_LEFT_CORNER); - cMoveTR = moveTR ? Gdk::Cursor::create(display, moveTR, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::TOP_RIGHT_CORNER); - cMoveX = moveX ? Gdk::Cursor::create(display, moveX, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::SB_H_DOUBLE_ARROW); - cMoveXY = moveXY ? Gdk::Cursor::create(display, moveXY, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::FLEUR); - cMoveY = moveY ? Gdk::Cursor::create(display, moveY, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::SB_V_DOUBLE_ARROW); - cRotate = rotate ? Gdk::Cursor::create(display, rotate, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::EXCHANGE); - cWB = colPick ? Gdk::Cursor::create(display, colPick, (int)(4.*s), (int)(21.*s)) : Gdk::Cursor::create(display, Gdk::TARGET); - cWait = wait ? Gdk::Cursor::create(display, wait, (int)(12.*s), (int)(12.*s)) : Gdk::Cursor::create(display, Gdk::CLOCK); + return cursor; + }; + + cAdd = createCursor("crosshair-small", Gdk::PLUS); + cAddPicker = createCursor("color-picker-add-hicontrast", Gdk::PLUS); + cCropDraw = createCursor("crop-point-hicontrast", Gdk::DIAMOND_CROSS); + cCrosshair = createCursor("crosshair-hicontrast", Gdk::CROSSHAIR); + cEmpty = createCursor("empty", Gdk::BLANK_CURSOR); + cHandClosed = createCursor("hand-closed-hicontrast", Gdk::HAND1); + cHandOpen = createCursor("hand-open-hicontrast", Gdk::HAND2); + cMoveBL = createCursor("node-move-sw-ne-hicontrast", Gdk::BOTTOM_LEFT_CORNER); + cMoveBR = createCursor("node-move-nw-se-hicontrast", Gdk::BOTTOM_RIGHT_CORNER); + cMoveL = createCursor("node-move-x-hicontrast", Gdk::SB_LEFT_ARROW); + cMoveR = createCursor("node-move-x-hicontrast", Gdk::SB_RIGHT_ARROW); + cMoveTL = createCursor("node-move-nw-se-hicontrast", Gdk::TOP_LEFT_CORNER); + cMoveTR = createCursor("node-move-sw-ne-hicontrast", Gdk::TOP_RIGHT_CORNER); + cMoveX = createCursor("node-move-x-hicontrast", Gdk::SB_H_DOUBLE_ARROW); + cMoveXY = createCursor("node-move-xy-hicontrast", Gdk::FLEUR); + cMoveY = createCursor("node-move-y-hicontrast", Gdk::SB_V_DOUBLE_ARROW); + cRotate = createCursor("rotate-aroundnode-hicontrast", Gdk::EXCHANGE); + cWB = createCursor("color-picker-hicontrast", Gdk::TARGET); + cWait = createCursor("gears", Gdk::CLOCK); window = mainWindow; } -void CursorManager::cleanup() -{ - cAdd.reset(); - cAddPicker.reset(); - cCropDraw.reset(); - cCrosshair.reset(); - cHandClosed.reset(); - cHandOpen.reset(); - cEmpty.reset(); - cMoveBL.reset(); - cMoveBR.reset(); - cMoveL.reset(); - cMoveR.reset(); - cMoveTL.reset(); - cMoveTR.reset(); - cMoveX.reset(); - cMoveY.reset(); - cMoveXY.reset(); - cRotate.reset(); - cWB.reset(); - cWait.reset(); -} - /* Set the cursor of the given window */ void CursorManager::setCursor (Glib::RefPtr window, CursorShape shape) { diff --git a/rtgui/cursormanager.h b/rtgui/cursormanager.h index 38f198e32..8b506bb1d 100644 --- a/rtgui/cursormanager.h +++ b/rtgui/cursormanager.h @@ -81,7 +81,6 @@ private: public: void init (Glib::RefPtr mainWindow); - void cleanup (); static void setWidgetCursor (Glib::RefPtr window, CursorShape shape); static void setCursorOfMainWindow (Glib::RefPtr window, CursorShape shape); }; diff --git a/rtgui/curveeditor.cc b/rtgui/curveeditor.cc index 67cea5174..efe2ef200 100644 --- a/rtgui/curveeditor.cc +++ b/rtgui/curveeditor.cc @@ -75,11 +75,11 @@ bool CurveEditor::reset() DiagonalCurveEditor::DiagonalCurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEditorSubGroup* ceSubGroup) : CurveEditor::CurveEditor(text, static_cast(ceGroup), ceSubGroup) { - curveType->addEntry("curve-linear-small.png", M("CURVEEDITOR_LINEAR")); // 0 Linear - curveType->addEntry("curve-spline-small.png", M("CURVEEDITOR_CUSTOM")); // 1 Spline - curveType->addEntry("curve-catmullrom-small.png", M("CURVEEDITOR_CATMULLROM")); // 4 CatmullRom - curveType->addEntry("curve-parametric-small.png", M("CURVEEDITOR_PARAMETRIC")); // 2 Parametric - curveType->addEntry("curve-nurbs-small.png", M("CURVEEDITOR_NURBS")); // 3 NURBS + curveType->addEntry("curve-linear-small", M("CURVEEDITOR_LINEAR")); // 0 Linear + curveType->addEntry("curve-spline-small", M("CURVEEDITOR_CUSTOM")); // 1 Spline + curveType->addEntry("curve-catmullrom-small", M("CURVEEDITOR_CATMULLROM")); // 4 CatmullRom + curveType->addEntry("curve-parametric-small", M("CURVEEDITOR_PARAMETRIC")); // 2 Parametric + curveType->addEntry("curve-nurbs-small", M("CURVEEDITOR_NURBS")); // 3 NURBS static_cast(curveType)->setPosIndexMap({ 0, 1, 4, 2, 3 }); curveType->setSelected(DCT_Linear); @@ -199,8 +199,8 @@ FlatCurveEditor::FlatCurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, identityValue = 0.5; // Order set in the same order than "enum FlatCurveType". Shouldn't change, for compatibility reason - curveType->addEntry("curve-flat-small.png", M("CURVEEDITOR_LINEAR")); // 0 Linear - curveType->addEntry("curve-controlpoints-small.png", M("CURVEEDITOR_MINMAXCPOINTS")); // 1 Min/Max ControlPoints + curveType->addEntry("curve-flat-small", M("CURVEEDITOR_LINEAR")); // 0 Linear + curveType->addEntry("curve-controlpoints-small", M("CURVEEDITOR_MINMAXCPOINTS")); // 1 Min/Max ControlPoints curveType->setSelected(FCT_Linear); curveType->show(); } diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index d099e1a99..f348ac33b 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -28,6 +28,7 @@ #include "rtimage.h" #include "options.h" #include "pathutils.h" +#include "rtscalable.h" CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring groupLabel, int blank) : curveDir(curveDir), line(0), curve_reset(nullptr), displayedCurve(nullptr), flatSubGroup(nullptr), diagonalSubGroup(nullptr), cl(nullptr), numberOfPackedCurve(0) @@ -39,9 +40,9 @@ CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring group } else if(blank == 1){ curveGroupLabel = Gtk::manage (new Gtk::Label (groupLabel, Gtk::ALIGN_START)); } - + setExpandAlignProperties(curveGroupLabel, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); - set_row_spacing(RTScalable::getScale()); + set_row_spacing(RTScalable::scalePixelSize(1)); } CurveEditorGroup::~CurveEditorGroup() @@ -129,7 +130,7 @@ void CurveEditorGroup::newLine() if (curveEditors.size() > numberOfPackedCurve) { Gtk::Grid* currLine = Gtk::manage (new Gtk::Grid ()); setExpandAlignProperties(currLine, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - currLine->set_column_spacing(RTScalable::getScale()); + currLine->set_column_spacing(RTScalable::scalePixelSize(1)); bool isHeader = false; int x = 0; @@ -162,7 +163,7 @@ void CurveEditorGroup::newLine() if (isHeader) { curve_reset = Gtk::manage (new Gtk::Button ()); setExpandAlignProperties(curve_reset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - curve_reset->add (*Gtk::manage (new RTImage ("undo-small.png", "redo-small.png"))); + curve_reset->add (*Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON))); curve_reset->set_relief (Gtk::RELIEF_NONE); curve_reset->set_tooltip_text (M("CURVEEDITOR_TOOLTIPLINEAR")); curve_reset->signal_clicked().connect( sigc::mem_fun(*this, &CurveEditorGroup::curveResetPressed) ); @@ -381,7 +382,7 @@ void CurveEditorGroup::setTooltip( Glib::ustring ttip) void CurveEditorGroup::setBatchMode (bool batchMode) { for (std::vector::iterator i = curveEditors.begin(); i != curveEditors.end(); ++i) { - (*i)->curveType->addEntry("template-24.png", M("GENERAL_UNCHANGED")); + (*i)->curveType->addEntry("template-24", M("GENERAL_UNCHANGED")); (*i)->curveType->show(); } } @@ -441,7 +442,7 @@ void CurveEditorSubGroup::initButton (Gtk::Button &button, const Glib::ustring & vAlign = options.curvebboxpos == 0 || options.curvebboxpos == 2 ? Gtk::ALIGN_FILL : Gtk::ALIGN_END; } - button.add (*Gtk::manage (new RTImage (iconName))); + button.add (*Gtk::manage (new RTImage(iconName, Gtk::ICON_SIZE_BUTTON))); button.get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); if (!tooltip.empty()) { button.set_tooltip_text(M(tooltip)); diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index b6b1201a7..1d478b2a3 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -38,7 +38,7 @@ DarkFrame::DarkFrame () : FoldableToolPanel(this, "darkframe", M("TP_DARKFRAME_L bindCurrentFolder (*darkFrameFile, options.lastDarkframeDir); dfLabel = Gtk::manage(new Gtk::Label(M("GENERAL_FILE"))); btnReset = Gtk::manage(new Gtk::Button()); - btnReset->set_image (*Gtk::manage(new RTImage ("cancel-small.png"))); + btnReset->set_image (*Gtk::manage(new RTImage ("cancel-small", Gtk::ICON_SIZE_BUTTON))); hbdf->pack_start(*dfLabel, Gtk::PACK_SHRINK, 0); hbdf->pack_start(*darkFrameFile); hbdf->pack_start(*btnReset, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index f4fc8449e..55d6d457f 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -33,6 +33,7 @@ #include "rtimage.h" #include "options.h" #include "popuptogglebutton.h" +#include "rtscalable.h" #include "../rtengine/curves.h" @@ -85,18 +86,18 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, } editPointCustom = Gtk::manage (new Gtk::ToggleButton ()); - initButton(*editPointCustom, Glib::ustring("edit-point.png"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT"); + initButton(*editPointCustom, Glib::ustring("edit-point"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT"); editCustom = Gtk::manage (new Gtk::ToggleButton()); - initButton(*editCustom, Glib::ustring("crosshair-node-curve.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); + initButton(*editCustom, Glib::ustring("crosshair-node-curve"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); editCustom->hide(); copyCustom = Gtk::manage (new Gtk::Button ()); - initButton(*copyCustom, Glib::ustring("copy.png"), Gtk::ALIGN_END, true); + initButton(*copyCustom, Glib::ustring("copy"), Gtk::ALIGN_END, true); pasteCustom = Gtk::manage (new Gtk::Button ()); - initButton(*pasteCustom, Glib::ustring("paste.png"), Gtk::ALIGN_END, false); + initButton(*pasteCustom, Glib::ustring("paste"), Gtk::ALIGN_END, false); loadCustom = Gtk::manage (new Gtk::Button ()); - initButton(*loadCustom, Glib::ustring("folder-open.png"), Gtk::ALIGN_END, false); + initButton(*loadCustom, Glib::ustring("folder-open"), Gtk::ALIGN_END, false); saveCustom = Gtk::manage (new Gtk::Button ()); - initButton(*saveCustom, Glib::ustring("save.png"), Gtk::ALIGN_END, false); + initButton(*saveCustom, Glib::ustring("save"), Gtk::ALIGN_END, false); custombbox->attach_next_to(*editPointCustom, sideStart, 1, 1); custombbox->attach_next_to(*editCustom, sideStart, 1, 1); @@ -177,18 +178,18 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, } editPointNURBS = Gtk::manage (new Gtk::ToggleButton ()); - initButton(*editPointNURBS, Glib::ustring("edit-point.png"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT"); + initButton(*editPointNURBS, Glib::ustring("edit-point"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT"); editNURBS = Gtk::manage (new Gtk::ToggleButton()); - initButton(*editNURBS, Glib::ustring("crosshair-node-curve.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); + initButton(*editNURBS, Glib::ustring("crosshair-node-curve"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); editNURBS->hide(); copyNURBS = Gtk::manage (new Gtk::Button ()); - initButton(*copyNURBS, Glib::ustring("copy.png"), Gtk::ALIGN_END, true); + initButton(*copyNURBS, Glib::ustring("copy"), Gtk::ALIGN_END, true); pasteNURBS = Gtk::manage (new Gtk::Button ()); - initButton(*pasteNURBS, Glib::ustring("paste.png"), Gtk::ALIGN_END, false); + initButton(*pasteNURBS, Glib::ustring("paste"), Gtk::ALIGN_END, false); loadNURBS = Gtk::manage (new Gtk::Button ()); - initButton(*loadNURBS, Glib::ustring("folder-open.png"), Gtk::ALIGN_END, false); + initButton(*loadNURBS, Glib::ustring("folder-open"), Gtk::ALIGN_END, false); saveNURBS = Gtk::manage (new Gtk::Button ()); - initButton(*saveNURBS, Glib::ustring("save.png"), Gtk::ALIGN_END, false); + initButton(*saveNURBS, Glib::ustring("save"), Gtk::ALIGN_END, false); NURBSbbox->attach_next_to(*editPointNURBS, sideStart, 1, 1); NURBSbbox->attach_next_to(*editNURBS, sideStart, 1, 1); @@ -273,16 +274,16 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, paramCurveBox->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1); editParam = Gtk::manage (new Gtk::ToggleButton()); - initButton(*editParam, Glib::ustring("crosshair-node-curve.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); + initButton(*editParam, Glib::ustring("crosshair-node-curve"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); editParam->hide(); copyParam = Gtk::manage (new Gtk::Button ()); - initButton(*copyParam, Glib::ustring("copy.png"), Gtk::ALIGN_END, true); + initButton(*copyParam, Glib::ustring("copy"), Gtk::ALIGN_END, true); pasteParam = Gtk::manage (new Gtk::Button ()); - initButton(*pasteParam, Glib::ustring("paste.png"), Gtk::ALIGN_END, false); + initButton(*pasteParam, Glib::ustring("paste"), Gtk::ALIGN_END, false); loadParam = Gtk::manage (new Gtk::Button ()); - initButton(*loadParam, Glib::ustring("folder-open.png"), Gtk::ALIGN_END, false); + initButton(*loadParam, Glib::ustring("folder-open"), Gtk::ALIGN_END, false); saveParam = Gtk::manage (new Gtk::Button ()); - initButton(*saveParam, Glib::ustring("save.png"), Gtk::ALIGN_END, false); + initButton(*saveParam, Glib::ustring("save"), Gtk::ALIGN_END, false); parambbox->attach_next_to(*editParam, sideStart, 1, 1); parambbox->attach_next_to(*copyParam, sideEnd, 1, 1); @@ -753,7 +754,6 @@ void DiagonalCurveEditorSubGroup::switchGUI() dCurve->paramCurveEd.at(3) ); - double s = (double)RTScalable::getScale(); highlights->setValue (dCurve->paramCurveEd.at(4)); highlights->setLabel(label[3]); lights->setValue (dCurve->paramCurveEd.at(5)); @@ -765,8 +765,8 @@ void DiagonalCurveEditorSubGroup::switchGUI() shcSelector->coloredBar.setColorProvider(barColorProvider, dCurve->getBottomBarCallerId()); shcSelector->coloredBar.setBgGradient(bgGradient); shcSelector->setMargins( - (int)( ((leftBar ? (double)CBAR_WIDTH + 2. + (double)CBAR_MARGIN + RADIUS : RADIUS) - 1.5) * s ), - (int)((RADIUS - 1.5) * s) + (int)( RTScalable::scalePixelSize((leftBar ? (double)CBAR_WIDTH + 2. + (double)CBAR_MARGIN + RADIUS : RADIUS) - 1.5) ), + (int)( RTScalable::scalePixelSize(RADIUS - 1.5) ) ); paramCurve->setColoredBar(leftBar, nullptr); paramCurve->queue_resize_no_redraw(); diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index 2be1e3f3a..369b69233 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -28,7 +28,7 @@ #endif #include "guiutils.h" -#include "rtimage.h" +#include "rtsurface.h" #include "multilangmgr.h" #include "options.h" @@ -121,13 +121,13 @@ DirBrowser::~DirBrowser() void DirBrowser::fillDirTree () { - openfolder = RTImage::createPixbufFromFile ("folder-open-small.png"); - closedfolder = RTImage::createPixbufFromFile ("folder-closed-small.png"); - icdrom = RTImage::createPixbufFromFile ("device-optical.png"); - ifloppy = RTImage::createPixbufFromFile ("device-floppy.png"); - ihdd = RTImage::createPixbufFromFile ("device-hdd.png"); - iremovable = RTImage::createPixbufFromFile ("device-usb.png"); - inetwork = RTImage::createPixbufFromFile ("device-network.png"); + openfolder = std::shared_ptr(new RTPixbuf("folder-open-small", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + closedfolder = std::shared_ptr(new RTPixbuf("folder-closed-small", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + icdrom = std::shared_ptr(new RTPixbuf("device-optical", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + ifloppy = std::shared_ptr(new RTPixbuf("device-floppy", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + ihdd = std::shared_ptr(new RTPixbuf("device-hdd", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + iremovable = std::shared_ptr(new RTPixbuf("device-usb", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + inetwork = std::shared_ptr(new RTPixbuf("device-network", Gtk::ICON_SIZE_SMALL_TOOLBAR)); //Create the Tree model: dirTreeModel = Gtk::TreeStore::create(dtColumns); @@ -175,22 +175,22 @@ void DirBrowser::addRoot (char letter) int type = GetDriveType (volume); if (type == DRIVE_CDROM) { - root->set_value (0, icdrom); - root->set_value (1, icdrom); + root->set_value (0, icdrom->get()); + root->set_value (1, icdrom->get()); } else if (type == DRIVE_REMOVABLE) { if (letter - 'A' < 2) { - root->set_value (0, ifloppy); - root->set_value (1, ifloppy); + root->set_value (0, ifloppy->get()); + root->set_value (1, ifloppy->get()); } else { - root->set_value (0, iremovable); - root->set_value (1, iremovable); + root->set_value (0, iremovable->get()); + root->set_value (1, iremovable->get()); } } else if (type == DRIVE_REMOTE) { - root->set_value (0, inetwork); - root->set_value (1, inetwork); + root->set_value (0, inetwork->get()); + root->set_value (1, inetwork->get()); } else if (type == DRIVE_FIXED) { - root->set_value (0, ihdd); - root->set_value (1, ihdd); + root->set_value (0, ihdd->get()); + root->set_value (1, ihdd->get()); } Gtk::TreeModel::iterator child = dirTreeModel->append (root->children()); @@ -366,8 +366,8 @@ void DirBrowser::addDir (const Gtk::TreeModel::iterator& iter, const Glib::ustri Gtk::TreeModel::iterator child = dirTreeModel->append(iter->children()); child->set_value (dtColumns.filename, dirname); - child->set_value (dtColumns.icon1, openfolder); - child->set_value (dtColumns.icon2, closedfolder); + child->set_value (dtColumns.icon1, openfolder->get()); + child->set_value (dtColumns.icon2, closedfolder->get()); Glib::ustring fullname = Glib::build_filename (iter->get_value (dtColumns.dirname), dirname); child->set_value (dtColumns.dirname, fullname); Gtk::TreeModel::iterator fooRow = dirTreeModel->append(child->children()); diff --git a/rtgui/dirbrowser.h b/rtgui/dirbrowser.h index 0254d6eb5..599f9fa16 100644 --- a/rtgui/dirbrowser.h +++ b/rtgui/dirbrowser.h @@ -23,6 +23,8 @@ #include "guiutils.h" +class RTPixbuf; + class DirBrowser : public Gtk::Box { public: @@ -62,13 +64,13 @@ private: void fillRoot (); - Glib::RefPtr openfolder; - Glib::RefPtr closedfolder; - Glib::RefPtr icdrom; - Glib::RefPtr ifloppy; - Glib::RefPtr ihdd; - Glib::RefPtr inetwork; - Glib::RefPtr iremovable; + std::shared_ptr openfolder; + std::shared_ptr closedfolder; + std::shared_ptr icdrom; + std::shared_ptr ifloppy; + std::shared_ptr ihdd; + std::shared_ptr inetwork; + std::shared_ptr iremovable; bool expandSuccess; diff --git a/rtgui/distortion.cc b/rtgui/distortion.cc index 165ccee06..5089a2dfe 100644 --- a/rtgui/distortion.cc +++ b/rtgui/distortion.cc @@ -32,7 +32,7 @@ Distortion::Distortion (): FoldableToolPanel(this, "distortion", M("TP_DISTORTIO rlistener = nullptr; autoDistor = Gtk::manage (new Gtk::Button (M("GENERAL_AUTO"))); - autoDistor->set_image (*Gtk::manage (new RTImage ("distortion-auto-small.png"))); + autoDistor->set_image (*Gtk::manage (new RTImage ("distortion-auto-small", Gtk::ICON_SIZE_BUTTON))); autoDistor->get_style_context()->add_class("independent"); autoDistor->set_alignment(0.5f, 0.5f); autoDistor->set_tooltip_text (M("TP_DISTORTION_AUTO_TIP")); @@ -40,14 +40,14 @@ Distortion::Distortion (): FoldableToolPanel(this, "distortion", M("TP_DISTORTIO autoDistor->show(); pack_start (*autoDistor); - Gtk::Image* idistL = Gtk::manage (new RTImage ("distortion-pincushion-small.png")); - Gtk::Image* idistR = Gtk::manage (new RTImage ("distortion-barrel-small.png")); + Gtk::Image* idistL = Gtk::manage (new RTImage ("distortion-pincushion-small")); + Gtk::Image* idistR = Gtk::manage (new RTImage ("distortion-barrel-small")); distor = Gtk::manage (new Adjuster (M("TP_DISTORTION_AMOUNT"), -0.5, 0.5, 0.001, 0, idistL, idistR)); distor->setAdjusterListener (this); distor->setLogScale(2, 0); - + distor->show(); pack_start (*distor); } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 78a07ddd6..d21ef3917 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -186,9 +186,9 @@ private: void prepareIntentBox () { // same order as the enum - intentBox.addEntry ("intent-perceptual.png", M ("PREFERENCES_INTENT_PERCEPTUAL")); - intentBox.addEntry ("intent-relative.png", M ("PREFERENCES_INTENT_RELATIVE")); - intentBox.addEntry ("intent-absolute.png", M ("PREFERENCES_INTENT_ABSOLUTE")); + intentBox.addEntry ("intent-perceptual", M ("PREFERENCES_INTENT_PERCEPTUAL")); + intentBox.addEntry ("intent-relative", M ("PREFERENCES_INTENT_RELATIVE")); + intentBox.addEntry ("intent-absolute", M ("PREFERENCES_INTENT_ABSOLUTE")); setExpandAlignProperties (intentBox.buttonGroup, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); intentBox.setSelected (1); @@ -197,7 +197,7 @@ private: void prepareSoftProofingBox () { - Gtk::Image *softProofImage = Gtk::manage (new RTImage ("gamut-softproof.png")); + Gtk::Image *softProofImage = Gtk::manage (new RTImage ("gamut-softproof", Gtk::ICON_SIZE_LARGE_TOOLBAR)); softProofImage->set_padding (0, 0); softProof.add (*softProofImage); softProof.set_relief (Gtk::RELIEF_NONE); @@ -206,7 +206,7 @@ private: softProof.set_active (false); softProof.show (); - Gtk::Image *spGamutCheckImage = Gtk::manage (new RTImage ("gamut-warning.png")); + Gtk::Image *spGamutCheckImage = Gtk::manage (new RTImage ("gamut-warning", Gtk::ICON_SIZE_LARGE_TOOLBAR)); spGamutCheckImage->set_padding (0, 0); spGamutCheck.add (*spGamutCheckImage); spGamutCheck.set_relief (Gtk::RELIEF_NONE); @@ -509,7 +509,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) //leftsubpaned->pack_start (*ppframe, Gtk::PACK_SHRINK, 4); navigator = Gtk::manage(new Navigator()); - navigator->previewWindow->set_size_request(-1, 150 * RTScalable::getScale()); + navigator->previewWindow->set_size_request(-1, RTScalable::scalePixelSize(150)); leftsubpaned->pack1(*navigator, false, false); history = Gtk::manage(new History()); @@ -525,19 +525,19 @@ EditorPanel::EditorPanel (FilePanel* filePanel) Gtk::Box* editbox = Gtk::manage (new Gtk::Box (Gtk::ORIENTATION_VERTICAL)); info = Gtk::manage (new Gtk::ToggleButton ()); - Gtk::Image* infoimg = Gtk::manage (new RTImage ("info.png")); + Gtk::Image* infoimg = Gtk::manage (new RTImage ("info", Gtk::ICON_SIZE_LARGE_TOOLBAR)); info->add (*infoimg); info->set_relief (Gtk::RELIEF_NONE); info->set_tooltip_markup (M ("MAIN_TOOLTIP_QINFO")); beforeAfter = Gtk::manage (new Gtk::ToggleButton ()); - Gtk::Image* beforeAfterIcon = Gtk::manage (new RTImage ("beforeafter.png")); + Gtk::Image* beforeAfterIcon = Gtk::manage (new RTImage ("beforeafter", Gtk::ICON_SIZE_LARGE_TOOLBAR)); beforeAfter->add (*beforeAfterIcon); beforeAfter->set_relief (Gtk::RELIEF_NONE); beforeAfter->set_tooltip_markup (M ("MAIN_TOOLTIP_TOGGLE")); - iBeforeLockON = new RTImage ("padlock-locked-small.png"); - iBeforeLockOFF = new RTImage ("padlock-unlocked-small.png"); + iBeforeLockON = new RTImage ("padlock-locked-small", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iBeforeLockOFF = new RTImage ("padlock-unlocked-small", Gtk::ICON_SIZE_LARGE_TOOLBAR); Gtk::Separator* vsept = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)); Gtk::Separator* vsepz = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)); @@ -546,8 +546,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel) hidehp = Gtk::manage (new Gtk::ToggleButton ()); - iHistoryShow = new RTImage ("panel-to-right.png"); - iHistoryHide = new RTImage ("panel-to-left.png"); + iHistoryShow = new RTImage ("panel-to-right", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iHistoryHide = new RTImage ("panel-to-left", Gtk::ICON_SIZE_LARGE_TOOLBAR); hidehp->set_relief (Gtk::RELIEF_NONE); hidehp->set_active (options.showHistory); @@ -563,8 +563,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel) if (!simpleEditor && filePanel) { tbTopPanel_1 = new Gtk::ToggleButton (); - iTopPanel_1_Show = new RTImage ("panel-to-bottom.png"); - iTopPanel_1_Hide = new RTImage ("panel-to-top.png"); + iTopPanel_1_Show = new RTImage ("panel-to-bottom", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iTopPanel_1_Hide = new RTImage ("panel-to-top", Gtk::ICON_SIZE_LARGE_TOOLBAR); tbTopPanel_1->set_relief (Gtk::RELIEF_NONE); tbTopPanel_1->set_active (true); tbTopPanel_1->set_tooltip_markup (M ("MAIN_TOOLTIP_SHOWHIDETP1")); @@ -581,7 +581,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) // Histogram profile toggle controls toggleHistogramProfile = Gtk::manage (new Gtk::ToggleButton ()); - Gtk::Image* histProfImg = Gtk::manage (new RTImage ("gamut-hist.png")); + Gtk::Image* histProfImg = Gtk::manage (new RTImage ("gamut-hist", Gtk::ICON_SIZE_LARGE_TOOLBAR)); toggleHistogramProfile->add (*histProfImg); toggleHistogramProfile->set_relief (Gtk::RELIEF_NONE); toggleHistogramProfile->set_active (options.rtSettings.HistogramWorking); @@ -654,21 +654,21 @@ EditorPanel::EditorPanel (FilePanel* filePanel) iops->set_row_spacing (2); iops->set_column_spacing (2); - Gtk::Image *saveButtonImage = Gtk::manage (new RTImage ("save.png")); + Gtk::Image *saveButtonImage = Gtk::manage (new RTImage ("save", Gtk::ICON_SIZE_LARGE_TOOLBAR)); saveimgas = Gtk::manage (new Gtk::Button ()); saveimgas->set_relief(Gtk::RELIEF_NONE); saveimgas->add (*saveButtonImage); saveimgas->set_tooltip_markup (M ("MAIN_BUTTON_SAVE_TOOLTIP")); setExpandAlignProperties (saveimgas, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - Gtk::Image *queueButtonImage = Gtk::manage (new RTImage ("gears.png")); + Gtk::Image *queueButtonImage = Gtk::manage (new RTImage ("gears", Gtk::ICON_SIZE_LARGE_TOOLBAR)); queueimg = Gtk::manage (new Gtk::Button ()); queueimg->set_relief(Gtk::RELIEF_NONE); queueimg->add (*queueButtonImage); queueimg->set_tooltip_markup (M ("MAIN_BUTTON_PUTTOQUEUE_TOOLTIP")); setExpandAlignProperties (queueimg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - Gtk::Image *sendToEditorButtonImage = Gtk::manage (new RTImage ("palette-brush.png")); + Gtk::Image *sendToEditorButtonImage = Gtk::manage (new RTImage ("palette-brush", Gtk::ICON_SIZE_LARGE_TOOLBAR)); sendtogimp = Gtk::manage (new Gtk::Button ()); sendtogimp->set_relief(Gtk::RELIEF_NONE); sendtogimp->add (*sendToEditorButtonImage); @@ -683,8 +683,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel) // tbRightPanel_1 tbRightPanel_1 = Gtk::manage(new Gtk::ToggleButton()); - iRightPanel_1_Show = new RTImage ("panel-to-left.png"); - iRightPanel_1_Hide = new RTImage ("panel-to-right.png"); + iRightPanel_1_Show = new RTImage ("panel-to-left", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iRightPanel_1_Hide = new RTImage ("panel-to-right", Gtk::ICON_SIZE_LARGE_TOOLBAR); tbRightPanel_1->set_relief (Gtk::RELIEF_NONE); tbRightPanel_1->set_active (true); tbRightPanel_1->set_tooltip_markup (M ("MAIN_TOOLTIP_SHOWHIDERP1")); @@ -693,8 +693,8 @@ EditorPanel::EditorPanel (FilePanel* filePanel) // ShowHideSidePanels tbShowHideSidePanels = Gtk::manage(new Gtk::ToggleButton()); - iShowHideSidePanels = new RTImage ("crossed-arrows-out.png"); - iShowHideSidePanels_exit = new RTImage ("crossed-arrows-in.png"); + iShowHideSidePanels = new RTImage ("crossed-arrows-out", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iShowHideSidePanels_exit = new RTImage ("crossed-arrows-in", Gtk::ICON_SIZE_LARGE_TOOLBAR); tbShowHideSidePanels->set_relief (Gtk::RELIEF_NONE); tbShowHideSidePanels->set_active (false); tbShowHideSidePanels->set_tooltip_markup (M ("MAIN_BUTTON_SHOWHIDESIDEPANELS_TOOLTIP")); @@ -705,7 +705,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) if (!simpleEditor && !options.tabbedUI) { // Navigation buttons - Gtk::Image *navPrevImage = Gtk::manage (new RTImage ("arrow2-left.png")); + Gtk::Image *navPrevImage = Gtk::manage (new RTImage ("arrow2-left", Gtk::ICON_SIZE_LARGE_TOOLBAR)); navPrevImage->set_padding (0, 0); navPrev = Gtk::manage (new Gtk::Button ()); navPrev->add (*navPrevImage); @@ -713,7 +713,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) navPrev->set_tooltip_markup (M ("MAIN_BUTTON_NAVPREV_TOOLTIP")); setExpandAlignProperties (navPrev, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - Gtk::Image *navNextImage = Gtk::manage (new RTImage ("arrow2-right.png")); + Gtk::Image *navNextImage = Gtk::manage (new RTImage ("arrow2-right", Gtk::ICON_SIZE_LARGE_TOOLBAR)); navNextImage->set_padding (0, 0); navNext = Gtk::manage (new Gtk::Button ()); navNext->add (*navNextImage); @@ -721,7 +721,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) navNext->set_tooltip_markup (M ("MAIN_BUTTON_NAVNEXT_TOOLTIP")); setExpandAlignProperties (navNext, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - Gtk::Image *navSyncImage = Gtk::manage (new RTImage ("arrow-updown.png")); + Gtk::Image *navSyncImage = Gtk::manage (new RTImage ("arrow-updown", Gtk::ICON_SIZE_LARGE_TOOLBAR)); navSyncImage->set_padding (0, 0); navSync = Gtk::manage (new Gtk::Button ()); navSync->add (*navSyncImage); @@ -2072,7 +2072,7 @@ bool EditorPanel::idle_sendToGimp ( ProgressConnector *p sf.tiffBits = 16; sf.tiffFloat = false; } - + sf.tiffUncompressed = true; sf.saveParams = true; diff --git a/rtgui/editwidgets.cc b/rtgui/editwidgets.cc index f9c9b3781..ff662f1fa 100644 --- a/rtgui/editwidgets.cc +++ b/rtgui/editwidgets.cc @@ -989,11 +989,11 @@ void OPIcon::drivenPointToRectangle(const rtengine::Coord &pos, bottomRight.y = topLeft.y + H - 1; } -OPIcon::OPIcon(const Cairo::RefPtr &normal, - const Cairo::RefPtr &active, - const Cairo::RefPtr &prelight, - const Cairo::RefPtr &dragged, - const Cairo::RefPtr &insensitive, +OPIcon::OPIcon(const std::shared_ptr &normal, + const std::shared_ptr &active, + const std::shared_ptr &prelight, + const std::shared_ptr &dragged, + const std::shared_ptr&insensitive, DrivenPoint drivenPoint) : drivenPoint(drivenPoint) { @@ -1022,48 +1022,48 @@ OPIcon::OPIcon(Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustri Glib::ustring draggedImage, Glib::ustring insensitiveImage, DrivenPoint drivenPoint) : drivenPoint(drivenPoint) { if (!normalImage.empty()) { - normalImg = Cairo::RefPtr(new RTSurface(normalImage)); + normalImg = std::shared_ptr(new RTSurface(normalImage, Gtk::ICON_SIZE_MENU)); } if (!prelightImage.empty()) { - prelightImg = Cairo::RefPtr(new RTSurface(prelightImage)); + prelightImg = std::shared_ptr(new RTSurface(prelightImage, Gtk::ICON_SIZE_MENU)); } if (!activeImage.empty()) { - activeImg = Cairo::RefPtr(new RTSurface(activeImage)); + activeImg = std::shared_ptr(new RTSurface(activeImage, Gtk::ICON_SIZE_MENU)); } if (!draggedImage.empty()) { - draggedImg = Cairo::RefPtr(new RTSurface(draggedImage)); + draggedImg = std::shared_ptr(new RTSurface(draggedImage, Gtk::ICON_SIZE_MENU)); } if (!insensitiveImage.empty()) { - insensitiveImg = Cairo::RefPtr(new RTSurface(insensitiveImage)); + insensitiveImg = std::shared_ptr(new RTSurface(insensitiveImage, Gtk::ICON_SIZE_MENU)); } } -const Cairo::RefPtr OPIcon::getNormalImg() +const std::shared_ptr OPIcon::getNormalImg() { return normalImg; } -const Cairo::RefPtr OPIcon::getPrelightImg() +const std::shared_ptr OPIcon::getPrelightImg() { return prelightImg; } -const Cairo::RefPtr OPIcon::getActiveImg() +const std::shared_ptr OPIcon::getActiveImg() { return activeImg; } -const Cairo::RefPtr OPIcon::getDraggedImg() +const std::shared_ptr OPIcon::getDraggedImg() { return draggedImg; } -const Cairo::RefPtr OPIcon::getInsensitiveImg() +const std::shared_ptr OPIcon::getInsensitiveImg() { return insensitiveImg; } -void OPIcon::drawImage(Cairo::RefPtr &img, +void OPIcon::drawImage(std::shared_ptr &img, Cairo::RefPtr &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) { @@ -1089,7 +1089,7 @@ void OPIcon::drawImage(Cairo::RefPtr &img, cr->fill(); } -void OPIcon::drawMOImage(Cairo::RefPtr &img, Cairo::RefPtr &cr, +void OPIcon::drawMOImage(std::shared_ptr &img, Cairo::RefPtr &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) { // test of F_HOVERABLE has already been done diff --git a/rtgui/editwidgets.h b/rtgui/editwidgets.h index fd539c355..968796ceb 100644 --- a/rtgui/editwidgets.h +++ b/rtgui/editwidgets.h @@ -354,34 +354,32 @@ class OPIcon : public Geometry // OP stands for "On Preview" { private: - Cairo::RefPtr normalImg; - Cairo::RefPtr prelightImg; - Cairo::RefPtr activeImg; - Cairo::RefPtr draggedImg; - Cairo::RefPtr insensitiveImg; + std::shared_ptr normalImg; + std::shared_ptr prelightImg; + std::shared_ptr activeImg; + std::shared_ptr draggedImg; + std::shared_ptr insensitiveImg; - static void updateImages(); - void changeImage(Glib::ustring &newImage); - void drawImage (Cairo::RefPtr &img, Cairo::RefPtr &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); - void drawMOImage (Cairo::RefPtr &img, Cairo::RefPtr &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); + void drawImage (std::shared_ptr &img, Cairo::RefPtr &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); + void drawMOImage (std::shared_ptr &img, Cairo::RefPtr &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); void drivenPointToRectangle(const rtengine::Coord &pos, rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H); public: DrivenPoint drivenPoint; rtengine::Coord position; - OPIcon (const Cairo::RefPtr &normal, - const Cairo::RefPtr &active, - const Cairo::RefPtr &prelight = {}, - const Cairo::RefPtr &dragged = {}, - const Cairo::RefPtr &insensitive = {}, + OPIcon (const std::shared_ptr &normal, + const std::shared_ptr &active, + const std::shared_ptr &prelight = nullptr, + const std::shared_ptr &dragged = nullptr, + const std::shared_ptr &insensitive = nullptr, DrivenPoint drivenPoint = DP_CENTERCENTER); OPIcon (Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustring prelightImage = "", Glib::ustring draggedImage = "", Glib::ustring insensitiveImage = "", DrivenPoint drivenPoint = DP_CENTERCENTER); - const Cairo::RefPtr getNormalImg(); - const Cairo::RefPtr getPrelightImg(); - const Cairo::RefPtr getActiveImg(); - const Cairo::RefPtr getDraggedImg(); - const Cairo::RefPtr getInsensitiveImg(); + const std::shared_ptr getNormalImg(); + const std::shared_ptr getPrelightImg(); + const std::shared_ptr getActiveImg(); + const std::shared_ptr getDraggedImg(); + const std::shared_ptr getInsensitiveImg(); void drawOuterGeometry (Cairo::RefPtr &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) override; void drawInnerGeometry (Cairo::RefPtr &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) override; void drawToMOChannel (Cairo::RefPtr &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) override; diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index d0e53d730..5b57e35c7 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -57,15 +57,14 @@ EditWindow* EditWindow::getInstance(RTWindow* p) } EditWindow::EditWindow (RTWindow* p) - : resolution(RTScalable::baseDPI) - , parent(p) + : parent(p) , isFullscreen(false) , isClosed(true) , isMinimized(false) { + // Set window icon + set_default_icon_name("rawtherapee"); - updateResolution(); - setAppIcon(); set_title_decorated(""); set_modal(false); set_resizable(true); @@ -165,56 +164,8 @@ void EditWindow::on_realize () editWindowCursorManager.init (get_window()); } -bool EditWindow::updateResolution() -{ - int scale = get_scale_factor(); - double res = get_screen()->get_resolution(); - if (scale == 2) { - // from Windows' behavior : if scale==2, resolution = 192. (Gtk shows 96 dpi !?), there's no higher value - res = RTScalable::baseHiDPI; - } - bool retVal = res != resolution; - resolution = res; - return retVal; -} - -void EditWindow::setAppIcon() -{ - Glib::ustring fName; - bool downsize = false; - // findIconAbsolutePath won't be able to select the image based on resolution with the - // storage of the images, we're doing the selection here - if (resolution == RTScalable::baseDPI) { - fName = "rawtherapee-logo-24.png"; - } else { - fName = "rawtherapee-logo-48.png"; - if (resolution < RTScalable::baseHiDPI) { - downsize = true; - } - } - Glib::ustring icon_path = Glib::build_filename (argv0, "images", fName); - const Glib::RefPtr pixbuf = Gdk::Pixbuf::create_from_file(icon_path); - if (!pixbuf) { - return; - } - if (downsize) { - int size = int((48. * resolution) / RTScalable::baseHiDPI); - pixbuf->scale_simple(size, size, Gdk::InterpType::INTERP_BILINEAR); - } - - try { - set_default_icon(pixbuf); - } catch(Glib::Exception& ex) { - printf ("%s\n", ex.what().c_str()); - } -} - bool EditWindow::on_configure_event(GdkEventConfigure* event) { - if (updateResolution()) { - setAppIcon(); - } - if (!options.meowMaximized && !isFullscreen && !isMinimized) { get_position(options.meowX, options.meowY); get_size(options.meowWidth, options.meowHeight); @@ -253,11 +204,11 @@ void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) // construct closeable tab for the image Gtk::Box* hb = Gtk::manage (new Gtk::Box ()); - hb->pack_start (*Gtk::manage (new RTImage ("aperture.png"))); + hb->pack_start (*Gtk::manage (new RTImage ("aperture"))); hb->pack_start (*Gtk::manage (new Gtk::Label (Glib::path_get_basename (name)))); hb->set_tooltip_markup (name); Gtk::Button* closeb = Gtk::manage (new Gtk::Button ()); - closeb->set_image (*Gtk::manage(new RTImage ("cancel-small.png"))); + closeb->set_image (*Gtk::manage(new RTImage ("cancel-small", Gtk::ICON_SIZE_BUTTON))); closeb->set_relief (Gtk::RELIEF_NONE); closeb->set_focus_on_click (false); diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index b8eeaee82..bbe9a14c2 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -31,7 +31,6 @@ class EditWindow : { private: - double resolution; RTWindow* parent; RTImage appIcon; @@ -44,8 +43,6 @@ private: bool isMinimized; sigc::connection onConfEventConn; void toggleFullscreen (); - bool updateResolution(); - void setAppIcon(); IdleRegister idle_register; diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index eeff0c8c7..246a75388 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -31,7 +31,11 @@ using namespace rtexif; ExifPanel::ExifPanel() : idata(nullptr), changeList(new rtengine::procparams::ExifPairs), - defChangeList(new rtengine::procparams::ExifPairs) + defChangeList(new rtengine::procparams::ExifPairs), + + delicon("cancel-small"), + keepicon("tick-small"), + editicon("add-small") { set_orientation(Gtk::ORIENTATION_VERTICAL); recursiveOp = true; @@ -54,17 +58,14 @@ ExifPanel::ExifPanel() : exifTree->set_grid_lines (Gtk::TREE_VIEW_GRID_LINES_NONE); exifTree->set_row_separator_func (sigc::mem_fun(*this, &ExifPanel::rowSeperatorFunc)); - delicon = RTImage::createPixbufFromFile ("cancel-small.png"); - keepicon = RTImage::createPixbufFromFile ("tick-small.png"); - editicon = RTImage::createPixbufFromFile ("add-small.png"); - Gtk::TreeView::Column *viewcol = Gtk::manage (new Gtk::TreeView::Column ("Field Name")); - Gtk::CellRendererPixbuf* render_pb = Gtk::manage (new Gtk::CellRendererPixbuf ()); + Gtk::CellRendererPixbuf* render_pb = Gtk::manage (new Gtk::CellRendererPixbuf()); + render_pb->property_stock_size() = Gtk::ICON_SIZE_SMALL_TOOLBAR; Gtk::CellRendererText *render_txt = Gtk::manage (new Gtk::CellRendererText()); render_txt->property_ellipsize() = Pango::ELLIPSIZE_END; viewcol->pack_start (*render_pb, false); viewcol->pack_start (*render_txt, true); - viewcol->add_attribute (*render_pb, "pixbuf", exifColumns.icon); + viewcol->add_attribute (*render_pb, "icon-name", exifColumns.icon); viewcol->add_attribute (*render_txt, "markup", exifColumns.field); viewcol->set_expand (true); viewcol->set_resizable (true); @@ -106,21 +107,21 @@ ExifPanel::ExifPanel() : setExpandAlignProperties (buttons2, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); remove = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_REMOVE") - remove->set_image (*Gtk::manage (new RTImage(delicon))); + remove->set_image (*Gtk::manage (new RTImage(delicon, Gtk::ICON_SIZE_BUTTON))); remove->set_tooltip_text (M ("EXIFPANEL_REMOVEHINT")); remove->get_style_context()->add_class ("Left"); setExpandAlignProperties (remove, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); buttons1->attach_next_to (*remove, Gtk::POS_LEFT, 1, 1); keep = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_KEEP") - keep->set_image (*Gtk::manage (new RTImage(keepicon))); + keep->set_image (*Gtk::manage (new RTImage(keepicon, Gtk::ICON_SIZE_BUTTON))); keep->set_tooltip_text (M ("EXIFPANEL_KEEPHINT")); keep->get_style_context()->add_class ("MiddleH"); setExpandAlignProperties (keep, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); buttons1->attach_next_to (*keep, Gtk::POS_RIGHT, 1, 1); add = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_ADDEDIT") - add->set_image (*Gtk::manage (new RTImage(editicon))); + add->set_image (*Gtk::manage (new RTImage(editicon, Gtk::ICON_SIZE_BUTTON))); add->set_tooltip_text (M ("EXIFPANEL_ADDEDITHINT")); add->get_style_context()->add_class ("Right"); setExpandAlignProperties (add, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); @@ -134,14 +135,14 @@ ExifPanel::ExifPanel() : buttons2->attach_next_to (*showAll, Gtk::POS_LEFT, 1, 1); reset = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_RESET") - reset->set_image (*Gtk::manage (new RTImage("undo.png", "redo.png"))); + reset->set_image (*Gtk::manage (new RTImage ("undo", Gtk::ICON_SIZE_BUTTON))); reset->set_tooltip_text (M ("EXIFPANEL_RESETHINT")); reset->get_style_context()->add_class ("MiddleH"); setExpandAlignProperties (reset, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); buttons2->attach_next_to (*reset, Gtk::POS_RIGHT, 1, 1); resetAll = Gtk::manage (new Gtk::Button ()); // M("EXIFPANEL_RESETALL") - resetAll->set_image (*Gtk::manage (new RTImage ("undo-all.png", "redo-all.png"))); + resetAll->set_image (*Gtk::manage (new RTImage ("undo-all", Gtk::ICON_SIZE_BUTTON))); resetAll->set_tooltip_text (M ("EXIFPANEL_RESETALLHINT")); resetAll->get_style_context()->add_class ("Right"); setExpandAlignProperties (resetAll, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); diff --git a/rtgui/exifpanel.h b/rtgui/exifpanel.h index 4c28af289..7723e56c3 100644 --- a/rtgui/exifpanel.h +++ b/rtgui/exifpanel.h @@ -39,7 +39,7 @@ private: class ExifColumns : public Gtk::TreeModelColumnRecord { public: - Gtk::TreeModelColumn > icon; + Gtk::TreeModelColumn icon; Gtk::TreeModelColumn field; Gtk::TreeModelColumn field_nopango; Gtk::TreeModelColumn value; @@ -64,9 +64,10 @@ private: add (isSeparator); } }; - Glib::RefPtr delicon; - Glib::RefPtr keepicon; - Glib::RefPtr editicon; + + Glib::ustring delicon; + Glib::ustring keepicon; + Glib::ustring editicon; ExifColumns exifColumns; Gtk::TreeView* exifTree; diff --git a/rtgui/exportpanel.cc b/rtgui/exportpanel.cc index a4ce63c1d..3c299e714 100644 --- a/rtgui/exportpanel.cc +++ b/rtgui/exportpanel.cc @@ -185,14 +185,14 @@ ExportPanel::ExportPanel () : listener (nullptr) // Buttons btnFastExport = Gtk::manage ( new Gtk::Button () ); btnFastExport->set_tooltip_text (M ("EXPORT_PUTTOQUEUEFAST")); - btnFastExport->set_image (*Gtk::manage (new RTImage ("gears.png"))); + btnFastExport->set_image (*Gtk::manage (new RTImage ("gears"))); pack_start (*btnFastExport, Gtk::PACK_SHRINK, 4); // add panel ending Gtk::Box* vboxpe = Gtk::manage (new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); Gtk::Separator* hseptpe = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); - Gtk::Image* peImg = Gtk::manage (new RTImage ("ornament1.png")); + Gtk::Image* peImg = Gtk::manage (new RTImage ("ornament1")); vboxpe->pack_start (*hseptpe, Gtk::PACK_SHRINK, 4); vboxpe->pack_start (*peImg); pack_start (*vboxpe, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/fattaltonemap.cc b/rtgui/fattaltonemap.cc index 89a1e9e30..1e3c7171a 100644 --- a/rtgui/fattaltonemap.cc +++ b/rtgui/fattaltonemap.cc @@ -1,5 +1,5 @@ /** -*- C++ -*- - * + * * This file is part of RawTherapee. * * Copyright (c) 2017 Alberto Griggio @@ -39,8 +39,8 @@ FattalToneMapping::FattalToneMapping(): FoldableToolPanel(this, "fattal", M("TP_ amount = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_AMOUNT"), 1., 100., 1., 30.)); threshold = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_THRESHOLD"), -100., 300., 1., 0.0)); threshold->setLogScale(10, 0); - Gtk::Image *al = Gtk::manage(new RTImage("circle-black-small.png")); - Gtk::Image *ar = Gtk::manage(new RTImage("circle-white-small.png")); + Gtk::Image *al = Gtk::manage(new RTImage("circle-black-small")); + Gtk::Image *ar = Gtk::manage(new RTImage("circle-white-small")); anchor = Gtk::manage(new Adjuster(M("TP_TM_FATTAL_ANCHOR"), 1, 100, 1, 50, al, ar)); amount->setAdjusterListener(this); diff --git a/rtgui/favoritbrowser.cc b/rtgui/favoritbrowser.cc index 0481847cb..2b16aadcc 100644 --- a/rtgui/favoritbrowser.cc +++ b/rtgui/favoritbrowser.cc @@ -16,7 +16,8 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include "favoritbrowser.h" + #include "multilangmgr.h" #include "rtimage.h" @@ -57,7 +58,7 @@ FavoritBrowser::FavoritBrowser () : listener (NULL) add->set_vexpand(false); add->set_halign(Gtk::ALIGN_FILL); add->set_valign(Gtk::ALIGN_START); - add->set_image (*Gtk::manage (new RTImage ("add-small.png"))); + add->set_image (*Gtk::manage (new RTImage ("add-small", Gtk::ICON_SIZE_BUTTON))); add->get_style_context()->add_class("Left"); del = Gtk::manage (new Gtk::Button ()); del->set_tooltip_text(M("MAIN_FRAME_PLACES_DEL")); @@ -65,7 +66,7 @@ FavoritBrowser::FavoritBrowser () : listener (NULL) del->set_vexpand(false); del->set_halign(Gtk::ALIGN_FILL); del->set_valign(Gtk::ALIGN_START); - del->set_image (*Gtk::manage (new RTImage ("remove-small.png"))); + del->set_image (*Gtk::manage (new RTImage ("remove-small", Gtk::ICON_SIZE_BUTTON))); del->get_style_context()->add_class("Right"); Gtk::Box* buttonBox = Gtk::manage (new Gtk::Box ()); buttonBox->pack_start (*add); diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 97e724174..91eb8dc72 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -157,7 +157,7 @@ FileBrowser::FileBrowser () : pmenu->attach (*Gtk::manage(inspect = new Gtk::MenuItem (M("FILEBROWSER_POPUPINSPECT"))), 0, 1, p, p + 1); p++; } - pmenu->attach (*Gtk::manage(develop = new MyImageMenuItem (M("FILEBROWSER_POPUPPROCESS"), "gears.png")), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(develop = new MyImageMenuItem (M("FILEBROWSER_POPUPPROCESS"), "gears")), 0, 1, p, p + 1); p++; pmenu->attach (*Gtk::manage(developfast = new Gtk::MenuItem (M("FILEBROWSER_POPUPPROCESSFAST"))), 0, 1, p, p + 1); p++; @@ -209,8 +209,8 @@ FileBrowser::FileBrowser () : // Thumbnail context menu // Similar image arrays in filecatalog.cc - std::array clabelActiveIcons = {"circle-empty-gray-small.png", "circle-red-small.png", "circle-yellow-small.png", "circle-green-small.png", "circle-blue-small.png", "circle-purple-small.png"}; - std::array clabelInactiveIcons = {"circle-empty-darkgray-small.png", "circle-empty-red-small.png", "circle-empty-yellow-small.png", "circle-empty-green-small.png", "circle-empty-blue-small.png", "circle-empty-purple-small.png"}; + std::array clabelActiveIcons = {"circle-empty-gray-small", "circle-red-small", "circle-yellow-small", "circle-green-small", "circle-blue-small", "circle-purple-small"}; + std::array clabelInactiveIcons = {"circle-empty-darkgray-small", "circle-empty-red-small", "circle-empty-yellow-small", "circle-empty-green-small", "circle-empty-blue-small", "circle-empty-purple-small"}; if (options.menuGroupLabel) { pmenu->attach (*Gtk::manage(menuLabel = new Gtk::MenuItem (M("FILEBROWSER_POPUPCOLORLABEL"))), 0, 1, p, p + 1); diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index bf3f11a79..9f9be2eff 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -25,7 +25,7 @@ #include "cursormanager.h" #include "guiutils.h" #include "inspector.h" -#include "rtimage.h" +#include "rtsurface.h" #include "threadutils.h" #include "thumbbrowserbase.h" #include "thumbnail.h" @@ -38,11 +38,11 @@ //extern Glib::Threads::Thread* mainThread; bool FileBrowserEntry::iconsLoaded(false); -Glib::RefPtr FileBrowserEntry::editedIcon; -Glib::RefPtr FileBrowserEntry::recentlySavedIcon; -Glib::RefPtr FileBrowserEntry::enqueuedIcon; -Glib::RefPtr FileBrowserEntry::hdr; -Glib::RefPtr FileBrowserEntry::ps; +std::shared_ptr FileBrowserEntry::editedIcon(std::shared_ptr(nullptr)); +std::shared_ptr FileBrowserEntry::recentlySavedIcon(std::shared_ptr(nullptr)); +std::shared_ptr FileBrowserEntry::enqueuedIcon(std::shared_ptr(nullptr)); +std::shared_ptr FileBrowserEntry::hdr(std::shared_ptr(nullptr)); +std::shared_ptr FileBrowserEntry::ps(std::shared_ptr(nullptr)); FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname) : ThumbBrowserEntryBase (fname), wasInside(false), iatlistener(nullptr), press_x(0), press_y(0), action_x(0), action_y(0), rot_deg(0.0), landscape(true), cropParams(new rtengine::procparams::CropParams), cropgl(nullptr), state(SNormal), crop_custom_ratio(0.f) @@ -61,11 +61,11 @@ FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname) scale = 1; if (!iconsLoaded) { - editedIcon = RTImage::createPixbufFromFile ("tick-small.png"); - recentlySavedIcon = RTImage::createPixbufFromFile ("save-small.png"); - enqueuedIcon = RTImage::createPixbufFromFile ("gears-small.png"); - hdr = RTImage::createPixbufFromFile ("filetype-hdr.png"); - ps = RTImage::createPixbufFromFile ("filetype-ps.png"); + editedIcon = std::shared_ptr(new RTPixbuf("tick-small", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + recentlySavedIcon = std::shared_ptr(new RTPixbuf("save-small", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + enqueuedIcon = std::shared_ptr(new RTPixbuf("gears-small", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + hdr = std::shared_ptr(new RTPixbuf("filetype-hdr", Gtk::ICON_SIZE_SMALL_TOOLBAR)); + ps = std::shared_ptr(new RTPixbuf("filetype-ps", Gtk::ICON_SIZE_SMALL_TOOLBAR)); iconsLoaded = true; } @@ -134,15 +134,15 @@ std::vector> FileBrowserEntry::getIconsOnImageArea () std::vector> ret; if (thumbnail->hasProcParams() && editedIcon) { - ret.push_back(editedIcon); + ret.push_back(editedIcon->get()); } if (thumbnail->isRecentlySaved() && recentlySavedIcon) { - ret.push_back(recentlySavedIcon); + ret.push_back(recentlySavedIcon->get()); } if (thumbnail->isEnqueued () && enqueuedIcon) { - ret.push_back(enqueuedIcon); + ret.push_back(enqueuedIcon->get()); } return ret; @@ -157,11 +157,11 @@ std::vector> FileBrowserEntry::getSpecificityIconsOnIm std::vector> ret; if (thumbnail->isHDR() && hdr) { - ret.push_back (hdr); + ret.push_back (hdr->get()); } if (thumbnail->isPixelShift() && ps) { - ret.push_back (ps); + ret.push_back (ps->get()); } return ret; @@ -195,8 +195,8 @@ void FileBrowserEntry::customBackBufferUpdate (Cairo::RefPtr c) void FileBrowserEntry::getIconSize (int& w, int& h) const { - w = editedIcon->get_width (); - h = editedIcon->get_height (); + w = editedIcon->get()->get_width (); + h = editedIcon->get()->get_height (); } FileThumbnailButtonSet* FileBrowserEntry::getThumbButtonSet () diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index 67b953514..fcf916f00 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -35,6 +35,7 @@ class FileBrowserEntry; class Thumbnail; +class RTPixbuf; struct FileBrowserEntryIdleHelper { FileBrowserEntry* fbentry; @@ -72,11 +73,11 @@ class FileBrowserEntry final : public ThumbBrowserEntryBase, public: - static Glib::RefPtr editedIcon; - static Glib::RefPtr recentlySavedIcon; - static Glib::RefPtr enqueuedIcon; - static Glib::RefPtr hdr; - static Glib::RefPtr ps; + static std::shared_ptr editedIcon; + static std::shared_ptr recentlySavedIcon; + static std::shared_ptr enqueuedIcon; + static std::shared_ptr hdr; + static std::shared_ptr ps; FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname); ~FileBrowserEntry () override; diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index d6c440570..b01d83223 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -83,7 +83,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : trashButtonBox = Gtk::manage( new Gtk::Box(Gtk::ORIENTATION_VERTICAL) ); Gtk::Button* emptyT = Gtk::manage( new Gtk::Button ()); emptyT->set_tooltip_markup (M("FILEBROWSER_EMPTYTRASHHINT")); - emptyT->set_image (*Gtk::manage(new RTImage ("trash-delete.png"))); + emptyT->set_image (*Gtk::manage(new RTImage ("trash-delete", Gtk::ICON_SIZE_LARGE_TOOLBAR))); emptyT->signal_pressed().connect (sigc::mem_fun(*this, &FileCatalog::emptyTrash)); trashButtonBox->pack_start (*emptyT, Gtk::PACK_SHRINK, 4); emptyT->show (); @@ -93,8 +93,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : hbToolBar1 = Gtk::manage(new Gtk::Box ()); //setup BrowsePath - iRefreshWhite = new RTImage("refresh-small.png"); - iRefreshRed = new RTImage("refresh-red-small.png"); + iRefreshWhite = new RTImage("refresh-small", Gtk::ICON_SIZE_BUTTON); + iRefreshRed = new RTImage("refresh-red-small", Gtk::ICON_SIZE_BUTTON); BrowsePath = Gtk::manage(new Gtk::Entry ()); BrowsePath->set_width_chars (50); @@ -113,7 +113,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : BrowsePath->signal_key_press_event().connect(sigc::mem_fun(*this, &FileCatalog::BrowsePath_key_pressed)); //setup Query - iQueryClear = new RTImage("cancel-small.png"); + iQueryClear = new RTImage("cancel-small", Gtk::ICON_SIZE_BUTTON); Gtk::Label* labelQuery = Gtk::manage(new Gtk::Label(M("FILEBROWSER_QUERYLABEL"))); Query = Gtk::manage(new Gtk::Entry ()); // cannot use Gtk::manage here as FileCatalog::getFilter will fail on Query->get_text() Query->set_text(""); @@ -151,8 +151,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : pack_start (*stb, Gtk::PACK_SHRINK); tbLeftPanel_1 = new Gtk::ToggleButton (); - iLeftPanel_1_Show = new RTImage("panel-to-right.png"); - iLeftPanel_1_Hide = new RTImage("panel-to-left.png"); + iLeftPanel_1_Show = new RTImage("panel-to-right", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iLeftPanel_1_Hide = new RTImage("panel-to-left", Gtk::ICON_SIZE_LARGE_TOOLBAR); tbLeftPanel_1->set_relief(Gtk::RELIEF_NONE); tbLeftPanel_1->set_active (true); @@ -164,11 +164,11 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : vSepiLeftPanel = new Gtk::Separator(Gtk::ORIENTATION_VERTICAL); buttonBar->pack_start (*vSepiLeftPanel, Gtk::PACK_SHRINK); - iFilterClear = new RTImage ("filter-clear.png"); - igFilterClear = new RTImage ("filter.png"); + iFilterClear = new RTImage ("filter-clear", Gtk::ICON_SIZE_LARGE_TOOLBAR); + igFilterClear = new RTImage ("filter", Gtk::ICON_SIZE_LARGE_TOOLBAR); bFilterClear = Gtk::manage(new Gtk::ToggleButton ()); bFilterClear->set_active (true); - bFilterClear->set_image(*iFilterClear);// (*Gtk::manage(new RTImage ("filter-clear.png"))); + bFilterClear->set_image(*iFilterClear); bFilterClear->set_relief (Gtk::RELIEF_NONE); bFilterClear->set_tooltip_markup (M("FILEBROWSER_SHOWDIRHINT")); bFilterClear->signal_button_press_event().connect (sigc::mem_fun(*this, &FileCatalog::capture_event), false); @@ -182,8 +182,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : fltrLabelbox = Gtk::manage (new Gtk::Box()); fltrLabelbox->get_style_context()->add_class("smallbuttonbox"); - iUnRanked = new RTImage ("star-gold-hollow-small.png"); - igUnRanked = new RTImage ("star-hollow-small.png"); + iUnRanked = new RTImage ("star-gold-hollow-small", Gtk::ICON_SIZE_BUTTON); + igUnRanked = new RTImage ("star-hollow-small", Gtk::ICON_SIZE_BUTTON); bUnRanked = Gtk::manage( new Gtk::ToggleButton () ); bUnRanked->get_style_context()->add_class("smallbutton"); bUnRanked->set_active (false); @@ -195,8 +195,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : bUnRanked->signal_button_press_event().connect (sigc::mem_fun(*this, &FileCatalog::capture_event), false); for (int i = 0; i < 5; i++) { - iranked[i] = new RTImage ("star-gold-small.png"); - igranked[i] = new RTImage ("star-small.png"); + iranked[i] = new RTImage ("star-gold-small", Gtk::ICON_SIZE_BUTTON); + igranked[i] = new RTImage ("star-small", Gtk::ICON_SIZE_BUTTON); iranked[i]->show (); igranked[i]->show (); bRank[i] = Gtk::manage( new Gtk::ToggleButton () ); @@ -210,11 +210,11 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : // Toolbar // Similar image arrays in filebrowser.cc - std::array clabelActiveIcons = {"circle-gray-small.png", "circle-red-small.png", "circle-yellow-small.png", "circle-green-small.png", "circle-blue-small.png", "circle-purple-small.png"}; - std::array clabelInactiveIcons = {"circle-empty-gray-small.png", "circle-empty-red-small.png", "circle-empty-yellow-small.png", "circle-empty-green-small.png", "circle-empty-blue-small.png", "circle-empty-purple-small.png"}; + std::array clabelActiveIcons = {"circle-gray-small", "circle-red-small", "circle-yellow-small", "circle-green-small", "circle-blue-small", "circle-purple-small"}; + std::array clabelInactiveIcons = {"circle-empty-gray-small", "circle-empty-red-small", "circle-empty-yellow-small", "circle-empty-green-small", "circle-empty-blue-small", "circle-empty-purple-small"}; - iUnCLabeled = new RTImage(clabelActiveIcons[0]); - igUnCLabeled = new RTImage(clabelInactiveIcons[0]); + iUnCLabeled = new RTImage(clabelActiveIcons[0], Gtk::ICON_SIZE_BUTTON); + igUnCLabeled = new RTImage(clabelInactiveIcons[0], Gtk::ICON_SIZE_BUTTON); bUnCLabeled = Gtk::manage(new Gtk::ToggleButton()); bUnCLabeled->get_style_context()->add_class("smallbutton"); bUnCLabeled->set_active(false); @@ -226,8 +226,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : bUnCLabeled->signal_button_press_event().connect (sigc::mem_fun(*this, &FileCatalog::capture_event), false); for (int i = 0; i < 5; i++) { - iCLabeled[i] = new RTImage(clabelActiveIcons[i+1]); - igCLabeled[i] = new RTImage(clabelInactiveIcons[i+1]); + iCLabeled[i] = new RTImage(clabelActiveIcons[i+1], Gtk::ICON_SIZE_BUTTON); + igCLabeled[i] = new RTImage(clabelInactiveIcons[i+1], Gtk::ICON_SIZE_BUTTON); iCLabeled[i]->show(); igCLabeled[i]->show(); bCLabel[i] = Gtk::manage(new Gtk::ToggleButton()); @@ -267,10 +267,10 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : // TODO The "g" variant was the more transparent variant of the icon, used // when the button was not toggled. Simplify this, change to ordinary // togglebutton, use CSS for opacity change. - iEdited[0] = new RTImage ("tick-hollow-small.png"); - igEdited[0] = new RTImage ("tick-hollow-small.png"); - iEdited[1] = new RTImage ("tick-small.png"); - igEdited[1] = new RTImage ("tick-small.png"); + iEdited[0] = new RTImage ("tick-hollow-small", Gtk::ICON_SIZE_BUTTON); + igEdited[0] = new RTImage ("tick-hollow-small", Gtk::ICON_SIZE_BUTTON); + iEdited[1] = new RTImage ("tick-small", Gtk::ICON_SIZE_BUTTON); + igEdited[1] = new RTImage ("tick-small", Gtk::ICON_SIZE_BUTTON); for (int i = 0; i < 2; i++) { iEdited[i]->show (); @@ -292,10 +292,10 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : // TODO The "g" variant was the more transparent variant of the icon, used // when the button was not toggled. Simplify this, change to ordinary // togglebutton, use CSS for opacity change. - iRecentlySaved[0] = new RTImage ("saved-no-small.png"); - igRecentlySaved[0] = new RTImage ("saved-no-small.png"); - iRecentlySaved[1] = new RTImage ("saved-yes-small.png"); - igRecentlySaved[1] = new RTImage ("saved-yes-small.png"); + iRecentlySaved[0] = new RTImage ("saved-no-small", Gtk::ICON_SIZE_BUTTON); + igRecentlySaved[0] = new RTImage ("saved-no-small", Gtk::ICON_SIZE_BUTTON); + iRecentlySaved[1] = new RTImage ("saved-yes-small", Gtk::ICON_SIZE_BUTTON); + igRecentlySaved[1] = new RTImage ("saved-yes-small", Gtk::ICON_SIZE_BUTTON); for (int i = 0; i < 2; i++) { iRecentlySaved[i]->show (); @@ -320,8 +320,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : buttonBar->pack_start (*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)), Gtk::PACK_SHRINK); // Trash - iTrashShowEmpty = new RTImage("trash-empty-show.png") ; - iTrashShowFull = new RTImage("trash-full-show.png") ; + iTrashShowEmpty = new RTImage("trash-empty-show", Gtk::ICON_SIZE_LARGE_TOOLBAR) ; + iTrashShowFull = new RTImage("trash-full-show", Gtk::ICON_SIZE_LARGE_TOOLBAR) ; bTrash = Gtk::manage( new Gtk::ToggleButton () ); bTrash->set_image (*iTrashShowEmpty); @@ -330,8 +330,8 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : bCateg[17] = bTrash->signal_toggled().connect (sigc::bind(sigc::mem_fun(*this, &FileCatalog::categoryButtonToggled), bTrash, true)); bTrash->signal_button_press_event().connect (sigc::mem_fun(*this, &FileCatalog::capture_event), false); - iNotTrash = new RTImage("trash-hide-deleted.png") ; - iOriginal = new RTImage("filter-original.png"); + iNotTrash = new RTImage("trash-hide-deleted", Gtk::ICON_SIZE_LARGE_TOOLBAR) ; + iOriginal = new RTImage("filter-original", Gtk::ICON_SIZE_LARGE_TOOLBAR); bNotTrash = Gtk::manage( new Gtk::ToggleButton () ); bNotTrash->set_image (*iNotTrash); @@ -400,7 +400,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : categoryButtons[19] = bOriginal; exifInfo = Gtk::manage(new Gtk::ToggleButton ()); - exifInfo->set_image (*Gtk::manage(new RTImage ("info.png"))); + exifInfo->set_image (*Gtk::manage(new RTImage ("info", Gtk::ICON_SIZE_LARGE_TOOLBAR))); exifInfo->set_relief (Gtk::RELIEF_NONE); exifInfo->set_tooltip_markup (M("FILEBROWSER_SHOWEXIFINFO")); exifInfo->set_active( options.showFileNames ); @@ -410,13 +410,13 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : // thumbnail zoom Gtk::Box* zoomBox = Gtk::manage( new Gtk::Box () ); zoomInButton = Gtk::manage( new Gtk::Button () ); - zoomInButton->set_image (*Gtk::manage(new RTImage ("magnifier-plus.png"))); + zoomInButton->set_image (*Gtk::manage(new RTImage ("magnifier-plus", Gtk::ICON_SIZE_LARGE_TOOLBAR))); zoomInButton->signal_pressed().connect (sigc::mem_fun(*this, &FileCatalog::zoomIn)); zoomInButton->set_relief (Gtk::RELIEF_NONE); zoomInButton->set_tooltip_markup (M("FILEBROWSER_ZOOMINHINT")); zoomBox->pack_end (*zoomInButton, Gtk::PACK_SHRINK); zoomOutButton = Gtk::manage( new Gtk::Button () ); - zoomOutButton->set_image (*Gtk::manage(new RTImage ("magnifier-minus.png"))); + zoomOutButton->set_image (*Gtk::manage(new RTImage ("magnifier-minus", Gtk::ICON_SIZE_LARGE_TOOLBAR))); zoomOutButton->signal_pressed().connect (sigc::mem_fun(*this, &FileCatalog::zoomOut)); zoomOutButton->set_relief (Gtk::RELIEF_NONE); zoomOutButton->set_tooltip_markup (M("FILEBROWSER_ZOOMOUTHINT")); @@ -425,17 +425,14 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : buttonBar->pack_start (*zoomBox, Gtk::PACK_SHRINK); buttonBar->pack_start (*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)), Gtk::PACK_SHRINK); - //iRightArrow = new RTImage("right.png"); - //iRightArrow_red = new RTImage("right_red.png"); - // if it IS a single row toolbar if (options.FileBrowserToolbarSingleRow) { buttonBar->pack_start (*hbToolBar1, Gtk::PACK_EXPAND_WIDGET, 0); } tbRightPanel_1 = new Gtk::ToggleButton (); - iRightPanel_1_Show = new RTImage("panel-to-left.png"); - iRightPanel_1_Hide = new RTImage("panel-to-right.png"); + iRightPanel_1_Show = new RTImage("panel-to-left", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iRightPanel_1_Hide = new RTImage("panel-to-right", Gtk::ICON_SIZE_LARGE_TOOLBAR); tbRightPanel_1->set_relief(Gtk::RELIEF_NONE); tbRightPanel_1->set_active (true); @@ -713,7 +710,8 @@ void FileCatalog::_refreshProgressBar () // create tab label once Gtk::Notebook *nb = (Gtk::Notebook *)(filepanel->get_parent()); Gtk::Grid* grid = Gtk::manage(new Gtk::Grid()); - progressImage = Gtk::manage(new RTImage("folder-closed.png")); + setExpandAlignProperties (grid, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + progressImage = Gtk::manage(new RTImage("folder-closed", Gtk::ICON_SIZE_LARGE_TOOLBAR)); progressLabel = Gtk::manage(new Gtk::Label(M("MAIN_FRAME_FILEBROWSER"))); grid->attach_next_to(*progressImage, options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*progressLabel, options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1); @@ -727,14 +725,14 @@ void FileCatalog::_refreshProgressBar () } } if (!previewsToLoad) { - progressImage->changeImage("folder-closed.png"); + progressImage->set_from_icon_name("folder-closed", Gtk::ICON_SIZE_LARGE_TOOLBAR); int filteredCount = min(fileBrowser->getNumFiltered(), previewsLoaded); progressLabel->set_text(M("MAIN_FRAME_FILEBROWSER") + (filteredCount != previewsLoaded ? " [" + Glib::ustring::format(filteredCount) + "/" : " (") + Glib::ustring::format(previewsLoaded) + (filteredCount != previewsLoaded ? "]" : ")")); } else { - progressImage->changeImage("magnifier.png"); + progressImage->set_from_icon_name("magnifier", Gtk::ICON_SIZE_LARGE_TOOLBAR); progressLabel->set_text(M("MAIN_FRAME_FILEBROWSER") + " [" + Glib::ustring::format(previewsLoaded) + "/" + Glib::ustring::format(previewsToLoad) + "]" ); diff --git a/rtgui/filethumbnailbuttonset.cc b/rtgui/filethumbnailbuttonset.cc index bb64675a1..cb288b0c0 100644 --- a/rtgui/filethumbnailbuttonset.cc +++ b/rtgui/filethumbnailbuttonset.cc @@ -18,20 +18,20 @@ */ #include "filethumbnailbuttonset.h" -#include "rtimage.h" +#include "rtsurface.h" #include "multilangmgr.h" #include "lwbutton.h" #include "rtsurface.h" bool FileThumbnailButtonSet::iconsLoaded = false; -Cairo::RefPtr FileThumbnailButtonSet::rankIcon; -Cairo::RefPtr FileThumbnailButtonSet::gRankIcon; -Cairo::RefPtr FileThumbnailButtonSet::unRankIcon; -Cairo::RefPtr FileThumbnailButtonSet::trashIcon; -Cairo::RefPtr FileThumbnailButtonSet::unTrashIcon; -Cairo::RefPtr FileThumbnailButtonSet::processIcon; -std::array, 6> FileThumbnailButtonSet::colorLabelIcon; +std::shared_ptr FileThumbnailButtonSet::rankIcon = std::shared_ptr(nullptr); +std::shared_ptr FileThumbnailButtonSet::gRankIcon = std::shared_ptr(nullptr); +std::shared_ptr FileThumbnailButtonSet::unRankIcon = std::shared_ptr(nullptr); +std::shared_ptr FileThumbnailButtonSet::trashIcon = std::shared_ptr(nullptr); +std::shared_ptr FileThumbnailButtonSet::unTrashIcon = std::shared_ptr(nullptr); +std::shared_ptr FileThumbnailButtonSet::processIcon = std::shared_ptr(nullptr); +std::array, 6> FileThumbnailButtonSet::colorLabelIcon; Glib::ustring FileThumbnailButtonSet::processToolTip; Glib::ustring FileThumbnailButtonSet::unrankToolTip; @@ -44,18 +44,18 @@ FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry) { if (!iconsLoaded) { - unRankIcon = Cairo::RefPtr(new RTSurface("star-hollow-narrow.png")); - rankIcon = Cairo::RefPtr(new RTSurface("star-gold-narrow.png")); - gRankIcon = Cairo::RefPtr(new RTSurface("star-narrow.png")); - trashIcon = Cairo::RefPtr(new RTSurface("trash-small.png")); - unTrashIcon = Cairo::RefPtr(new RTSurface("trash-remove-small.png")); - processIcon = Cairo::RefPtr(new RTSurface("gears-small.png")); - colorLabelIcon[0] = Cairo::RefPtr(new RTSurface("circle-empty-gray-small.png")); - colorLabelIcon[1] = Cairo::RefPtr(new RTSurface("circle-red-small.png")); - colorLabelIcon[2] = Cairo::RefPtr(new RTSurface("circle-yellow-small.png")); - colorLabelIcon[3] = Cairo::RefPtr(new RTSurface("circle-green-small.png")); - colorLabelIcon[4] = Cairo::RefPtr(new RTSurface("circle-blue-small.png")); - colorLabelIcon[5] = Cairo::RefPtr(new RTSurface("circle-purple-small.png")); + unRankIcon = std::shared_ptr(new RTSurface("star-hollow-narrow", Gtk::ICON_SIZE_BUTTON)); + rankIcon = std::shared_ptr(new RTSurface("star-gold-narrow", Gtk::ICON_SIZE_BUTTON)); + gRankIcon = std::shared_ptr(new RTSurface("star-narrow", Gtk::ICON_SIZE_BUTTON)); + trashIcon = std::shared_ptr(new RTSurface("trash-small", Gtk::ICON_SIZE_BUTTON)); + unTrashIcon = std::shared_ptr(new RTSurface("trash-remove-small", Gtk::ICON_SIZE_BUTTON)); + processIcon = std::shared_ptr(new RTSurface("gears-small", Gtk::ICON_SIZE_BUTTON)); + colorLabelIcon[0] = std::shared_ptr(new RTSurface("circle-empty-gray-small", Gtk::ICON_SIZE_BUTTON)); + colorLabelIcon[1] = std::shared_ptr(new RTSurface("circle-red-small", Gtk::ICON_SIZE_BUTTON)); + colorLabelIcon[2] = std::shared_ptr(new RTSurface("circle-yellow-small", Gtk::ICON_SIZE_BUTTON)); + colorLabelIcon[3] = std::shared_ptr(new RTSurface("circle-green-small", Gtk::ICON_SIZE_BUTTON)); + colorLabelIcon[4] = std::shared_ptr(new RTSurface("circle-blue-small", Gtk::ICON_SIZE_BUTTON)); + colorLabelIcon[5] = std::shared_ptr(new RTSurface("circle-purple-small", Gtk::ICON_SIZE_BUTTON)); processToolTip = M("FILEBROWSER_POPUPPROCESS"); unrankToolTip = M("FILEBROWSER_UNRANK_TOOLTIP"); diff --git a/rtgui/filethumbnailbuttonset.h b/rtgui/filethumbnailbuttonset.h index 868d3b58a..af6d1321d 100644 --- a/rtgui/filethumbnailbuttonset.h +++ b/rtgui/filethumbnailbuttonset.h @@ -34,14 +34,14 @@ class FileThumbnailButtonSet : static bool iconsLoaded; public: - static Cairo::RefPtr rankIcon; - static Cairo::RefPtr gRankIcon; - static Cairo::RefPtr unRankIcon; - static Cairo::RefPtr trashIcon; - static Cairo::RefPtr unTrashIcon; - static Cairo::RefPtr processIcon; + static std::shared_ptr rankIcon; + static std::shared_ptr gRankIcon; + static std::shared_ptr unRankIcon; + static std::shared_ptr trashIcon; + static std::shared_ptr unTrashIcon; + static std::shared_ptr processIcon; - static std::array, 6> colorLabelIcon; + static std::array, 6> colorLabelIcon; static Glib::ustring processToolTip; static Glib::ustring unrankToolTip; diff --git a/rtgui/filmnegative.cc b/rtgui/filmnegative.cc index 068575a96..ad998a364 100644 --- a/rtgui/filmnegative.cc +++ b/rtgui/filmnegative.cc @@ -204,13 +204,13 @@ FilmNegative::FilmNegative() : refInputLabel(Gtk::manage(new Gtk::Label(Glib::ustring::compose(M("TP_FILMNEGATIVE_REF_LABEL"), "- - -")))), refSpotButton(Gtk::manage(new Gtk::ToggleButton(M("TP_FILMNEGATIVE_REF_PICK")))), outputLevel(createLevelAdjuster(this, M("TP_FILMNEGATIVE_OUT_LEVEL"))), // ref level - greenBalance(createBalanceAdjuster(this, M("TP_FILMNEGATIVE_GREENBALANCE"), -3.0, 3.0, 0.0, "circle-magenta-small.png", "circle-green-small.png")), // green balance - blueBalance(createBalanceAdjuster(this, M("TP_FILMNEGATIVE_BLUEBALANCE"), -3.0, 3.0, 0.0, "circle-blue-small.png", "circle-yellow-small.png")) // blue balance + greenBalance(createBalanceAdjuster(this, M("TP_FILMNEGATIVE_GREENBALANCE"), -3.0, 3.0, 0.0, "circle-magenta-small", "circle-green-small")), // green balance + blueBalance(createBalanceAdjuster(this, M("TP_FILMNEGATIVE_BLUEBALANCE"), -3.0, 3.0, 0.0, "circle-blue-small", "circle-yellow-small")) // blue balance { setExpandAlignProperties(spotButton, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); spotButton->get_style_context()->add_class("independent"); spotButton->set_tooltip_text(M("TP_FILMNEGATIVE_GUESS_TOOLTIP")); - spotButton->set_image(*Gtk::manage(new RTImage("color-picker-small.png"))); + spotButton->set_image(*Gtk::manage(new RTImage("color-picker-small", Gtk::ICON_SIZE_BUTTON))); refSpotButton->set_tooltip_text(M("TP_FILMNEGATIVE_REF_TOOLTIP")); @@ -518,18 +518,18 @@ void FilmNegative::filmRefValuesChanged(const RGB &refInput, const RGB &refOutpu [this, refInput, refOutput]() -> bool { refInputValues = refInput; paramsUpgraded = true; - + disableListener(); - + refInputLabel->set_markup( Glib::ustring::compose(M("TP_FILMNEGATIVE_REF_LABEL"), fmt(refInputValues))); - + writeOutputSliders(refOutput); - + outputLevel->show(); blueBalance->show(); greenBalance->show(); - + enableListener(); return false; } diff --git a/rtgui/filterpanel.cc b/rtgui/filterpanel.cc index c407b88d7..1ea843e28 100644 --- a/rtgui/filterpanel.cc +++ b/rtgui/filterpanel.cc @@ -138,7 +138,7 @@ FilterPanel::FilterPanel () : listener (nullptr) // add panel ending Gtk::Box* vboxpe = Gtk::manage (new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); Gtk::Separator* hseptpe = Gtk::manage (new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); - Gtk::Image* peImg = Gtk::manage (new RTImage("ornament1.png")); + Gtk::Image* peImg = Gtk::manage (new RTImage("ornament1")); vboxpe->pack_start(*hseptpe, Gtk::PACK_SHRINK, 4); vboxpe->pack_start(*peImg); pack_start(*vboxpe, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index 1cc3f5c14..0cabd2f80 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -54,7 +54,7 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u CPointsCurve = Gtk::manage (new MyFlatCurve ()); CPointsCurve->setType (FCT_MinMaxCPoints); - + Gtk::Grid* CPointsCurveBox = Gtk::manage (new Gtk::Grid ()); CPointsCurveBox->get_style_context()->add_class("curve-curvebox"); CPointsCurveBox->add(*CPointsCurve); @@ -81,17 +81,17 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u } editCPoints = Gtk::manage (new Gtk::ToggleButton()); - initButton(*editCPoints, Glib::ustring("crosshair-node-curve.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); + initButton(*editCPoints, Glib::ustring("crosshair-node-curve"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP"); editPointCPoints = Gtk::manage (new Gtk::ToggleButton ()); - initButton(*editPointCPoints, Glib::ustring("edit-point.png"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT"); + initButton(*editPointCPoints, Glib::ustring("edit-point"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT"); copyCPoints = Gtk::manage (new Gtk::Button ()); - initButton(*copyCPoints, Glib::ustring("copy.png"), Gtk::ALIGN_END, true); + initButton(*copyCPoints, Glib::ustring("copy"), Gtk::ALIGN_END, true); pasteCPoints = Gtk::manage (new Gtk::Button ()); - initButton(*pasteCPoints, Glib::ustring("paste.png"), Gtk::ALIGN_END, false); + initButton(*pasteCPoints, Glib::ustring("paste"), Gtk::ALIGN_END, false); loadCPoints = Gtk::manage (new Gtk::Button ()); - initButton(*loadCPoints, Glib::ustring("folder-open.png"), Gtk::ALIGN_END, false); + initButton(*loadCPoints, Glib::ustring("folder-open"), Gtk::ALIGN_END, false); saveCPoints = Gtk::manage (new Gtk::Button ()); - initButton(*saveCPoints, Glib::ustring("save.png"), Gtk::ALIGN_END, false); + initButton(*saveCPoints, Glib::ustring("save"), Gtk::ALIGN_END, false); CPointsbbox->attach_next_to(*editPointCPoints, sideStart, 1, 1); CPointsbbox->attach_next_to(*editCPoints, sideStart, 1, 1); diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 71fa0aab6..b217bb7c5 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -37,7 +37,7 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L bindCurrentFolder (*flatFieldFile, options.lastFlatfieldDir); ffLabel = Gtk::manage(new Gtk::Label(M("GENERAL_FILE"))); flatFieldFileReset = Gtk::manage(new Gtk::Button()); - flatFieldFileReset->set_image (*Gtk::manage(new RTImage ("cancel-small.png"))); + flatFieldFileReset->set_image (*Gtk::manage(new RTImage ("cancel-small", Gtk::ICON_SIZE_BUTTON))); hbff->pack_start(*ffLabel, Gtk::PACK_SHRINK); hbff->pack_start(*flatFieldFile); hbff->pack_start(*flatFieldFileReset, Gtk::PACK_SHRINK); diff --git a/rtgui/gradient.cc b/rtgui/gradient.cc index 1274da9ab..79f8d085f 100644 --- a/rtgui/gradient.cc +++ b/rtgui/gradient.cc @@ -31,7 +31,7 @@ Gradient::Gradient () : FoldableToolPanel(this, "gradient", M("TP_GRADIENT_LABEL editHBox = Gtk::manage (new Gtk::Box()); edit = Gtk::manage (new Gtk::ToggleButton()); edit->get_style_context()->add_class("independent"); - edit->add (*Gtk::manage (new RTImage ("crosshair-adjust.png"))); + edit->add (*Gtk::manage (new RTImage ("crosshair-adjust", Gtk::ICON_SIZE_BUTTON))); edit->set_tooltip_text(M("EDIT_OBJECT_TOOLTIP")); editConn = edit->signal_toggled().connect( sigc::mem_fun(*this, &Gradient::editToggled) ); editHBox->pack_start(*edit, Gtk::PACK_SHRINK, 0); @@ -164,8 +164,8 @@ void Gradient::updateGeometry(const int centerX, const int centerY, const double int imW=0; int imH=0; - - + + if (fullWidth != -1 && fullHeight != -1) { imW = fullWidth; imH = fullHeight; diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 61cbde140..c6399bed6 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -23,6 +23,7 @@ #include "../rtengine/utils.h" #include "../rtengine/procparams.h" #include "rtimage.h" +#include "rtscalable.h" #include "multilangmgr.h" #include @@ -31,12 +32,6 @@ using namespace std; -Glib::RefPtr MyExpander::inconsistentImage; -Glib::RefPtr MyExpander::enabledImage; -Glib::RefPtr MyExpander::disabledImage; -Glib::RefPtr MyExpander::openedImage; -Glib::RefPtr MyExpander::closedImage; - IdleRegister::~IdleRegister() { destroy(); @@ -184,13 +179,14 @@ Gtk::Border getPadding(const Glib::RefPtr style) return padding; } - int s = (double)RTScalable::getScale(); padding = style->get_padding(); - if (s > 1) { - padding.set_left(padding.get_left() * s); - padding.set_right(padding.get_right() * s); - padding.set_top(padding.get_top() * s); - padding.set_bottom(padding.get_bottom() * s); + + if (RTScalable::getGlobalScale() > 1.0) { + // Scale pixel border size based on DPI and Scale + padding.set_left(RTScalable::scalePixelSize(padding.get_left())); + padding.set_right(RTScalable::scalePixelSize(padding.get_right())); + padding.set_top(RTScalable::scalePixelSize(padding.get_top())); + padding.set_bottom(RTScalable::scalePixelSize(padding.get_bottom())); } return padding; @@ -589,27 +585,12 @@ void ExpanderBox::hideBox() Gtk::EventBox::hide(); } -void MyExpander::init() -{ - if (!inconsistentImage) { // if one is null, all are null - inconsistentImage = Glib::RefPtr(new RTImage("power-inconsistent-small.png")); - enabledImage = Glib::RefPtr(new RTImage("power-on-small.png")); - disabledImage = Glib::RefPtr(new RTImage("power-off-small.png")); - openedImage = Glib::RefPtr(new RTImage("expander-open-small.png")); - closedImage = Glib::RefPtr(new RTImage("expander-closed-small.png")); - } -} - -void MyExpander::cleanup() -{ - inconsistentImage.reset(); - enabledImage.reset(); - disabledImage.reset(); - openedImage.reset(); - closedImage.reset(); -} - MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) : + inconsistentImage("power-inconsistent-small"), + enabledImage("power-on-small"), + disabledImage("power-off-small"), + openedImage("expander-open-small"), + closedImage("expander-closed-small"), enabled(false), inconsistent(false), flushEvent(false), expBox(nullptr), child(nullptr), headerWidget(nullptr), statusImage(nullptr), label(nullptr), useEnabled(useEnabled) @@ -666,6 +647,11 @@ MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) : } MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) : + inconsistentImage("power-inconsistent-small"), + enabledImage("power-on-small"), + disabledImage("power-off-small"), + openedImage("expander-open-small"), + closedImage("expander-closed-small"), enabled(false), inconsistent(false), flushEvent(false), expBox(nullptr), child(nullptr), headerWidget(nullptr), label(nullptr), useEnabled(useEnabled) @@ -807,13 +793,13 @@ void MyExpander::set_inconsistent(bool isInconsistent) if (useEnabled) { if (isInconsistent) { - statusImage->set(inconsistentImage->get_surface()); + statusImage->set_from_icon_name(inconsistentImage); } else { if (enabled) { - statusImage->set(enabledImage->get_surface()); + statusImage->set_from_icon_name(enabledImage); get_style_context()->add_class("enabledTool"); } else { - statusImage->set(disabledImage->get_surface()); + statusImage->set_from_icon_name(disabledImage); get_style_context()->remove_class("enabledTool"); } } @@ -840,7 +826,7 @@ void MyExpander::setEnabled(bool isEnabled) enabled = false; if (!inconsistent) { - statusImage->set(disabledImage->get_surface()); + statusImage->set_from_icon_name(disabledImage); get_style_context()->remove_class("enabledTool"); message.emit(); } @@ -848,7 +834,7 @@ void MyExpander::setEnabled(bool isEnabled) enabled = true; if (!inconsistent) { - statusImage->set(enabledImage->get_surface()); + statusImage->set_from_icon_name(enabledImage); get_style_context()->add_class("enabledTool"); message.emit(); } @@ -879,9 +865,9 @@ void MyExpander::set_expanded( bool expanded ) if (!useEnabled) { if (expanded ) { - statusImage->set(openedImage->get_surface()); + statusImage->set_from_icon_name(openedImage); } else { - statusImage->set(closedImage->get_surface()); + statusImage->set_from_icon_name(closedImage); } } @@ -924,9 +910,9 @@ bool MyExpander::on_toggle(GdkEventButton* event) if (!useEnabled) { if (isVisible) { - statusImage->set(closedImage->get_surface()); + statusImage->set_from_icon_name(closedImage); } else { - statusImage->set(openedImage->get_surface()); + statusImage->set_from_icon_name(openedImage); } } @@ -951,11 +937,11 @@ bool MyExpander::on_enabled_change(GdkEventButton* event) if (event->button == 1) { if (enabled) { enabled = false; - statusImage->set(disabledImage->get_surface()); + statusImage->set_from_icon_name(disabledImage); get_style_context()->remove_class("enabledTool"); } else { enabled = true; - statusImage->set(enabledImage->get_surface()); + statusImage->set_from_icon_name(enabledImage); get_style_context()->add_class("enabledTool"); } @@ -1019,17 +1005,17 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event) void MyScrolledWindow::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - natural_width = minimum_width = 100 * RTScalable::getScale(); + natural_width = minimum_width = RTScalable::scalePixelSize(100); } void MyScrolledWindow::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - natural_height = minimum_height = 50 * RTScalable::getScale(); + natural_height = minimum_height = RTScalable::scalePixelSize(50); } void MyScrolledWindow::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const { - natural_height = minimum_height = 50 * RTScalable::getScale(); + natural_height = minimum_height = RTScalable::scalePixelSize(50); } /* @@ -1108,7 +1094,7 @@ void MyScrolledToolbar::get_preferred_height_vfunc (int &minimumHeight, int &nat MyComboBoxText::MyComboBoxText (bool has_entry) : Gtk::ComboBoxText(has_entry) { - minimumWidth = naturalWidth = 70; + minimumWidth = naturalWidth = RTScalable::scalePixelSize(70); Gtk::CellRendererText* cellRenderer = dynamic_cast(get_first_cell()); cellRenderer->property_ellipsize() = Pango::ELLIPSIZE_MIDDLE; add_events(Gdk::SCROLL_MASK|Gdk::SMOOTH_SCROLL_MASK); @@ -1132,12 +1118,12 @@ bool MyComboBoxText::on_scroll_event (GdkEventScroll* event) void MyComboBoxText::setPreferredWidth (int minimum_width, int natural_width) { if (natural_width == -1 && minimum_width == -1) { - naturalWidth = minimumWidth = 70 * RTScalable::getScale(); + naturalWidth = minimumWidth = RTScalable::scalePixelSize(70); } else if (natural_width == -1) { naturalWidth = minimumWidth = minimum_width; } else if (minimum_width == -1) { naturalWidth = natural_width; - minimumWidth = rtengine::max(naturalWidth / 2, 20); + minimumWidth = rtengine::max(naturalWidth / 2, RTScalable::scalePixelSize(20)); minimumWidth = rtengine::min(naturalWidth, minimumWidth); } else { naturalWidth = natural_width; @@ -1147,19 +1133,20 @@ void MyComboBoxText::setPreferredWidth (int minimum_width, int natural_width) void MyComboBoxText::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - natural_width = rtengine::max(naturalWidth, 10 * RTScalable::getScale()); - minimum_width = rtengine::max(minimumWidth, 10 * RTScalable::getScale()); + natural_width = rtengine::max(naturalWidth, RTScalable::scalePixelSize(10)); + minimum_width = rtengine::max(minimumWidth, RTScalable::scalePixelSize(10)); } + void MyComboBoxText::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { - natural_width = rtengine::max(naturalWidth, 10 * RTScalable::getScale()); - minimum_width = rtengine::max(minimumWidth, 10 * RTScalable::getScale()); + natural_width = rtengine::max(naturalWidth, RTScalable::scalePixelSize(10)); + minimum_width = rtengine::max(minimumWidth, RTScalable::scalePixelSize(10)); } MyComboBox::MyComboBox () { - minimumWidth = naturalWidth = 70 * RTScalable::getScale(); + minimumWidth = naturalWidth = RTScalable::scalePixelSize(70); } bool MyComboBox::on_scroll_event (GdkEventScroll* event) @@ -1178,12 +1165,12 @@ bool MyComboBox::on_scroll_event (GdkEventScroll* event) void MyComboBox::setPreferredWidth (int minimum_width, int natural_width) { if (natural_width == -1 && minimum_width == -1) { - naturalWidth = minimumWidth = 70 * RTScalable::getScale(); + naturalWidth = minimumWidth = RTScalable::scalePixelSize(70); } else if (natural_width == -1) { naturalWidth = minimumWidth = minimum_width; } else if (minimum_width == -1) { naturalWidth = natural_width; - minimumWidth = rtengine::max(naturalWidth / 2, 20); + minimumWidth = rtengine::max(naturalWidth / 2, RTScalable::scalePixelSize(20)); minimumWidth = rtengine::min(naturalWidth, minimumWidth); } else { naturalWidth = natural_width; @@ -1193,13 +1180,14 @@ void MyComboBox::setPreferredWidth (int minimum_width, int natural_width) void MyComboBox::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - natural_width = rtengine::max(naturalWidth, 10 * RTScalable::getScale()); - minimum_width = rtengine::max(minimumWidth, 10 * RTScalable::getScale()); + natural_width = rtengine::max(naturalWidth, RTScalable::scalePixelSize(10)); + minimum_width = rtengine::max(minimumWidth, RTScalable::scalePixelSize(10)); } + void MyComboBox::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { - natural_width = rtengine::max(naturalWidth, 10 * RTScalable::getScale()); - minimum_width = rtengine::max(minimumWidth, 10 * RTScalable::getScale()); + natural_width = rtengine::max(naturalWidth, RTScalable::scalePixelSize(10)); + minimum_width = rtengine::max(minimumWidth, RTScalable::scalePixelSize(10)); } MySpinButton::MySpinButton () @@ -1485,19 +1473,20 @@ bool MyFileChooserButton::on_scroll_event (GdkEventScroll* event) void MyFileChooserButton::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = natural_width = 35 * RTScalable::getScale(); + minimum_width = natural_width = RTScalable::scalePixelSize(35); } + void MyFileChooserButton::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const { - minimum_width = natural_width = 35 * RTScalable::getScale(); + minimum_width = natural_width = RTScalable::scalePixelSize(35); } -TextOrIcon::TextOrIcon (const Glib::ustring &fname, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx) +TextOrIcon::TextOrIcon (const Glib::ustring &icon_name, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx) { - RTImage *img = Gtk::manage(new RTImage(fname)); + RTImage *img = Gtk::manage(new RTImage(icon_name, Gtk::ICON_SIZE_LARGE_TOOLBAR)); pack_start(*img, Gtk::PACK_SHRINK, 0); set_tooltip_markup("" + labelTx + "\n" + tooltipTx); @@ -1506,14 +1495,14 @@ TextOrIcon::TextOrIcon (const Glib::ustring &fname, const Glib::ustring &labelTx } -MyImageMenuItem::MyImageMenuItem(Glib::ustring label, Glib::ustring imageFileName) +MyImageMenuItem::MyImageMenuItem(Glib::ustring label, Glib::ustring iconName) { box = Gtk::manage (new Gtk::Grid()); this->label = Gtk::manage( new Gtk::Label(label)); box->set_orientation(Gtk::ORIENTATION_HORIZONTAL); - if (!imageFileName.empty()) { - image = Gtk::manage( new RTImage(imageFileName) ); + if (!iconName.empty()) { + image = Gtk::manage( new RTImage(iconName, Gtk::ICON_SIZE_MENU) ); box->attach_next_to(*image, Gtk::POS_LEFT, 1, 1); } else { image = nullptr; @@ -1535,18 +1524,18 @@ const Gtk::Label* MyImageMenuItem::getLabel () const return label; } -MyProgressBar::MyProgressBar(int width) : w(rtengine::max(width, 10 * RTScalable::getScale())) {} -MyProgressBar::MyProgressBar() : w(200 * RTScalable::getScale()) {} +MyProgressBar::MyProgressBar(int width) : w(rtengine::max(width, RTScalable::scalePixelSize(10))) {} +MyProgressBar::MyProgressBar() : w(RTScalable::scalePixelSize(200)) {} void MyProgressBar::setPreferredWidth(int width) { - w = rtengine::max(width, 10 * RTScalable::getScale()); + w = rtengine::max(width, RTScalable::scalePixelSize(10)); } void MyProgressBar::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = rtengine::max(w / 2, 50 * RTScalable::getScale()); - natural_width = rtengine::max(w, 50 * RTScalable::getScale()); + minimum_width = rtengine::max(w / 2, RTScalable::scalePixelSize(50)); + natural_width = rtengine::max(w, RTScalable::scalePixelSize(50)); } void MyProgressBar::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 126cf672b..3b8e80ebb 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -191,11 +191,11 @@ public: typedef sigc::signal type_signal_enabled_toggled; private: type_signal_enabled_toggled message; - static Glib::RefPtr inconsistentImage; /// "inconsistent" image, displayed when useEnabled is true ; in this case, nothing will tell that an expander is opened/closed - static Glib::RefPtr enabledImage; /// "enabled" image, displayed when useEnabled is true ; in this case, nothing will tell that an expander is opened/closed - static Glib::RefPtr disabledImage; /// "disabled" image, displayed when useEnabled is true ; in this case, nothing will tell that an expander is opened/closed - static Glib::RefPtr openedImage; /// "opened" image, displayed when useEnabled is false - static Glib::RefPtr closedImage; /// "closed" image, displayed when useEnabled is false + const Glib::ustring inconsistentImage; /// "inconsistent" image, displayed when useEnabled is true ; in this case, nothing will tell that an expander is opened/closed + const Glib::ustring enabledImage; /// "enabled" image, displayed when useEnabled is true ; in this case, nothing will tell that an expander is opened/closed + const Glib::ustring disabledImage; /// "disabled" image, displayed when useEnabled is true ; in this case, nothing will tell that an expander is opened/closed + const Glib::ustring openedImage; /// "opened" image, displayed when useEnabled is false + const Glib::ustring closedImage; /// "closed" image, displayed when useEnabled is false bool enabled; /// Enabled feature (default to true) bool inconsistent; /// True if the enabled button is inconsistent Gtk::EventBox *titleEvBox; /// EventBox of the title, to get a connector from it @@ -238,10 +238,6 @@ public: */ MyExpander(bool useEnabled, Gtk::Widget* titleWidget); - /// Initialize the class by loading the images - static void init(); - static void cleanup(); - Glib::SignalProxy1< bool, GdkEventButton* > signal_button_release_event() { return titleEvBox->signal_button_release_event(); @@ -479,7 +475,7 @@ class TextOrIcon final : public Gtk::Box { public: - TextOrIcon (const Glib::ustring &filename, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx); + TextOrIcon (const Glib::ustring &icon_name, const Glib::ustring &labelTx, const Glib::ustring &tooltipTx); }; class MyImageMenuItem final : public Gtk::MenuItem @@ -490,7 +486,7 @@ private: Gtk::Label *label; public: - MyImageMenuItem (Glib::ustring label, Glib::ustring imageFileName); + MyImageMenuItem (Glib::ustring label, Glib::ustring iconName); const RTImage *getImage () const; const Gtk::Label* getLabel () const; }; diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 6bda0812e..a7e652460 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -25,6 +25,7 @@ #include "../rtengine/array2D.h" #include "../rtengine/LUT.h" #include "rtimage.h" +#include "rtscalable.h" #include "../rtengine/color.h" using namespace rtengine; @@ -114,30 +115,30 @@ HistogramPanel::HistogramPanel () : histogramRGBAreaHori->set_no_show_all(); histogramRGBAreaVert->set_no_show_all(); - redImage = new RTImage ("histogram-red-on-small.png"); - greenImage = new RTImage ("histogram-green-on-small.png"); - blueImage = new RTImage ("histogram-blue-on-small.png"); - valueImage = new RTImage ("histogram-silver-on-small.png"); - chroImage = new RTImage ("histogram-gold-on-small.png"); - barImage = new RTImage ("histogram-bar-on-small.png"); + redImage = new RTImage ("histogram-red-on-small", Gtk::ICON_SIZE_BUTTON); + greenImage = new RTImage ("histogram-green-on-small", Gtk::ICON_SIZE_BUTTON); + blueImage = new RTImage ("histogram-blue-on-small", Gtk::ICON_SIZE_BUTTON); + valueImage = new RTImage ("histogram-silver-on-small", Gtk::ICON_SIZE_BUTTON); + chroImage = new RTImage ("histogram-gold-on-small", Gtk::ICON_SIZE_BUTTON); + barImage = new RTImage ("histogram-bar-on-small", Gtk::ICON_SIZE_BUTTON); - redImage_g = new RTImage ("histogram-red-off-small.png"); - greenImage_g = new RTImage ("histogram-green-off-small.png"); - blueImage_g = new RTImage ("histogram-blue-off-small.png"); - valueImage_g = new RTImage ("histogram-silver-off-small.png"); - chroImage_g = new RTImage ("histogram-gold-off-small.png"); - barImage_g = new RTImage ("histogram-bar-off-small.png"); + redImage_g = new RTImage ("histogram-red-off-small", Gtk::ICON_SIZE_BUTTON); + greenImage_g = new RTImage ("histogram-green-off-small", Gtk::ICON_SIZE_BUTTON); + blueImage_g = new RTImage ("histogram-blue-off-small", Gtk::ICON_SIZE_BUTTON); + valueImage_g = new RTImage ("histogram-silver-off-small", Gtk::ICON_SIZE_BUTTON); + chroImage_g = new RTImage ("histogram-gold-off-small", Gtk::ICON_SIZE_BUTTON); + barImage_g = new RTImage ("histogram-bar-off-small", Gtk::ICON_SIZE_BUTTON); - mode0Image = new RTImage ("histogram-mode-linear-small.png"); - mode1Image = new RTImage ("histogram-mode-logx-small.png"); - mode2Image = new RTImage ("histogram-mode-logxy-small.png"); + mode0Image = new RTImage ("histogram-mode-linear-small", Gtk::ICON_SIZE_BUTTON); + mode1Image = new RTImage ("histogram-mode-logx-small", Gtk::ICON_SIZE_BUTTON); + mode2Image = new RTImage ("histogram-mode-logxy-small", Gtk::ICON_SIZE_BUTTON); - Gtk::Image* histImage = Gtk::manage(new RTImage("histogram-type-histogram-small.png")); - Gtk::Image* histRawImage = Gtk::manage(new RTImage("histogram-type-histogram-raw-small.png")); - Gtk::Image* paradeImage = Gtk::manage(new RTImage("histogram-type-parade-small.png")); - Gtk::Image* waveImage = Gtk::manage(new RTImage("histogram-type-waveform-small.png")); - Gtk::Image* vectHcImage = Gtk::manage(new RTImage("histogram-type-vectorscope-hc-small.png")); - Gtk::Image* vectHsImage = Gtk::manage(new RTImage("histogram-type-vectorscope-hs-small.png")); + Gtk::Image* histImage = Gtk::manage(new RTImage("histogram-type-histogram-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* histRawImage = Gtk::manage(new RTImage("histogram-type-histogram-raw-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* paradeImage = Gtk::manage(new RTImage("histogram-type-parade-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* waveImage = Gtk::manage(new RTImage("histogram-type-waveform-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* vectHcImage = Gtk::manage(new RTImage("histogram-type-vectorscope-hc-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* vectHsImage = Gtk::manage(new RTImage("histogram-type-vectorscope-hs-small", Gtk::ICON_SIZE_BUTTON)); showRed = Gtk::manage (new Gtk::ToggleButton ()); showGreen = Gtk::manage (new Gtk::ToggleButton ()); @@ -275,7 +276,7 @@ HistogramPanel::HistogramPanel () : case ScopeType::NONE: break; } - scopeOptions->set_image(*Gtk::manage(new RTImage("histogram-ellipsis-small.png"))); + scopeOptions->set_image(*Gtk::manage(new RTImage("histogram-ellipsis-small"))); showBAR->set_image (showBAR->get_active() ? *barImage : *barImage_g); setExpandAlignProperties(showRed , false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); @@ -760,21 +761,18 @@ void HistogramRGBArea::getPreferredThickness(int& min_thickness, int& natural_th void HistogramRGBArea::getPreferredLength(int& min_length, int& natural_length) const { - int s = RTScalable::getScale(); - min_length = 60 * s; - natural_length = 200 * s; + min_length = RTScalable::scalePixelSize(60); + natural_length = RTScalable::scalePixelSize(200); } void HistogramRGBArea::getPreferredThicknessForLength(int length, int& min_thickness, int& natural_thickness) const { int bThickness = length / 30; - int s = RTScalable::getScale(); - - if (bThickness > (10 * s)) { - bThickness = 10 * s; - } else if (bThickness < (5 * s)) { - bThickness = 5 * s; + if (bThickness > RTScalable::scalePixelSize(10)) { + bThickness = RTScalable::scalePixelSize(10); + } else if (bThickness < RTScalable::scalePixelSize(5)) { + bThickness = RTScalable::scalePixelSize(5); } min_thickness = bThickness; @@ -814,7 +812,7 @@ void HistogramRGBArea::updateBackBuffer (int r, int g, int b, const Glib::ustrin int winx, winy, winw, winh; window->get_geometry(winx, winy, winw, winh); - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); // This will create or update the size of the BackBuffer::surface setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, winw, winh, true); @@ -1032,7 +1030,7 @@ void HistogramRGBAreaVert::get_preferred_height_vfunc (int &minimum_height, int void HistogramRGBAreaVert::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = 10 * RTScalable::getScale(); + minimum_width = RTScalable::scalePixelSize(10); natural_width = minimum_width; } @@ -1103,22 +1101,18 @@ Gtk::SizeRequestMode HistogramArea::get_request_mode_vfunc () const void HistogramArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - int s = RTScalable::getScale(); - minimum_height = 100 * s; - natural_height = 200 * s; + minimum_height = RTScalable::scalePixelSize(100); + natural_height = RTScalable::scalePixelSize(200); } void HistogramArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - - int s = RTScalable::getScale(); - minimum_width = 200 * s; - natural_width = 400 * s; + minimum_width = RTScalable::scalePixelSize(200); + natural_width = RTScalable::scalePixelSize(400); } void HistogramArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const { - minimum_height = 0; natural_height = 0; } @@ -1252,7 +1246,7 @@ void HistogramArea::updateBackBuffer () Cairo::RefPtr cr = Cairo::Context::create(surface); const Glib::RefPtr style = get_style_context(); - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); // Setup drawing cr->set_source_rgba (0., 0., 0., 0.); @@ -1471,7 +1465,7 @@ void HistogramArea::on_realize () void HistogramArea::drawCurve(Cairo::RefPtr &cr, const LUTu & data, double scale, int hsize, int vsize) { - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); cr->set_line_width(s); cr->move_to (padding, vsize - 1); @@ -1501,7 +1495,7 @@ void HistogramArea::drawCurve(Cairo::RefPtr &cr, void HistogramArea::drawMarks(Cairo::RefPtr &cr, const LUTu & data, double scale, int hsize, int & ui, int & oi) { - int s = 8 * RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); if(data[0] > scale) { cr->rectangle(padding, (ui++)*s, s, s); @@ -1674,7 +1668,7 @@ void HistogramArea::drawVectorscope(Cairo::RefPtr &cr, int w, in scope_scale * std::max(vect_width, vect_height) : std::min(w, h) - 2 * padding; const float o_x = (w - scope_scale * vect_width) / 2; const float o_y = (h - scope_scale * vect_height) / 2; - const double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); auto orig_matrix = cr->get_matrix(); const double line_length = scope_size / 2.0; std::valarray ch_ds(1); diff --git a/rtgui/history.cc b/rtgui/history.cc index 4d6940e9b..9cd9173a8 100644 --- a/rtgui/history.cc +++ b/rtgui/history.cc @@ -98,7 +98,7 @@ History::History (bool bookmarkSupport) : historyVPaned (nullptr), blistener (nu //addBookmark->get_style_context()->set_junction_sides(Gtk::JUNCTION_RIGHT); addBookmark->get_style_context()->add_class ("Left"); addBookmark->set_tooltip_markup (M ("HISTORY_NEWSNAPSHOT_TOOLTIP")); - Gtk::Image* addimg = Gtk::manage (new RTImage ("add-small.png")); + Gtk::Image* addimg = Gtk::manage (new RTImage ("add-small", Gtk::ICON_SIZE_BUTTON)); addBookmark->set_image (*addimg); ahbox->pack_start (*addBookmark); @@ -106,7 +106,7 @@ History::History (bool bookmarkSupport) : historyVPaned (nullptr), blistener (nu setExpandAlignProperties (delBookmark, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); //delBookmark->get_style_context()->set_junction_sides(Gtk::JUNCTION_LEFT); delBookmark->get_style_context()->add_class ("Right"); - Gtk::Image* delimg = Gtk::manage (new RTImage ("remove-small.png")); + Gtk::Image* delimg = Gtk::manage (new RTImage ("remove-small", Gtk::ICON_SIZE_BUTTON)); delBookmark->set_image (*delimg); ahbox->pack_start (*delBookmark); diff --git a/rtgui/iccprofilecreator.cc b/rtgui/iccprofilecreator.cc index 446dda3fb..542234db2 100644 --- a/rtgui/iccprofilecreator.cc +++ b/rtgui/iccprofilecreator.cc @@ -87,21 +87,6 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow) setExpandAlignProperties(primariesGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); primariesGrid->set_column_spacing(5); - /* - Gtk::Image* gamuts0 = Gtk::manage(new RTImage("rt-logo-tiny.png")); - Gtk::Image* gamutl0 = Gtk::manage(new RTImage("rt-logo-small.png")); - Gtk::Image* gamuts1 = Gtk::manage(new RTImage("rt-logo-tiny.png")); - Gtk::Image* gamutl1 = Gtk::manage(new RTImage("rt-logo-small.png")); - Gtk::Image* gamuts2 = Gtk::manage(new RTImage("rt-logo-tiny.png")); - Gtk::Image* gamutl2 = Gtk::manage(new RTImage("rt-logo-small.png")); - Gtk::Image* gamuts3 = Gtk::manage(new RTImage("rt-logo-tiny.png")); - Gtk::Image* gamutl3 = Gtk::manage(new RTImage("rt-logo-small.png")); - Gtk::Image* gamuts4 = Gtk::manage(new RTImage("rt-logo-tiny.png")); - Gtk::Image* gamutl4 = Gtk::manage(new RTImage("rt-logo-small.png")); - Gtk::Image* gamuts5 = Gtk::manage(new RTImage("rt-logo-tiny.png")); - Gtk::Image* gamutl5 = Gtk::manage(new RTImage("rt-logo-small.png")); - */ - aPrimariesRedX = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_REDX"), 0.4100, 0.9000, 0.0001, 0.6400/*, gamuts0, gamutl0*/)); setExpandAlignProperties(aPrimariesRedX, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); aPrimariesRedY = Gtk::manage(new Adjuster(M("ICCPROFCREATOR_PRIM_REDY"), 0.1000, 0.6000, 0.0001, 0.3300/*, gamutl1, gamuts1*/)); @@ -219,7 +204,7 @@ ICCProfileCreator::ICCProfileCreator(RTWindow *rtwindow) setExpandAlignProperties(eCopyright, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); copygrid->attach(*eCopyright, 0, 0, 1, 1); resetCopyright = Gtk::manage(new Gtk::Button()); - resetCopyright->add(*Gtk::manage(new RTImage("undo-small.png", "redo-small.png"))); + resetCopyright->add(*Gtk::manage(new RTImage("undo-small", Gtk::ICON_SIZE_BUTTON))); setExpandAlignProperties(resetCopyright, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); resetCopyright->set_relief(Gtk::RELIEF_NONE); resetCopyright->set_tooltip_markup(M("ICCPROFCREATOR_COPYRIGHT_RESET_TOOLTIP")); @@ -850,7 +835,7 @@ void ICCProfileCreator::savePressed() //g5=0.517448 presetGamma = 2.22; presetSlope = 4.5; - + } else if (gammaPreset == "linear_g1.0") { sGammaPreset = "Linear_g=1.0"; ga[0] = 1.0; //gamma=1 linear : for high dynamic images (cf D.Coffin...) diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 90528e831..d57e9e7a8 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -170,7 +170,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha iVBox->pack_start(*dcpFrame); saveRef = Gtk::manage(new Gtk::Button(M("TP_ICM_SAVEREFERENCE"))); - saveRef->set_image(*Gtk::manage(new RTImage("save-small.png"))); + saveRef->set_image(*Gtk::manage(new RTImage("save-small", Gtk::ICON_SIZE_BUTTON))); saveRef->set_alignment(0.5f, 0.5f); saveRef->set_tooltip_markup(M("TP_ICM_SAVEREFERENCE_TOOLTIP")); iVBox->pack_start(*saveRef, Gtk::PACK_SHRINK); @@ -268,7 +268,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha neutral = Gtk::manage (new Gtk::Button (M ("TP_ICM_NEUTRAL"))); setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - RTImage *resetImg = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); + RTImage *resetImg = Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON)); setExpandAlignProperties (resetImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); neutral->set_image (*resetImg); neutralconn = neutral->signal_pressed().connect ( sigc::mem_fun (*this, &ICMPanel::neutral_pressed) ); @@ -340,7 +340,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha redVBox->pack_start(*bluBox, Gtk::PACK_EXPAND_WIDGET); preser = Gtk::manage(new Adjuster(M("TP_ICM_WORKING_PRESER"), 0., 100., 0.5, 0.)); preser->setAdjusterListener(this); - + preBox = Gtk::manage(new Gtk::Box()); preBox->pack_start(*preser, Gtk::PACK_SHRINK); redVBox->pack_start(*separator1, Gtk::PACK_SHRINK); @@ -352,7 +352,7 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha redVBox->pack_start(*cielab, Gtk::PACK_SHRINK); redVBox->pack_start(*labgridcie, Gtk::PACK_EXPAND_WIDGET, 4); - + redFrame->add(*redVBox); wGamma->setAdjusterListener(this); @@ -374,10 +374,10 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha Gtk::Label* abIntentLbl = Gtk::manage(new Gtk::Label(M("TP_ICM_PROFILEINTENT"))); riaHBox->pack_start(*abIntentLbl, Gtk::PACK_SHRINK); aRendIntent.reset(new PopUpButton()); - aRendIntent->addEntry("intent-perceptual.png", M("PREFERENCES_INTENT_PERCEPTUAL")); - aRendIntent->addEntry("intent-relative.png", M("PREFERENCES_INTENT_RELATIVE")); - aRendIntent->addEntry("intent-saturation.png", M("PREFERENCES_INTENT_SATURATION")); - aRendIntent->addEntry("intent-absolute.png", M("PREFERENCES_INTENT_ABSOLUTE")); + aRendIntent->addEntry("intent-perceptual", M("PREFERENCES_INTENT_PERCEPTUAL")); + aRendIntent->addEntry("intent-relative", M("PREFERENCES_INTENT_RELATIVE")); + aRendIntent->addEntry("intent-saturation", M("PREFERENCES_INTENT_SATURATION")); + aRendIntent->addEntry("intent-absolute", M("PREFERENCES_INTENT_ABSOLUTE")); aRendIntent->setSelected(1); aRendIntent->show(); riaHBox->pack_start(*aRendIntent->buttonGroup, Gtk::PACK_EXPAND_PADDING); @@ -417,10 +417,10 @@ ICMPanel::ICMPanel() : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iuncha Gtk::Label* outputIntentLbl = Gtk::manage(new Gtk::Label(M("TP_ICM_PROFILEINTENT"))); riHBox->pack_start(*outputIntentLbl, Gtk::PACK_SHRINK); oRendIntent.reset(new PopUpButton()); - oRendIntent->addEntry("intent-perceptual.png", M("PREFERENCES_INTENT_PERCEPTUAL")); - oRendIntent->addEntry("intent-relative.png", M("PREFERENCES_INTENT_RELATIVE")); - oRendIntent->addEntry("intent-saturation.png", M("PREFERENCES_INTENT_SATURATION")); - oRendIntent->addEntry("intent-absolute.png", M("PREFERENCES_INTENT_ABSOLUTE")); + oRendIntent->addEntry("intent-perceptual", M("PREFERENCES_INTENT_PERCEPTUAL")); + oRendIntent->addEntry("intent-relative", M("PREFERENCES_INTENT_RELATIVE")); + oRendIntent->addEntry("intent-saturation", M("PREFERENCES_INTENT_SATURATION")); + oRendIntent->addEntry("intent-absolute", M("PREFERENCES_INTENT_ABSOLUTE")); oRendIntent->setSelected(1); oRendIntent->show(); riHBox->pack_start(*oRendIntent->buttonGroup, Gtk::PACK_EXPAND_PADDING); @@ -1671,8 +1671,8 @@ void ICMPanel::wprimChanged() break; } } - - + + if (ColorManagementParams::Primaries(wprim->get_active_row_number()) == ColorManagementParams::Primaries::DEFAULT) { if (wProfNames->get_active_text() == "Rec2020") { redx->setValue(0.708); @@ -1776,7 +1776,7 @@ void ICMPanel::wprimChanged() labgridcie->set_sensitive(false); will->set_sensitive(true); } - + } willChanged (); @@ -2156,9 +2156,9 @@ void ICMPanel::setBatchMode(bool batchMode) iVBox->reorder_child(*iunchanged, 5); removeIfThere(this, saveRef); oProfNames->append(M("GENERAL_UNCHANGED")); - oRendIntent->addEntry("template-24.png", M("GENERAL_UNCHANGED")); + oRendIntent->addEntry("template-24", M("GENERAL_UNCHANGED")); oRendIntent->show(); - aRendIntent->addEntry("template-24.png", M("GENERAL_UNCHANGED")); + aRendIntent->addEntry("template-24", M("GENERAL_UNCHANGED")); aRendIntent->show(); wProfNames->append(M("GENERAL_UNCHANGED")); wTRC->append(M("GENERAL_UNCHANGED")); diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 22e140e7d..df9756e88 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -788,14 +788,14 @@ Gtk::SizeRequestMode ImageArea::get_request_mode_vfunc () const void ImageArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - minimum_height= 50 * RTScalable::getScale(); - natural_height = 300 * RTScalable::getScale(); + minimum_height = RTScalable::scalePixelSize(50); + natural_height = RTScalable::scalePixelSize(300); } void ImageArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = 100 * RTScalable::getScale(); - natural_width = 400 * RTScalable::getScale(); + minimum_width = RTScalable::scalePixelSize(100); + natural_width = RTScalable::scalePixelSize(400); } void ImageArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const diff --git a/rtgui/indclippedpanel.cc b/rtgui/indclippedpanel.cc index df9f632ab..72f68887f 100644 --- a/rtgui/indclippedpanel.cc +++ b/rtgui/indclippedpanel.cc @@ -21,31 +21,30 @@ #include "imagearea.h" #include "rtimage.h" -IndicateClippedPanel::IndicateClippedPanel (ImageArea* ia) : imageArea(ia) +IndicateClippedPanel::IndicateClippedPanel (ImageArea* ia) : + Fon("focusscreen-on"), + Foff("focusscreen-off"), + Son("contrastmask-on"), + Soff("contrastmask-off"), + iF(Gtk::manage(new RTImage(Foff, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iS(Gtk::manage(new RTImage(Soff, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + imageArea(ia) { - - iFon = new RTImage ("focusscreen-on.png"); - iFoff = new RTImage ("focusscreen-off.png"); - - // for previewSharpMask, needs to be replaced with different icons - iSon = new RTImage ("contrastmask-on.png"); - iSoff = new RTImage ("contrastmask-off.png"); - previewFocusMask = Gtk::manage (new Gtk::ToggleButton ()); previewFocusMask->set_relief(Gtk::RELIEF_NONE); previewFocusMask->set_tooltip_markup (M("MAIN_TOOLTIP_PREVIEWFOCUSMASK")); - previewFocusMask->set_image(*iFoff); + previewFocusMask->set_image(*iF); previewSharpMask = Gtk::manage (new Gtk::ToggleButton ()); previewSharpMask->set_relief(Gtk::RELIEF_NONE); previewSharpMask->set_tooltip_markup (M("MAIN_TOOLTIP_PREVIEWSHARPMASK")); - previewSharpMask->set_image(*iSoff); + previewSharpMask->set_image(*iS); Glib::ustring tt; indClippedH = Gtk::manage (new Gtk::ToggleButton ()); indClippedH->set_relief(Gtk::RELIEF_NONE); - indClippedH->add (*Gtk::manage (new RTImage ("warning-highlights.png"))); + indClippedH->add (*Gtk::manage (new RTImage ("warning-highlights", Gtk::ICON_SIZE_LARGE_TOOLBAR))); tt = Glib::ustring::compose("%1\n%2 = %3", M("MAIN_TOOLTIP_INDCLIPPEDH"), M("MAIN_TOOLTIP_THRESHOLD"), options.highlightThreshold); if (tt.find("<") == Glib::ustring::npos && tt.find(">") == Glib::ustring::npos) { @@ -56,7 +55,7 @@ IndicateClippedPanel::IndicateClippedPanel (ImageArea* ia) : imageArea(ia) indClippedS = Gtk::manage (new Gtk::ToggleButton ()); indClippedS->set_relief(Gtk::RELIEF_NONE); - indClippedS->add (*Gtk::manage (new RTImage ("warning-shadows.png"))); + indClippedS->add (*Gtk::manage (new RTImage ("warning-shadows", Gtk::ICON_SIZE_LARGE_TOOLBAR))); tt = Glib::ustring::compose("%1\n%2 = %3", M("MAIN_TOOLTIP_INDCLIPPEDS"), M("MAIN_TOOLTIP_THRESHOLD"), options.shadowThreshold); if (tt.find("<") == Glib::ustring::npos && tt.find(">") == Glib::ustring::npos) { @@ -102,7 +101,7 @@ void IndicateClippedPanel::silentlyDisableSharpMask () { ConnectionBlocker conBlocker(connSharpMask); previewSharpMask->set_active(false); - previewSharpMask->set_image(*iSoff); + iS->set_from_icon_name(Soff); } @@ -141,8 +140,8 @@ void IndicateClippedPanel::buttonToggled (Gtk::ToggleButton* tb) } imageArea->sharpMaskSelected(previewSharpMask->get_active()); - previewFocusMask->set_image(previewFocusMask->get_active() ? *iFon : *iFoff); - previewSharpMask->set_image(previewSharpMask->get_active() ? *iSon : *iSoff); + iF->set_from_icon_name(previewFocusMask->get_active() ? Fon : Foff); + iS->set_from_icon_name(previewSharpMask->get_active() ? Son : Soff); connFocusMask.block(false); connSharpMask.block(false); @@ -158,10 +157,4 @@ void IndicateClippedPanel::buttonToggled (Gtk::ToggleButton* tb) } } -IndicateClippedPanel::~IndicateClippedPanel () -{ - delete iFon; - delete iFoff; - delete iSon; - delete iSoff; -} +IndicateClippedPanel::~IndicateClippedPanel () {} diff --git a/rtgui/indclippedpanel.h b/rtgui/indclippedpanel.h index 6be0a6c40..aeeb14315 100644 --- a/rtgui/indclippedpanel.h +++ b/rtgui/indclippedpanel.h @@ -22,13 +22,19 @@ #include class ImageArea; +class RTImage; class IndicateClippedPanel : public Gtk::Box { protected: - Gtk::Image* iFon, *iFoff, *iSon, *iSoff; + const Glib::ustring Fon; + const Glib::ustring Foff; + const Glib::ustring Son; + const Glib::ustring Soff; + RTImage* const iF; + RTImage* const iS; Gtk::ToggleButton* previewSharpMask; Gtk::ToggleButton* previewFocusMask; Gtk::ToggleButton* indClippedH; diff --git a/rtgui/inspector.cc b/rtgui/inspector.cc index 675da51c6..e2f9df35b 100644 --- a/rtgui/inspector.cc +++ b/rtgui/inspector.cc @@ -590,7 +590,7 @@ void Inspector::switchImage (const Glib::ustring &fullPath) bool Inspector::doSwitchImage() { Glib::ustring fullPath = next_image_path; - + // we first check the size of the list, it may have been changed in Preference if (images.size() > size_t(options.maxInspectorBuffers)) { // deleting the last entries @@ -688,14 +688,14 @@ Gtk::SizeRequestMode Inspector::get_request_mode_vfunc () const void Inspector::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - minimum_height= 50 * RTScalable::getScale(); - natural_height = 300 * RTScalable::getScale(); + minimum_height = RTScalable::scalePixelSize(50); + natural_height = RTScalable::scalePixelSize(300); } void Inspector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = 50 * RTScalable::getScale(); - natural_width = 200 * RTScalable::getScale(); + minimum_width = RTScalable::scalePixelSize(50); + natural_width = RTScalable::scalePixelSize(200); } void Inspector::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const diff --git a/rtgui/iptcpanel.cc b/rtgui/iptcpanel.cc index 1134b36da..ac4d976b4 100644 --- a/rtgui/iptcpanel.cc +++ b/rtgui/iptcpanel.cc @@ -118,9 +118,9 @@ IPTCPanel::IPTCPanel () : setExpandAlignProperties(addKW, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); delKW = Gtk::manage( new Gtk::Button () ); setExpandAlignProperties(delKW, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - Gtk::Image* addKWImg = Gtk::manage( new RTImage ("add-small.png") ); + Gtk::Image* const addKWImg = Gtk::manage( new RTImage ("add-small", Gtk::ICON_SIZE_BUTTON) ); setExpandAlignProperties(addKWImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); - Gtk::Image* delKWImg = Gtk::manage( new RTImage ("remove-small.png") ); + Gtk::Image* const delKWImg = Gtk::manage( new RTImage ("remove-small", Gtk::ICON_SIZE_BUTTON) ); setExpandAlignProperties(delKWImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); addKW->add (*addKWImg); delKW->add (*delKWImg); @@ -168,9 +168,9 @@ IPTCPanel::IPTCPanel () : setExpandAlignProperties(addSC, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); delSC = Gtk::manage( new Gtk::Button () ); setExpandAlignProperties(delSC, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); - Gtk::Image* addSCImg = Gtk::manage( new RTImage ("add-small.png") ); + Gtk::Image* const addSCImg = Gtk::manage( new RTImage ("add-small", Gtk::ICON_SIZE_BUTTON) ); setExpandAlignProperties(addSCImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); - Gtk::Image* delSCImg = Gtk::manage( new RTImage ("remove-small.png") ); + Gtk::Image* const delSCImg = Gtk::manage( new RTImage ("remove-small", Gtk::ICON_SIZE_BUTTON) ); setExpandAlignProperties(delSCImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); addSC->add (*addSCImg); delSC->add (*delSCImg); @@ -334,25 +334,25 @@ IPTCPanel::IPTCPanel () : reset = Gtk::manage( new Gtk::Button () ); // M("IPTCPANEL_RESET") reset->get_style_context()->add_class("Left"); - reset->set_image (*Gtk::manage(new RTImage ("undo.png", "redo.png"))); + reset->set_image (*Gtk::manage(new RTImage ("undo", Gtk::ICON_SIZE_BUTTON))); setExpandAlignProperties(reset, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); bbox->attach_next_to (*reset, Gtk::POS_LEFT, 1, 1); file = Gtk::manage( new Gtk::Button () ); // M("IPTCPANEL_EMBEDDED") file->get_style_context()->add_class("MiddleH"); - file->set_image (*Gtk::manage(new RTImage ("folder-open.png"))); + file->set_image (*Gtk::manage(new RTImage ("folder-open", Gtk::ICON_SIZE_BUTTON))); setExpandAlignProperties(file, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); bbox->attach_next_to (*file, Gtk::POS_RIGHT, 1, 1); copy = Gtk::manage( new Gtk::Button () ); copy->get_style_context()->add_class("MiddleH"); - copy->set_image (*Gtk::manage(new RTImage ("copy.png"))); + copy->set_image (*Gtk::manage(new RTImage ("copy", Gtk::ICON_SIZE_BUTTON))); setExpandAlignProperties(copy, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); bbox->attach_next_to (*copy, Gtk::POS_RIGHT, 1, 1); paste = Gtk::manage( new Gtk::Button () ); paste->get_style_context()->add_class("Right"); - paste->set_image (*Gtk::manage(new RTImage ("paste.png"))); + paste->set_image (*Gtk::manage(new RTImage ("paste", Gtk::ICON_SIZE_BUTTON))); setExpandAlignProperties(paste, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); bbox->attach_next_to (*paste, Gtk::POS_RIGHT, 1, 1); diff --git a/rtgui/labgrid.cc b/rtgui/labgrid.cc index bc3b806de..fc34fb53a 100644 --- a/rtgui/labgrid.cc +++ b/rtgui/labgrid.cc @@ -1,5 +1,5 @@ /** -*- C++ -*- - * + * * This file is part of RawTherapee. * * Copyright (c) 2017 Alberto Griggio @@ -43,6 +43,7 @@ #include "../rtengine/color.h" #include "options.h" #include "rtimage.h" +#include "rtscalable.h" using rtengine::Color; @@ -86,7 +87,7 @@ LabGridArea::LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool isDragged(false), low_enabled(enable_low), ciexy_enabled(ciexy) - + { set_can_focus(false); // prevent moving the grid while you're moving a point add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK); @@ -120,7 +121,7 @@ void LabGridArea::setParams(double la, double lb, double ha, double hb, double g gre_y = rtengine::LIM(gy, lo, hi); whi_x = rtengine::LIM(wx, lo, hi); whi_y = rtengine::LIM(wy, lo, hi); - + queue_draw(); if (notify) { notifyListener(); @@ -200,7 +201,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) int width = allocation.get_width(); int height = allocation.get_height(); - int s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); cr->set_line_cap(Cairo::LINE_CAP_SQUARE); @@ -210,23 +211,24 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) cr->paint (); cr->set_operator (Cairo::OPERATOR_OVER); style->render_background(cr, - inset * s + padding.get_left() - s, - inset * s + padding.get_top() - s, - width - 2 * inset * s - padding.get_right() - padding.get_left() + 2 * s, - height - 2 * inset * s - padding.get_top() - padding.get_bottom() + 2 * s + (int)(inset * s + padding.get_left() - s + 0.5), + (int)(inset * s + padding.get_top() - s + 0.5), + (int)(width - 2 * inset * s - padding.get_right() - padding.get_left() + 2 * s + 0.5), + (int)(height - 2 * inset * s - padding.get_top() - padding.get_bottom() + 2 * s + 0.5) ); // drawing the cells - cr->translate(inset * s + padding.get_left(), inset * s + padding.get_top()); + cr->translate((int)(inset * s + padding.get_left() + 0.5), + (int)(inset * s + padding.get_top() + 0.5)); cr->set_antialias(Cairo::ANTIALIAS_NONE); - width -= 2 * inset * s + padding.get_right() + padding.get_left(); - height -= 2 * inset * s + padding.get_top() + padding.get_bottom(); + width -= (int)(2 * inset * s + 0.5) + padding.get_right() + padding.get_left(); + height -= (int)(2 * inset * s + 0.5) + padding.get_top() + padding.get_bottom(); // flip y: cr->translate(0, height); cr->scale(1., -1.); - if (! ciexy_enabled) {//draw cells for Labgrid + if (! ciexy_enabled) {//draw cells for Labgrid int cells = 8; float step = 12000.f / float(cells/2); double cellW = double(width) / double(cells); @@ -270,7 +272,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) // this graph is not accurate...I replace curve by polygon or parabolic float xa = 0.2653f / (0.7347f - 0.17f); float xb = -0.17f * xa; - //linear values + //linear values // float ax = (0.1f - 0.6f) / 0.08f; // float bx = 0.6f; // float ax0 = -0.1f / (0.17f - 0.08f); @@ -306,16 +308,16 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) // float y3 = axss * x + bxss; // float y4 = axsss * x + bxsss; // float y5 = bx4s; - float y6 = 22.52f * x * x - 7.652f * x + 0.65f;//parabolic passing in x=0.17 y=0 - x=0.1 y =0.11 - x=0 y= 0.65 + float y6 = 22.52f * x * x - 7.652f * x + 0.65f;//parabolic passing in x=0.17 y=0 - x=0.1 y =0.11 - x=0 y= 0.65 float y3 = -1.266666f * x * x -0.170002f * x + 0.859686f;//other parabolic for green passing in x=0.35 y=0.65 - x=0.20 y=0.775 - x=0.1 y=0.83 float y4 = -60.71428f * x * x + 6.821428f * x + 0.65f;//other parabolic x=0 y=0.65 - x=0.03 y=0.8 - x=0.07 y=0.83 //small difference in the connection of the 2 last parabolic - + Color::xyz2srgb(XX, YY, ZZ, R, G, B); //replace color by gray if(y < yr && x > 0.17f) { R = 0.7f; G = 0.7f; B = 0.7f; - } + } /* if(y < y0 && x <= 0.17f && x >= 0.08f) { R = 0.7f; G = 0.7f; B = 0.7f; @@ -327,7 +329,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) if(y < y6 && y < 0.65f && x < 0.17f) { R = 0.7f; G = 0.7f; B = 0.7f; } - + if(y > y2 && x > 0.35f) {//0.35 R = 0.7f; G = 0.7f; B = 0.7f; } @@ -396,7 +398,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) cr->line_to(width, 0.04545 * i * height); } - cr->stroke(); + cr->stroke(); //draw abciss and ordonate cr->set_line_width(1.f * double(s)); cr->set_source_rgb(0.4, 0., 0.); @@ -404,7 +406,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) cr->line_to(0.04545 * 2 * width, height); cr->move_to(0., 0.04545 * 2 * height ); cr->line_to(width, 0.04545 * 2 * height); - cr->stroke(); + cr->stroke(); //draw 0 and 1 with circle and lines cr->set_line_width(1.2f * double(s)); @@ -420,7 +422,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) cr->line_to(0.07 * width, 0.965 * height); cr->stroke(); - + } @@ -468,7 +470,7 @@ bool LabGridArea::on_draw(const ::Cairo::RefPtr &crf) bool LabGridArea::on_button_press_event(GdkEventButton *event) { if (event->button == 1) { - if (!ciexy_enabled) { + if (!ciexy_enabled) { if (event->type == GDK_2BUTTON_PRESS) { switch (litPoint) { case NONE: @@ -527,9 +529,9 @@ bool LabGridArea::on_motion_notify_event(GdkEventMotion *event) State oldLitPoint = litPoint; - int s = RTScalable::getScale(); - int width = get_allocated_width() - 2 * inset * s - padding.get_right() - padding.get_left(); - int height = get_allocated_height() - 2 * inset * s - padding.get_top() - padding.get_bottom(); + const double s = RTScalable::scalePixelSize(1.); + int width = (int)(get_allocated_width() - 2 * inset * s - padding.get_right() - padding.get_left() + 0.5); + int height = (int)(get_allocated_height() - 2 * inset * s - padding.get_top() - padding.get_bottom() + 0.5); const float mouse_x = std::min(double(std::max(event->x - inset * s - padding.get_right(), 0.)), double(width)); const float mouse_y = std::min(double(std::max(get_allocated_height() - 1 - event->y - inset * s - padding.get_bottom(), 0.)), double(height)); const float ma = (2.f * mouse_x - width) / width; @@ -590,11 +592,11 @@ void LabGridArea::get_preferred_width_vfunc(int &minimum_width, int &natural_wid { Glib::RefPtr style = get_style_context(); Gtk::Border padding = getPadding(style); // already scaled - int s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); int p = padding.get_left() + padding.get_right(); - minimum_width = 50 * s + p; - natural_width = 150 * s + p; // same as GRAPH_SIZE from mycurve.h + minimum_width = (int)(50 * s + p + 0.5); + natural_width = (int)(150 * s + p + 0.5); // same as GRAPH_SIZE from mycurve.h } @@ -643,7 +645,7 @@ LabGrid::LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_ Gtk::Button *reset = Gtk::manage(new Gtk::Button()); reset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT")); if(!ciexy) {//disabled for Cie xy - reset->add(*Gtk::manage(new RTImage("undo-small.png", "redo-small.png"))); + reset->add(*Gtk::manage(new RTImage("undo-small", Gtk::ICON_SIZE_BUTTON))); } reset->signal_button_release_event().connect(sigc::mem_fun(*this, &LabGrid::resetPressed)); @@ -662,5 +664,5 @@ LabGrid::LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_ bool LabGrid::resetPressed(GdkEventButton *event) { grid.reset(event->state & GDK_CONTROL_MASK); - return false; + return false; } diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 8bdbf6dd4..621f9c278 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -46,7 +46,7 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, "lensgeom", M("TP_LENSGE pack_start (*fill); autoCrop = Gtk::manage (new Gtk::Button (M("TP_LENSGEOM_AUTOCROP"))); - autoCrop->set_image (*Gtk::manage (new RTImage ("crop-auto-small.png"))); + autoCrop->set_image (*Gtk::manage (new RTImage ("crop-auto-small", Gtk::ICON_SIZE_BUTTON))); autoCrop->get_style_context()->add_class("independent"); pack_start (*autoCrop, Gtk::PACK_SHRINK, 2); diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index 73fb0399b..e33fd314c 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -62,7 +62,7 @@ LensProfilePanel::LensProfilePanel() : lensfunCameras(Gtk::manage((new MyComboBox()))), lensfunLensesLbl(Gtk::manage((new Gtk::Label(M("EXIFFILTER_LENS"))))), lensfunLenses(Gtk::manage((new MyComboBox()))), - warning(Gtk::manage(new RTImage("warning.png"))), + warning(Gtk::manage(new RTImage("warning"))), ckbUseDist(Gtk::manage((new Gtk::CheckButton(M("TP_LENSPROFILE_USE_GEOMETRIC"))))), ckbUseVign(Gtk::manage((new Gtk::CheckButton(M("TP_LENSPROFILE_USE_VIGNETTING"))))), ckbUseCA(Gtk::manage((new Gtk::CheckButton(M("TP_LENSPROFILE_USE_CA"))))) @@ -163,7 +163,7 @@ LensProfilePanel::LensProfilePanel() : // Attach grids: nodesFrame->add(*modesGrid); distFrame->add(*distGrid); - + pack_start(*nodesFrame, Gtk::PACK_EXPAND_WIDGET); pack_start(*distFrame, Gtk::PACK_EXPAND_WIDGET); @@ -257,7 +257,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa } - /* + /* if (!batchMode && !checkLensfunCanCorrect(true)) { if (corrLensfunAutoRB->get_active()) { corrOffRB->set_active(true); @@ -268,26 +268,26 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa if (!batchMode && corrLensfunManualRB->get_active() && !checkLensfunCanCorrect(false)) { corrOffRB->set_active(true); - } + } */ - + ckbUseDist->set_active(pp->lensProf.useDist); ckbUseVign->set_active(pp->lensProf.useVign); ckbUseCA->set_active(pp->lensProf.useCA); - + if (pedited) { corrUnchangedRB->set_active(!pedited->lensProf.lcMode); ckbUseDist->set_inconsistent(!pedited->lensProf.useDist); ckbUseVign->set_inconsistent(!pedited->lensProf.useVign); ckbUseCA->set_inconsistent(!pedited->lensProf.useCA); - + if (!pedited->lensProf.lfCameraMake || !pedited->lensProf.lfCameraModel) { setLensfunCamera("", ""); } if (!pedited->lensProf.lfLens) { setLensfunLens(""); } - + ckbUseDist->set_sensitive(true); ckbUseVign->set_sensitive(true); ckbUseCA->set_sensitive(true); @@ -295,7 +295,7 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa lcModeChanged = lcpFileChanged = useDistChanged = useVignChanged = useCAChanged = false; useLensfunChanged = lensfunAutoChanged = lensfunCameraChanged = lensfunLensChanged = false; - + updateLensfunWarning(); enableListener(); conUseDist.block(false); @@ -434,7 +434,7 @@ void LensProfilePanel::onUseCAChanged() void LensProfilePanel::setBatchMode(bool yes) { FoldableToolPanel::setBatchMode(yes); - + corrUnchangedRB->set_group(corrGroup); modesGrid->attach_next_to(*corrUnchangedRB, Gtk::POS_TOP, 3, 1); corrUnchangedRB->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &LensProfilePanel::onCorrModeChanged), corrUnchangedRB)); @@ -498,7 +498,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged) ckbUseCA->set_sensitive(false); mode = M("GENERAL_NONE"); - + } else if (rbChanged == corrLensfunAutoRB) { lcModeChanged = true; useLensfunChanged = true; @@ -511,7 +511,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged) ckbUseVign->set_sensitive(true); ckbUseCA->set_sensitive(true); - + const bool disabled = disableListener(); if (batchMode) { setLensfunCamera("", ""); @@ -526,9 +526,9 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged) if (disabled) { enableListener(); } - + mode = M("TP_LENSPROFILE_CORRECTION_AUTOMATCH"); - + } else if (rbChanged == corrLensfunManualRB) { lcModeChanged = true; useLensfunChanged = true; @@ -542,7 +542,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged) ckbUseCA->set_sensitive(false); mode = M("TP_LENSPROFILE_CORRECTION_MANUAL"); - + } else if (rbChanged == corrLcpFileRB) { lcModeChanged = true; useLensfunChanged = true; @@ -552,7 +552,7 @@ void LensProfilePanel::onCorrModeChanged(const Gtk::RadioButton* rbChanged) updateDisabled(true); mode = M("TP_LENSPROFILE_CORRECTION_LCPFILE"); - + } else if (rbChanged == corrUnchangedRB) { lcModeChanged = false; useLensfunChanged = false; diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index bc72a8f35..ad035b81f 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -141,12 +141,12 @@ LocallabTool::LocallabTool(Gtk::Box* content, Glib::ustring toolName, Glib::ustr titleLabel->set_markup(Glib::ustring("") + escapeHtmlChars(UILabel) + Glib::ustring("")); titleLabel->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); titleBox->pack_start(*titleLabel, Gtk::PACK_EXPAND_WIDGET, 0); - + Gtk::EventBox* const removeEvBox = Gtk::manage(new Gtk::EventBox()); // Glue to manage mouse clicking event on remove image removeEvBox->set_can_focus(false); removeEvBox->set_above_child(false); // To have priority over expander title bar when mouse clicking on remove image removeEvBox->signal_button_release_event().connect(sigc::mem_fun(this, &LocallabTool::on_remove_change)); - RTImage* const removeImage = Gtk::manage(new RTImage("cancel-small.png")); + RTImage* const removeImage = Gtk::manage(new RTImage("cancel-small", Gtk::ICON_SIZE_BUTTON)); removeEvBox->add(*removeImage); titleBox->pack_end(*removeEvBox, Gtk::PACK_SHRINK, 1); if (needMode) { @@ -161,7 +161,7 @@ LocallabTool::LocallabTool(Gtk::Box* content, Glib::ustring toolName, Glib::ustr titleBox->pack_end(*separator, Gtk::PACK_SHRINK, 0); if (need100Percent) { - RTImage* const titleImage = Gtk::manage(new RTImage("one-to-one-small.png")); + RTImage* const titleImage = Gtk::manage(new RTImage("one-to-one-small", Gtk::ICON_SIZE_BUTTON)); titleImage->set_tooltip_text(M("TP_GENERAL_11SCALE_TOOLTIP")); titleBox->pack_end(*titleImage, Gtk::PACK_SHRINK, 0); } @@ -490,7 +490,7 @@ LocallabColor::LocallabColor(): conthrcol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CONTTHR"), 0.0, 100.0, 0.5, 0.))), gridmerFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LABGRIDMERG")))), labgridmerg(Gtk::manage(new LabGrid(EvLocallabLabGridmergValue, M("TP_LOCALLAB_LABGRID_VALUES"), false))), - merlucol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MERLUCOL"), 0.0, 100.0, 0.5, 32., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + merlucol(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MERLUCOL"), 0.0, 100.0, 0.5, 32., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), expmaskcol(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_SHOWC")))), mergecolFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_MERGECOLFRA")))), showmaskcolMethod(Gtk::manage(new MyComboBoxText())), @@ -526,9 +526,9 @@ LocallabColor::LocallabColor(): LLmaskcolshapewav(static_cast(mask2CurveEditorGwav->addCurve(CT_Flat, "L(L)", nullptr, false, false))), csThresholdcol(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLDBLUR"), 0, 9, 0, 0, 6, 5, 0, false))) { - + set_orientation(Gtk::ORIENTATION_VERTICAL); - + float R, G, B; std::vector six_shape; @@ -848,8 +848,8 @@ LocallabColor::LocallabColor(): // colBox3->pack_start(*invmaskc); exprecov->add(*colBox3, false); pack_start(*exprecov, false, false); - - + + ToolParamBlock* const gradcolBox = Gtk::manage(new ToolParamBlock()); gradcolBox->pack_start(*strcol); gradcolBox->pack_start(*strcolab); @@ -1541,7 +1541,7 @@ void LocallabColor::setDefaults(const rtengine::procparams::ProcParams* defParam lowthresc->setDefault((double)defSpot.lowthresc); higthresc->setDefault((double)defSpot.higthresc); decayc->setDefault((double)defSpot.decayc); - + } // Note: No need to manage pedited as batch mode is deactivated for Locallab @@ -1621,7 +1621,7 @@ void LocallabColor::adjusterChanged(Adjuster* a, double newval) } if (a == recothresc) { - + if (listener) { listener->panelChanged(Evlocallabrecothresc, recothresc->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -2117,7 +2117,7 @@ void LocallabColor::updateGUIToMode(const modeType new_type) if (enaColorMask->get_active()) { maskusablec->show(); maskunusablec->hide(); - + } else { maskusablec->hide(); maskunusablec->show(); @@ -2154,7 +2154,7 @@ void LocallabColor::updateGUIToMode(const modeType new_type) if (enaColorMask->get_active()) { maskusablec->show(); maskunusablec->hide(); - + } else { maskusablec->hide(); maskunusablec->show(); @@ -2371,7 +2371,7 @@ void LocallabColor::enaColorMaskChanged() maskusablec->hide(); maskunusablec->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaColorMask->get_active()) { @@ -2570,7 +2570,7 @@ LocallabExposure::LocallabExposure(): fatdetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATDETAIL"), -100., 300., 1., 0.))), norm(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_EQUIL")))), fatlevel(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATLEVEL"), 0.5, 2.0, 0.01, 1.))), - fatanchor(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 0.1, 100.0, 0.01, 50., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + fatanchor(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 0.1, 100.0, 0.01, 50., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), gamex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMC"), 0.5, 3.0, 0.05, 1.))), sensiex(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), structexp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))), @@ -2620,7 +2620,7 @@ LocallabExposure::LocallabExposure(): Lmaskexpshape(static_cast(mask2expCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Exposure specific widgets @@ -3625,7 +3625,7 @@ void LocallabExposure::updateGUIToMode(const modeType new_type) if (enaExpMask->get_active()) { maskusablee->show(); maskunusablee->hide(); - + } else { maskusablee->hide(); maskunusablee->show(); @@ -3637,7 +3637,7 @@ void LocallabExposure::updateGUIToMode(const modeType new_type) // Specific Simple mode widgets are shown in Normal mode softradiusexp->hide(); blurexpde->hide(); - + if (!inversex->get_active()) { // Keep widget hidden when invers is toggled expgradexp->show(); softradiusexp->show(); @@ -3676,7 +3676,7 @@ void LocallabExposure::updateGUIToMode(const modeType new_type) if (enaExpMask->get_active()) { maskusablee->show(); maskunusablee->hide(); - + } else { maskusablee->hide(); maskunusablee->show(); @@ -3822,7 +3822,7 @@ void LocallabExposure::enaExpMaskChanged() maskusablee->hide(); maskunusablee->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaExpMask->get_active()) { @@ -3938,7 +3938,7 @@ void LocallabExposure::updateExposureGUI3() gamex->show(); } - + reparexp->show(); showmaskexpMethodinv->hide(); @@ -3982,7 +3982,7 @@ LocallabShadow::LocallabShadow(): shadows(Gtk::manage(new Adjuster(M("TP_SHADOWSHLIGHTS_SHADOWS"), 0, 100, 1, 0))), s_tonalwidth(Gtk::manage(new Adjuster(M("TP_SHADOWSHLIGHTS_SHTONALW"), 10, 100, 1, 30))), sh_radius(Gtk::manage(new Adjuster(M("TP_SHADOWSHLIGHTS_RADIUS"), 0, 100, 1, 40))), - sensihs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),//unused here, but used for normalize_mean_dt + sensihs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),//unused here, but used for normalize_mean_dt blurSHde(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BLURDE"), 2, 100, 1, 5))), exprecovs(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), maskusables(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), @@ -4017,10 +4017,10 @@ LocallabShadow::LocallabShadow(): LmaskSHshape(static_cast(mask2SHCurveEditorG->addCurve(CT_Diagonal, "L(L)"))), fatSHFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_FATSHFRA")))), fatamountSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATAMOUNT"), 1., 100., 1., 1.))), - fatanchorSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 1., 100., 1., 50., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))) + fatanchorSH(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATANCHOR"), 1., 100., 1., 50., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Shadow highlight specific widgets @@ -4149,7 +4149,7 @@ LocallabShadow::LocallabShadow(): pack_start(*shadows); pack_start(*s_tonalwidth); pack_start(*sh_radius); - // pack_start(*sensihs);//unused here, but used for normalize_mean_dt + // pack_start(*sensihs);//unused here, but used for normalize_mean_dt pack_start(*blurSHde); ToolParamBlock* const shBox3 = Gtk::manage(new ToolParamBlock()); shBox3->pack_start(*maskusables, Gtk::PACK_SHRINK, 0); @@ -4266,7 +4266,7 @@ void LocallabShadow::updateAdviceTooltips(const bool showTooltips) decays->set_tooltip_text(M("TP_LOCALLAB_MASKDECAY_TOOLTIP")); lowthress->set_tooltip_text(M("TP_LOCALLAB_MASKLOWTHRESS_TOOLTIP")); higthress->set_tooltip_text(M("TP_LOCALLAB_MASKHIGTHRESS_TOOLTIP")); - + } else { exp->set_tooltip_text(""); @@ -4301,7 +4301,7 @@ void LocallabShadow::updateAdviceTooltips(const bool showTooltips) decays->set_tooltip_text(""); lowthress->set_tooltip_text(""); higthress->set_tooltip_text(""); - + } } @@ -4571,7 +4571,7 @@ void LocallabShadow::adjusterChanged(Adjuster* a, double newval) } if (a == recothress) { - + if (listener) { listener->panelChanged(Evlocallabrecothress, recothress->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -4791,7 +4791,7 @@ void LocallabShadow::convertParamToSimple() // radmaskSH->setValue(defSpot.radmaskSH); // chromaskSH->setValue(defSpot.chromaskSH); // LmaskSHshape->setCurve(defSpot.LmaskSHcurve); - + recothress->setValue(defSpot.recothress); lowthress->setValue(defSpot.lowthress); higthress->setValue(defSpot.higthresc); @@ -4834,7 +4834,7 @@ void LocallabShadow::updateGUIToMode(const modeType new_type) if (enaSHMask->get_active()) { maskusables->show(); maskunusables->hide(); - + } else { maskusables->hide(); maskunusables->show(); @@ -4865,7 +4865,7 @@ void LocallabShadow::updateGUIToMode(const modeType new_type) if (enaSHMask->get_active()) { maskusables->show(); maskunusables->hide(); - + } else { maskusables->hide(); maskunusables->show(); @@ -4987,7 +4987,7 @@ void LocallabShadow::enaSHMaskChanged() maskusables->hide(); maskunusables->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaSHMask->get_active()) { @@ -5075,12 +5075,12 @@ LocallabVibrance::LocallabVibrance(): saturated(Gtk::manage(new Adjuster(M("TP_VIBRANCE_SATURATED"), -100., 100., 1., 0.))), pastels(Gtk::manage(new Adjuster(M("TP_VIBRANCE_PASTELS"), -100., 100., 1., 0.))), vibgam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GAMC"), 0.5, 3., 0.05, 1.))), - warm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WARM"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-small.png")), Gtk::manage(new RTImage("circle-orange-small.png"))))), + warm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_WARM"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-small")), Gtk::manage(new RTImage("circle-orange-small"))))), psThreshold(Gtk::manage(new ThresholdAdjuster(M("TP_VIBRANCE_PSTHRESHOLD"), -100., 100., 0., M("TP_VIBRANCE_PSTHRESHOLD_WEIGTHING"), 0, 0., 100., 75., M("TP_VIBRANCE_PSTHRESHOLD_SATTHRESH"), 0, this, false))), protectSkins(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PROTECTSKINS")))), avoidColorShift(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_AVOIDCOLORSHIFT")))), pastSatTog(Gtk::manage(new Gtk::CheckButton(M("TP_VIBRANCE_PASTSATTOG")))), - sensiv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),//unused here, but used for normalize_mean_dt + sensiv(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 15))),//unused here, but used for normalize_mean_dt curveEditorGG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES_LABEL"))), skinTonesCurve(static_cast(curveEditorGG->addCurve(CT_Diagonal, M("TP_VIBRANCE_CURVEEDITOR_SKINTONES")))), exprecovv(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), @@ -5113,7 +5113,7 @@ LocallabVibrance::LocallabVibrance(): Lmaskvibshape(static_cast(mask2vibCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + float R, G, B; const LocallabParams::LocallabSpot defSpot; @@ -5237,7 +5237,7 @@ LocallabVibrance::LocallabVibrance(): pack_start(*protectSkins, Gtk::PACK_SHRINK, 0); pack_start(*avoidColorShift, Gtk::PACK_SHRINK, 0); pack_start(*pastSatTog, Gtk::PACK_SHRINK, 0); - // pack_start(*sensiv, Gtk::PACK_SHRINK, 0);//unused here, but used for normalize_mean_dt + // pack_start(*sensiv, Gtk::PACK_SHRINK, 0);//unused here, but used for normalize_mean_dt pack_start(*curveEditorGG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor ToolParamBlock* const vibBox3 = Gtk::manage(new ToolParamBlock()); vibBox3->pack_start(*maskusablev, Gtk::PACK_SHRINK, 0); @@ -5583,7 +5583,7 @@ void LocallabVibrance::adjusterChanged(Adjuster* a, double newval) } if (a == recothresv) { - + if (listener) { listener->panelChanged(Evlocallabrecothresv, recothresv->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -5806,7 +5806,7 @@ void LocallabVibrance::convertParamToNormal() // Set hidden GUI widgets in Normal mode to default spot values saturated->setValue((double)defSpot.saturated); vibgam->setValue(defSpot.vibgam); - + psThreshold->setValue(defSpot.psthreshold); protectSkins->set_active(defSpot.protectskins); avoidColorShift->set_active(defSpot.avoidcolorshift); @@ -5900,7 +5900,7 @@ void LocallabVibrance::updateGUIToMode(const modeType new_type) if (enavibMask->get_active()) { maskusablev->show(); maskunusablev->hide(); - + } else { maskusablev->hide(); maskunusablev->show(); @@ -5930,7 +5930,7 @@ void LocallabVibrance::updateGUIToMode(const modeType new_type) if (enavibMask->get_active()) { maskusablev->show(); maskunusablev->hide(); - + } else { maskusablev->hide(); maskunusablev->show(); @@ -6027,7 +6027,7 @@ void LocallabVibrance::enavibMaskChanged() maskusablev->hide(); maskunusablev->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enavibMask->get_active()) { @@ -6069,7 +6069,7 @@ LocallabSoft::LocallabSoft(): sensisf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 1, 100, 1, 30))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + // Parameter Soft light specific widgets softMethod->append(M("TP_LOCALLAB_SOFTM")); softMethod->append(M("TP_LOCALLAB_RETIM")); @@ -6493,9 +6493,9 @@ LocallabBlur::LocallabBlur(): noiselumf0(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINEZERO"), MINCHRO, MAXCHRO, 0.01, 0.))), noiselumf(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINE"), MINCHRO, MAXCHRO, 0.01, 0.))), noiselumf2(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMFINETWO"), MINCHRO, MAXCHRO, 0.01, 0.))), - noiselumc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMCOARSE"), MINCHRO, MAXCHROCC, 0.01, 0.))),//unused here, but used for normalize_mean_dt + noiselumc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMCOARSE"), MINCHRO, MAXCHROCC, 0.01, 0.))),//unused here, but used for normalize_mean_dt noiselumdetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELUMDETAIL"), 0., 100., 0.01, 50.))), - noiselequal(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELEQUAL"), -2, 10, 1, 7, Gtk::manage(new RTImage("circle-white-small.png")), Gtk::manage(new RTImage("circle-black-small.png"))))), + noiselequal(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISELEQUAL"), -2, 10, 1, 7, Gtk::manage(new RTImage("circle-white-small")), Gtk::manage(new RTImage("circle-black-small"))))), noisegam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISEGAM"), 1.0, 5., 0.1, 1.))), LocalcurveEditorwavhue(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_WAVELET_DENOISEHUE"))), wavhue(static_cast(LocalcurveEditorwavhue->addCurve(CT_Flat, "", nullptr, false, true))), @@ -6504,7 +6504,7 @@ LocallabBlur::LocallabBlur(): noisechrodetail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_NOISECHRODETAIL"), 0., 100., 0.01, 50.))), detailFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_DETAILFRA")))), detailthr(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAILTHR"), 0, 100, 1, 50))), - adjblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ADJ"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-yellow-small.png")), Gtk::manage(new RTImage("circle-red-green-small.png"))))), + adjblur(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ADJ"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-yellow-small")), Gtk::manage(new RTImage("circle-red-green-small"))))), expdenoise3(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), recothresd(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKRECOTHRES"), 1., 2., 0.01, 1.))), lowthresd(Gtk::manage(new Adjuster(M("TP_LOCALLAB_MASKLCTHRLOW2"), 1., 80., 0.5, 12.))), @@ -6553,7 +6553,7 @@ LocallabBlur::LocallabBlur(): csThresholdblur(Gtk::manage(new ThresholdAdjuster(M("TP_LOCALLAB_CSTHRESHOLDBLUR"), 0, 9, 0, 0, 6, 5, 0, false))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Blur, Noise & Denoise specific widgets @@ -6714,7 +6714,7 @@ LocallabBlur::LocallabBlur(): setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - RTImage *resetImg = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); + RTImage *resetImg = Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON)); setExpandAlignProperties (resetImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); neutral->set_image (*resetImg); neutral->set_tooltip_text (M ("TP_RETINEX_NEUTRAL_TIP")); @@ -6842,7 +6842,7 @@ LocallabBlur::LocallabBlur(): // wavBox->pack_start(*noiselumf0); // wavBox->pack_start(*noiselumf); // wavBox->pack_start(*noiselumf2); - // wavBox->pack_start(*noiselumc);//unused here, but used for normalize_mean_dt + // wavBox->pack_start(*noiselumc);//unused here, but used for normalize_mean_dt wavBox->pack_start(*noiselumdetail); wavBox->pack_start(*noiselequal); wavBox->pack_start(*noisegam); @@ -6862,7 +6862,7 @@ LocallabBlur::LocallabBlur(): wavBox->pack_start(*detailFrame); denoisebox->pack_start(*sensiden); denoisebox->pack_start(*reparden); - + ToolParamBlock* const nlbox = Gtk::manage(new ToolParamBlock()); nlbox->pack_start(*nlstr); nlbox->pack_start(*nldet); @@ -6871,7 +6871,7 @@ LocallabBlur::LocallabBlur(): nlbox->pack_start(*nlrad); nlFrame->add(*nlbox); wavBox->pack_start(*nlFrame); - + wavBox->pack_start(*noisechrof); wavBox->pack_start(*noisechroc); wavBox->pack_start(*noisechrodetail); @@ -7026,7 +7026,7 @@ void LocallabBlur::updateAdviceTooltips(const bool showTooltips) higthres->set_tooltip_text(M("TP_LOCALLAB_MASKHIGTHRES_TOOLTIP")); decayd->set_tooltip_text(M("TP_LOCALLAB_MASKDECAY_TOOLTIP")); } else { - + expblnoise->set_tooltip_markup(""); radius->set_tooltip_text(""); strength->set_tooltip_text(""); @@ -7099,7 +7099,7 @@ void LocallabBlur::updateAdviceTooltips(const bool showTooltips) } void LocallabBlur::neutral_pressed () -{ +{ const LocallabParams::LocallabSpot defSpot; lnoiselow->setValue(defSpot.lnoiselow); levelthr->setValue(defSpot.levelthr); @@ -7135,7 +7135,7 @@ void LocallabBlur::neutral_pressed () recothres->setValue(defSpot.recothres); lowthres->setValue(defSpot.lowthres); higthres->setValue(defSpot.higthres); - + } @@ -7303,7 +7303,7 @@ void LocallabBlur::read(const rtengine::procparams::ProcParams* pp, const Params nlrad->setValue((double)spot.nlrad); nlgam->setValue((double)spot.nlgam); sensiden->setValue((double)spot.sensiden); - + if (spot.showmaskblMethodtyp == "blur") { showmaskblMethodtyp ->set_active(0); } else if (spot.showmaskblMethodtyp == "nois") { @@ -7477,7 +7477,7 @@ void LocallabBlur::write(rtengine::procparams::ProcParams* pp, ParamsEdited* ped spot.Lmaskblcurve = Lmaskblshape->getCurve(); spot.LLmaskblcurvewav = LLmaskblshapewav->getCurve(); spot.csthresholdblur = csThresholdblur->getValue(); - + } // Note: No need to manage pedited as batch mode is deactivated for Locallab @@ -7621,7 +7621,7 @@ void LocallabBlur::adjusterChanged(Adjuster* a, double newval) showmaskblMethodtyp->set_active(2); } } - + if (listener) { listener->panelChanged(Evlocallabrecothres, recothres->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -7648,7 +7648,7 @@ void LocallabBlur::adjusterChanged(Adjuster* a, double newval) showmaskblMethodtyp->set_active(2); } } - + if (listener) { listener->panelChanged(Evlocallabrecothresd, recothresd->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -8038,7 +8038,7 @@ void LocallabBlur::convertParamToNormal() lnoiselow->setValue(defSpot.lnoiselow); nlrad->setValue(defSpot.nlrad); noisegam->setValue(defSpot.noisegam); - + // Enable all listeners enableListener(); } @@ -8094,7 +8094,7 @@ void LocallabBlur::convertParamToSimple() nlrad->setValue(defSpot.nlrad); nlgam->setValue(defSpot.nlgam); noisegam->setValue(defSpot.noisegam); - + // Enable all listeners enableListener(); } @@ -8175,7 +8175,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) showmaskblMethodtyp->set_active(2); } } - + if (enablMask->get_active()) { maskusable->show(); maskunusable->hide(); @@ -8183,7 +8183,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) maskunusable2->hide(); maskusable3->show(); maskunusable3->hide(); - + } else { maskusable->hide(); maskunusable->show(); @@ -8248,7 +8248,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) showmaskblMethodtyp->set_active(2); } } - + if (enablMask->get_active()) { maskusable->show(); maskunusable->hide(); @@ -8264,7 +8264,7 @@ void LocallabBlur::updateGUIToMode(const modeType new_type) maskusable3->show(); maskunusable3->hide(); } - + } } @@ -8388,7 +8388,7 @@ void LocallabBlur::invblChanged() } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (invbl->get_active()) { @@ -8560,7 +8560,7 @@ void LocallabBlur::updateBlurGUI() guidbl->setValue(defSpot.guidbl); } - + const int mode = complexity->get_active_row_number(); if (blMethod->get_active_row_number() == 0) { diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 3358a61ef..95e84d847 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -128,7 +128,7 @@ LocallabTone::LocallabTone(): estop(Gtk::manage(new Adjuster(M("TP_LOCALLAB_ESTOP"), 0.1, 4., 0.01, 1.4))), scaltm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SCALTM"), 0.1, 10.0, 0.01, 1.0))), rewei(Gtk::manage(new Adjuster(M("TP_LOCALLAB_REWEI"), 0, 3, 1, 0))), - softradiustm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))),//unused here, but used for normalize_mean_dt + softradiustm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOFTRADIUSCOL"), 0.0, 100.0, 0.1, 0.))),//unused here, but used for normalize_mean_dt sensitm(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SENSI"), 0, 100, 1, 60))), exprecovt(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), maskusablet(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), @@ -156,7 +156,7 @@ LocallabTone::LocallabTone(): Lmasktmshape(static_cast(mask2tmCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Tone Mapping specific widgets @@ -253,7 +253,7 @@ LocallabTone::LocallabTone(): pack_start(*estop); pack_start(*scaltm); pack_start(*rewei); - // pack_start(*softradiustm); //unused here, but used for normalize_mean_dt + // pack_start(*softradiustm); //unused here, but used for normalize_mean_dt // pack_start(*sensitm); ToolParamBlock* const tmBox3 = Gtk::manage(new ToolParamBlock()); tmBox3->pack_start(*maskusablet, Gtk::PACK_SHRINK, 0); @@ -265,7 +265,7 @@ LocallabTone::LocallabTone(): // colBox3->pack_start(*invmaskc); exprecovt->add(*tmBox3, false); pack_start(*exprecovt, false, false); - + ToolParamBlock* const masktmBox = Gtk::manage(new ToolParamBlock()); masktmBox->pack_start(*showmasktmMethod, Gtk::PACK_SHRINK, 4); masktmBox->pack_start(*enatmMask, Gtk::PACK_SHRINK, 0); @@ -673,7 +673,7 @@ void LocallabTone::updateGUIToMode(const modeType new_type) if (enatmMask->get_active()) { maskusablet->show(); maskunusablet->hide(); - + } else { maskusablet->hide(); maskunusablet->show(); @@ -695,7 +695,7 @@ void LocallabTone::updateGUIToMode(const modeType new_type) if (enatmMask->get_active()) { maskusablet->show(); maskunusablet->hide(); - + } else { maskusablet->hide(); maskunusablet->show(); @@ -758,7 +758,7 @@ void LocallabTone::enatmMaskChanged() maskusablet->hide(); maskunusablet->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enatmMask->get_active()) { @@ -849,7 +849,7 @@ LocallabRetinex::LocallabRetinex(): inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS")))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Retinex specific widgets @@ -1530,7 +1530,7 @@ void LocallabRetinex::adjusterChanged(Adjuster* a, double newval) } if (a == recothresr) { - + if (listener) { listener->panelChanged(Evlocallabrecothresr, recothresr->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -1740,7 +1740,7 @@ void LocallabRetinex::convertParamToSimple() higthresr->setValue(defSpot.higthresr); decayr->setValue(defSpot.decayr); enableListener(); - + } void LocallabRetinex::updateGUIToMode(const modeType new_type) @@ -1778,7 +1778,7 @@ void LocallabRetinex::updateGUIToMode(const modeType new_type) if (enaretiMask->get_active()) { maskusabler->show(); maskunusabler->hide(); - + } else { maskusabler->hide(); maskunusabler->show(); @@ -1882,7 +1882,7 @@ void LocallabRetinex::enaretiMaskChanged() maskusabler->hide(); maskunusabler->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaretiMask->get_active()) { @@ -1994,7 +1994,7 @@ LocallabSharp::LocallabSharp(): showmasksharMethod(Gtk::manage(new MyComboBoxText())) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + // Parameter Sharpening specific widgets sharcontrast->setAdjusterListener(this); @@ -2412,7 +2412,7 @@ LocallabContrast::LocallabContrast(): expcontrastpyr2(Gtk::manage(new MyExpander(false, Gtk::manage(new Gtk::Box())))), wavcont(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_CONTFRA")))), sigma(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 2.5, 0.01, 1.))), - offset(Gtk::manage(new Adjuster(M("TP_LOCALLAB_OFFSETWAV"), 0.33, 1.66, 0.01, 1., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + offset(Gtk::manage(new Adjuster(M("TP_LOCALLAB_OFFSETWAV"), 0.33, 1.66, 0.01, 1., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), chromalev(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMALEV"), 0.1, 5., 0.1, 1.))), LocalcurveEditorwavcon(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVCON"))), wavshapecon(static_cast(LocalcurveEditorwavcon->addCurve(CT_Flat, "", nullptr, false, false))), @@ -2424,7 +2424,7 @@ LocallabContrast::LocallabContrast(): residcomp(Gtk::manage(new Adjuster(M("TP_LOCALLAB_RESIDCOMP"), -1., 1., 0.01, 0.))), wavcomp(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_COMPFRA")))), sigmadc(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMAWAV"), 0.2, 3., 0.01, 1.))), - deltad(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DELTAD"), -3., 3., 0.1, 0.))),//, Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + deltad(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DELTAD"), -3., 3., 0.1, 0.))),//, Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), LocalcurveEditorwavcomp(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_WAVCOMP"))), wavshapecomp(static_cast(LocalcurveEditorwavcomp->addCurve(CT_Flat, "", nullptr, false, false))), fatres(Gtk::manage(new Adjuster(M("TP_LOCALLAB_FATRES"), 0., 100., 1., 0.))), @@ -2452,7 +2452,7 @@ LocallabContrast::LocallabContrast(): Lmasklcshape(static_cast(mask2lcCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Local contrast specific widgets @@ -2636,7 +2636,7 @@ LocallabContrast::LocallabContrast(): TittleVBox2->pack_start(*LCTitleHBox2, Gtk::PACK_SHRINK); TittleVBox2->pack_start(*LCTitleHBox22, Gtk::PACK_SHRINK); expcontrastpyr2->setLabel(TittleVBox2); - + setExpandAlignProperties(expcontrastpyr2, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); wavcontConn = wavcont->signal_toggled().connect(sigc::mem_fun(*this, &LocallabContrast::wavcontChanged)); @@ -2841,7 +2841,7 @@ LocallabContrast::LocallabContrast(): blurlevelFrame->add(*blurlevcontBox); blurcontBox->pack_start(*blurlevelFrame); expcontrastpyr->add(*blurcontBox, false); - pack_start(*gamlc); + pack_start(*gamlc); pack_start(*expcontrastpyr); ToolParamBlock* const blurcontBox2 = Gtk::manage(new ToolParamBlock()); Gtk::Frame* const contFrame2 = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_CONTFRA"))); @@ -2981,7 +2981,7 @@ void LocallabContrast::updateAdviceTooltips(const bool showTooltips) threswav->set_tooltip_text(M("TP_LOCALLAB_WAT_BALTHRES_TOOLTIP")); residcomp->set_tooltip_text(M("TP_LOCALLAB_WAT_RESIDCOMP_TOOLTIP")); - + expresidpyr->set_tooltip_text(M("TP_LOCALLAB_WAT_EXPRESID_TOOLTIP")); expcontrastpyr->set_tooltip_text(M("TP_LOCALLAB_EXPCONTRASTPYR_TOOLTIP")); wavgradl->set_tooltip_text(M("TP_LOCALLAB_WAVGRAD_TOOLTIP")); @@ -3767,7 +3767,7 @@ void LocallabContrast::adjusterChanged(Adjuster* a, double newval) } if (a == recothresw) { - + if (listener) { listener->panelChanged(Evlocallabrecothresw, recothresw->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -4025,7 +4025,7 @@ void LocallabContrast::convertParamToSimple() lowthresw->setValue(defSpot.lowthresw); higthresw->setValue(defSpot.higthresw); decayw->setValue(defSpot.decayw); - + enableListener(); // Update GUI based on converted widget parameters: @@ -4066,7 +4066,7 @@ void LocallabContrast::updateGUIToMode(const modeType new_type) if (enalcMask->get_active()) { maskusablew->show(); maskunusablew->hide(); - + } else { maskusablew->hide(); maskunusablew->show(); @@ -4096,12 +4096,12 @@ void LocallabContrast::updateGUIToMode(const modeType new_type) if (enalcMask->get_active()) { maskusablew->show(); maskunusablew->hide(); - + } else { maskusablew->hide(); maskunusablew->show(); } - + } } @@ -4335,7 +4335,7 @@ void LocallabContrast::enalcMaskChanged() maskusablew->hide(); maskunusablew->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enalcMask->get_active()) { @@ -4474,7 +4474,7 @@ LocallabCBDL::LocallabCBDL(): lumacontrastPlusButton(Gtk::manage(new Gtk::Button(M("TP_DIRPYREQUALIZER_LUMACONTRAST_PLUS")))) { set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter CBDL specific widgets @@ -4911,7 +4911,7 @@ void LocallabCBDL::adjusterChanged(Adjuster* a, double newval) } if (a == recothrescb) { - + if (listener) { listener->panelChanged(Evlocallabrecothrescb, recothrescb->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -5100,7 +5100,7 @@ void LocallabCBDL::updateGUIToMode(const modeType new_type) if (enacbMask->get_active()) { maskusablecb->show(); maskunusablecb->hide(); - + } else { maskusablecb->hide(); maskunusablecb->show(); @@ -5118,7 +5118,7 @@ void LocallabCBDL::updateGUIToMode(const modeType new_type) if (enacbMask->get_active()) { maskusablecb->show(); maskunusablecb->hide(); - + } else { maskusablecb->hide(); maskunusablecb->show(); @@ -5166,7 +5166,7 @@ void LocallabCBDL::enacbMaskChanged() maskusablecb->hide(); maskunusablecb->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enacbMask->get_active()) { @@ -5234,7 +5234,7 @@ LocallabLog::LocallabLog(): log2Frame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOG2FRA")))), targetGray(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TARGET_GRAY"), 4.0, 80.0, 0.1, 18.0))), detail(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAIL"), 0., 1., 0.01, 0.6))), - catad(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CATAD"), -100., 100., 0.5, 0., Gtk::manage(new RTImage("circle-blue-small.png")), Gtk::manage(new RTImage("circle-orange-small.png"))))), + catad(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CATAD"), -100., 100., 0.5, 0., Gtk::manage(new RTImage("circle-blue-small")), Gtk::manage(new RTImage("circle-orange-small"))))), lightl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGLIGHTL"), -100., 100., 0.5, 0.))), lightq(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGLIGHTQ"), -100., 100., 0.5, 0.))), contl(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCONTL"), -100., 100., 0.5, 0.))), @@ -5249,7 +5249,7 @@ LocallabLog::LocallabLog(): targabs(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_ABS"), 0.01, 16384.0, 0.01, 16.0))), surround(Gtk::manage (new MyComboBoxText ())), surrHBox(Gtk::manage(new Gtk::Box())), - baselog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BASELOG"), 1.3, 3., 0.05, 2.))),//, Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + baselog(Gtk::manage(new Adjuster(M("TP_LOCALLAB_BASELOG"), 1.3, 3., 0.05, 2.))),//, Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), exprecovl(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), maskusablel(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUSABLE")))), maskunusablel(Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_MASKUNUSABLE")))), @@ -5275,11 +5275,11 @@ LocallabLog::LocallabLog(): chromaskL(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROMASKCOL"), -100.0, 100.0, 0.1, 0.))), mask2CurveEditorL(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), LmaskshapeL(static_cast(mask2CurveEditorL->addCurve(CT_Diagonal, "L(L)"))) - - + + { set_orientation(Gtk::ORIENTATION_VERTICAL); - + // Parameter Log encoding specific widgets autoconn = autocompute->signal_toggled().connect(sigc::mem_fun(*this, &LocallabLog::autocomputeToggled)); const LocallabParams::LocallabSpot defSpot; @@ -5350,7 +5350,7 @@ LocallabLog::LocallabLog(): strlog->setAdjusterListener(this); anglog->setAdjusterListener(this); - + surHBox->set_spacing (2); surHBox->set_tooltip_markup (M ("TP_LOCALLAB_LOGSURSOUR_TOOLTIP")); Gtk::Label* surLabel = Gtk::manage (new Gtk::Label (M ("TP_COLORAPP_SURROUND") + ":")); @@ -5457,11 +5457,11 @@ LocallabLog::LocallabLog(): logP11Box->pack_start(*colorfl); expL->add(*logP11Box, false); logP1Box->pack_start(*expL, false, false); - + // logP1Box->pack_start(*CurveEditorL, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor log1Frame->add(*logP1Box); pack_start(*log1Frame); - log2Frame->set_label_align(0.025, 0.5); + log2Frame->set_label_align(0.025, 0.5); ToolParamBlock* const logP2Box = Gtk::manage(new ToolParamBlock()); logP2Box->pack_start(*targetGray); logP2Box->pack_start(*targabs); @@ -5476,7 +5476,7 @@ LocallabLog::LocallabLog(): logBox3->pack_start(*decayl); // colBox3->pack_start(*invmaskc); exprecovl->add(*logBox3, false); - + ToolParamBlock* const logP3Box = Gtk::manage(new ToolParamBlock()); logP3Box->pack_start(*showmaskLMethod, Gtk::PACK_SHRINK, 4); logP3Box->pack_start(*enaLMask, Gtk::PACK_SHRINK, 0); @@ -5491,11 +5491,11 @@ LocallabLog::LocallabLog(): log2Frame->add(*logP2Box); pack_start(*log2Frame); pack_start(*exprecovl, false, false); - + // pack_start(*baselog); // pack_start(*sensilog); pack_start(*expmaskL, false, false); - + // Gtk::Frame* const gradlogFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_GRADLOGFRA"))); gradlogFrame->set_label_align(0.025, 0.5); ToolParamBlock* const gradlogBox = Gtk::manage(new ToolParamBlock()); @@ -5510,7 +5510,7 @@ LocallabLog::~LocallabLog() delete maskCurveEditorL; delete mask2CurveEditorL; delete CurveEditorL; - + } void LocallabLog::setDefaultExpanderVisibility() @@ -5549,8 +5549,8 @@ void LocallabLog::updateAdviceTooltips(const bool showTooltips) contq->set_tooltip_text(M("TP_LOCALLAB_LOGCONTQ_TOOLTIP")); contthres->set_tooltip_text(M("TP_LOCALLAB_LOGCONTTHRES_TOOLTIP")); colorfl->set_tooltip_text(M("TP_LOCALLAB_LOGCOLORF_TOOLTIP")); - lightl->set_tooltip_text(M("TP_LOCALLAB_LOGLIGHTL_TOOLTIP")); - lightq->set_tooltip_text(M("TP_LOCALLAB_LOGLIGHTQ_TOOLTIP")); + lightl->set_tooltip_text(M("TP_LOCALLAB_LOGLIGHTL_TOOLTIP")); + lightq->set_tooltip_text(M("TP_LOCALLAB_LOGLIGHTQ_TOOLTIP")); saturl->set_tooltip_text(M("TP_LOCALLAB_LOGSATURL_TOOLTIP")); chroml->set_tooltip_text(M("TP_COLORAPP_CHROMA_TOOLTIP")); detail->set_tooltip_text(M("TP_LOCALLAB_LOGDETAIL_TOOLTIP")); @@ -5747,7 +5747,7 @@ void LocallabLog::read(const rtengine::procparams::ProcParams* pp, const ParamsE chromaskL->setValue(spot.chromaskL); LmaskshapeL->setCurve(spot.LmaskcurveL); - + } // Enable all listeners @@ -5831,7 +5831,7 @@ void LocallabLog::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi } else if (surround->get_active_row_number() == 3) { spot.surround = "ExtremelyDark"; } - + } // Note: No need to manage pedited as batch mode is deactivated for Locallab @@ -5847,7 +5847,7 @@ void LocallabLog::enaLMaskChanged() maskusablel->hide(); maskunusablel->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enaLMask->get_active()) { @@ -5917,12 +5917,12 @@ void LocallabLog::updateGUIToMode(const modeType new_type) if (enaLMask->get_active()) { maskusablel->show(); maskunusablel->hide(); - + } else { maskusablel->hide(); maskunusablel->show(); } - + exprecovl->show(); decayl->hide(); @@ -5951,7 +5951,7 @@ void LocallabLog::updateGUIToMode(const modeType new_type) if (enaLMask->get_active()) { maskusablel->show(); maskunusablel->hide(); - + } else { maskusablel->hide(); maskunusablel->show(); @@ -6242,7 +6242,7 @@ void LocallabLog::adjusterChanged(Adjuster* a, double newval) } if (a == recothresl) { - + if (listener) { listener->panelChanged(Evlocallabrecothresl, recothresl->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); @@ -6291,7 +6291,7 @@ void LocallabLog::adjusterChanged(Adjuster* a, double newval) anglog->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); } } - + if (a == blendmaskL) { if (listener) { listener->panelChanged(EvLocallabblendmaskL, @@ -6313,7 +6313,7 @@ void LocallabLog::adjusterChanged(Adjuster* a, double newval) } } - + } } @@ -6403,7 +6403,7 @@ void LocallabLog::ciecamChanged() targabs->set_sensitive(true); catad->set_sensitive(true); surrHBox->set_sensitive(true); - + sourceabs->show(); targabs->show(); catad->show(); @@ -6515,7 +6515,7 @@ void LocallabLog::updateLogGUI2() void LocallabLog::updateLogGUI() { const int mode = complexity->get_active_row_number(); - + if (autocompute->get_active()) { blackEv->set_sensitive(false); whiteEv->set_sensitive(false); @@ -6538,7 +6538,7 @@ void LocallabLog::updateLogGUI() if (mode == Expert || mode == Normal) { // Keep widget hidden in Simple mode exprecovl->show(); } - + } @@ -6583,9 +6583,9 @@ LocallabMask::LocallabMask(): str_mask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADSTR"), -2., 2., 0.05, 0.))), ang_mask(Gtk::manage(new Adjuster(M("TP_LOCALLAB_GRADANG"), -180., 180., 0.1, 0.))) { - + set_orientation(Gtk::ORIENTATION_VERTICAL); - + const LocallabParams::LocallabSpot defSpot; // Parameter Mask common specific widgets @@ -7281,7 +7281,7 @@ void LocallabMask::updateGUIToMode(const modeType new_type) csThresholdmask->show(); gradFramemask->show(); } - + } void LocallabMask::updateMaskBackground(const double normChromar, const double normLumar, const double normHuer, const double normHuerjz) @@ -7446,14 +7446,14 @@ Locallabcie::Locallabcie(): sigmoidFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SIGFRA")))), sigq(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGFRA")))), sigmoidldacie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDLAMBDA"), 0.0, 1., 0.01, 0.5))), - sigmoidthcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + sigmoidthcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), sigmoidblcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDBL"), 0.5, 1.5, 0.01, 1.))), sigmoidqjcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGMOIDQJ")))), logcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LOGCIE")))), sigmoidjzFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_SIGJZFRA")))), sigjz(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_SIGJZFRA")))), sigmoidldajzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDLAMBDA"), 0., 1.0, 0.01, 0.5))), - sigmoidthjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + sigmoidthjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDTH"), 0.1, 4., 0.01, 1., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), sigmoidbljzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SIGMOIDBL"), 0.5, 1.5, 0.01, 1.))), colorflcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCOLORFL"), -100., 100., 0.5, 0.))), saturlcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SATURV"), -100., 100., 0.5, 0.))), @@ -7486,7 +7486,7 @@ Locallabcie::Locallabcie(): thrhjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZTHRHCIE"), 40., 150., 0.5, 60.))), chjzcie(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_JZCH")))), strsoftjzcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_JZSTRSOFTCIE"), 0, 100., 0.5, 100.))), - + /* ciezFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_ZCAMFRA")))), @@ -7498,13 +7498,13 @@ Locallabcie::Locallabcie(): colorflzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_LOGCOLORFL"), -100., 100., 0.5, 0.))), saturzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SATURV"), -100., 100., 0.5, 0.))), chromzcam(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CHROML"), -100., 100., 0.5, 0.))), -*/ +*/ expLcie(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_CIETOOLEXP")))), cie2Frame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_LOG2FRA")))), targetGraycie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_TARGET_GRAY"), 5.0, 80.0, 0.1, 18.0))), targabscie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SOURCE_ABS"), 0.01, 16384.0, 0.01, 16.0))), detailcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DETAIL"), 0., 100., 0.1, 0.))), - catadcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CATAD"), -100., 100., 0.5, 0., Gtk::manage(new RTImage("circle-blue-small.png")), Gtk::manage(new RTImage("circle-orange-small.png"))))), + catadcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CATAD"), -100., 100., 0.5, 0., Gtk::manage(new RTImage("circle-blue-small")), Gtk::manage(new RTImage("circle-orange-small"))))), surroundcie(Gtk::manage (new MyComboBoxText ())), surrHBoxcie(Gtk::manage(new Gtk::Box())), exprecovcie(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_DENOI2_EXP")))), @@ -7530,11 +7530,11 @@ Locallabcie::Locallabcie(): slomaskcie(Gtk::manage(new Adjuster(M("TP_LOCALLAB_SLOMASKCOL"), 0.0, 15.0, 0.1, 0.))), mask2cieCurveEditorG(new CurveEditorGroup(options.lastlocalCurvesDir, M("TP_LOCALLAB_MASK2"))), Lmaskcieshape(static_cast(mask2cieCurveEditorG->addCurve(CT_Diagonal, "L(L)"))) - - + + { set_orientation(Gtk::ORIENTATION_VERTICAL); - + // Parameter Ciecam specific widgets const LocallabParams::LocallabSpot defSpot; reparcie->setAdjusterListener(this); @@ -7617,12 +7617,12 @@ Locallabcie::Locallabcie(): sigmoidFrame->set_label_widget(*sigq); ToolParamBlock* const sigBox = Gtk::manage(new ToolParamBlock()); Gtk::Separator* const separatorsig = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)); - + sigBox->pack_start(*sigmoidldacie); sigBox->pack_start(*sigmoidthcie); sigBox->pack_start(*sigmoidblcie); sigBox->pack_start(*sigmoidqjcie); - sigBox->pack_start(*separatorsig); + sigBox->pack_start(*separatorsig); sigBox->pack_start(*logcie); sigmoidFrame->add(*sigBox); cieFBox->pack_start(*sigmoidFrame); @@ -7636,10 +7636,10 @@ Locallabcie::Locallabcie(): sigjzBox->pack_start(*sigmoidbljzcie); sigjzBox->pack_start(*forcebw); sigmoidjzFrame->add(*sigjzBox); - + // jzBox->pack_start(*sigmoidjzFrame); cieFBox->pack_start(*sigmoidjzFrame); - + cieFBox->pack_start (*surHBoxcie); cieFrame->add(*cieFBox); pack_start(*cieFrame); @@ -7734,7 +7734,7 @@ Locallabcie::Locallabcie(): jz3CurveEditorG->curveListComplete(); - + jzFrame->set_label_align(0.025, 0.5); ToolParamBlock* const jzBox = Gtk::manage(new ToolParamBlock()); jzBox->pack_start(*qtoj); @@ -7752,7 +7752,7 @@ Locallabcie::Locallabcie(): ciePzcolorBox->pack_start(*huejzcie); czcolorFrame->add(*ciePzcolorBox); jzBox->pack_start(*czcolorFrame); - + jzBox->pack_start(*jz1CurveEditorG, Gtk::PACK_SHRINK, 4); HFramejz->set_label_align(0.025, 0.5); ToolParamBlock* const jzHHBox = Gtk::manage(new ToolParamBlock()); @@ -7763,7 +7763,7 @@ Locallabcie::Locallabcie(): jzHBox->pack_start(*thrhjzcie); JzHFramejz->add(*jzHBox); jzHHBox->pack_start(*JzHFramejz); - + jzHHBox->pack_start(*jz3CurveEditorG, Gtk::PACK_SHRINK, 4); // jzBox->pack_start(*adapjzcie); jzHHBox->pack_start(*softjzcie); HFramejz->add(*jzHHBox); @@ -7776,9 +7776,9 @@ Locallabcie::Locallabcie(): sigjzBox->pack_start(*sigmoidbljzcie); sigjzBox->pack_start(*jabcie); sigmoidjzFrame->add(*sigjzBox); - + // jzBox->pack_start(*sigmoidjzFrame); - */ + */ jzshFrame->set_label_align(0.025, 0.5); ToolParamBlock* const jzshBox = Gtk::manage(new ToolParamBlock()); jzshBox->pack_start(*hljzcie); @@ -7812,7 +7812,7 @@ Locallabcie::Locallabcie(): clarilresjz->setAdjusterListener(this); claricresjz->setAdjusterListener(this); clarisoftjz->setAdjusterListener(this); - + clariFramejz->set_label_align(0.025, 0.5); ToolParamBlock* const coBox3jz = Gtk::manage(new ToolParamBlock()); coBox3jz->pack_start(*clarilresjz); @@ -7821,13 +7821,13 @@ Locallabcie::Locallabcie(): clariFramejz->add(*coBox3jz); coBox2jz->pack_start(*clariFramejz); expwavjz->add(*coBox2jz, false); - + jzBox->pack_start(*expwavjz, false, false); jzallBox->add(*jzBox); expjz->add(*jzallBox, false); - + jabcieConn = jabcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::jabcieChanged)); AutograycieConn = Autograycie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::AutograycieChanged)); sigmoidqjcieconn = sigmoidqjcie->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::sigmoidqjcieChanged)); @@ -7876,7 +7876,7 @@ Locallabcie::Locallabcie(): shapecie2->setBottomBarColorProvider (this, 1); shapecie2->setLeftBarColorProvider (this, 1); shapecie2->setRangeDefaultMilestones (0.05, 0.2, 0.58); - + std::vector shape2Milestones; // float R, G, B; @@ -7890,7 +7890,7 @@ Locallabcie::Locallabcie(): shapecie2->setLeftBarBgGradient (shape2Milestones); shapecie2->setRangeDefaultMilestones (0.05, 0.2, 0.58); - + cieCurveEditorG2->curveListComplete(); @@ -8006,7 +8006,7 @@ Locallabcie::Locallabcie(): /* sigmoidFrame->set_label_align(0.025, 0.5); ToolParamBlock* const sigBox = Gtk::manage(new ToolParamBlock()); - + sigBox->pack_start(*sigmoidldacie); sigBox->pack_start(*sigmoidthcie); sigBox->pack_start(*sigmoidblcie); @@ -8022,9 +8022,9 @@ Locallabcie::Locallabcie(): // cie1Frame->add(*cieP1Box); // expcam16->pack_start(*cie1Frame); expcam16->add(*cieP1Box, false); - + pack_start(*expcam16, false, false); - + pack_start(*expjz, false, false); /* ciezFrame->set_label_align(0.025, 0.5); @@ -8040,8 +8040,8 @@ Locallabcie::Locallabcie(): ciezFrame->add(*ciePzBox); pack_start(*ciezFrame); */ - - cie2Frame->set_label_align(0.025, 0.5); + + cie2Frame->set_label_align(0.025, 0.5); ToolParamBlock* const cieP2Box = Gtk::manage(new ToolParamBlock()); cieP2Box->pack_start(*targetGraycie); cieP2Box->pack_start(*targabscie); @@ -8049,7 +8049,7 @@ Locallabcie::Locallabcie(): cieP2Box->pack_start(*surrHBoxcie); // cieP2Box->pack_start(*detailcie); // cieP2Box->pack_start(*jabcie); - + cie2Frame->add(*cieP2Box); pack_start(*cie2Frame); @@ -8070,7 +8070,7 @@ Locallabcie::Locallabcie(): showmaskcieMethod->set_active(0); showmaskcieMethod->set_tooltip_markup(M("TP_LOCALLAB_SHOWMASKCOL_TOOLTIP")); showmaskcieMethodConn = showmaskcieMethod->signal_changed().connect(sigc::mem_fun(*this, &Locallabcie::showmaskcieMethodChanged)); - + enacieMaskConn = enacieMask->signal_toggled().connect(sigc::mem_fun(*this, &Locallabcie::enacieMaskChanged)); maskcieCurveEditorG->setCurveListener(this); @@ -8127,8 +8127,8 @@ Locallabcie::Locallabcie(): maskcieBox->pack_start(*mask2cieCurveEditorG, Gtk::PACK_SHRINK, 4); // Padding is mandatory to correct behavior of curve editor expmaskcie->add(*maskcieBox, false); pack_start(*expmaskcie, false, false); - - + + } Locallabcie::~Locallabcie() @@ -8180,7 +8180,7 @@ void Locallabcie::updateAdviceTooltips(const bool showTooltips) cieFrame->set_tooltip_text(M("TP_LOCALLAB_LOGSCENE_TOOLTIP")); PQFrame->set_tooltip_text(M("TP_LOCALLAB_JZPQFRA_TOOLTIP")); qtoj->set_tooltip_text(M("TP_LOCALLAB_JZQTOJ_TOOLTIP")); - logcie->set_tooltip_text(M("TP_LOCALLAB_LOGCIE_TOOLTIP")); + logcie->set_tooltip_text(M("TP_LOCALLAB_LOGCIE_TOOLTIP")); modecam->set_tooltip_text(M("TP_LOCALLAB_JZMODECAM_TOOLTIP")); adapjzcie->set_tooltip_text(M("TP_LOCALLAB_JABADAP_TOOLTIP")); jz100->set_tooltip_text(M("TP_LOCALLAB_JZ100_TOOLTIP")); @@ -8364,7 +8364,7 @@ void Locallabcie::enacieMaskChanged() maskusablecie->hide(); maskunusablecie->show(); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (enacieMask->get_active()) { @@ -8430,7 +8430,7 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE } else if (spot.toneMethodcie2 == "thrc") { toneMethodcie2->set_active(2); } - + Autograycie->set_active(spot.Autograycie); forcejz->set_active(spot.forcejz); forcebw->set_active(spot.forcebw); @@ -8447,7 +8447,7 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE jabcie->set_active(spot.jabcie); jabcieChanged(); modecamChanged(); - + if(logcie->get_active()) { sigmoidldacie->set_sensitive(false); sigmoidthcie->set_sensitive(false); @@ -8459,7 +8459,7 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE sigmoidblcie->set_sensitive(true); sigmoidqjcie->set_sensitive(true); } - + if (spot.sursourcie == "Average") { sursourcie->set_active (0); } else if (spot.sursourcie == "Dim") { @@ -8559,7 +8559,7 @@ void Locallabcie::read(const rtengine::procparams::ProcParams* pp, const ParamsE higthrescie->setValue((double)spot.higthrescie); decaycie->setValue((double)spot.decaycie); - + } enableListener(); // Update GUI according to complexity mode @@ -8707,7 +8707,7 @@ void Locallabcie::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedi spot.lightlzcam = lightlzcam->getValue(); spot.lightqzcam = lightqzcam->getValue(); spot.contlzcam = contlzcam->getValue(); - spot.contqzcam = contqzcam->getValue(); + spot.contqzcam = contqzcam->getValue(); spot.contthreszcam = contthreszcam->getValue(); spot.colorflzcam = colorflzcam->getValue(); spot.saturzcam = saturzcam->getValue(); @@ -8780,7 +8780,7 @@ void Locallabcie::updateMaskBackground(const double normChromar, const double no void Locallabcie::updateAutocompute(const float blackev, const float whiteev, const float sourceg, const float sourceab, const float targetg, const float jz1) -{ +{ if (Autograycie->get_active()) { idle_register.add( @@ -8889,7 +8889,7 @@ void Locallabcie::qtojChanged() } void Locallabcie::jabcieChanged() -{ +{ if (isLocActivated && exp->getEnabled()) { if (listener) { if (jabcie->get_active()) { @@ -8920,7 +8920,7 @@ void Locallabcie::sigmoidqjcieChanged() void Locallabcie::logcieChanged() { - + if(logcie->get_active()) { sigmoidldacie->set_sensitive(false); sigmoidthcie->set_sensitive(false); @@ -8932,7 +8932,7 @@ void Locallabcie::logcieChanged() sigmoidblcie->set_sensitive(true); sigmoidqjcie->set_sensitive(true); } - + if (isLocActivated && exp->getEnabled()) { if (listener) { if (logcie->get_active()) { @@ -9014,7 +9014,7 @@ void Locallabcie::chjzcieChanged() void Locallabcie::modecamChanged() { const int mode = complexity->get_active_row_number(); - + if (modecam->get_active_row_number() == 1 || modecam->get_active_row_number() == 2) { expjz->show(); jzFrame->show(); @@ -9028,7 +9028,7 @@ void Locallabcie::modecamChanged() sigmoidjzFrame->show(); sigmoidFrame->hide(); forcejz->hide(); - + } else { expjz->hide(); jzFrame->hide(); @@ -9039,7 +9039,7 @@ void Locallabcie::modecamChanged() jabcie->hide(); PQFrame->hide(); logjzFrame->hide(); - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidFrame->show(); } @@ -9071,7 +9071,7 @@ void Locallabcie::modecamChanged() exprecovcie->show(); expmaskcie->show(); } - + } if (modecam->get_active_row_number() == 3) { if(mode == Expert) { @@ -9101,7 +9101,7 @@ void Locallabcie::modecamChanged() cie2Frame->hide(); } - } + } if(mode != Expert) { expjz->hide(); @@ -9115,7 +9115,7 @@ void Locallabcie::modecamChanged() sigmoidjzFrame->hide(); sigmoidFrame->hide(); bevwevFrame->hide(); - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidFrame->show(); } @@ -9137,10 +9137,10 @@ void Locallabcie::modecamChanged() } else { cieFrame->show(); cie2Frame->show(); - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidjzFrame->hide(); - + } if (modecam->get_active_row_number() == 1) { targetGraycie->hide(); @@ -9160,8 +9160,8 @@ void Locallabcie::modecamChanged() } else { thrhjzcie->set_sensitive(false); } - - + + } if (modecam->get_active_row_number() == 3) { cieFrame->show(); @@ -9179,7 +9179,7 @@ void Locallabcie::modecamChanged() catadcie->hide(); cie2Frame->hide(); } - + } if (modecam->get_active_row_number() == 0 || modecam->get_active_row_number() == 2) { targetGraycie->show(); @@ -9188,7 +9188,7 @@ void Locallabcie::modecamChanged() cie2Frame->show(); pqremapcam16->show(); } - + if (isLocActivated && exp->getEnabled()) { @@ -9204,17 +9204,17 @@ void Locallabcie::modecamChanged() void Locallabcie::modecieChanged() { if (isLocActivated && exp->getEnabled()) { - + const int mode = complexity->get_active_row_number(); exprecovcie->show(); expmaskcie->show(); - + if (modecie->get_active_row_number() > 0) { sensicie->hide(); reparcie->hide(); exprecovcie->hide(); expmaskcie->hide(); - + } else { sensicie->show(); reparcie->show(); @@ -9224,11 +9224,11 @@ void Locallabcie::modecieChanged() } } if (mode == Simple || mode == Normal) { // Keep widget hidden in Normal and Simple mode - + modecie->set_active (0); sensicie->show(); reparcie->show(); - + } if (listener) { @@ -9286,7 +9286,7 @@ void Locallabcie::updateGUIToMode(const modeType new_type) sensicie->show(); reparcie->show(); sigmoidblcie->hide(); - + expjz->hide(); jzFrame->hide(); adapjzcie->hide(); @@ -9314,7 +9314,7 @@ void Locallabcie::updateGUIToMode(const modeType new_type) bevwevFrame->hide(); sigmoidFrame->hide(); } - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidFrame->show(); } @@ -9347,7 +9347,7 @@ void Locallabcie::updateGUIToMode(const modeType new_type) logjzFrame->hide(); catadcie->hide(); } - + break; case Normal: // Expert mode widgets are hidden in Normal mode @@ -9397,12 +9397,12 @@ void Locallabcie::updateGUIToMode(const modeType new_type) if (enacieMask->get_active()) { maskusablecie->show(); maskunusablecie->hide(); - + } else { maskusablecie->hide(); maskunusablecie->show(); } - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidFrame->show(); } @@ -9431,7 +9431,7 @@ void Locallabcie::updateGUIToMode(const modeType new_type) expmaskcie->hide(); maskusablecie->hide(); maskunusablecie->hide(); - + } if (modecam->get_active_row_number() == 3) { cieFrame->hide(); @@ -9489,12 +9489,12 @@ void Locallabcie::updateGUIToMode(const modeType new_type) if (enacieMask->get_active()) { maskusablecie->show(); maskunusablecie->hide(); - + } else { maskusablecie->hide(); maskunusablecie->show(); } - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); } @@ -9511,7 +9511,7 @@ void Locallabcie::updateGUIToMode(const modeType new_type) sigmoidjzFrame->show(); sigmoidFrame->hide(); forcejz->hide(); - + } cieFrame->show(); cie2Frame->show(); @@ -9525,11 +9525,11 @@ void Locallabcie::updateGUIToMode(const modeType new_type) logjzFrame->hide(); sigmoidjzFrame->hide(); bevwevFrame->hide(); - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidFrame->show(); } - + } if (modecam->get_active_row_number() == 2) { PQFrame->show(); @@ -9560,9 +9560,9 @@ void Locallabcie::updateGUIToMode(const modeType new_type) } else { thrhjzcie->set_sensitive(false); } - + } - + if (modecam->get_active_row_number() == 3) { cieFrame->show(); cie1Frame->hide(); @@ -9583,7 +9583,7 @@ void Locallabcie::updateGUIToMode(const modeType new_type) if (modecie->get_active_row_number() > 0) { exprecovcie->hide(); expmaskcie->hide(); - } + } } } @@ -9608,10 +9608,10 @@ void Locallabcie::updatecieGUI() cie1Frame->show(); cie2Frame->show(); expcam16->show(); - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); } - + if (modecam->get_active_row_number() == 2 && mode == Expert) { PQFrame->show(); logjzFrame->show(); @@ -9624,7 +9624,7 @@ void Locallabcie::updatecieGUI() if (enacieMask->get_active() && mode != Simple) { maskusablecie->show(); maskunusablecie->hide(); - + } else { maskusablecie->hide(); maskunusablecie->show(); @@ -9655,7 +9655,7 @@ void Locallabcie::updatecieGUI() sigmoidjzFrame->hide(); sigmoidFrame->hide(); bevwevFrame->hide(); - if (modecam->get_active_row_number() == 0){ + if (modecam->get_active_row_number() == 0){ bevwevFrame->show(); sigmoidFrame->show(); } @@ -9718,7 +9718,7 @@ void Locallabcie::updatecieGUI() exprecovcie->hide(); expmaskcie->hide(); } - + } @@ -9778,10 +9778,10 @@ void Locallabcie::convertParamToNormal() lapmaskcie->setValue(defSpot.lapmaskcie); gammaskcie->setValue(defSpot.gammaskcie); slomaskcie->setValue(defSpot.slomaskcie); - + // Enable all listeners enableListener(); - + } void Locallabcie::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) @@ -9875,13 +9875,13 @@ void Locallabcie::curveChanged(CurveEditor* ce) listener->panelChanged(Evlocallabshapeczjz, spName); } } - + if (ce == HHshapejz) { if (listener) { listener->panelChanged(EvlocallabHHshapejz, spName); } } - + if (ce == CHshapejz) { if (listener) { listener->panelChanged(EvlocallabCHshapejz, spName); @@ -9905,7 +9905,7 @@ void Locallabcie::curveChanged(CurveEditor* ce) listener->panelChanged(Evlocallabshapecie2, spName); } } - + if (ce == CCmaskcieshape) { if (listener) { listener->panelChanged(EvlocallabCCmaskcieshape, @@ -9989,7 +9989,7 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) float pal = std::max(10. * (double) sqrt(sour), 1.5); adapjzcie->setValue(pal);//max to 10 if La > 10000 and mini to 1.5 jz100->setValue(defSpot.jz100); - + if (listener) { listener->panelChanged(Evlocallabsourceabscie, sourceabscie->getTextValue() + spName ); @@ -10361,7 +10361,7 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) detailcie->getTextValue() + spName); } } - + if (a == blendmaskcie) { if (listener) { listener->panelChanged(Evlocallabblendmaskcie, @@ -10405,7 +10405,7 @@ void Locallabcie::adjusterChanged(Adjuster* a, double newval) } if (a == recothrescie) { - + if (listener) { listener->panelChanged(Evlocallabrecothrescie, recothrescie->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")"); diff --git a/rtgui/lwbutton.cc b/rtgui/lwbutton.cc index 26d36f9e0..9f65218cf 100644 --- a/rtgui/lwbutton.cc +++ b/rtgui/lwbutton.cc @@ -20,7 +20,7 @@ #include "guiutils.h" #include "rtsurface.h" -LWButton::LWButton (Cairo::RefPtr i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring* tooltip) +LWButton::LWButton (std::shared_ptr i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring* tooltip) : xpos(0), ypos(0), halign(ha), valign(va), icon(i), bgr(0.0), bgg(0.0), bgb(0.0), fgr(0.0), fgg(0.0), fgb(0.0), state(Normal), listener(nullptr), actionCode(aCode), actionData(aData), toolTip(tooltip) { @@ -32,7 +32,7 @@ LWButton::LWButton (Cairo::RefPtr i, int aCode, void* aData, Alignmen } } -void LWButton::getSize (int& minw, int& minh) const +void LWButton::getSize (int& minw, int& minh) const { minw = w; @@ -59,7 +59,7 @@ void LWButton::getPosition (int& x, int& y) const y = ypos; } -void LWButton::setIcon (Cairo::RefPtr i) +void LWButton::setIcon (std::shared_ptr i) { icon = i; @@ -72,7 +72,7 @@ void LWButton::setIcon (Cairo::RefPtr i) } } -Cairo::RefPtr LWButton::getIcon () const +std::shared_ptr LWButton::getIcon () const { return icon; @@ -211,7 +211,7 @@ void LWButton::redraw (Cairo::RefPtr context) dilat++; } - if (icon) { + if (icon && icon->hasSurface()) { context->set_source (icon->get(), xpos + dilat, ypos + dilat); context->paint (); } diff --git a/rtgui/lwbutton.h b/rtgui/lwbutton.h index a98f1fe46..43c3ffe06 100644 --- a/rtgui/lwbutton.h +++ b/rtgui/lwbutton.h @@ -40,7 +40,7 @@ public: private: int xpos, ypos, w, h; Alignment halign, valign; - Cairo::RefPtr icon; + std::shared_ptr icon; double bgr, bgg, bgb; double fgr, fgg, fgb; State state; @@ -50,7 +50,7 @@ private: Glib::ustring* toolTip; public: - LWButton (Cairo::RefPtr i, int aCode, void* aData, Alignment ha = Left, Alignment va = Center, Glib::ustring* tooltip = nullptr); + LWButton (std::shared_ptr i, int aCode, void* aData, Alignment ha = Left, Alignment va = Center, Glib::ustring* tooltip = nullptr); void getSize (int& minw, int& minh) const; void getAlignment (Alignment& ha, Alignment& va) const; @@ -58,8 +58,8 @@ public: void addPosition (int x, int y); void getPosition (int& x, int& y) const; bool inside (int x, int y) const; - void setIcon (Cairo::RefPtr i); - Cairo::RefPtr getIcon () const; + void setIcon (std::shared_ptr i); + std::shared_ptr getIcon () const; void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg); void setToolTip (Glib::ustring* tooltip); diff --git a/rtgui/main.cc b/rtgui/main.cc index 9f623a6df..2ca0d9c91 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -68,7 +68,6 @@ Glib::ustring argv2; bool simpleEditor = false; bool gimpPlugin = false; bool remote = false; -unsigned char initialGdkScale = 1; //Glib::Threads::Thread* mainThread; namespace @@ -250,7 +249,7 @@ void cleanup_rt() RTWindow *create_rt_window() { - Glib::ustring icon_path = Glib::build_filename (argv0, "images"); + Glib::ustring icon_path = Glib::build_filename (argv0, "icons"); Glib::RefPtr defaultIconTheme = Gtk::IconTheme::get_default(); defaultIconTheme->append_search_path (icon_path); @@ -533,16 +532,6 @@ int main (int argc, char **argv) int ret = 0; - if (options.pseudoHiDPISupport) { - // Reading/updating GDK_SCALE early if it exists - const gchar *gscale = g_getenv("GDK_SCALE"); - if (gscale && gscale[0] == '2') { - initialGdkScale = 2; - } - // HOMBRE: On Windows, if resolution is set to 200%, Gtk internal variables are SCALE=2 and DPI=96 - g_setenv("GDK_SCALE", "1", true); - } - gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave))); gdk_threads_init(); gtk_init (&argc, &argv); // use the "--g-fatal-warnings" command line flag to make warnings fatal diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index d460713fb..851db0ec6 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -41,9 +41,7 @@ MyCurve::MyCurve () : snapToValX(0.0), snapToValY(0.0) { - - int s = RTScalable::getScale(); - int pointDiameter = (int)(RADIUS * 2.) * s; + int pointDiameter = RTScalable::scalePixelSize((int)(RADIUS * 2.)); graphW = get_allocation().get_width() - pointDiameter; graphH = get_allocation().get_height() - pointDiameter; prevGraphW = graphW; @@ -78,7 +76,7 @@ MyCurve::~MyCurve () void MyCurve::calcDimensions () { double newRequestedW, newRequestedH; - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); newRequestedW = newRequestedH = get_allocation().get_width(); @@ -103,21 +101,19 @@ void MyCurve::get_preferred_height_vfunc (int &minimum_height, int &natural_heig void MyCurve::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - int s = RTScalable::getScale(); - natural_width = minimum_width = (GRAPH_SIZE + (int)(RADIUS * 2.) + (leftBar ? (CBAR_WIDTH + 2 + CBAR_MARGIN) : 0)) * s; + natural_width = minimum_width = (GRAPH_SIZE + (int)(RADIUS * 2.) + RTScalable::scalePixelSize(leftBar ? (CBAR_WIDTH + 2 + CBAR_MARGIN) : 0)); } void MyCurve::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const { minimum_height = width; - int s = RTScalable::getScale(); if (leftBar && !bottomBar) { - minimum_height -= (CBAR_WIDTH + 2 + CBAR_MARGIN) * s; + minimum_height -= RTScalable::scalePixelSize(CBAR_WIDTH + 2 + CBAR_MARGIN); } if (!leftBar && bottomBar) { - minimum_height += (CBAR_WIDTH + 2 + CBAR_MARGIN) * s; + minimum_height += RTScalable::scalePixelSize(CBAR_WIDTH + 2 + CBAR_MARGIN); } natural_height = minimum_height; diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index 4f9422c69..a2ffbc905 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -260,7 +260,7 @@ void MyDiagonalCurve::draw (int handle) return; } - const double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); // re-calculate curve if dimensions changed int currLUTSize = point.getUpperBound(); @@ -594,7 +594,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) return false; } - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double minDistanceX = double(MIN_DISTANCE) / graphW * s; double minDistanceY = double(MIN_DISTANCE) / graphH * s; @@ -1069,7 +1069,7 @@ void MyDiagonalCurve::pipetteMouseOver (CurveEditor *ce, EditDataProvider *provi return; } - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double minDistanceX = MIN_DISTANCE / graphW * s; if (curve.type == DCT_Linear || curve.type == DCT_Spline || curve.type == DCT_NURBS || curve.type == DCT_CatumullRom) { @@ -1124,7 +1124,7 @@ bool MyDiagonalCurve::pipetteButton1Pressed(EditDataProvider *provider, int modi return false; } - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double minDistanceX = double(MIN_DISTANCE) * s / graphW; snapToElmt = -100; @@ -1201,7 +1201,7 @@ void MyDiagonalCurve::pipetteButton1Released(EditDataProvider *provider) return; } - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double minDistanceX = double(MIN_DISTANCE) * s / graphW; snapToElmt = -100; diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index 11d89ebd8..e95faf3d4 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -140,7 +140,7 @@ void MyFlatCurve::draw () return; } - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); // re-calculate curve if dimensions changed int currLUTSize = point.getUpperBound(); @@ -535,7 +535,7 @@ bool MyFlatCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) allocation.set_x(0); allocation.set_y(0); - int s = RTScalable::getScale(); + const int s = RTScalable::scalePixelSize(1); // setDrawRectangle will allocate the backbuffer Surface if (setDrawRectangle(Cairo::FORMAT_ARGB32, allocation)) { @@ -619,7 +619,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) return false; } - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); minDistanceX = double(MIN_DISTANCE) / graphW * s; minDistanceY = double(MIN_DISTANCE) / graphH * s; @@ -1321,7 +1321,7 @@ bool MyFlatCurve::pipetteButton1Pressed(EditDataProvider *provider, int modifier // hide the tangent handles tanHandlesDisplayed = false; - int s = RTScalable::getScale(); + const int s = RTScalable::scalePixelSize(1); // Action on BUTTON_PRESS and no edited point switch (area) { diff --git a/rtgui/perspective.cc b/rtgui/perspective.cc index 317732bd2..34feed221 100644 --- a/rtgui/perspective.cc +++ b/rtgui/perspective.cc @@ -111,29 +111,29 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, "perspective", M(" panel_listener = nullptr; metadata = nullptr; - Gtk::Image* ipers_draw(new RTImage ("draw.png")); - Gtk::Image* ipers_trash = Gtk::manage (new RTImage ("trash-empty.png")); - Gtk::Image* ipers_apply = Gtk::manage (new RTImage ("tick.png")); + RTImage* const ipers_draw = Gtk::manage (new RTImage ("draw", Gtk::ICON_SIZE_BUTTON)); + RTImage* const ipers_trash = Gtk::manage (new RTImage ("trash-empty", Gtk::ICON_SIZE_BUTTON)); + RTImage* const ipers_apply = Gtk::manage (new RTImage ("tick", Gtk::ICON_SIZE_BUTTON)); - Gtk::Image* ipersHL = Gtk::manage (new RTImage ("perspective-horizontal-left-small.png")); - Gtk::Image* ipersHR = Gtk::manage (new RTImage ("perspective-horizontal-right-small.png")); - Gtk::Image* ipersVL = Gtk::manage (new RTImage ("perspective-vertical-bottom-small.png")); - Gtk::Image* ipersVR = Gtk::manage (new RTImage ("perspective-vertical-top-small.png")); + RTImage* const ipersHL = Gtk::manage (new RTImage ("perspective-horizontal-left-small")); + RTImage* const ipersHR = Gtk::manage (new RTImage ("perspective-horizontal-right-small")); + RTImage* const ipersVL = Gtk::manage (new RTImage ("perspective-vertical-bottom-small")); + RTImage* const ipersVR = Gtk::manage (new RTImage ("perspective-vertical-top-small")); - Gtk::Image* ipers_auto_pitch = Gtk::manage (new RTImage ("perspective-vertical-bottom.png")); - Gtk::Image* ipers_auto_yaw = Gtk::manage (new RTImage ("perspective-horizontal-left.png")); - Gtk::Image* ipers_auto_pitch_yaw = Gtk::manage (new RTImage ("perspective-horizontal-vertical.png")); + RTImage* const ipers_auto_pitch = Gtk::manage (new RTImage ("perspective-vertical-botton", Gtk::ICON_SIZE_BUTTON)); + RTImage* const ipers_auto_yaw = Gtk::manage (new RTImage ("perspective-horizontal-left", Gtk::ICON_SIZE_BUTTON)); + RTImage* const ipers_auto_pitch_yaw = Gtk::manage (new RTImage ("perspective-horizontal-vertical", Gtk::ICON_SIZE_BUTTON)); - Gtk::Image* ipers_cam_yaw_left = Gtk::manage (new RTImage ("perspective-horizontal-left-small.png")); - Gtk::Image* ipers_cam_yaw_right = Gtk::manage (new RTImage ("perspective-horizontal-right-small.png")); - Gtk::Image* ipers_cam_pitch_left = Gtk::manage (new RTImage ("perspective-vertical-bottom-small.png")); - Gtk::Image* ipers_cam_pitch_right = Gtk::manage (new RTImage ("perspective-vertical-top-small.png")); - Gtk::Image* ipers_proj_yaw_left = Gtk::manage (new RTImage ("perspective-horizontal-left-small.png")); - Gtk::Image* ipers_proj_yaw_right = Gtk::manage (new RTImage ("perspective-horizontal-right-small.png")); - Gtk::Image* ipers_proj_pitch_left = Gtk::manage (new RTImage ("perspective-vertical-bottom-small.png")); - Gtk::Image* ipers_proj_pitch_right = Gtk::manage (new RTImage ("perspective-vertical-top-small.png")); - Gtk::Image* ipers_rotate_left = Gtk::manage(new RTImage("rotate-right-small.png")); - Gtk::Image* ipers_rotate_right = Gtk::manage(new RTImage("rotate-left-small.png")); + RTImage* const ipers_cam_yaw_left = Gtk::manage (new RTImage ("perspective-horizontal-left-small")); + RTImage* const ipers_cam_yaw_right = Gtk::manage (new RTImage ("perspective-horizontal-right-small")); + RTImage* const ipers_cam_pitch_left = Gtk::manage (new RTImage ("perspective-vertical-bottom-small")); + RTImage* const ipers_cam_pitch_right = Gtk::manage (new RTImage ("perspective-vertical-top-small")); + RTImage* const ipers_proj_yaw_left = Gtk::manage (new RTImage ("perspective-horizontal-left-small")); + RTImage* const ipers_proj_yaw_right = Gtk::manage (new RTImage ("perspective-horizontal-right-small")); + RTImage* const ipers_proj_pitch_left = Gtk::manage (new RTImage ("perspective-vertical-bottom-small")); + RTImage* const ipers_proj_pitch_right = Gtk::manage (new RTImage ("perspective-vertical-top-small")); + RTImage* const ipers_rotate_left = Gtk::manage(new RTImage("rotate-right-small")); + RTImage* const ipers_rotate_right = Gtk::manage(new RTImage("rotate-left-small")); Gtk::Box* method_hbox = Gtk::manage (new Gtk::Box()); Gtk::Label* method_label = Gtk::manage (new Gtk::Label (M("TP_PERSPECTIVE_METHOD") + ": ")); diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 3440080f8..aec203ee2 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -32,7 +32,7 @@ PlacesBrowser::PlacesBrowser () { set_orientation(Gtk::ORIENTATION_VERTICAL); - + scrollw = Gtk::manage (new Gtk::ScrolledWindow ()); scrollw->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); pack_start (*scrollw); @@ -43,13 +43,13 @@ PlacesBrowser::PlacesBrowser () setExpandAlignProperties(add, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); //add->get_style_context()->set_junction_sides(Gtk::JUNCTION_RIGHT); add->get_style_context()->add_class("Left"); - add->set_image (*Gtk::manage (new RTImage ("add-small.png"))); + add->set_image (*Gtk::manage (new RTImage ("add-small", Gtk::ICON_SIZE_BUTTON))); del = Gtk::manage (new Gtk::Button ()); del->set_tooltip_text(M("MAIN_FRAME_PLACES_DEL")); setExpandAlignProperties(del, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); //del->get_style_context()->set_junction_sides(Gtk::JUNCTION_LEFT); del->get_style_context()->add_class("Right"); - del->set_image (*Gtk::manage (new RTImage ("remove-small.png"))); + del->set_image (*Gtk::manage (new RTImage ("remove-small", Gtk::ICON_SIZE_BUTTON))); Gtk::Grid* buttonBox = Gtk::manage (new Gtk::Grid ()); buttonBox->set_orientation(Gtk::ORIENTATION_HORIZONTAL); buttonBox->attach_next_to(*add, Gtk::POS_LEFT, 1, 1); diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index 8c4c9dda1..69d51f2dd 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -56,21 +56,21 @@ PopUpCommon::~PopUpCommon () delete buttonImage; } -bool PopUpCommon::addEntry (const Glib::ustring& fileName, const Glib::ustring& label) +bool PopUpCommon::addEntry (const Glib::ustring& iconName, const Glib::ustring& label) { if (label.empty ()) return false; // Create the menu item and image - MyImageMenuItem* newItem = Gtk::manage (new MyImageMenuItem (label, fileName)); - imageFilenames.push_back (fileName); + MyImageMenuItem* newItem = Gtk::manage (new MyImageMenuItem (label, iconName)); + imageFilenames.push_back (iconName); images.push_back (newItem->getImage ()); if (selected == -1) { // Create the menu on the first item menu = new Gtk::Menu (); // Create the image for the button - buttonImage = new RTImage(fileName); + buttonImage = new RTImage(iconName, Gtk::ICON_SIZE_BUTTON); setExpandAlignProperties(buttonImage, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); // Use the first image by default imageContainer->attach_next_to(*buttonImage, Gtk::POS_RIGHT, 1, 1); @@ -80,8 +80,7 @@ bool PopUpCommon::addEntry (const Glib::ustring& fileName, const Glib::ustring& // When there is at least 1 choice, we add the arrow button if (images.size() == 1) { Gtk::Button* arrowButton = Gtk::manage( new Gtk::Button() ); - Gtk::Image *arrowImage = Gtk::manage(new Gtk::Image()); - arrowImage->set_from_icon_name("pan-down-symbolic", Gtk::ICON_SIZE_BUTTON); + Gtk::Image *arrowImage = Gtk::manage(new RTImage("pan-down-symbolic", Gtk::ICON_SIZE_BUTTON)); setExpandAlignProperties(arrowButton, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); arrowButton->add(*arrowImage); //menuSymbol); buttonGroup->attach_next_to(*arrowButton, *button, Gtk::POS_RIGHT, 1, 1); @@ -125,12 +124,12 @@ void PopUpCommon::setItemSensitivity (int index, bool isSensitive) { bool PopUpCommon::setSelected (int entryNum) { entryNum = indexToPos(entryNum); - + if (entryNum < 0 || entryNum > ((int)images.size() - 1) || (int)entryNum == selected) { return false; } else { // Maybe we could do something better than loading the image file each time the selection is changed !? - buttonImage->changeImage(imageFilenames.at(entryNum)); + buttonImage->set_from_icon_name(imageFilenames.at(entryNum), Gtk::ICON_SIZE_BUTTON); selected = entryNum; setButtonHint(); return true; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index c6c2eb61b..0cf7ebd47 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -527,7 +527,7 @@ Gtk::Widget* Preferences::getImageProcessingPanel () iprofiles->set_size_request(50, -1); setExpandAlignProperties(iprofiles, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); ipconn = iprofiles->signal_changed().connect(sigc::mem_fun(*this, &Preferences::forImageComboChanged)); - + Gtk::Grid* defpt = Gtk::manage(new Gtk::Grid()); defpt->set_row_spacing(2); defpt->attach(*drlab, 0, 0, 1, 1); @@ -535,7 +535,7 @@ Gtk::Widget* Preferences::getImageProcessingPanel () defpt->attach(*drimg, 0, 1, 1, 1); defpt->attach(*iprofiles, 1, 1, 1, 1); vbpp->pack_start(*defpt, Gtk::PACK_SHRINK, 4); - + useBundledProfiles = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_USEBUNDLEDPROFILES"))); bpconn = useBundledProfiles->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::bundledProfilesChanged)); vbpp->pack_start(*useBundledProfiles, Gtk::PACK_SHRINK, 4); @@ -779,7 +779,7 @@ Gtk::Widget* Preferences::getColorManPanel () vbColorMan->pack_start (*iccdgrid, Gtk::PACK_SHRINK); - + //------------------------- MONITOR ---------------------- Gtk::Frame* fmonitor = Gtk::manage(new Gtk::Frame(M("PREFERENCES_MONITOR"))); @@ -898,7 +898,7 @@ Gtk::Widget* Preferences::getColorManPanel () fprinter->add(*gprinter); vbColorMan->pack_start (*fprinter, Gtk::PACK_SHRINK); - + //-------------CIECAM Gtk::Frame* fcie = Gtk::manage(new Gtk::Frame(M("PREFERENCES_CIE"))); Gtk::Grid* gcie = Gtk::manage(new Gtk::Grid()); @@ -1118,7 +1118,7 @@ Gtk::Widget* Preferences::getGeneralPanel() setExpandAlignProperties(pseudoHiDPI, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); Gtk::Separator *vSep = Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)); - + appearanceGrid->attach(*themeLbl, 0, 0, 1, 1); appearanceGrid->attach(*themeCBT, 1, 0, 1, 1); @@ -1281,7 +1281,7 @@ Gtk::Widget* Preferences::getGeneralPanel() hb->pack_start(*editor_dir_custom_path, Gtk::PACK_EXPAND_WIDGET, 2); vb->pack_start(*hb); f->add(*vb); - + hb = Gtk::manage(new Gtk::Box()); hb->pack_start(*externaleditorGrid); hb->pack_start(*f, Gtk::PACK_EXPAND_WIDGET, 4); @@ -1298,8 +1298,8 @@ Gtk::Widget* Preferences::getGeneralPanel() vb->show(); fdg->add(*vb); } - - + + vbGeneral->attach_next_to (*fdg, *fclip, Gtk::POS_BOTTOM, 2, 1); langAutoDetectConn = ckbLangAutoDetect->signal_toggled().connect(sigc::mem_fun(*this, &Preferences::langAutoDetectToggled)); tconn = themeCBT->signal_changed().connect ( sigc::mem_fun (*this, &Preferences::themeChanged) ); @@ -1326,7 +1326,7 @@ Gtk::Widget* Preferences::getFileBrowserPanel() startupdir = Gtk::manage(new Gtk::Entry()); Gtk::Button* sdselect = Gtk::manage(new Gtk::Button()); - sdselect->set_image (*Gtk::manage (new RTImage ("folder-open-small.png"))); + sdselect->set_image (*Gtk::manage (new RTImage ("folder-open-small", Gtk::ICON_SIZE_BUTTON))); Gtk::RadioButton::Group opts = sdcurrent->get_group(); sdlast->set_group(opts); @@ -1437,10 +1437,10 @@ Gtk::Widget* Preferences::getFileBrowserPanel() delExt->set_tooltip_text(M("PREFERENCES_PARSEDEXTDELHINT")); moveExtUp->set_tooltip_text(M("PREFERENCES_PARSEDEXTUPHINT")); moveExtDown->set_tooltip_text(M("PREFERENCES_PARSEDEXTDOWNHINT")); - Gtk::Image* addExtImg = Gtk::manage ( new RTImage ("add-small.png") ); - Gtk::Image* delExtImg = Gtk::manage ( new RTImage ("remove-small.png") ); - Gtk::Image* moveExtUpImg = Gtk::manage(new RTImage("arrow-up-small.png")); - Gtk::Image* moveExtDownImg = Gtk::manage(new RTImage("arrow-down-small.png")); + Gtk::Image* addExtImg = Gtk::manage ( new RTImage ("add-small", Gtk::ICON_SIZE_BUTTON) ); + Gtk::Image* delExtImg = Gtk::manage ( new RTImage ("remove-small", Gtk::ICON_SIZE_BUTTON) ); + Gtk::Image* moveExtUpImg = Gtk::manage(new RTImage("arrow-up-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* moveExtDownImg = Gtk::manage(new RTImage("arrow-down-small", Gtk::ICON_SIZE_BUTTON)); addExt->add(*addExtImg); delExt->add(*delExtImg); moveExtUp->set_image(*moveExtUpImg); @@ -2133,7 +2133,7 @@ void Preferences::fillPreferences() } curveBBoxPosC->set_active(moptions.curvebboxpos); - complexitylocal->set_active(moptions.complexity); + complexitylocal->set_active(moptions.complexity); inspectorWindowCB->set_active(moptions.inspectorWindow); zoomOnScrollCB->set_active(moptions.zoomOnScroll); @@ -2263,7 +2263,6 @@ void Preferences::cancelPressed() { // set the initial theme back if (themeFNames.at (themeCBT->get_active_row_number ()).longFName != options.theme) { - RTImage::updateImages(); switchThemeTo(options.theme); } @@ -2320,7 +2319,6 @@ void Preferences::themeChanged() { moptions.theme = themeFNames.at (themeCBT->get_active_row_number ()).longFName; - RTImage::updateImages(); switchThemeTo(moptions.theme); } diff --git a/rtgui/previewmodepanel.cc b/rtgui/previewmodepanel.cc index 586923173..8bec03ee9 100644 --- a/rtgui/previewmodepanel.cc +++ b/rtgui/previewmodepanel.cc @@ -21,74 +21,72 @@ #include "imagearea.h" #include "rtimage.h" -PreviewModePanel::PreviewModePanel (ImageArea* ia) : imageArea(ia) +PreviewModePanel::PreviewModePanel (ImageArea* ia) : + imageArea(ia), + nR("square-toggle-red-on-narrow"), ngR("square-toggle-red-off-narrow"), + nG("square-toggle-green-on-narrow"), ngG("square-toggle-green-off-narrow"), + nB("square-toggle-blue-on-narrow"), ngB("square-toggle-blue-off-narrow"), + nL("square-toggle-luminosity-on-narrow"), ngL("square-toggle-luminosity-off-narrow"), + nBC0("square-toggle-theme-on-narrow"), ngBC0("square-toggle-theme-off-narrow"), + nBC1("square-toggle-black-on-narrow"), ngBC1("square-toggle-black-off-narrow"), + nBC2("square-toggle-white-on-narrow"), ngBC2("square-toggle-white-off-narrow"), + nBC3("square-toggle-gray-on-narrow"), ngBC3("square-toggle-gray-off-narrow"), + iR(Gtk::manage (new RTImage(ngR, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iG(Gtk::manage (new RTImage(ngG, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iB(Gtk::manage (new RTImage(ngB, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iL(Gtk::manage (new RTImage(ngL, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iBC0(Gtk::manage (new RTImage(options.bgcolor == 0 ? nBC0 : ngBC0, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iBC1(Gtk::manage (new RTImage(options.bgcolor == 1 ? nBC1 : ngBC1, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iBC2(Gtk::manage (new RTImage(options.bgcolor == 2 ? nBC2 : ngBC2, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + iBC3(Gtk::manage (new RTImage(options.bgcolor == 3 ? nBC3 : ngBC3, Gtk::ICON_SIZE_LARGE_TOOLBAR))) { - - iR = new RTImage ("square-toggle-red-on-narrow.png"); - iG = new RTImage ("square-toggle-green-on-narrow.png"); - iB = new RTImage ("square-toggle-blue-on-narrow.png"); - iL = new RTImage ("square-toggle-luminosity-on-narrow.png"); - iBC0 = new RTImage ("square-toggle-theme-on-narrow.png"); - iBC1 = new RTImage ("square-toggle-black-on-narrow.png"); - iBC2 = new RTImage ("square-toggle-white-on-narrow.png"); - iBC3 = new RTImage ("square-toggle-gray-on-narrow.png"); - - igR = new RTImage ("square-toggle-red-off-narrow.png"); - igG = new RTImage ("square-toggle-green-off-narrow.png"); - igB = new RTImage ("square-toggle-blue-off-narrow.png"); - igL = new RTImage ("square-toggle-luminosity-off-narrow.png"); - igBC0 = new RTImage ("square-toggle-theme-off-narrow.png"); - igBC1 = new RTImage ("square-toggle-black-off-narrow.png"); - igBC2 = new RTImage ("square-toggle-white-off-narrow.png"); - igBC3 = new RTImage ("square-toggle-gray-off-narrow.png"); - backColor0 = Gtk::manage (new Gtk::ToggleButton ()); backColor0->get_style_context()->add_class("narrowbutton"); backColor0->set_relief(Gtk::RELIEF_NONE); backColor0->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR0")); - backColor0->set_image(options.bgcolor == 0 ? *iBC0 : *igBC0); + backColor0->set_image(*iBC0); backColor1 = Gtk::manage (new Gtk::ToggleButton ()); backColor1->get_style_context()->add_class("narrowbutton"); backColor1->set_relief(Gtk::RELIEF_NONE); backColor1->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR1")); - backColor1->set_image(options.bgcolor == 1 ? *iBC1 : *igBC1); + backColor1->set_image(*iBC1); backColor3 = Gtk::manage (new Gtk::ToggleButton ()); backColor3->get_style_context()->add_class("narrowbutton"); backColor3->set_relief(Gtk::RELIEF_NONE); backColor3->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR3")); - backColor3->set_image(options.bgcolor == 3 ? *iBC3 : *igBC3); + backColor3->set_image(*iBC3); backColor2 = Gtk::manage (new Gtk::ToggleButton ()); backColor2->get_style_context()->add_class("narrowbutton"); backColor2->set_relief(Gtk::RELIEF_NONE); backColor2->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR2")); - backColor2->set_image(options.bgcolor == 2 ? *iBC2 : *igBC2); + backColor2->set_image(*iBC2); previewR = Gtk::manage (new Gtk::ToggleButton ()); previewR->get_style_context()->add_class("narrowbutton"); previewR->set_relief(Gtk::RELIEF_NONE); previewR->set_tooltip_markup (M("MAIN_TOOLTIP_PREVIEWR")); - previewR->set_image(*igR); + previewR->set_image(*iR); previewG = Gtk::manage (new Gtk::ToggleButton ()); previewG->get_style_context()->add_class("narrowbutton"); previewG->set_relief(Gtk::RELIEF_NONE); previewG->set_tooltip_markup (M("MAIN_TOOLTIP_PREVIEWG")); - previewG->set_image(*igG); + previewG->set_image(*iG); previewB = Gtk::manage (new Gtk::ToggleButton ()); previewB->get_style_context()->add_class("narrowbutton"); previewB->set_relief(Gtk::RELIEF_NONE); previewB->set_tooltip_markup (M("MAIN_TOOLTIP_PREVIEWB")); - previewB->set_image(*igB); + previewB->set_image(*iB); previewL = Gtk::manage (new Gtk::ToggleButton ()); previewL->get_style_context()->add_class("narrowbutton"); previewL->set_relief(Gtk::RELIEF_NONE); previewL->set_tooltip_markup (M("MAIN_TOOLTIP_PREVIEWL")); - previewL->set_image(*igL); + previewL->set_image(*iL); previewR->set_active (false); previewG->set_active (false); @@ -125,25 +123,8 @@ PreviewModePanel::PreviewModePanel (ImageArea* ia) : imageArea(ia) //show_all (); } -PreviewModePanel::~PreviewModePanel () -{ - delete iR; - delete iG; - delete iB; - delete iL; - delete iBC0; - delete iBC1; - delete iBC2; - delete iBC3; - delete igR; - delete igG; - delete igB; - delete igL; - delete igBC0; - delete igBC1; - delete igBC2; - delete igBC3; -} +PreviewModePanel::~PreviewModePanel () {} + //toggle Functions below are for shortcuts void PreviewModePanel::toggleR () { @@ -206,10 +187,10 @@ void PreviewModePanel::buttonToggled (Gtk::ToggleButton* tbpreview) } // set image based on button's state - previewR->set_image(previewR->get_active() ? *iR : *igR); - previewG->set_image(previewG->get_active() ? *iG : *igG); - previewB->set_image(previewB->get_active() ? *iB : *igB); - previewL->set_image(previewL->get_active() ? *iL : *igL); + iR->set_from_icon_name(previewR->get_active() ? nR : ngR); + iG->set_from_icon_name(previewG->get_active() ? nG : ngG); + iB->set_from_icon_name(previewB->get_active() ? nB : ngB); + iL->set_from_icon_name(previewL->get_active() ? nL : ngL); connR.block(false); connG.block(false); @@ -306,10 +287,10 @@ void PreviewModePanel::buttonToggled_backColor (Gtk::ToggleButton* tbbackColor) } // set image based on button's state - backColor0->set_image(backColor0->get_active() ? *iBC0 : *igBC0); - backColor1->set_image(backColor1->get_active() ? *iBC1 : *igBC1); - backColor2->set_image(backColor2->get_active() ? *iBC2 : *igBC2); - backColor3->set_image(backColor3->get_active() ? *iBC3 : *igBC3); + iBC0->set_from_icon_name(backColor0->get_active() ? nBC0 : ngBC0); + iBC1->set_from_icon_name(backColor1->get_active() ? nBC1 : ngBC1); + iBC2->set_from_icon_name(backColor2->get_active() ? nBC2 : ngBC2); + iBC3->set_from_icon_name(backColor3->get_active() ? nBC3 : ngBC3); connbackColor0.block(false); connbackColor1.block(false); diff --git a/rtgui/previewmodepanel.h b/rtgui/previewmodepanel.h index d475fd4a4..b496958ab 100644 --- a/rtgui/previewmodepanel.h +++ b/rtgui/previewmodepanel.h @@ -20,6 +20,7 @@ #include class ImageArea; +class RTImage; class PreviewModePanel : public Gtk::Box @@ -36,14 +37,22 @@ protected: Gtk::ToggleButton* backColor3; ImageArea* imageArea; - Gtk::Image* iR, *igR; - Gtk::Image* iG, *igG; - Gtk::Image* iB, *igB; - Gtk::Image* iL, *igL; - Gtk::Image* iBC0, *igBC0; - Gtk::Image* iBC1, *igBC1; - Gtk::Image* iBC2, *igBC2; - Gtk::Image* iBC3, *igBC3; + const Glib::ustring nR, ngR; + const Glib::ustring nG, ngG; + const Glib::ustring nB, ngB; + const Glib::ustring nL, ngL; + const Glib::ustring nBC0, ngBC0; + const Glib::ustring nBC1, ngBC1; + const Glib::ustring nBC2, ngBC2; + const Glib::ustring nBC3, ngBC3; + RTImage* const iR; + RTImage* const iG; + RTImage* const iB; + RTImage* const iL; + RTImage* const iBC0; + RTImage* const iBC1; + RTImage* const iBC2; + RTImage* const iBC3; public: explicit PreviewModePanel (ImageArea* ia); diff --git a/rtgui/previewwindow.cc b/rtgui/previewwindow.cc index 90d0a7b4b..cc239ed26 100644 --- a/rtgui/previewwindow.cc +++ b/rtgui/previewwindow.cc @@ -156,7 +156,7 @@ bool PreviewWindow::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) int x, y, w, h; getObservedFrameArea (x, y, w, h); if (x>imgX || y>imgY || w < imgW || h < imgH) { - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double rectX = x + 0.5; double rectY = y + 0.5; double rectW = std::min(w, (int)(imgW - (x - imgX) - 1)); @@ -307,14 +307,14 @@ Gtk::SizeRequestMode PreviewWindow::get_request_mode_vfunc () const void PreviewWindow::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - minimum_height= 50 * RTScalable::getScale(); - natural_height = 100 * RTScalable::getScale(); + minimum_height= RTScalable::scalePixelSize(50); + natural_height = RTScalable::scalePixelSize(100); } void PreviewWindow::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = 80 * RTScalable::getScale(); - natural_width = 120 * RTScalable::getScale(); + minimum_width = RTScalable::scalePixelSize(80); + natural_width = RTScalable::scalePixelSize(120); } void PreviewWindow::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index e18ec8cff..da18807a6 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -45,16 +45,16 @@ void ProfilePanel::cleanup () delete partialProfileDlg; } -ProfilePanel::ProfilePanel () : storedPProfile(nullptr), lastSavedPSE(nullptr), customPSE(nullptr) +ProfilePanel::ProfilePanel () : storedPProfile(nullptr), + modeOn("profile-filled"), modeOff("profile-partial"), + profileFillImage(Gtk::manage(new RTImage(options.filledProfile ? modeOn : modeOff, Gtk::ICON_SIZE_LARGE_TOOLBAR))), + lastSavedPSE(nullptr), customPSE(nullptr) { - tpc = nullptr; - profileFillModeOnImage = new RTImage("profile-filled.png"); - profileFillModeOffImage = new RTImage("profile-partial.png"); fillMode = Gtk::manage (new Gtk::ToggleButton()); fillMode->set_active(options.filledProfile); - fillMode->add( options.filledProfile ? *profileFillModeOnImage : *profileFillModeOffImage ); + fillMode->add(*profileFillImage); fillMode->signal_toggled().connect ( sigc::mem_fun(*this, &ProfilePanel::profileFillModeToggled) ); fillMode->set_tooltip_text(M("PROFILEPANEL_MODE_TIP")); //GTK318 @@ -69,20 +69,20 @@ ProfilePanel::ProfilePanel () : storedPProfile(nullptr), lastSavedPSE(nullptr), setExpandAlignProperties(profiles, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); load = Gtk::manage (new Gtk::Button ()); - load->add (*Gtk::manage (new RTImage ("folder-open.png"))); + load->add (*Gtk::manage (new RTImage ("folder-open", Gtk::ICON_SIZE_LARGE_TOOLBAR))); load->get_style_context()->add_class("Left"); load->set_margin_left(2); setExpandAlignProperties(load, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); save = Gtk::manage (new Gtk::Button ()); - save->add (*Gtk::manage (new RTImage ("save.png"))); + save->add (*Gtk::manage (new RTImage ("save", Gtk::ICON_SIZE_LARGE_TOOLBAR))); save->get_style_context()->add_class("MiddleH"); setExpandAlignProperties(save, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); copy = Gtk::manage (new Gtk::Button ()); - copy->add (*Gtk::manage (new RTImage ("copy.png"))); + copy->add (*Gtk::manage (new RTImage ("copy", Gtk::ICON_SIZE_LARGE_TOOLBAR))); copy->get_style_context()->add_class("MiddleH"); setExpandAlignProperties(copy, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); paste = Gtk::manage (new Gtk::Button ()); - paste->add (*Gtk::manage (new RTImage ("paste.png"))); + paste->add (*Gtk::manage (new RTImage ("paste", Gtk::ICON_SIZE_LARGE_TOOLBAR))); paste->get_style_context()->add_class("Right"); setExpandAlignProperties(paste, false, true, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); @@ -132,8 +132,6 @@ ProfilePanel::~ProfilePanel () delete lastsaved; } - delete profileFillModeOnImage; - delete profileFillModeOffImage; delete lastSavedPSE; delete customPSE; } @@ -887,10 +885,10 @@ void ProfilePanel::profileFillModeToggled() { if (fillMode->get_active()) { // The button is pressed, we'll use the profileFillModeOnImage - fillMode->set_image(*profileFillModeOnImage); + profileFillImage->set_from_icon_name(modeOn); } else { // The button is released, we'll use the profileFillModeOffImage - fillMode->set_image(*profileFillModeOffImage); + profileFillImage->set_from_icon_name(modeOff); } } diff --git a/rtgui/profilepanel.h b/rtgui/profilepanel.h index c3a125c49..e1d1f4067 100644 --- a/rtgui/profilepanel.h +++ b/rtgui/profilepanel.h @@ -62,8 +62,8 @@ private: Glib::ustring storedValue; Glib::ustring lastFilename; Glib::ustring imagePath; - RTImage *profileFillModeOnImage; - RTImage *profileFillModeOffImage; + const Glib::ustring modeOn, modeOff; + RTImage* const profileFillImage; Gtk::ToggleButton* fillMode; Gtk::TreeIter currRow; ProfileStoreEntry *lastSavedPSE; diff --git a/rtgui/rawcacorrection.cc b/rtgui/rawcacorrection.cc index 58c7995f9..207d535ac 100644 --- a/rtgui/rawcacorrection.cc +++ b/rtgui/rawcacorrection.cc @@ -35,10 +35,10 @@ RAWCACorr::RAWCACorr () : FoldableToolPanel(this, "rawcacorrection", M("TP_RAWCA EvPreProcessCAColourshift = m->newEvent(DARKFRAME, "HISTORY_MSG_RAWCACORR_COLORSHIFT"); EvPreProcessCAColourshiftHistory = m->newEvent(M_VOID, "HISTORY_MSG_RAWCACORR_COLORSHIFT"); - Gtk::Image* icaredL = Gtk::manage (new RTImage ("circle-red-cyan-small.png")); - Gtk::Image* icaredR = Gtk::manage (new RTImage ("circle-cyan-red-small.png")); - Gtk::Image* icablueL = Gtk::manage (new RTImage ("circle-blue-yellow-small.png")); - Gtk::Image* icablueR = Gtk::manage (new RTImage ("circle-yellow-blue-small.png")); + Gtk::Image* const icaredL = Gtk::manage (new RTImage ("circle-red-cyan-small")); + Gtk::Image* const icaredR = Gtk::manage (new RTImage ("circle-cyan-red-small")); + Gtk::Image* const icablueL = Gtk::manage (new RTImage ("circle-blue-yellow-small")); + Gtk::Image* const icablueR = Gtk::manage (new RTImage ("circle-yellow-blue-small")); caAutocorrect = Gtk::manage (new CheckBox(M("TP_RAWCACORR_AUTO"), multiImage)); caAutocorrect->setCheckBoxListener (this); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index a9d7cc376..d77849be2 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -491,7 +491,7 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL") neutral = Gtk::manage (new Gtk::Button (M ("TP_RETINEX_NEUTRAL"))); setExpandAlignProperties (neutral, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - RTImage *resetImg = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); + RTImage *resetImg = Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON)); setExpandAlignProperties (resetImg, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); neutral->set_image (*resetImg); neutral->set_tooltip_text (M ("TP_RETINEX_NEUTRAL_TIP")); @@ -939,7 +939,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) cdshapeH->setCurve (pp->retinex.cdHcurve); lhshape->setCurve (pp->retinex.lhcurve); mapshape->setCurve (pp->retinex.mapcurve); - + retinexMethodConn.block (false); retinexColorSpaceConn.block (false); gammaretinexConn.block (false); @@ -951,7 +951,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) complexmethodconn.block (false); enableListener (); - + if (complexmethod->get_active_row_number() == 0) { updateGUIToMode(0); // convertParamToNormal(); @@ -959,7 +959,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) } else { updateGUIToMode(1); } - + } diff --git a/rtgui/rotate.cc b/rtgui/rotate.cc index 06c53cd4e..a2456a681 100644 --- a/rtgui/rotate.cc +++ b/rtgui/rotate.cc @@ -35,15 +35,15 @@ Rotate::Rotate () : FoldableToolPanel(this, "rotate", M("TP_ROTATE_LABEL")) rlistener = nullptr; //TODO the action of the rotation slider is counter-intuitive - Gtk::Image* irotateL = Gtk::manage (new RTImage ("rotate-right-small.png")); - Gtk::Image* irotateR = Gtk::manage (new RTImage ("rotate-left-small.png")); + Gtk::Image* irotateL = Gtk::manage (new RTImage ("rotate-right-small")); + Gtk::Image* irotateR = Gtk::manage (new RTImage ("rotate-left-small")); degree = Gtk::manage (new Adjuster (M("TP_ROTATE_DEGREE"), -45, 45, 0.01, 0, irotateL, irotateR)); degree->setAdjusterListener (this); pack_start (*degree); selectStraight = Gtk::manage (new Gtk::Button (M("TP_ROTATE_SELECTLINE"))); - selectStraight->set_image (*Gtk::manage (new RTImage ("rotate-straighten-small.png"))); + selectStraight->set_image (*Gtk::manage (new RTImage ("rotate-straighten-small"))); selectStraight->get_style_context()->add_class("independent"); pack_start (*selectStraight, Gtk::PACK_SHRINK, 2); diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index 44078ed3b..2040ec21d 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -3,6 +3,7 @@ * * Copyright (c) 2004-2010 Gabor Horvath * Copyright (c) 2018 Jean-Christophe FRISCH + * Copyright (c) 2022 Pierre CABRERA * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,205 +21,21 @@ #include "rtimage.h" -#include -#include - -#include "../rtengine/settings.h" - -namespace -{ - -std::map > pixbufCache; -std::map > surfaceCache; - -} - -double RTImage::dpiBack = 0.; -int RTImage::scaleBack = 0; - RTImage::RTImage () {} -RTImage::RTImage (RTImage &other) : surface(other.surface), pixbuf(other.pixbuf) +RTImage::RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize) : + Gtk::Image(iconName, iconSize), + size(iconSize) { - if (pixbuf) { - set(pixbuf); - } else if (surface) { - set(surface); - } } -RTImage::RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName) : Gtk::Image() +void RTImage::set_from_icon_name(const Glib::ustring& iconName) { - setImage (fileName, rtlFileName); + Gtk::Image::set_from_icon_name(iconName, this->size); } -RTImage::RTImage (Glib::RefPtr &pbuf) +void RTImage::set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize) { - if (surface) { - surface.clear(); - } - if (pbuf) { - set(pbuf); - this->pixbuf = pbuf; - } -} - -RTImage::RTImage (Cairo::RefPtr &surf) -{ - if (pixbuf) { - pixbuf.clear(); - } - if (surf) { - set(surf); - surface = surf; - } -} - -RTImage::RTImage (Glib::RefPtr &other) -{ - if (other) { - if (other->get_surface()) { - surface = other->get_surface(); - set(surface); - } else { - pixbuf = other->get_pixbuf(); - set(pixbuf); - } - } -} - -void RTImage::setImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName) -{ - Glib::ustring imageName; - - if (!rtlFileName.empty() && getDirection() == Gtk::TEXT_DIR_RTL) { - imageName = rtlFileName; - } else { - imageName = fileName; - } - - changeImage (imageName); -} - -/* - * On windows, if scale = 2, the dpi is non significant, i.e. should be considered = 192 - */ -void RTImage::setDPInScale (const double newDPI, const int newScale) -{ - if (scaleBack != newScale || (scaleBack == 1 && dpiBack != newDPI)) { - RTScalable::setDPInScale(newDPI, newScale); - dpiBack = getDPI(); - scaleBack = getScale(); - updateImages(); - } -} - -void RTImage::changeImage (const Glib::ustring& imageName) -{ - clear (); - - if (imageName.empty()) { - return; - } - - if (pixbuf) { - auto iterator = pixbufCache.find (imageName); - assert(iterator != pixbufCache.end ()); - pixbuf = iterator->second; - set(iterator->second); - } else { // if no Pixbuf is set, we update or create a Cairo::ImageSurface - auto iterator = surfaceCache.find (imageName); - if (iterator == surfaceCache.end ()) { - auto surf = createImgSurfFromFile(imageName); - iterator = surfaceCache.emplace (imageName, surf).first; - } - surface = iterator->second; - set(iterator->second); - } -} - -Cairo::RefPtr RTImage::get_surface() -{ - return surface; -} - -int RTImage::get_width() -{ - if (surface) { - return surface->get_width(); - } - if (pixbuf) { - return pixbuf->get_width(); - } - return -1; -} - -int RTImage::get_height() -{ - if (surface) { - return surface->get_height(); - } - if (pixbuf) { - return pixbuf->get_height(); - } - return -1; -} - -void RTImage::init() -{ - dpiBack = RTScalable::getDPI(); - scaleBack = RTScalable::getScale(); -} - -void RTImage::cleanup(bool all) -{ - for (auto& entry : pixbufCache) { - entry.second.reset(); - } - for (auto& entry : surfaceCache) { - entry.second.clear(); - } - RTScalable::cleanup(all); -} - -void RTImage::updateImages() -{ - for (auto& entry : pixbufCache) { - entry.second = createPixbufFromFile(entry.first); - } - for (auto& entry : surfaceCache) { - entry.second = createImgSurfFromFile(entry.first); - } -} - -Glib::RefPtr RTImage::createPixbufFromFile (const Glib::ustring& fileName) -{ - Cairo::RefPtr imgSurf = createImgSurfFromFile(fileName); - return Gdk::Pixbuf::create(imgSurf, 0, 0, imgSurf->get_width(), imgSurf->get_height()); -} - -Cairo::RefPtr RTImage::createImgSurfFromFile (const Glib::ustring& fileName) -{ - Cairo::RefPtr surf; - - try { - surf = loadImage(fileName, getTweakedDPI()); - - // HOMBRE: As of now, GDK_SCALE is forced to 1, so setting the Cairo::ImageSurface scale is not required - /* - double x=0., y=0.; - cairo_surface_get_device_scale(surf->cobj(), &x, &y); - if (getScale() == 2) { - cairo_surface_set_device_scale(surf->cobj(), 0.5, 0.5); - cairo_surface_get_device_scale(surf->cobj(), &x, &y); - surf->flush(); - } - */ - } catch (const Glib::Exception& exception) { - if (rtengine::settings->verbose) { - std::cerr << "Failed to load image \"" << fileName << "\": " << exception.what() << std::endl; - } - } - - return surf; + this->size = iconSize; + Gtk::Image::set_from_icon_name(iconName, this->size); } diff --git a/rtgui/rtimage.h b/rtgui/rtimage.h index eb1930d28..895267dbd 100644 --- a/rtgui/rtimage.h +++ b/rtgui/rtimage.h @@ -3,6 +3,7 @@ * * Copyright (c) 2004-2010 Gabor Horvath * Copyright (c) 2018 Jean-Christophe FRISCH + * Copyright (c) 2022 Pierre CABRERA * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,44 +21,19 @@ #pragma once #include -#include "rtscalable.h" /** * @brief A derived class of Gtk::Image in order to handle theme-related icon sets. */ -class RTImage final : public Gtk::Image, public RTScalable +class RTImage final : public Gtk::Image { - static double dpiBack; // used to keep track of master dpi change - static int scaleBack; // used to keep track of master scale change - //bool on_configure_event(GdkEventConfigure* configure_event); - -protected: - Cairo::RefPtr surface; - Glib::RefPtr pixbuf; +private: + Gtk::IconSize size; public: RTImage (); - RTImage (RTImage &other); - explicit RTImage (Glib::RefPtr &pixbuf); - explicit RTImage (Cairo::RefPtr &surf); - explicit RTImage(Cairo::RefPtr other); - explicit RTImage (Glib::RefPtr &other); - explicit RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName = Glib::ustring()); - - void setImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName = Glib::ustring()); - void changeImage (const Glib::ustring& imageName); - Cairo::RefPtr get_surface(); - int get_width(); - int get_height(); - - - static void init(); - static void cleanup(bool all = false); - static void updateImages (); - static void setDPInScale (const double newDPI, const int newScale); - static void setScale (const int newScale); - - static Glib::RefPtr createPixbufFromFile (const Glib::ustring& fileName); - static Cairo::RefPtr createImgSurfFromFile (const Glib::ustring& fileName); + explicit RTImage (const Glib::ustring& iconName, const Gtk::IconSize iconSize = Gtk::ICON_SIZE_SMALL_TOOLBAR); + void set_from_icon_name(const Glib::ustring& iconName); + void set_from_icon_name(const Glib::ustring& iconName, const Gtk::IconSize iconSize); }; diff --git a/rtgui/rtscalable.cc b/rtgui/rtscalable.cc index 78202326a..09fb82205 100644 --- a/rtgui/rtscalable.cc +++ b/rtgui/rtscalable.cc @@ -2,6 +2,7 @@ * This file is part of RawTherapee. * * Copyright (c) 2018 Jean-Christophe FRISCH + * Copyright (c) 2022 Pierre CABRERA * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,47 +19,221 @@ */ #include "rtscalable.h" -#include -#include -#include + #include #include -#include "../rtengine/rt_math.h" -#include "options.h" +#include "../rtengine/settings.h" +#include "config.h" +#include "guiutils.h" -double RTScalable::dpi = 0.; -int RTScalable::scale = 0; +// Default static parameter values +double RTScalable::dpi = 96.; +int RTScalable::scale = 1; -extern Glib::ustring argv0; -extern unsigned char initialGdkScale; -extern float fontScale; -Gtk::TextDirection RTScalable::direction = Gtk::TextDirection::TEXT_DIR_NONE; +void RTScalable::updateDPInScale(const Gtk::Window* window, double &newDPI, int &newScale) +{ + if (window) { + const auto screen = window->get_screen(); + newDPI = screen->get_resolution(); // Get DPI retrieved from the OS + newScale = window->get_scale_factor(); // Get scale factor associated to the window + } +} + +Cairo::RefPtr RTScalable::loadSurfaceFromIcon(const Glib::ustring &iconName, const Gtk::IconSize iconSize) +{ + GThreadLock lock; // All icon theme access or image access on separate thread HAVE to be protected + + Cairo::RefPtr surf; // Create Cairo::RefPtr nullptr + + // Get icon theme + const auto theme = Gtk::IconTheme::get_default(); + + // Get pixel size from Gtk::IconSize + int wSize, hSize; + + if (!Gtk::IconSize::lookup(iconSize, wSize, hSize)) { // Size in invalid + wSize = hSize = 16; // Set to a default size of 16px (i.e. Gtk::ICON_SIZE_SMALL_TOOLBAR one) + } + + // Get scale based on DPI and scale + // Note: hSize not used because icon are considered squared + const int size = wSize; + + // Looking for corresponding icon (if existing) + const auto iconInfo = theme->lookup_icon(iconName, size); + const auto iconPath = iconInfo.get_filename(); + + if ((iconPath.empty() || !iconInfo) && rtengine::settings->verbose) { + std::cerr << "Failed to load icon \"" << iconName << "\" for size " << size << "px" << std::endl; + return surf; + } + + // Create surface from corresponding icon + const auto pos = iconPath.find_last_of('.'); + + if (pos >= 0 && pos < iconPath.length()) { + const auto fext = iconPath.substr(pos + 1, iconPath.length()).lowercase(); + + // Case where iconPath is a PNG file + if (fext == "png") { + // Create surface from PNG file + surf = RTScalable::loadSurfaceFromPNG(iconPath, true); + } + + // Case where iconPath is a SVG file + if (fext == "svg") { + // Create surface from SVG file + surf = RTScalable::loadSurfaceFromSVG(iconPath, size, size, true); + } + } + + /* + // Scale current surface size to desired scaled size + if (surface) { + // Note: surface is considered made from squared icon + const double scale_factor = static_cast(size) / static_cast(surface->get_width()); + surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, + static_cast(surface->get_width() * scale_factor + 0.5), + static_cast(surface->get_height() * scale_factor + 0.5)); + const auto cr = Cairo::Context::create(surf); + cr->scale(scale_factor, scale_factor); + cr->set_source(surface, 0, 0); + cr->paint(); + } + */ + + return surf; +} + +Cairo::RefPtr RTScalable::loadSurfaceFromPNG(const Glib::ustring &fname, const bool is_path) +{ + GThreadLock lock; // All icon theme access or image access on separate thread HAVE to be protected + + Cairo::RefPtr surf; // Create Cairo::RefPtr nullptr + + Glib::ustring path; + + if (is_path) { + // Directly use fname as a path + path = fname; + } else { + // Look for PNG file in "images" folder + Glib::ustring imagesFolder = Glib::build_filename(DATA_SEARCH_PATH, "images"); + path = Glib::build_filename(imagesFolder, fname); + } + + // Create surface from PNG file if file exist + if (Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS)) { + surf = Cairo::ImageSurface::create_from_png(path); + } else { + if (rtengine::settings->verbose) { + std::cerr << "Failed to load PNG file \"" << fname << "\"" << std::endl; + } + } + + return surf; +} + +Cairo::RefPtr RTScalable::loadSurfaceFromSVG(const Glib::ustring &fname, const int width, const int height, const bool is_path) +{ + GThreadLock lock; // All icon theme access or image access on separate thread HAVE to be protected + + Cairo::RefPtr surf; // Create Cairo::RefPtr nullptr + + Glib::ustring path; + + if (is_path) { + // Directly use fname as a path + path = fname; + } else { + // Look for PNG file in "images" folder + Glib::ustring imagesFolder = Glib::build_filename(DATA_SEARCH_PATH, "images"); + path = Glib::build_filename(imagesFolder, fname); + } + + // Create surface from SVG file if file exist + if (Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS)) { + // Read content of SVG file + std::string svgFile; + try { + svgFile = Glib::file_get_contents(path); + } + catch (Glib::FileError &err) { + std::cerr << "Failed to load SVG file \"" << fname << "\": " << err.what() << std::endl; + return surf; + } + + // Create surface with librsvg library + GError* error = nullptr; + RsvgHandle* handle = rsvg_handle_new_from_data((unsigned const char*)svgFile.c_str(), svgFile.length(), &error); + + if (error) { + std::cerr << "Failed to load SVG file \"" << fname << "\": " << std::endl + << Glib::ustring(error->message) << std::endl; + return surf; + } + + if (width == -1 || height == -1) { + // Use SVG image natural width and height + RsvgDimensionData dim; + rsvg_handle_get_dimensions(handle, &dim); // Get SVG image dimensions + surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, dim.width, dim.height); + } else { + // Use given width and height + surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, width, height); + } + + // Render (and erase with) default surface background + Cairo::RefPtr c = Cairo::Context::create(surf); + c->set_source_rgba (0., 0., 0., 0.); + c->set_operator (Cairo::OPERATOR_CLEAR); + c->paint(); + + // Render surface based on SVG image + error = nullptr; + RsvgRectangle rect = { + .x = 0., + .y = 0., + .width = static_cast(width * RTScalable::getScale()), // SVG image is upscaled to avoid blur effect + .height = static_cast(height * RTScalable::getScale()) // SVG image is upscaled to avoid blur effect + }; + c->set_operator (Cairo::OPERATOR_OVER); + c->scale(1. / RTScalable::getScale(), 1. / RTScalable::getScale()); // Cairo surface is scaled to match image dimensions + + const bool success = rsvg_handle_render_document(handle, c->cobj(), &rect, &error); + + if (!success && error) { + std::cerr << "Failed to load SVG file \"" << fname << "\": " << std::endl + << Glib::ustring(error->message) << std::endl; + return surf; + } + + rsvg_handle_free(handle); + } else { + if (rtengine::settings->verbose) { + std::cerr << "Failed to load SVG file \"" << fname << "\"" << std::endl; + } + } + + return surf; +} + +void RTScalable::init(const Gtk::Window* window) +{ + // Retrieve DPI and Scale paremeters from OS + updateDPInScale(window, dpi, scale); +} + +void RTScalable::setDPInScale (const Gtk::Window* window) +{ + updateDPInScale(window, dpi, scale); +} void RTScalable::setDPInScale (const double newDPI, const int newScale) { - if (!options.pseudoHiDPISupport) { - scale = 1; - dpi = baseDPI; - return; - } - - if (scale != newScale || (scale == 1 && dpi != newDPI)) { - // reload all images - scale = newScale; - // HOMBRE: On windows, if scale = 2, the dpi is non significant, i.e. should be considered = 192 ; don't know for linux/macos - dpi = newDPI; - if (scale == 1) { - if (dpi >= baseHiDPI) { - scale = 2; - } - } - else if (scale == 2) { - if (dpi < baseHiDPI) { - dpi *= 2.; - } - } - } + dpi = newDPI; + scale = newScale; } double RTScalable::getDPI () @@ -66,188 +241,26 @@ double RTScalable::getDPI () return dpi; } -double RTScalable::getTweakedDPI () -{ - return dpi * static_cast(fontScale); -} - int RTScalable::getScale () { return scale; } -Gtk::TextDirection RTScalable::getDirection() +double RTScalable::getGlobalScale() { - return direction; + return (static_cast(RTScalable::getDPI()) / + static_cast(RTScalable::baseDPI) * + RTScalable::getScale()); } -void RTScalable::init(Gtk::Window *window) +int RTScalable::scalePixelSize(const int pixel_size) { - dpi = 0.; - scale = 0; - - setDPInScale(window->get_screen()->get_resolution(), rtengine::max((int)initialGdkScale, window->get_scale_factor())); - direction = window->get_direction(); + const double s = getGlobalScale(); + return static_cast(pixel_size * s + 0.5); // Rounded scaled size } -void RTScalable::deleteDir(const Glib::ustring& path) +double RTScalable::scalePixelSize(const double pixel_size) { - int error = 0; - try { - - Glib::Dir dir (path); - - // Removing the directory content - for (auto entry = dir.begin(); entry != dir.end(); ++entry) { - error |= g_remove (Glib::build_filename (path, *entry).c_str()); - } - - if (error != 0 && rtengine::settings->verbose) { - std::cerr << "Failed to delete all entries in '" << path << "': " << g_strerror(errno) << std::endl; - } - - } catch (Glib::Error&) { - error = 1; - } - - // Removing the directory itself - if (!error) { - try { - - error = g_remove (path.c_str()); - - } catch (Glib::Error&) {} - } -} - -void RTScalable::cleanup(bool all) -{ - Glib::ustring imagesCacheFolder = Glib::build_filename (options.cacheBaseDir, "svg2png"); - Glib::ustring sDPI = Glib::ustring::compose("%1", (int)getTweakedDPI()); - - try { - Glib::Dir dir(imagesCacheFolder); - - for (Glib::DirIterator entry = dir.begin(); entry != dir.end(); ++entry) { - const Glib::ustring fileName = *entry; - const Glib::ustring filePath = Glib::build_filename(imagesCacheFolder, fileName); - if (fileName == "." || fileName == ".." || !Glib::file_test(filePath, Glib::FILE_TEST_IS_DIR)) { - continue; - } - - if (all || fileName != sDPI) { - deleteDir(filePath); - } - } - } catch (Glib::Exception&) { - } - -} - -/* - * This function try to find the svg file converted to png in a cache and return - * the Cairo::ImageSurface. If it can't find it, it will generate it. - * - * If the provided filename doesn't end with ".svg" (and then we're assuming it's a png file), - * it will try to load that file directly from the source images folder. Scaling is disabled - * for anything else than svg files. - * - * This function will always return a usable value, but it might be a garbage image - * if something went wrong. - */ -Cairo::RefPtr RTScalable::loadImage(const Glib::ustring &fname, double dpi) -{ - // Magic color : #2a7fff - // Dark theme color : #CCCCCC - // Light theme color : #252525 -- not used - - Glib::ustring imagesFolder = Glib::build_filename (argv0, "images"); - Glib::ustring imagesCacheFolder = Glib::build_filename (options.cacheBaseDir, "svg2png"); - - // -------------------- Looking for the cached PNG file first -------------------- - - Glib::ustring imagesCacheFolderDPI = Glib::build_filename (imagesCacheFolder, Glib::ustring::compose("%1", (int)dpi)); - auto path = Glib::build_filename(imagesCacheFolderDPI, fname); - - if (Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS)) { - return Cairo::ImageSurface::create_from_png(path); - } else { - - // -------------------- Looking for the PNG file in install directory -------------------- - - path = Glib::build_filename(imagesFolder, fname); - if (Glib::file_test(path.c_str(), Glib::FILE_TEST_EXISTS)) { - return Cairo::ImageSurface::create_from_png(path); - } - } - - // Last chance: looking for the svg file and creating the cached image file - - // -------------------- Creating the cache folder for PNGs -------------------- - - if (!Glib::file_test(imagesCacheFolderDPI.c_str(), Glib::FILE_TEST_EXISTS)) { - auto error = g_mkdir_with_parents (imagesCacheFolderDPI.c_str(), 0777); - if (error != 0) { - std::cerr << "ERROR: Can't create \"" << imagesCacheFolderDPI << "\" cache folder: " << g_strerror(error) << std::endl; - Cairo::RefPtr surf = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, 10, 10); - return surf; - } - } - - // -------------------- Loading the SVG file -------------------- - - std::string svgFile; - Glib::ustring iconNameSVG; - if (fname.find(".png") != Glib::ustring::npos) { - iconNameSVG = fname.substr(0, fname.length() - 3) + Glib::ustring("svg"); - } - try { - path = Glib::build_filename (imagesFolder, iconNameSVG); - //printf("Trying to get content of %s\n", path.c_str()); - svgFile = Glib::file_get_contents(Glib::build_filename (imagesFolder, iconNameSVG)); - } - catch (Glib::FileError &err) { - std::cerr << "ERROR: " << err.what() << std::endl; - Cairo::RefPtr surf = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, 10, 10); - return surf; - } - - // -------------------- Updating the the magic color -------------------- - - std::string updatedSVG = std::regex_replace(svgFile, std::regex("#2a7fff"), "#CCCCCC"); - - // -------------------- Creating the rsvg handle -------------------- - - GError **error = nullptr; - RsvgHandle *handle = rsvg_handle_new_from_data((unsigned const char*)updatedSVG.c_str(), updatedSVG.length(), error); - - if (error && !handle) { - std::cerr << "ERROR: Can't use the provided data for \"" << fname << "\" to create a RsvgHandle:" << std::endl - << Glib::ustring((*error)->message) << std::endl; - Cairo::RefPtr surf = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, 10, 10); - return surf; - } - - // -------------------- Drawing the image to a Cairo::ImageSurface -------------------- - - RsvgDimensionData dim; - rsvg_handle_get_dimensions(handle, &dim); - double r = dpi / baseDPI; - Cairo::RefPtr surf = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, (int)(dim.width * r + 0.499), (int)(dim.height * r + 0.499)); - Cairo::RefPtr c = Cairo::Context::create(surf); - c->set_source_rgba (0., 0., 0., 0.); - c->set_operator (Cairo::OPERATOR_CLEAR); - c->paint (); - c->set_operator (Cairo::OPERATOR_OVER); - c->scale(r, r); - rsvg_handle_render_cairo(handle, c->cobj()); - rsvg_handle_free(handle); - - // -------------------- Saving the image in cache -------------------- - - surf->write_to_png(Glib::build_filename(imagesCacheFolderDPI, fname)); - - // -------------------- Finished! Pfeeew ! -------------------- - - return surf; + const double s = getGlobalScale(); + return (pixel_size * s); } diff --git a/rtgui/rtscalable.h b/rtgui/rtscalable.h index 28ebf7be8..f78c3bf3d 100644 --- a/rtgui/rtscalable.h +++ b/rtgui/rtscalable.h @@ -2,6 +2,7 @@ * This file is part of RawTherapee. * * Copyright (c) 2018 Jean-Christophe FRISCH + * Copyright (c) 2022 Pierre CABRERA * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,39 +20,52 @@ #pragma once -#include +#include /** - * @brief A master class for derived class of Gtk::Image in order to handle theme-related icon sets. + * A static class in order to handle Hi-DPI. + * + * About Cairo size convention (for surface): + * Cairo size is expressed in "px" with a 96 DPI (i.e. px per inch) default resolution + * + * About Pango size convention (for font): + * Pango size can be expressed in two different units: + * - Absolute size (i.e. "px"): If size is int type, absolute size is given in "Pango unit" + * shall be divided by Pango::SCALE (i.e. 1024) to get "px". If size is double, absolute + * is already given in "px". + * - Non-absolute size (i.e. "pt"): The default resolution is 72 DPI (i.e. pt per inch). To + * convert the size to "px", use the following formula: + * "size in px" = "size in pt" * ("device resolution" / 72) * "device scale" + * + * Hi-DPI implementation according to the OS (source: GDK code): + * - Windows: A default DPI of 96 is considered. Current DPI parameter is provided by the OS. + * Scale is calculated by (int)("current DPI" / 96). If Scale is greater than 1, DPI is + * forced to 96. + * - MacOS: Scale is calculated from OS parameters (= "Retina screen width" / "Virtual width"). + * DPI is forced to 72. + * - Linux: DPI is calculated from OS parameter (= 96 * "text-scaling-factor"). */ class RTScalable { +private: static double dpi; static int scale; - static Gtk::TextDirection direction; // cached value for text-direction - static void deleteDir(const Glib::ustring& path); + static void updateDPInScale(const Gtk::Window* window, double &newDPI, int &newScale); protected: - static void setDPInScale (const double newDPI, const int newScale); - static Cairo::RefPtr loadImage(const Glib::ustring &fname, double dpi); - static Gtk::TextDirection getDirection(); - + static Cairo::RefPtr loadSurfaceFromIcon(const Glib::ustring &icon_name, const Gtk::IconSize iconSize = Gtk::ICON_SIZE_SMALL_TOOLBAR); + static Cairo::RefPtr loadSurfaceFromPNG(const Glib::ustring &fname, const bool is_path = false); + static Cairo::RefPtr loadSurfaceFromSVG(const Glib::ustring &fname, const int width = -1, const int height = -1, const bool is_path = false); public: - -#ifdef __APPLE__ - static constexpr double baseDPI = 72.; - static constexpr double baseHiDPI = 144.; - static constexpr int baseFontSize = 12; -#else - static constexpr double baseDPI = 96.; - static constexpr double baseHiDPI = 192.; - static constexpr int baseFontSize = 9; -#endif - - static void init(Gtk::Window *window); - static void cleanup(bool all = false); - static double getDPI (); - static double getTweakedDPI (); // The returned value is tweaked DPI to adapt to main the font size. Maybe not an ideal solution. - static int getScale (); + static constexpr double pangoDPI = 72.; // Pango default DPI for "pt" size + static constexpr double baseDPI = 96.; // Cairo default DPI + static void init(const Gtk::Window* window); + static void setDPInScale(const Gtk::Window* window); + static void setDPInScale(const double newDPI, const int newScale); + static double getDPI(); + static int getScale(); + static double getGlobalScale(); + static int scalePixelSize(const int pixel_size); + static double scalePixelSize(const double pixel_size); }; diff --git a/rtgui/rtsurface.cc b/rtgui/rtsurface.cc index 62dfe36d5..46bddcaa1 100644 --- a/rtgui/rtsurface.cc +++ b/rtgui/rtsurface.cc @@ -2,6 +2,7 @@ * This file is part of RawTherapee. * * Copyright (c) 2018 Jean-Christophe FRISCH + * Copyright (c) 2022 Pierre CABRERA * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,37 +24,69 @@ #include "options.h" -namespace -{ - -using SurfaceCache = std::map>; - -SurfaceCache surfaceCache; - -} - RTSurface::RTSurface() : surface(new Cairo::ImageSurface(nullptr, false)) { + // Initialize "back" parameters from RTScalable + dpiBack = RTScalable::getDPI(); + scaleBack = RTScalable::getScale(); + + // Initialize other private parameters + type = RTSurface::InvalidType; + name = ""; + icon_size = Gtk::ICON_SIZE_INVALID; } -RTSurface::RTSurface(const Glib::ustring& fileName, const Glib::ustring& rtlFileName) : +RTSurface::RTSurface(const Glib::ustring &icon_name, const Gtk::IconSize iconSize) : RTSurface() { - setImage(fileName, rtlFileName); + // Create surface + surface = RTScalable::loadSurfaceFromIcon(icon_name, iconSize); + + if (surface) { + // Save private parameters + type = RTSurface::IconType; + name = icon_name; + icon_size = iconSize; + } } -void RTSurface::setImage(const Glib::ustring& fileName, const Glib::ustring& rtlFileName) +RTSurface::RTSurface(const Glib::ustring &fname) : + RTSurface() { - const Glib::ustring& imageName = - !rtlFileName.empty() && getDirection() == Gtk::TEXT_DIR_RTL - ? rtlFileName - : fileName; + // Create surface based on file extension + const auto pos = fname.find_last_of('.'); - changeImage (imageName); + if (pos >= 0 && pos < fname.length()) { + const auto fext = fname.substr(pos + 1, fname.length()).lowercase(); + + // Case where fname is a PNG file + if (fext == "png") { + // Create surface from PNG file + surface = RTScalable::loadSurfaceFromPNG(fname); + + if (surface) { + // Save private parameter + type = RTSurface::PNGType; + name = fname; + } + } + + // Case where fname is a SVG file + if (fext == "svg") { + // Create surface from SVG file + surface = RTScalable::loadSurfaceFromSVG(fname); + + if (surface) { + // Save private parameter + type = RTSurface::SVGType; + name = fname; + } + } + } } -int RTSurface::getWidth() const +int RTSurface::getWidth() { return surface @@ -61,7 +94,7 @@ int RTSurface::getWidth() const : -1; } -int RTSurface::getHeight() const +int RTSurface::getHeight() { return surface @@ -69,77 +102,156 @@ int RTSurface::getHeight() const : -1; } -bool RTSurface::hasSurface() const +bool RTSurface::hasSurface() { return static_cast(surface); } -Cairo::RefPtr RTSurface::get() const +Cairo::RefPtr RTSurface::get() { - return surface; -} + if (dpiBack != RTScalable::getDPI() || + scaleBack != RTScalable::getScale()) { + switch (type) { + case RTSurface::IconType : + surface = RTScalable::loadSurfaceFromIcon(name, icon_size); + break; + case RTSurface::PNGType : + surface = RTScalable::loadSurfaceFromPNG(name); + break; + case RTSurface::SVGType : + surface = RTScalable::loadSurfaceFromSVG(name); + break; + default : + break; + } -const Cairo::RefPtr& RTSurface::get() -{ - return surface; -} - -void RTSurface::init() -{ - dpiBack = getDPI(); - scaleBack = getScale(); -} - -void RTSurface::updateImages() -{ - const double tweakedDpi = getTweakedDPI(); - - for (auto& entry : surfaceCache) { - entry.second = loadImage(entry.first, tweakedDpi); - } -} - -void RTSurface::setDPInScale(const double newDPI, const int newScale) -{ - if ( - getScale() != newScale - || ( - getScale() == 1 - && getDPI() != newDPI - ) - ) { - setDPInScale(newDPI, newScale); - dpiBack = getDPI(); - scaleBack = getScale(); - - updateImages(); - } -} - -void RTSurface::changeImage(const Glib::ustring& imageName) -{ - const SurfaceCache::const_iterator iterator = surfaceCache.find(imageName); - - if (iterator != surfaceCache.end()) { - surface = iterator->second; - } else { - surface = loadImage(imageName, getTweakedDPI()); - - // HOMBRE: As of now, GDK_SCALE is forced to 1, so setting the Cairo::ImageSurface scale is not required - // Anyway, this might be of use one day - /* - double x=0., y=0.; - cairo_surface_get_device_scale(surface->cobj(), &x, &y); - if (getScale() == 2) { - cairo_surface_set_device_scale(surface->cobj(), 0.5, 0.5); // Not sure if it should be 0.5 or 2.0 here ! - surface->flush(); + // Save new DPI and scale + dpiBack = RTScalable::getDPI(); + scaleBack = RTScalable::getScale(); } - */ - surfaceCache.emplace(imageName, surface); + return surface; +} + +RTPixbuf::RTPixbuf() +{ + // Initialize "back" parameters from RTScalable + dpiBack = RTPixbuf::getDPI(); + scaleBack = RTPixbuf::getScale(); + + // Initialize other private parameters + type = RTPixbuf::InvalidType; + name = ""; + icon_size = Gtk::ICON_SIZE_INVALID; +} + +RTPixbuf::RTPixbuf(const Glib::ustring &icon_name, const Gtk::IconSize iconSize) : + RTPixbuf() +{ + // Create surface + const Cairo::RefPtr surface = RTScalable::loadSurfaceFromIcon(icon_name, iconSize); + + if (surface) { + // Create pixbuf from surface + pixbuf = Gdk::Pixbuf::create(surface, 0, 0, surface->get_width(), surface->get_height()); + + // Save private parameters + type = RTPixbuf::IconType; + name = icon_name; + icon_size = iconSize; } } -double RTSurface::dpiBack = 0.; +RTPixbuf::RTPixbuf(const Glib::ustring &fname) : + RTPixbuf() +{ + // Create surface based on file extension + const auto pos = fname.find_last_of('.'); -int RTSurface::scaleBack = 0; + if (pos >= 0 && pos < fname.length()) { + const auto fext = fname.substr(pos + 1, fname.length()).lowercase(); + + // Case where fname is a PNG file + if (fext == "png") { + // Create surface from PNG file + const Cairo::RefPtr surface = RTScalable::loadSurfaceFromPNG(fname); + + if (surface) { + // Create pixbuf from surface + pixbuf = Gdk::Pixbuf::create(surface, 0, 0, surface->get_width(), surface->get_height()); + + // Save private parameter + type = RTPixbuf::PNGType; + name = fname; + } + } + + // Case where fname is a SVG file + if (fext == "svg") { + // Create surface from SVG file + const Cairo::RefPtr surface = RTScalable::loadSurfaceFromSVG(fname); + + if (surface) { + // Create pixbuf from surface + pixbuf = Gdk::Pixbuf::create(surface, 0, 0, surface->get_width(), surface->get_height()); + + // Save private parameter + type = RTPixbuf::SVGType; + name = fname; + } + } + } +} + +int RTPixbuf::getWidth() +{ + return + pixbuf + ? pixbuf->get_width() + : -1; +} + +int RTPixbuf::getHeight() +{ + return + pixbuf + ? pixbuf->get_height() + : -1; +} + +bool RTPixbuf::hasPixbuf() +{ + return static_cast(pixbuf); +} + +Glib::RefPtr RTPixbuf::get() +{ + if (dpiBack != RTScalable::getDPI() || + scaleBack != RTScalable::getScale()) { + Cairo::RefPtr surface; + + // Surface needs to be regenerated + switch (type) { + case RTPixbuf::IconType : + surface = RTScalable::loadSurfaceFromIcon(name, icon_size); + pixbuf = Gdk::Pixbuf::create(surface, 0, 0, surface->get_width(), surface->get_height()); + break; + case RTPixbuf::PNGType : + surface = RTScalable::loadSurfaceFromPNG(name); + pixbuf = Gdk::Pixbuf::create(surface, 0, 0, surface->get_width(), surface->get_height()); + break; + case RTPixbuf::SVGType : + surface = RTScalable::loadSurfaceFromSVG(name); + pixbuf = Gdk::Pixbuf::create(surface, 0, 0, surface->get_width(), surface->get_height()); + break; + default : + break; + } + + // Save new DPI and scale + dpiBack = RTScalable::getDPI(); + scaleBack = RTScalable::getScale(); + } + + return pixbuf; +} diff --git a/rtgui/rtsurface.h b/rtgui/rtsurface.h index 1944cc2dc..46a8bcdb5 100644 --- a/rtgui/rtsurface.h +++ b/rtgui/rtsurface.h @@ -2,6 +2,7 @@ * This file is part of RawTherapee. * * Copyright (c) 2018 Jean-Christophe FRISCH + * Copyright (c) 2022 Pierre CABRERA * * RawTherapee is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,37 +19,70 @@ */ #pragma once -#include - #include "rtscalable.h" /** - * @brief A derived class of Gtk::Image in order to handle theme-related icon sets. + * @brief A custom class in order to handle Hi-DPI surface. */ -class RTSurface : - public RTScalable +class RTSurface final : public RTScalable { public: - RTSurface(); - explicit RTSurface(const Glib::ustring& fileName, const Glib::ustring& rtlFileName = {}); - - void setImage(const Glib::ustring& fileName, const Glib::ustring& rtlFileName = {}); - - int getWidth() const; - int getHeight() const; - bool hasSurface() const; - - Cairo::RefPtr get() const; - const Cairo::RefPtr& get(); - - static void init(); - static void updateImages(); - static void setDPInScale(double newDPI, int newScale); + enum RTSurfaceType { + InvalidType = 1, + IconType = 2, + PNGType = 3, + SVGType = 4 + }; private: - void changeImage(const Glib::ustring& imageName); - - static double dpiBack; // used to keep track of master dpi change - static int scaleBack; // used to keep track of master scale change + double dpiBack; // Used to identify dpi change + int scaleBack; // Used to identify scale change + RTSurfaceType type; + Glib::ustring name; + Gtk::IconSize icon_size; Cairo::RefPtr surface; + +public: + RTSurface(); + explicit RTSurface(const Glib::ustring &icon_name, const Gtk::IconSize iconSize); + explicit RTSurface(const Glib::ustring &fname); + + int getWidth(); + int getHeight(); + bool hasSurface(); + + Cairo::RefPtr get(); +}; + +/** + * @brief A custom class in order to handle Hi-DPI pixbuf. + */ +class RTPixbuf final : public RTScalable +{ +public: + enum RTPixbufType { + InvalidType = 1, + IconType = 2, + PNGType = 3, + SVGType = 4 + }; + +private: + double dpiBack; // Used to identify dpi change + int scaleBack; // Used to identify scale change + RTPixbufType type; + Glib::ustring name; + Gtk::IconSize icon_size; + Glib::RefPtr pixbuf; + +public: + RTPixbuf(); + explicit RTPixbuf(const Glib::ustring &icon_name, const Gtk::IconSize iconSize); + explicit RTPixbuf(const Glib::ustring &fname); + + int getWidth(); + int getHeight(); + bool hasPixbuf(); + + Glib::RefPtr get(); }; diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 1b90d631b..9ea9dec5a 100755 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -34,12 +34,9 @@ #include "filepanel.h" #include "filmsimulation.h" -float fontScale = 1.f; Glib::RefPtr cssForced; Glib::RefPtr cssRT; -extern unsigned char initialGdkScale; - #if defined(__APPLE__) static gboolean osx_should_quit_cb (GtkosxApplication *app, gpointer data) @@ -104,10 +101,6 @@ RTWindow::RTWindow () , epanel (nullptr) , fpanel (nullptr) { - - if (options.is_new_version()) { - RTImage::cleanup(true); - } cacheMgr->init (); ProfilePanel::init (this); @@ -116,9 +109,15 @@ RTWindow::RTWindow () Glib::RefPtr screen = Gdk::Screen::get_default(); if (screen) { + // Setting default theme and icon theme (bases for custom themes) Gtk::Settings::get_for_screen (screen)->property_gtk_theme_name() = "Adwaita"; Gtk::Settings::get_for_screen (screen)->property_gtk_application_prefer_dark_theme() = true; + Gtk::Settings::get_for_screen (screen)->property_gtk_icon_theme_name() = "RawTherapee"; + // Initialize RTScalable for Hi-DPI support + RTScalable::init(this); + + // Look for theme and set it Glib::RefPtr regex = Glib::Regex::create (THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS); Glib::ustring filename; Glib::MatchInfo mInfo; @@ -169,63 +168,84 @@ RTWindow::RTWindow () // Set the font face and size Glib::ustring css; - if (options.fontFamily != "default") { - //GTK318 - #if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20 - css = Glib::ustring::compose ("* { font-family: %1; font-size: %2px}", options.fontFamily, options.fontSize * (int)initialGdkScale); - #else - css = Glib::ustring::compose ("* { font-family: %1; font-size: %2pt}", options.fontFamily, options.fontSize * (int)initialGdkScale); - #endif - //GTK318 - if (options.pseudoHiDPISupport) { - fontScale = options.fontSize / (float)RTScalable::baseFontSize; - } + +#ifndef __APPLE__ + const double fontScale = static_cast(RTScalable::getDPI()) + / static_cast(RTScalable::pangoDPI) + * RTScalable::getScale(); // Refer to notes in rtscalable.h +#else + // On MacOS, font is already scaled by the System library + // Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c + const double fontScale = 1.; +#endif + auto style = get_pango_context(); + + if (options.fontFamily != "default") { // Set font and size according to user choice + // Scale font size based on DPI and Scale + const int scaledFontSize = static_cast(options.fontSize * fontScale + 0.5); + + // Set font and size in css + css = Glib::ustring::compose ("* { font-family: %1; font-size: %2px}", options.fontFamily, scaledFontSize); + if (rtengine::settings->verbose) { - printf("\"Non-Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", options.fontSize, (int)initialGdkScale, static_cast(fontScale)); + printf("\"Non-Default\" font size in pt(%d) * scale(%.3f) = font size in px(%d)\n", options.fontSize, fontScale, scaledFontSize); } - } else { + } else { // Set font and size according to default values + // Retrieve default style values Glib::RefPtr style = Gtk::StyleContext::create(); Pango::FontDescription pfd = style->get_font(Gtk::STATE_FLAG_NORMAL); + if (pfd.get_set_fields() & Pango::FONT_MASK_SIZE) { - int pt; - int fontSize = pfd.get_size(); - bool isPix = pfd.get_size_is_absolute(); - int resolution = (int)style->get_screen()->get_resolution(); - if (isPix) { - // HOMBRE: guessing here... - // if resolution is lower than baseHiDPI, we're supposing that it's already expressed in a scale==1 scenario - if (resolution >= int(RTScalable::baseHiDPI)) { - // converting the resolution to a scale==1 scenario - resolution /= 2; - } - // 1pt = 1/72in @ 96 ppi - // HOMBRE: If the font unit is px, is it already scaled up to match the resolution ? - // px >inch >pt >"scaled pt" - pt = (int)(double(fontSize) / RTScalable::baseDPI * 72. * (96. / (double)resolution) + 0.49); - } else { - pt = fontSize / Pango::SCALE; - } - if (options.pseudoHiDPISupport) { - fontScale = (float)pt / (float)RTScalable::baseFontSize; - } - if ((int)initialGdkScale > 1 || pt != RTScalable::baseFontSize) { - css = Glib::ustring::compose ("* { font-size: %1pt}", pt * (int)initialGdkScale); + const int fontSize = pfd.get_size(); + const bool isAbsoluteFontSize = pfd.get_size_is_absolute(); + int newFontSize; + + if (isAbsoluteFontSize) { + // Absolute size is defined in "Pango units" and shall be divided by + // Pango::SCALE to get "px" + newFontSize = fontSize / Pango::SCALE; + + // Guessing that pixel size is given for a 96 DPI reference: +#ifndef __APPLE__ + const double newFontScale = static_cast(RTScalable::getDPI()) + / static_cast(RTScalable::pangoDPI) + * RTScalable::getScale(); // Refer to notes in rtscalable.h +#else + // On MacOS, font is already scaled by the System library + // Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c + const double newFontScale = 1.; +#endif + newFontSize = static_cast(newFontSize * newFontScale + 0.5); + if (rtengine::settings->verbose) { - printf("\"Default\" font size(%d) * scale(%d) / fontScale(%.3f)\n", pt, (int)initialGdkScale, static_cast(fontScale)); + printf("\"Default\" absolute font size(%d)\n", newFontSize); + } + } else { + // Non-absolute size is defined in "pt" and shall be converted to "px" + newFontSize = static_cast(fontSize * fontScale + 0.5); + + if (rtengine::settings->verbose) { + printf("\"Default\" non-absolute font size in pt(%d) * scale(%.3f) = font size in px(%d)\n", fontSize, fontScale, newFontSize); } } + + // Set font and size in css + css = Glib::ustring::compose ("* { font-size: %1px}", newFontSize); + printf("newFontSize: %d\n", newFontSize); } } + + // Load custom CSS for font if (!css.empty()) { if (rtengine::settings->verbose) { printf("CSS:\n%s\n\n", css.c_str()); } + try { cssForced = Gtk::CssProvider::create(); cssForced->load_from_data (css); Gtk::StyleContext::add_provider_for_screen (screen, cssForced, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } catch (Glib::Error &err) { printf ("Error: \"%s\"\n", err.what().c_str()); } catch (...) { @@ -236,22 +256,10 @@ RTWindow::RTWindow () // ------- end loading theme files - RTScalable::init(this); - RTSurface::init(); - RTImage::init(); - WhiteBalance::init(); - MyExpander::init(); - + // For UNIX system, set app icon #ifndef WIN32 - const std::vector> appIcons = { - RTImage::createPixbufFromFile("rawtherapee-logo-16.png"), - RTImage::createPixbufFromFile("rawtherapee-logo-24.png"), - RTImage::createPixbufFromFile("rawtherapee-logo-48.png"), - RTImage::createPixbufFromFile("rawtherapee-logo-128.png"), - RTImage::createPixbufFromFile("rawtherapee-logo-256.png") - }; try { - set_default_icon_list(appIcons); + set_default_icon_name("rawtherapee"); } catch (Glib::Exception& ex) { printf ("%s\n", ex.what().c_str()); } @@ -324,11 +332,11 @@ RTWindow::RTWindow () if (options.mainNBVertical) { mainNB->set_tab_pos (Gtk::POS_LEFT); fpl->set_angle (90); - RTImage* folderIcon = Gtk::manage (new RTImage ("folder-closed.png")); + RTImage* folderIcon = Gtk::manage (new RTImage ("folder-closed", Gtk::ICON_SIZE_LARGE_TOOLBAR)); fpanelLabelGrid->attach_next_to (*folderIcon, Gtk::POS_TOP, 1, 1); fpanelLabelGrid->attach_next_to (*fpl, Gtk::POS_TOP, 1, 1); } else { - RTImage* folderIcon = Gtk::manage (new RTImage ("folder-closed.png")); + RTImage* folderIcon = Gtk::manage (new RTImage ("folder-closed", Gtk::ICON_SIZE_LARGE_TOOLBAR)); fpanelLabelGrid->attach_next_to (*folderIcon, Gtk::POS_RIGHT, 1, 1); fpanelLabelGrid->attach_next_to (*fpl, Gtk::POS_RIGHT, 1, 1); } @@ -361,27 +369,27 @@ RTWindow::RTWindow () //mainBox->pack_start (*mainNB); // filling bottom box - iFullscreen = new RTImage ("fullscreen-enter.png"); - iFullscreen_exit = new RTImage ("fullscreen-leave.png"); + iFullscreen = new RTImage ("fullscreen-enter", Gtk::ICON_SIZE_LARGE_TOOLBAR); + iFullscreen_exit = new RTImage ("fullscreen-leave", Gtk::ICON_SIZE_LARGE_TOOLBAR); Gtk::Button* iccProfileCreator = Gtk::manage (new Gtk::Button ()); setExpandAlignProperties (iccProfileCreator, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); iccProfileCreator->set_relief(Gtk::RELIEF_NONE); - iccProfileCreator->set_image (*Gtk::manage (new RTImage ("gamut-plus.png"))); + iccProfileCreator->set_image (*Gtk::manage (new RTImage ("gamut-plus", Gtk::ICON_SIZE_LARGE_TOOLBAR))); iccProfileCreator->set_tooltip_markup (M ("MAIN_BUTTON_ICCPROFCREATOR")); iccProfileCreator->signal_clicked().connect ( sigc::mem_fun (*this, &RTWindow::showICCProfileCreator) ); Gtk::Button* helpBtn = Gtk::manage (new Gtk::Button ()); setExpandAlignProperties (helpBtn, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); helpBtn->set_relief(Gtk::RELIEF_NONE); - helpBtn->set_image (*Gtk::manage (new RTImage ("questionmark.png"))); + helpBtn->set_image (*Gtk::manage (new RTImage("questionmark", Gtk::ICON_SIZE_LARGE_TOOLBAR))); helpBtn->set_tooltip_markup (M ("GENERAL_HELP")); helpBtn->signal_clicked().connect (sigc::mem_fun (*this, &RTWindow::showRawPedia)); Gtk::Button* preferences = Gtk::manage (new Gtk::Button ()); setExpandAlignProperties (preferences, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); preferences->set_relief(Gtk::RELIEF_NONE); - preferences->set_image (*Gtk::manage (new RTImage ("preferences.png"))); + preferences->set_image (*Gtk::manage (new RTImage ("preferences", Gtk::ICON_SIZE_LARGE_TOOLBAR))); preferences->set_tooltip_markup (M ("MAIN_BUTTON_PREFERENCES")); preferences->signal_clicked().connect ( sigc::mem_fun (*this, &RTWindow::showPreferences) ); @@ -454,7 +462,6 @@ RTWindow::~RTWindow() delete fpanel; delete iFullscreen; delete iFullscreen_exit; - RTImage::cleanup(); } void RTWindow::on_realize () @@ -529,8 +536,8 @@ bool RTWindow::on_configure_event (GdkEventConfigure* event) get_position (options.windowX, options.windowY); } - RTImage::setDPInScale(RTScalable::getDPI(), RTScalable::getScale()); // will update the RTImage on scale/resolution change - RTSurface::setDPInScale(RTScalable::getDPI(), RTScalable::getScale()); // will update the RTSurface on scale/resolution change + // With update the RTScalable on scale or resolution change + RTScalable::setDPInScale(this); return Gtk::Widget::on_configure_event (event); } @@ -541,7 +548,7 @@ bool RTWindow::on_window_state_event (GdkEventWindowState* event) options.windowMaximized = event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED; is_minimized = event->new_window_state & GDK_WINDOW_STATE_ICONIFIED; is_fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; - + return Gtk::Widget::on_window_state_event (event); } @@ -592,7 +599,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) // construct closeable tab for the image Gtk::Grid* titleGrid = Gtk::manage (new Gtk::Grid ()); titleGrid->set_tooltip_markup (name); - RTImage *closebimg = Gtk::manage (new RTImage ("cancel-small.png")); + RTImage *closebimg = Gtk::manage (new RTImage ("cancel-small", Gtk::ICON_SIZE_LARGE_TOOLBAR)); Gtk::Button* closeb = Gtk::manage (new Gtk::Button ()); closeb->set_name ("CloseButton"); closeb->add (*closebimg); @@ -601,7 +608,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) closeb->signal_clicked().connect ( sigc::bind (sigc::mem_fun (*this, &RTWindow::remEditorPanel), ep)); if (!EditWindow::isMultiDisplayEnabled()) { - titleGrid->attach_next_to (*Gtk::manage (new RTImage ("aperture.png")), Gtk::POS_RIGHT, 1, 1); + titleGrid->attach_next_to (*Gtk::manage (new RTImage ("aperture", Gtk::ICON_SIZE_LARGE_TOOLBAR)), Gtk::POS_RIGHT, 1, 1); } titleGrid->attach_next_to (*Gtk::manage (new Gtk::Label (Glib::path_get_basename (name))), Gtk::POS_RIGHT, 1, 1); titleGrid->attach_next_to (*closeb, Gtk::POS_RIGHT, 1, 1); @@ -855,12 +862,8 @@ bool RTWindow::on_delete_event (GdkEventAny* event) } cacheMgr->closeCache (); // also makes cleanup if too large - WhiteBalance::cleanup(); ProfilePanel::cleanup(); ClutComboBox::cleanup(); - MyExpander::cleanup(); - mainWindowCursorManager.cleanup(); - editWindowCursorManager.cleanup(); BatchQueueEntry::savedAsIcon.reset(); FileBrowserEntry::editedIcon.reset(); FileBrowserEntry::recentlySavedIcon.reset(); @@ -997,7 +1000,7 @@ void RTWindow::error(const Glib::ustring& descr) void RTWindow::toggle_fullscreen () { onConfEventConn.block(true); // Avoid getting size and position while window is getting fullscreen - + if (is_fullscreen) { unfullscreen(); @@ -1013,7 +1016,7 @@ void RTWindow::toggle_fullscreen () btn_fullscreen->set_image (*iFullscreen_exit); } } - + onConfEventConn.block(false); } @@ -1121,7 +1124,7 @@ bool RTWindow::splashClosed (GdkEventAny* event) void RTWindow::setWindowSize () { onConfEventConn.block(true); // Avoid getting size and position while window is being moved, maximized, ... - + Gdk::Rectangle lMonitorRect; const auto display = get_screen()->get_display(); display->get_monitor (std::min (options.windowMonitor, display->get_n_monitors() - 1))->get_geometry(lMonitorRect); @@ -1160,7 +1163,7 @@ void RTWindow::setWindowSize () unmaximize(); resize (options.windowWidth, options.windowHeight); } - + onConfEventConn.block(false); } @@ -1168,7 +1171,7 @@ void RTWindow::get_position(int& x, int& y) const { // Call native function Gtk::Window::get_position (x, y); - + // Retrieve display (concatenation of all monitors) size int width = 0, height = 0; const auto display = get_screen()->get_display(); @@ -1253,7 +1256,7 @@ void RTWindow::createSetmEditor() el->set_angle (90); } - editorLabelGrid->attach_next_to (*Gtk::manage (new RTImage ("aperture.png")), pos, 1, 1); + editorLabelGrid->attach_next_to (*Gtk::manage (new RTImage ("aperture", Gtk::ICON_SIZE_LARGE_TOOLBAR)), pos, 1, 1); editorLabelGrid->attach_next_to (*el, pos, 1, 1); editorLabelGrid->set_tooltip_markup (M ("MAIN_FRAME_EDITOR_TOOLTIP")); diff --git a/rtgui/shcselector.cc b/rtgui/shcselector.cc index ad2c28aaa..ac1149893 100644 --- a/rtgui/shcselector.cc +++ b/rtgui/shcselector.cc @@ -26,14 +26,11 @@ SHCSelector::SHCSelector() : movingPosition(-1), tmpX(0.0), tmpPos(0.0), wslider(0.0), cl(nullptr), coloredBar(RTO_Left2Right) { - - int s = RTScalable::getScale(); - positions[0] = defaults[0] = 0.25; positions[1] = defaults[1] = 0.5; positions[2] = defaults[2] = 0.75; - leftMargin = (RADIUS - 1.5) * s; - rightMargin = (RADIUS - 1.5) * s; + leftMargin = static_cast(RTScalable::scalePixelSize(RADIUS - 1.5)); + rightMargin = static_cast(RTScalable::scalePixelSize(RADIUS - 1.5)); Glib::RefPtr style = get_style_context(); style->add_class("drawingarea"); @@ -62,14 +59,13 @@ void SHCSelector::get_preferred_height_vfunc (int &minimum_height, int &natural_ void SHCSelector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - int s = RTScalable::getScale(); - minimum_width = 100 * s; - natural_width = 150 * s; + minimum_width = RTScalable::scalePixelSize(100); + natural_width = RTScalable::scalePixelSize(150); } void SHCSelector::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const { - natural_height = minimum_height = 14 * RTScalable::getScale(); + natural_height = minimum_height = RTScalable::scalePixelSize(14); } void SHCSelector::get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const @@ -141,7 +137,7 @@ void SHCSelector::updateBackBuffer() int w = get_width () - leftMargin - rightMargin; int h = get_height (); - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); wslider = (double)std::max(h / 5, 10) * s; double hwslider = wslider / 2.; @@ -244,7 +240,7 @@ bool SHCSelector::on_button_press_event (GdkEventButton* event) double w = double(get_width () - leftMargin - rightMargin); movingPosition = -1; - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); for (int i = 0; i < 3; i++) { double currPos = double(leftMargin) + 1. * s + (w - 2. * s) * positions[i]; @@ -290,7 +286,7 @@ bool SHCSelector::on_motion_notify_event (GdkEventMotion* event) { if (movingPosition >= 0) { - double s = RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double innerw = double(get_width () - leftMargin - rightMargin) - 2. * s; positions[movingPosition] = tmpPos + (event->x - tmpX) / innerw; diff --git a/rtgui/splash.cc b/rtgui/splash.cc index 7ae5bf4d7..b7d118d58 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -21,48 +21,62 @@ #include #include "multilangmgr.h" -#include "rtimage.h" extern Glib::ustring creditsPath; extern Glib::ustring licensePath; extern Glib::ustring versionString; -SplashImage::SplashImage () : surface(RTImage::createImgSurfFromFile("splash.png")) +SplashImage::SplashImage () : surface(new RTSurface("splash.svg")) { } bool SplashImage::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { + if (surface->hasSurface()) { + cr->set_source(surface->get(), 0., 0.); + cr->rectangle(0, 0, surface->get()->get_width(), surface->get()->get_height()); + cr->fill(); - cr->set_source(surface, 0., 0.); - cr->rectangle(0, 0, surface->get_width(), surface->get_height()); - cr->fill(); + Cairo::FontOptions cfo; + cfo.set_antialias (Cairo::ANTIALIAS_SUBPIXEL); + Glib::RefPtr context = get_pango_context (); + context->set_cairo_font_options (cfo); + Pango::FontDescription fontd = context->get_font_description (); + fontd.set_weight (Pango::WEIGHT_LIGHT); + // Absolute size is defined in "Pango units" and shall be multiplied by + // Pango::SCALE from "px" + const int fontSize = 12; + const int absoluteFontSize = fontSize * Pango::SCALE; + // Guessing that absolute pixel size is given for a 96 DPI reference: +#ifndef __APPLE__ + const double fontScale = static_cast(RTScalable::getDPI()) + / static_cast(RTScalable::pangoDPI) + * RTScalable::getScale(); // Refer to notes in rtscalable.h +#else + // On MacOS, font is already scaled by the System library + // Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c + const double fontScale = 1.; +#endif + fontd.set_absolute_size (static_cast(absoluteFontSize) * fontScale); + context->set_font_description (fontd); - Cairo::FontOptions cfo; - cfo.set_antialias (Cairo::ANTIALIAS_SUBPIXEL); - Glib::RefPtr context = get_pango_context (); - context->set_cairo_font_options (cfo); - Pango::FontDescription fontd = context->get_font_description (); - fontd.set_weight (Pango::WEIGHT_LIGHT); - fontd.set_absolute_size (12 * Pango::SCALE); - context->set_font_description (fontd); + int w, h; + Glib::ustring versionStr(versionString); - int w, h; - Glib::ustring versionStr(versionString); - - version = create_pango_layout (versionStr); - version->set_text(versionStr); - version->get_pixel_size (w, h); - cr->set_source_rgb (0., 0., 0.); - cr->set_line_width(3.); - cr->set_line_join(Cairo::LINE_JOIN_ROUND); - cr->move_to (surface->get_width() - w - 32, surface->get_height() - h - 20); - version->add_to_cairo_context (cr); - cr->stroke_preserve(); - cr->set_source_rgb (1., 1., 1.); - cr->set_line_width(0.5); - cr->stroke_preserve(); - cr->fill(); + version = create_pango_layout (versionStr); + version->set_text(versionStr); + version->get_pixel_size (w, h); + cr->set_source_rgb (0., 0., 0.); + cr->set_line_width(3.); + cr->set_line_join(Cairo::LINE_JOIN_ROUND); + cr->move_to (surface->get()->get_width() - w - 32, surface->get()->get_height() - h - 20); + version->add_to_cairo_context (cr); + cr->stroke_preserve(); + cr->set_source_rgb (1., 1., 1.); + cr->set_line_width(0.5); + cr->stroke_preserve(); + cr->fill(); + } return true; } @@ -74,12 +88,12 @@ Gtk::SizeRequestMode SplashImage::get_request_mode_vfunc () const void SplashImage::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - minimum_height = natural_height = surface ? surface->get_height() : 100 * RTScalable::getScale(); + minimum_height = natural_height = surface ? surface->get()->get_height() : RTScalable::scalePixelSize(100); } void SplashImage::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = natural_width = surface ? surface->get_width() : 100 * RTScalable::getScale(); + minimum_width = natural_width = surface ? surface->get()->get_width() : RTScalable::scalePixelSize(100); } void SplashImage::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const @@ -111,6 +125,8 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t // Tab 1: the image splashImage = Gtk::manage(new SplashImage ()); + splashImage->set_halign(Gtk::ALIGN_CENTER); + splashImage->set_valign(Gtk::ALIGN_CENTER); nb->append_page (*splashImage, M("ABOUT_TAB_SPLASH")); splashImage->show (); @@ -242,7 +258,6 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t } } - set_position (Gtk::WIN_POS_CENTER); //add_events(Gdk::BUTTON_RELEASE_MASK); set_resizable (true); diff --git a/rtgui/splash.h b/rtgui/splash.h index bc63cef91..6abfe91c7 100644 --- a/rtgui/splash.h +++ b/rtgui/splash.h @@ -19,13 +19,14 @@ #pragma once #include +#include "rtsurface.h" class SplashImage final : public Gtk::DrawingArea { private: - Cairo::RefPtr surface; + std::shared_ptr surface; Glib::RefPtr version; public: diff --git a/rtgui/spot.cc b/rtgui/spot.cc index 2f9910b70..34e2f0c18 100644 --- a/rtgui/spot.cc +++ b/rtgui/spot.cc @@ -58,18 +58,18 @@ Spot::Spot() : draggedSide(DraggedSide::NONE), lastObject(-1), activeSpot(-1), - sourceIcon("spot-normal.png", "spot-active.png", "spot-prelight.png", "", "", Geometry::DP_CENTERCENTER), + sourceIcon("spot-normal", "spot-active", "spot-prelight", "", "", Geometry::DP_CENTERCENTER), editedCheckBox(nullptr) { countLabel = Gtk::manage (new Gtk::Label (Glib::ustring::compose (M ("TP_SPOT_COUNTLABEL"), 0))); edit = Gtk::manage (new Gtk::ToggleButton()); - edit->add (*Gtk::manage (new RTImage ("edit-point.png"))); + edit->add (*Gtk::manage (new RTImage ("edit-point"))); editConn = edit->signal_toggled().connect ( sigc::mem_fun (*this, &Spot::editToggled) ); edit->set_tooltip_text(M("TP_SPOT_HINT")); reset = Gtk::manage (new Gtk::Button ()); - reset->add (*Gtk::manage (new RTImage ("undo-small.png"))); + reset->add (*Gtk::manage (new RTImage ("undo-small"))); reset->set_relief (Gtk::RELIEF_NONE); reset->set_border_width (0); reset->signal_clicked().connect ( sigc::mem_fun (*this, &Spot::resetPressed) ); @@ -83,7 +83,7 @@ Spot::Spot() : labelBox->pack_end (*reset, false, false, 0); labelBox->pack_end (*spotSize, false, false, 0); pack_start (*labelBox); - + sourceIcon.datum = Geometry::IMAGE; sourceIcon.setActive (false); sourceIcon.state = Geometry::ACTIVE; @@ -344,12 +344,12 @@ void Spot::createGeometry () EditSubscriber::mouseOverGeometry.at (i++) = &sourceFeatherCircle; // MO_OBJECT_COUNT + 5 // recreate all spots geometry - Cairo::RefPtr normalImg = sourceIcon.getNormalImg(); - Cairo::RefPtr prelightImg = sourceIcon.getPrelightImg(); - Cairo::RefPtr activeImg = sourceIcon.getActiveImg(); + std::shared_ptr normalImg = sourceIcon.getNormalImg(); + std::shared_ptr prelightImg = sourceIcon.getPrelightImg(); + std::shared_ptr activeImg = sourceIcon.getActiveImg(); for (; j < EditSubscriber::visibleGeometry.size() - VISIBLE_OBJECT_COUNT; ++i, ++j) { - EditSubscriber::mouseOverGeometry.at (i) = EditSubscriber::visibleGeometry.at (j) = new OPIcon (normalImg, activeImg, prelightImg, Cairo::RefPtr (nullptr), Cairo::RefPtr (nullptr), Geometry::DP_CENTERCENTER); + EditSubscriber::mouseOverGeometry.at (i) = EditSubscriber::visibleGeometry.at (j) = new OPIcon (normalImg, activeImg, prelightImg, nullptr, nullptr, Geometry::DP_CENTERCENTER); EditSubscriber::visibleGeometry.at (j)->setActive (true); EditSubscriber::visibleGeometry.at (j)->datum = Geometry::IMAGE; EditSubscriber::visibleGeometry.at (j)->state = Geometry::NORMAL; diff --git a/rtgui/thresholdadjuster.cc b/rtgui/thresholdadjuster.cc index 1f8b1c967..7f8aec508 100644 --- a/rtgui/thresholdadjuster.cc +++ b/rtgui/thresholdadjuster.cc @@ -99,7 +99,7 @@ void ThresholdAdjuster::initObject (Glib::ustring label, bool editedcb) hbox->pack_start (*this->label); reset = Gtk::manage (new Gtk::Button ()); - reset->add (*Gtk::manage (new RTImage ("undo-small.png", "redo-small.png"))); + reset->add (*Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON))); reset->set_relief (Gtk::RELIEF_NONE); reset->set_tooltip_markup (M("ADJUSTER_RESET_TO_DEFAULT")); diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index 61043525c..62694d086 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -167,7 +167,7 @@ void ThresholdSelector::get_preferred_height_vfunc (int &minimum_height, int &na void ThresholdSelector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - int s = RTScalable::getScale(); + const int s = RTScalable::scalePixelSize(1); Glib::RefPtr style = get_style_context(); Gtk::Border padding = getPadding(style); // already scaled int margins = padding.get_left() + padding.get_right(); @@ -177,7 +177,7 @@ void ThresholdSelector::get_preferred_width_vfunc (int &minimum_width, int &natu void ThresholdSelector::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const { - int s = RTScalable::getScale(); + const int s = RTScalable::scalePixelSize(1); Glib::RefPtr style = get_style_context(); Gtk::Border padding = getPadding(style); // already scaled int margins = padding.get_left() + padding.get_right(); @@ -275,7 +275,7 @@ void ThresholdSelector::updateBackBuffer() cr->paint (); cr->set_operator (Cairo::OPERATOR_OVER); - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double positions01[4]; int w = get_allocated_width (); @@ -499,7 +499,7 @@ bool ThresholdSelector::on_motion_notify_event (GdkEventMotion* event) Glib::RefPtr style = get_style_context(); Gtk::Border padding = getPadding(style); // already scaled - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double wslider = sliderWidth * s; // constant must be an odd value double hwslider = wslider / 2.; @@ -586,7 +586,7 @@ void ThresholdSelector::findLitCursor(int posX, int posY) Glib::RefPtr style = get_style_context(); Gtk::Border padding = getPadding(style); // already scaled - double s = (double)RTScalable::getScale(); + const double s = RTScalable::scalePixelSize(1.); double wslider = sliderWidth * s; // constant must be an odd value double hwslider = wslider / 2.; diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 06c662e51..29222992e 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -34,7 +34,7 @@ ThumbBrowserBase::ThumbBrowserBase () { inW = -1; inH = -1; - + hscroll.set_orientation(Gtk::ORIENTATION_HORIZONTAL); vscroll.set_orientation(Gtk::ORIENTATION_VERTICAL); @@ -1026,14 +1026,14 @@ Gtk::SizeRequestMode ThumbBrowserBase::Internal::get_request_mode_vfunc () const void ThumbBrowserBase::Internal::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const { - minimum_height = 20 * RTScalable::getScale(); - natural_height = 80 * RTScalable::getScale(); + minimum_height = RTScalable::scalePixelSize(20); + natural_height = RTScalable::scalePixelSize(80); } void ThumbBrowserBase::Internal::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const { - minimum_width = 200 * RTScalable::getScale(); - natural_width = 1000 * RTScalable::getScale(); + minimum_width = RTScalable::scalePixelSize(200); + natural_width = RTScalable::scalePixelSize(1000); } void ThumbBrowserBase::Internal::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const diff --git a/rtgui/toolbar.cc b/rtgui/toolbar.cc index 5cdfc2787..56237197c 100644 --- a/rtgui/toolbar.cc +++ b/rtgui/toolbar.cc @@ -28,8 +28,8 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n editingMode = false; - handimg.reset(new RTImage("hand-open.png")); - editinghandimg.reset(new RTImage("crosshair-adjust.png")); + handimg.reset(new RTImage("hand-open", Gtk::ICON_SIZE_LARGE_TOOLBAR)); + editinghandimg.reset(new RTImage("crosshair-adjust", Gtk::ICON_SIZE_LARGE_TOOLBAR)); handTool = Gtk::manage (new Gtk::ToggleButton ()); handTool->add (*handimg); @@ -40,7 +40,7 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n pack_start (*handTool); wbTool = Gtk::manage (new Gtk::ToggleButton ()); - Gtk::Image* wbimg = Gtk::manage (new RTImage ("color-picker.png")); + Gtk::Image* wbimg = Gtk::manage (new RTImage ("color-picker", Gtk::ICON_SIZE_LARGE_TOOLBAR)); wbTool->add (*wbimg); wbimg->show (); wbTool->set_relief(Gtk::RELIEF_NONE); @@ -48,8 +48,8 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n pack_start (*wbTool); - showcolpickersimg.reset(new RTImage("color-picker-bars.png")); - hidecolpickersimg.reset(new RTImage("color-picker-hide.png")); + showcolpickersimg.reset(new RTImage("color-picker-bars", Gtk::ICON_SIZE_LARGE_TOOLBAR)); + hidecolpickersimg.reset(new RTImage("color-picker-hide", Gtk::ICON_SIZE_LARGE_TOOLBAR)); colPickerTool = Gtk::manage (new Gtk::ToggleButton ()); colPickerTool->add (*showcolpickersimg); @@ -60,7 +60,7 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n pack_start (*colPickerTool); cropTool = Gtk::manage (new Gtk::ToggleButton ()); - Gtk::Image* cropimg = Gtk::manage (new RTImage ("crop.png")); + Gtk::Image* cropimg = Gtk::manage (new RTImage ("crop", Gtk::ICON_SIZE_LARGE_TOOLBAR)); cropTool->add (*cropimg); cropimg->show (); cropTool->set_relief(Gtk::RELIEF_NONE); @@ -69,7 +69,7 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n pack_start (*cropTool); straTool = Gtk::manage (new Gtk::ToggleButton ()); - Gtk::Image* straimg = Gtk::manage (new RTImage ("rotate-straighten.png")); + Gtk::Image* straimg = Gtk::manage (new RTImage ("rotate-straighten", Gtk::ICON_SIZE_LARGE_TOOLBAR)); straTool->add (*straimg); straimg->show (); straTool->set_relief(Gtk::RELIEF_NONE); @@ -78,7 +78,7 @@ ToolBar::ToolBar () : showColPickers(true), listener (nullptr), pickerListener(n pack_start (*straTool); perspTool = Gtk::manage(new Gtk::ToggleButton()); - Gtk::Image* perspimg = Gtk::manage(new RTImage("perspective-vertical-bottom.png")); + Gtk::Image* perspimg = Gtk::manage(new RTImage("perspective-vertical-bottom", Gtk::ICON_SIZE_LARGE_TOOLBAR)); perspTool->set_image(*perspimg); perspTool->set_relief(Gtk::RELIEF_NONE); pack_start(*perspTool); diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index cfc53639b..2024e76cc 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -61,7 +61,7 @@ FoldableToolPanel::FoldableToolPanel(Gtk::Box* content, Glib::ustring toolName, label->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); titleHBox->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0); - RTImage *image = Gtk::manage (new RTImage("one-to-one-small.png")); + RTImage *image = Gtk::manage (new RTImage("one-to-one-small")); image->set_tooltip_text(M("TP_GENERAL_11SCALE_TOOLTIP")); titleHBox->pack_end(*image, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 9099f5620..58e6d538b 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -143,7 +143,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit addfavoritePanel (detailsPanel, dehaze); addfavoritePanel (advancedPanel, wavelet); addfavoritePanel(locallabPanel, locallab); - + addfavoritePanel (transformPanel, crop); addfavoritePanel (transformPanel, resize); addPanel (resize->getPackBox(), prsharpening, 2); @@ -189,12 +189,12 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit transformPanelSW = Gtk::manage (new MyScrolledWindow ()); rawPanelSW = Gtk::manage (new MyScrolledWindow ()); advancedPanelSW = Gtk::manage (new MyScrolledWindow ()); - locallabPanelSW = Gtk::manage(new MyScrolledWindow()); + locallabPanelSW = Gtk::manage(new MyScrolledWindow()); // load panel endings for (int i = 0; i < 8; i++) { vbPanelEnd[i] = Gtk::manage (new Gtk::Box(Gtk::ORIENTATION_VERTICAL)); - imgPanelEnd[i] = Gtk::manage (new RTImage ("ornament1.png")); + imgPanelEnd[i] = Gtk::manage (new RTImage ("ornament1")); imgPanelEnd[i]->show(); vbPanelEnd[i]->pack_start(*imgPanelEnd[i], Gtk::PACK_SHRINK); vbPanelEnd[i]->show_all(); @@ -220,23 +220,23 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), favorit locallabPanelSW->add(*locallabPanel); locallabPanel->pack_start(*vbPanelEnd[7], Gtk::PACK_SHRINK, 4); - + transformPanelSW->add (*transformPanel); transformPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 4); rawPanelSW->add (*rawPanel); rawPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0); - toiF = Gtk::manage (new TextOrIcon ("star.png", M ("MAIN_TAB_FAVORITES"), M ("MAIN_TAB_FAVORITES_TOOLTIP"))); - toiE = Gtk::manage (new TextOrIcon ("exposure.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP"))); - toiD = Gtk::manage (new TextOrIcon ("detail.png", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP"))); - toiC = Gtk::manage (new TextOrIcon ("color-circles.png", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP"))); - toiW = Gtk::manage (new TextOrIcon ("atom.png", M ("MAIN_TAB_ADVANCED"), M ("MAIN_TAB_ADVANCED_TOOLTIP"))); - toiL = Gtk::manage(new TextOrIcon("hand-open.png", M("MAIN_TAB_LOCALLAB"), M("MAIN_TAB_LOCALLAB_TOOLTIP"))); + toiF = Gtk::manage (new TextOrIcon ("star", M ("MAIN_TAB_FAVORITES"), M ("MAIN_TAB_FAVORITES_TOOLTIP"))); + toiE = Gtk::manage (new TextOrIcon ("exposure", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP"))); + toiD = Gtk::manage (new TextOrIcon ("detail", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP"))); + toiC = Gtk::manage (new TextOrIcon ("color-circles", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP"))); + toiW = Gtk::manage (new TextOrIcon ("atom", M ("MAIN_TAB_ADVANCED"), M ("MAIN_TAB_ADVANCED_TOOLTIP"))); + toiL = Gtk::manage(new TextOrIcon("hand-open", M("MAIN_TAB_LOCALLAB"), M("MAIN_TAB_LOCALLAB_TOOLTIP"))); - toiT = Gtk::manage (new TextOrIcon ("transform.png", M ("MAIN_TAB_TRANSFORM"), M ("MAIN_TAB_TRANSFORM_TOOLTIP"))); - toiR = Gtk::manage (new TextOrIcon ("bayer.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP"))); - toiM = Gtk::manage (new TextOrIcon ("metadata.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP"))); + toiT = Gtk::manage (new TextOrIcon ("transform", M ("MAIN_TAB_TRANSFORM"), M ("MAIN_TAB_TRANSFORM_TOOLTIP"))); + toiR = Gtk::manage (new TextOrIcon ("bayer", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP"))); + toiM = Gtk::manage (new TextOrIcon ("metadata", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP"))); if (favoritePanelSW) { toolPanelNotebook->append_page (*favoritePanelSW, *toiF); } diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index f14dd8c8c..7e675a289 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -90,7 +90,7 @@ Wavelet::Wavelet() : oldsh(Gtk::manage(new Gtk::CheckButton(M("TP_WAVELET_OLDSH")))), neutralchButton(Gtk::manage(new Gtk::Button(M("TP_WAVELET_NEUTRAL")))), sigma(Gtk::manage(new Adjuster(M("TP_WAVELET_SIGMA"), 0.05, 2.5, 0.01, 1.))), - offset(Gtk::manage(new Adjuster(M("TP_WAVELET_WAVOFFSET"), 0.33, 1.66, 0.01, 1., Gtk::manage(new RTImage("circle-black-small.png")), Gtk::manage(new RTImage("circle-white-small.png"))))), + offset(Gtk::manage(new Adjuster(M("TP_WAVELET_WAVOFFSET"), 0.33, 1.66, 0.01, 1., Gtk::manage(new RTImage("circle-black-small")), Gtk::manage(new RTImage("circle-white-small"))))), lowthr(Gtk::manage(new Adjuster(M("TP_WAVELET_WAVLOWTHR"), 20., 100., 0.5, 40.))), rescon(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCON"), -100, 100, 1, 0))), resconH(Gtk::manage(new Adjuster(M("TP_WAVELET_RESCONH"), 0, 100, 1, 0))), @@ -150,8 +150,8 @@ Wavelet::Wavelet() : edgedetectthr2(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGEDETECTTHR2"), -10, 100, 1, 0))), edgesensi(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGESENSI"), 0, 100, 1, 60))), edgeampli(Gtk::manage(new Adjuster(M("TP_WAVELET_EDGEAMPLI"), 0, 100, 1, 10))), - ballum(Gtk::manage(new Adjuster(M("TP_WAVELET_BALLUM"), -2., 10., 0.5, 7., Gtk::manage(new RTImage("circle-white-small.png")), Gtk::manage(new RTImage("circle-black-small.png"))))), - balchrom(Gtk::manage(new Adjuster(M("TP_WAVELET_BALCHROM"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-yellow-small.png")), Gtk::manage(new RTImage("circle-red-green-small.png"))))), + ballum(Gtk::manage(new Adjuster(M("TP_WAVELET_BALLUM"), -2., 10., 0.5, 7., Gtk::manage(new RTImage("circle-white-small")), Gtk::manage(new RTImage("circle-black-small"))))), + balchrom(Gtk::manage(new Adjuster(M("TP_WAVELET_BALCHROM"), -100., 100., 1., 0., Gtk::manage(new RTImage("circle-blue-yellow-small")), Gtk::manage(new RTImage("circle-red-green-small"))))), chromfi(Gtk::manage(new Adjuster(M("TP_WAVELET_CHROMFI"), 0.0, 150., 0.01, 0.))), chromco(Gtk::manage(new Adjuster(M("TP_WAVELET_CHROMCO"), 0, 100., 0.01, 0.))), mergeL(Gtk::manage(new Adjuster(M("TP_WAVELET_MERGEL"), -50, 100, 1, 20))), @@ -604,7 +604,7 @@ Wavelet::Wavelet() : opaCurveEditorG->curveListComplete(); opaCurveEditorG->show(); tonBox->pack_start(*sigmaton); - + tonFrame->set_label_align(0.025, 0.5); ToolParamBlock* const ton2Box = Gtk::manage(new ToolParamBlock()); ton2Box->pack_start(*labgrid, Gtk::PACK_EXPAND_WIDGET, 2); @@ -714,7 +714,7 @@ Wavelet::Wavelet() : CurveEditorwavnoise->curveListComplete(); CurveEditorwavnoise->show(); const std::vector milestones4 = makeWholeHueRange(); - + wavdenoiseh = static_cast(CurveEditorwavnoiseh->addCurve(CT_Flat, "", nullptr, false, false)); wavdenoiseh->setIdentityValue(0.); wavdenoiseh->setResetCurve(FlatCurveType(default_params.wavdenoiseh.at(0)), default_params.wavdenoiseh); @@ -740,7 +740,7 @@ Wavelet::Wavelet() : wavguidf->setBottomBarBgGradient(milestones4); - + levelsigm->set_tooltip_text(M("TP_WAVELET_DENSIGMA_TOOLTIP")); // levden->set_tooltip_text(M("TP_WAVELET_DENLEV_TOOLTIP")); thrden->set_tooltip_text(M("TP_WAVELET_THRDEN_TOOLTIP")); @@ -764,7 +764,7 @@ Wavelet::Wavelet() : noiseBox->pack_start(*sigm); noiseBox->pack_start(*CurveEditorwavnoise); // noiseBox->pack_start(*CurveEditorwavnoiseh); - + balchrom->setAdjusterListener(this); chromfi->setAdjusterListener(this); @@ -920,7 +920,7 @@ Wavelet::Wavelet() : //Blur Wavelet ToolParamBlock* const blBox = Gtk::manage(new ToolParamBlock()); - + curveEditorbl->setCurveListener(this); blshape = static_cast(curveEditorbl->addCurve(CT_Flat, "", nullptr, false, false)); @@ -935,8 +935,8 @@ Wavelet::Wavelet() : blBox->pack_start(*bluwav); bluwav->setAdjusterListener(this); blBox->pack_start(*curveEditorbl, Gtk::PACK_SHRINK, 4); - - + + chrwav->setAdjusterListener(this); blBox->pack_start(*chrwav); @@ -1118,20 +1118,20 @@ Wavelet::Wavelet() : cbenabConn = cbenab->signal_toggled().connect(sigc::mem_fun(*this, &Wavelet::cbenabToggled)); cbenab->set_tooltip_text(M("TP_WAVELET_CB_TOOLTIP")); - Gtk::Image* const iblueR = Gtk::manage(new RTImage("circle-blue-small.png")); - Gtk::Image* const iyelL = Gtk::manage(new RTImage("circle-yellow-small.png")); - Gtk::Image* const imagL = Gtk::manage(new RTImage("circle-magenta-small.png")); - Gtk::Image* const igreenR = Gtk::manage(new RTImage("circle-green-small.png")); + Gtk::Image* const iblueR = Gtk::manage(new RTImage("circle-blue-small")); + Gtk::Image* const iyelL = Gtk::manage(new RTImage("circle-yellow-small")); + Gtk::Image* const imagL = Gtk::manage(new RTImage("circle-magenta-small")); + Gtk::Image* const igreenR = Gtk::manage(new RTImage("circle-green-small")); - Gtk::Image* const iblueRm = Gtk::manage(new RTImage("circle-blue-small.png")); - Gtk::Image* const iyelLm = Gtk::manage(new RTImage("circle-yellow-small.png")); - Gtk::Image* const imagLm = Gtk::manage(new RTImage("circle-magenta-small.png")); - Gtk::Image* const igreenRm = Gtk::manage(new RTImage("circle-green-small.png")); + Gtk::Image* const iblueRm = Gtk::manage(new RTImage("circle-blue-small")); + Gtk::Image* const iyelLm = Gtk::manage(new RTImage("circle-yellow-small")); + Gtk::Image* const imagLm = Gtk::manage(new RTImage("circle-magenta-small")); + Gtk::Image* const igreenRm = Gtk::manage(new RTImage("circle-green-small")); - Gtk::Image* const iblueRh = Gtk::manage(new RTImage("circle-blue-small.png")); - Gtk::Image* const iyelLh = Gtk::manage(new RTImage("circle-yellow-small.png")); - Gtk::Image* const imagLh = Gtk::manage(new RTImage("circle-magenta-small.png")); - Gtk::Image* const igreenRh = Gtk::manage(new RTImage("circle-green-small.png")); + Gtk::Image* const iblueRh = Gtk::manage(new RTImage("circle-blue-small")); + Gtk::Image* const iyelLh = Gtk::manage(new RTImage("circle-yellow-small")); + Gtk::Image* const imagLh = Gtk::manage(new RTImage("circle-magenta-small")); + Gtk::Image* const igreenRh = Gtk::manage(new RTImage("circle-green-small")); greenhigh = Gtk::manage(new Adjuster("", -100., 100., 1., 0., igreenRh, imagLh)); bluehigh = Gtk::manage(new Adjuster("", -100., 100., 1., 0., iblueRh, iyelLh)); @@ -1165,8 +1165,6 @@ Wavelet::Wavelet() : resBox->pack_start(*chanMixerMidFrame, Gtk::PACK_SHRINK); resBox->pack_start(*chanMixerShadowsFrame, Gtk::PACK_SHRINK); - //RTImage *resetImg = Gtk::manage (new RTImage ("undo-small.png", "redo-small.png")); - //neutral->set_image(*resetImg); Gtk::Button* const neutral = Gtk::manage(new Gtk::Button(M("TP_COLORTONING_NEUTRAL"))); neutral->set_tooltip_text(M("TP_COLORTONING_NEUTRAL_TIP")); neutralconn = neutral->signal_pressed().connect(sigc::mem_fun(*this, &Wavelet::neutral_pressed)); @@ -1275,7 +1273,7 @@ Wavelet::Wavelet() : guidBox->pack_start(*CurveEditorwavguid); guidFrame->add(*guidBox); finalBox->pack_start(*guidFrame); - + //----------------------------- @@ -1582,7 +1580,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) } else if (pp->wavelet.slimethod == "cur") { slimethod->set_active(1); } - + if (pp->wavelet.quamethod == "cons") { quamethod->set_active(0); } else if (pp->wavelet.quamethod == "agre") { @@ -2051,7 +2049,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) } else { sup->hide(); } - + if (complexmethod->get_active_row_number() == 0) { updateGUIToMode(0); convertParamToNormal(); @@ -2059,7 +2057,7 @@ void Wavelet::read(const ProcParams* pp, const ParamsEdited* pedited) } else { updateGUIToMode(1); } - + } /***************************************************************************************************** @@ -3286,7 +3284,7 @@ void Wavelet::convertParamToNormal() cbenab->set_active(false); //final touchup - BAmethod->set_active(0); + BAmethod->set_active(0); sigmafin->setValue(def_params.sigmafin); enableListener(); @@ -3368,7 +3366,7 @@ void Wavelet::updateGUIToMode(int mode) void Wavelet::complexmethodChanged() -{ +{ if (complexmethod->get_active_row_number() == 0) { updateGUIToMode(0); convertParamToNormal(); @@ -3383,7 +3381,7 @@ void Wavelet::complexmethodChanged() } void Wavelet::denmethodChanged() -{ +{ if (listener && (multiImage || getEnabled())) { listener->panelChanged(EvWavdenmethod, denmethod->get_active_text()); @@ -3391,7 +3389,7 @@ void Wavelet::denmethodChanged() } void Wavelet::mixmethodChanged() -{ +{ if (listener && (multiImage || getEnabled())) { listener->panelChanged(EvWavmixmethod, mixmethod->get_active_text()); @@ -3399,8 +3397,8 @@ void Wavelet::mixmethodChanged() } void Wavelet::slimethodChanged() -{ - +{ + if (slimethod->get_active_row_number() == 0 && complexmethod->get_active_row_number() == 0) { updateGUIToMode(0); convertParamToNormal(); @@ -3416,7 +3414,7 @@ void Wavelet::slimethodChanged() CurveEditorwavnoiseh->show(); CurveEditorwavnoise->show(); } - + if (listener && (multiImage || getEnabled())) { listener->panelChanged(EvWavslimethod, slimethod->get_active_text()); @@ -3424,7 +3422,7 @@ void Wavelet::slimethodChanged() } void Wavelet::quamethodChanged() -{ +{ if (listener && (multiImage || getEnabled())) { listener->panelChanged(EvWavquamethod, quamethod->get_active_text()); diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index fbcf40faf..e1e3af22a 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -21,6 +21,7 @@ #include #include "rtimage.h" +#include "rtsurface.h" #include "options.h" #define MINTEMP 1500 //1200 @@ -34,32 +35,6 @@ using namespace rtengine; using namespace rtengine::procparams; -Glib::RefPtr WhiteBalance::wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM) + 1]; - -void WhiteBalance::init () -{ - wbPixbufs[toUnderlying(WBEntry::Type::CAMERA)] = RTImage::createPixbufFromFile ("wb-camera-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::AUTO)] = RTImage::createPixbufFromFile ("wb-auto-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::DAYLIGHT)] = RTImage::createPixbufFromFile ("wb-sun-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::CLOUDY)] = RTImage::createPixbufFromFile ("wb-cloudy-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::SHADE)] = RTImage::createPixbufFromFile ("wb-shade-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::WATER)] = RTImage::createPixbufFromFile ("wb-water-small.png"); - //wbPixbufs[toUnderlying(WBEntry::Type::WATER2)] = RTImage::createPixbufFromFile ("wb-water-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::TUNGSTEN)] = RTImage::createPixbufFromFile ("wb-tungsten-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::FLUORESCENT)] = RTImage::createPixbufFromFile ("wb-fluorescent-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::LAMP)] = RTImage::createPixbufFromFile ("wb-lamp-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::FLASH)] = RTImage::createPixbufFromFile ("wb-flash-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::LED)] = RTImage::createPixbufFromFile ("wb-led-small.png"); - wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM)] = RTImage::createPixbufFromFile ("wb-custom-small.png"); -} - -void WhiteBalance::cleanup () -{ - for (int i = 0; i < toUnderlying(WBEntry::Type::CUSTOM) + 1; i++) { - wbPixbufs[i].reset(); - } -} - static double wbSlider2Temp(double sval) { @@ -144,6 +119,19 @@ static double wbTemp2Slider(double temp) WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WBALANCE_LABEL"), true, true), wbp(nullptr), wblistener(nullptr) { + // Assign icon name to wbIcons + wbIcons[toUnderlying(WBEntry::Type::CAMERA)] = "wb-camera-small"; + wbIcons[toUnderlying(WBEntry::Type::AUTO)] = "wb-auto-small"; + wbIcons[toUnderlying(WBEntry::Type::DAYLIGHT)] = "wb-sun-small"; + wbIcons[toUnderlying(WBEntry::Type::CLOUDY)] = "wb-cloudy-small"; + wbIcons[toUnderlying(WBEntry::Type::SHADE)] = "wb-shade-small"; + wbIcons[toUnderlying(WBEntry::Type::WATER)] = "wb-water-small"; + wbIcons[toUnderlying(WBEntry::Type::TUNGSTEN)] = "wb-tungsten-small"; + wbIcons[toUnderlying(WBEntry::Type::FLUORESCENT)] = "wb-fluorescent-small"; + wbIcons[toUnderlying(WBEntry::Type::LAMP)] = "wb-lamp-small"; + wbIcons[toUnderlying(WBEntry::Type::FLASH)] = "wb-flash-small"; + wbIcons[toUnderlying(WBEntry::Type::LED)] = "wb-led-small"; + wbIcons[toUnderlying(WBEntry::Type::CUSTOM)] = "wb-custom-small"; Gtk::Grid* methodgrid = Gtk::manage(new Gtk::Grid()); methodgrid->get_style_context()->add_class("grid-spacing"); @@ -159,6 +147,15 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB setExpandAlignProperties(method, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); // Assign the model to the Combobox method->set_model(refTreeModel); + method->clear(); // Clear default cell layout to add custom one + Gtk::CellRendererPixbuf* const renderer_icon = Gtk::manage(new Gtk::CellRendererPixbuf()); + renderer_icon->property_stock_size() = Gtk::ICON_SIZE_MENU; + method->pack_start(*renderer_icon, false); + method->add_attribute(*renderer_icon, "icon-name", methodColumns.colIcon); + Gtk::CellRendererText* const renderer_label = Gtk::manage(new Gtk::CellRendererText()); + renderer_label->property_ellipsize() = Pango::ELLIPSIZE_MIDDLE; + method->pack_start(*renderer_label, true); + method->add_attribute(*renderer_label, "markup", methodColumns.colLabel); WBEntry::Type oldType = WBParams::getWbEntries()[0].type; WBEntry::Type currType; @@ -170,7 +167,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB if (currType == WBEntry::Type::FLUORESCENT) { // Creating the Fluorescent subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLUO_HEADER"); row[methodColumns.colId] = i + 100; } @@ -178,7 +175,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB if (currType == WBEntry::Type::AUTO) { // Creating the auto category row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_AUTO_HEADER"); row[methodColumns.colId] = i + 100; } @@ -186,7 +183,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB if (currType == WBEntry::Type::WATER) { // Creating the under water subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_WATER_HEADER"); row[methodColumns.colId] = i + 100; } @@ -194,7 +191,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB if (currType == WBEntry::Type::LAMP) { // Creating the Lamp subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LAMP_HEADER"); row[methodColumns.colId] = i + 100; } @@ -202,7 +199,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB if (currType == WBEntry::Type::LED) { // Creating the LED subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LED_HEADER"); row[methodColumns.colId] = i + 100; } @@ -210,7 +207,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB if (currType == WBEntry::Type::FLASH) { // Creating the Flash subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLASH_HEADER"); row[methodColumns.colId] = i + 100; } @@ -224,12 +221,12 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB || currType == WBEntry::Type::AUTO ) { childrow = *(refTreeModel->append(row.children())); - childrow[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + childrow[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; childrow[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; childrow[methodColumns.colId] = i; } else { row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbIcons[toUnderlying(currType)]; row[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; row[methodColumns.colId] = i; } @@ -240,20 +237,11 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB custom_equal = 1.0; } - //Add the model columns to the Combo (which is a kind of view), - //rendering them in the default way: - method->pack_start(methodColumns.colIcon, false); - method->pack_start(methodColumns.colLabel, true); - - std::vector cells = method->get_cells(); - Gtk::CellRendererText* cellRenderer = dynamic_cast(cells.at(1)); - cellRenderer->property_ellipsize() = Pango::ELLIPSIZE_MIDDLE; - resetButton = Gtk::manage (new Gtk::Button()); // No label, keep it short setExpandAlignProperties(resetButton, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); resetButton->set_relief(Gtk::RELIEF_NONE); resetButton->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); - resetButton->set_image (*Gtk::manage (new RTImage ("undo-small.png"))); + resetButton->set_image (*Gtk::manage (new RTImage ("undo-small", Gtk::ICON_SIZE_BUTTON))); method->set_active (0); // Camera methodgrid->attach (*lab, 0, 0, 1, 1); @@ -270,7 +258,7 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB setExpandAlignProperties(spotbutton, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); spotbutton->get_style_context()->add_class("independent"); spotbutton->set_tooltip_text(M("TP_WBALANCE_SPOTWB")); - spotbutton->set_image (*Gtk::manage (new RTImage ("color-picker-small.png"))); + spotbutton->set_image (*Gtk::manage (new RTImage ("color-picker-small", Gtk::ICON_SIZE_BUTTON))); Gtk::Label* slab = Gtk::manage (new Gtk::Label (M("TP_WBALANCE_SIZE"))); setExpandAlignProperties(slab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); @@ -322,14 +310,14 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB separator->get_style_context()->add_class("grid-row-separator"); pack_start (*separator, Gtk::PACK_SHRINK, 0); - Gtk::Image* itempL = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* itempR = Gtk::manage (new RTImage ("circle-yellow-small.png")); - Gtk::Image* igreenL = Gtk::manage (new RTImage ("circle-magenta-small.png")); - Gtk::Image* igreenR = Gtk::manage (new RTImage ("circle-green-small.png")); - Gtk::Image* iblueredL = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* iblueredR = Gtk::manage (new RTImage ("circle-red-small.png")); - Gtk::Image* itempbiasL = Gtk::manage (new RTImage ("circle-blue-small.png")); - Gtk::Image* itempbiasR = Gtk::manage (new RTImage ("circle-yellow-small.png")); + Gtk::Image* itempL = Gtk::manage (new RTImage ("circle-blue-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* itempR = Gtk::manage (new RTImage ("circle-yellow-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* igreenL = Gtk::manage (new RTImage ("circle-magenta-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* igreenR = Gtk::manage (new RTImage ("circle-green-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* iblueredL = Gtk::manage (new RTImage ("circle-blue-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* iblueredR = Gtk::manage (new RTImage ("circle-red-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* itempbiasL = Gtk::manage (new RTImage ("circle-blue-small", Gtk::ICON_SIZE_BUTTON)); + Gtk::Image* itempbiasR = Gtk::manage (new RTImage ("circle-yellow-small", Gtk::ICON_SIZE_BUTTON)); StudLabel = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); StudLabel->set_tooltip_text(M("TP_WBALANCE_STUDLABEL_TOOLTIP")); @@ -719,7 +707,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) } else { StudLabel->hide(); } - + } setEnabled(pp->wb.enabled); @@ -954,7 +942,7 @@ void WhiteBalance::WBChanged(double temperature, double greenVal, float studgood StudLabel->set_text( Glib::ustring::compose(M("TP_WBALANCE_STUDLABEL"), Glib::ustring::format(std::fixed, std::setprecision(4), studgood)) - ); + ); temp->setDefault(temperature); green->setDefault(greenVal); enableListener(); diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index 1ed99a2aa..a034c1686 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -50,7 +50,7 @@ protected: class MethodColumns : public Gtk::TreeModel::ColumnRecord { public: - Gtk::TreeModelColumn< Glib::RefPtr > colIcon; + Gtk::TreeModelColumn colIcon; Gtk::TreeModelColumn colLabel; Gtk::TreeModelColumn colId; MethodColumns() @@ -61,7 +61,7 @@ protected: } }; - static Glib::RefPtr wbPixbufs[rtengine::toUnderlying(rtengine::procparams::WBEntry::Type::CUSTOM) + 1]; + Glib::ustring wbIcons[rtengine::toUnderlying(rtengine::procparams::WBEntry::Type::CUSTOM) + 1]; Glib::RefPtr refTreeModel; MethodColumns methodColumns; MyComboBox* method; @@ -102,8 +102,6 @@ public: WhiteBalance (); ~WhiteBalance () override; - static void init (); - static void cleanup (); void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; diff --git a/rtgui/zoompanel.cc b/rtgui/zoompanel.cc index c10ec97b9..a683870c9 100644 --- a/rtgui/zoompanel.cc +++ b/rtgui/zoompanel.cc @@ -25,15 +25,15 @@ ZoomPanel::ZoomPanel (ImageArea* iarea) : iarea(iarea) { set_name ("EditorZoomPanel"); - Gtk::Image* imageOut = Gtk::manage (new RTImage ("magnifier-minus.png")); + Gtk::Image* imageOut = Gtk::manage (new RTImage ("magnifier-minus", Gtk::ICON_SIZE_LARGE_TOOLBAR)); imageOut->set_padding(0, 0); - Gtk::Image* imageIn = Gtk::manage (new RTImage ("magnifier-plus.png")); + Gtk::Image* imageIn = Gtk::manage (new RTImage ("magnifier-plus", Gtk::ICON_SIZE_LARGE_TOOLBAR)); imageIn->set_padding(0, 0); - Gtk::Image* image11 = Gtk::manage ( new RTImage ("magnifier-1to1.png")); + Gtk::Image* image11 = Gtk::manage ( new RTImage ("magnifier-1to1", Gtk::ICON_SIZE_LARGE_TOOLBAR)); image11->set_padding(0, 0); - Gtk::Image* imageFit = Gtk::manage (new RTImage ("magnifier-fit.png")); + Gtk::Image* imageFit = Gtk::manage (new RTImage ("magnifier-fit", Gtk::ICON_SIZE_LARGE_TOOLBAR)); imageFit->set_padding(0, 0); - Gtk::Image* imageFitCrop = Gtk::manage (new RTImage ("magnifier-crop.png")); + Gtk::Image* imageFitCrop = Gtk::manage (new RTImage ("magnifier-crop", Gtk::ICON_SIZE_LARGE_TOOLBAR)); imageFit->set_padding(0, 0); zoomOut = Gtk::manage (new Gtk::Button()); @@ -67,7 +67,7 @@ ZoomPanel::ZoomPanel (ImageArea* iarea) : iarea(iarea) setExpandAlignProperties(zoomLabel, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); attach_next_to (*zoomLabel, Gtk::POS_RIGHT, 1, 1); - Gtk::Image* imageCrop = Gtk::manage (new RTImage ("window-add.png")); + Gtk::Image* imageCrop = Gtk::manage (new RTImage ("window-add", Gtk::ICON_SIZE_LARGE_TOOLBAR)); imageCrop->set_padding(0, 0); newCrop = Gtk::manage (new Gtk::Button()); newCrop->add (*imageCrop);