From 5ea0bacddd5cd3d23e091b80864a7cb00cb88799 Mon Sep 17 00:00:00 2001 From: Hombre Date: Sat, 8 Dec 2018 22:48:15 +0100 Subject: [PATCH] Icons are resized depending on the current scale/resolution See issue #3547 and #4803 --- rtengine/init.cc | 1 + rtgui/batchqueueentry.cc | 8 +-- rtgui/batchqueueentry.h | 4 +- rtgui/cursormanager.cc | 38 +++++++------- rtgui/dirbrowser.cc | 21 +++----- rtgui/exifpanel.cc | 9 ++-- rtgui/exifpanel.h | 6 +-- rtgui/filebrowserentry.cc | 28 +++++------ rtgui/filebrowserentry.h | 14 +++--- rtgui/guiutils.cc | 24 ++++----- rtgui/main.cc | 68 ++++++++++++++++++++++--- rtgui/rtimage.cc | 92 ++++++++++++++++------------------ rtgui/rtimage.h | 7 +-- rtgui/rtscalable.cc | 15 ++++-- rtgui/rtscalable.h | 2 +- rtgui/rtsurface.cc | 20 ++++++-- rtgui/rtsurface.h | 6 ++- rtgui/rtwindow.cc | 16 +++--- rtgui/splash.cc | 2 +- rtgui/thumbbrowserentrybase.cc | 12 ++--- rtgui/thumbbrowserentrybase.h | 8 +-- rtgui/whitebalance.cc | 46 ++++++++--------- rtgui/whitebalance.h | 4 +- 23 files changed, 259 insertions(+), 192 deletions(-) diff --git a/rtengine/init.cc b/rtengine/init.cc index 7d944fc0b..c11e398bf 100644 --- a/rtengine/init.cc +++ b/rtengine/init.cc @@ -112,6 +112,7 @@ void cleanup () ProcParams::cleanup (); Color::cleanup (); RawImageSource::cleanup (); + #ifdef RT_FFTW3F_OMP fftwf_cleanup_threads(); #else diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index fb65e0324..6771e77c9 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -27,7 +27,7 @@ #include "thumbbrowserbase.h" bool BatchQueueEntry::iconsLoaded(false); -Cairo::RefPtr BatchQueueEntry::savedAsIcon; +Glib::RefPtr BatchQueueEntry::savedAsIcon; BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm) : ThumbBrowserEntryBase(fname), @@ -55,7 +55,7 @@ BatchQueueEntry::BatchQueueEntry (rtengine::ProcessingJob* pjob, const rtengine: #endif if (!iconsLoaded) { - savedAsIcon = RTImage::createFromFile ("save-small.png"); + savedAsIcon = RTImage::createPixbufFromFile ("save-small.png"); iconsLoaded = true; } @@ -145,10 +145,10 @@ void BatchQueueEntry::removeButtonSet () buttonSet = nullptr; } -std::vector > BatchQueueEntry::getIconsOnImageArea () +std::vector > BatchQueueEntry::getIconsOnImageArea () { - std::vector > ret; + std::vector > ret; if (!outFileName.empty()) { ret.push_back (savedAsIcon); diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index 57b263689..2b75922b7 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -43,7 +43,7 @@ class BatchQueueEntry : public ThumbBrowserEntryBase, public BQEntryUpdateListen public: - static Cairo::RefPtr savedAsIcon; + static Glib::RefPtr savedAsIcon; rtengine::ProcessingJob* job; rtengine::procparams::ProcParams params; @@ -65,7 +65,7 @@ public: void removeButtonSet (); - std::vector > getIconsOnImageArea () override; + std::vector > getIconsOnImageArea () override; void getIconSize (int& w, int& h) override; Glib::ustring getToolTip (int x, int y) override; diff --git a/rtgui/cursormanager.cc b/rtgui/cursormanager.cc index d614634d5..4d08e4c7d 100644 --- a/rtgui/cursormanager.cc +++ b/rtgui/cursormanager.cc @@ -36,25 +36,25 @@ void CursorManager::init (Glib::RefPtr mainWindow) #endif - Cairo::RefPtr add = RTImage::createFromFile("crosshair-small.png"); - Cairo::RefPtr colPick = RTImage::createFromFile("color-picker-hicontrast.png"); - Cairo::RefPtr colPickAdd = RTImage::createFromFile("color-picker-add-hicontrast.png"); - Cairo::RefPtr cropDraw = RTImage::createFromFile("crop-point-hicontrast.png"); - Cairo::RefPtr crosshair = RTImage::createFromFile("crosshair-hicontrast.png"); - Cairo::RefPtr empty = RTImage::createFromFile("empty.png"); - Cairo::RefPtr handClosed = RTImage::createFromFile("hand-closed-hicontrast.png"); - Cairo::RefPtr handOpen = RTImage::createFromFile("hand-open-hicontrast.png"); - Cairo::RefPtr moveBL = RTImage::createFromFile("node-move-sw-ne-hicontrast.png"); - Cairo::RefPtr moveBR = RTImage::createFromFile("node-move-nw-se-hicontrast.png"); - Cairo::RefPtr moveL = RTImage::createFromFile("node-move-x-hicontrast.png"); - Cairo::RefPtr moveR = RTImage::createFromFile("node-move-x-hicontrast.png"); - Cairo::RefPtr moveTL = RTImage::createFromFile("node-move-nw-se-hicontrast.png"); - Cairo::RefPtr moveTR = RTImage::createFromFile("node-move-sw-ne-hicontrast.png"); - Cairo::RefPtr moveX = RTImage::createFromFile("node-move-x-hicontrast.png"); - Cairo::RefPtr moveXY = RTImage::createFromFile("node-move-xy-hicontrast.png"); - Cairo::RefPtr moveY = RTImage::createFromFile("node-move-y-hicontrast.png"); - Cairo::RefPtr rotate = RTImage::createFromFile("rotate-aroundnode-hicontrast.png"); - Cairo::RefPtr wait = RTImage::createFromFile("gears.png"); // Currently unused, create *-hicontrast once used. + 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. cAdd = add ? Gdk::Cursor::create(display, add, 8, 8) : Gdk::Cursor::create(display, Gdk::PLUS); cAddPicker = colPickAdd ? Gdk::Cursor::create(display, colPickAdd, 4, 21) : Gdk::Cursor::create(display, Gdk::PLUS); diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index b992550e7..2b30f0b2d 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -121,20 +121,13 @@ DirBrowser::~DirBrowser() void DirBrowser::fillDirTree () { - Cairo::RefPtr openfolder_ = RTImage::createFromFile ("folder-open-small.png"); - openfolder = Gdk::Pixbuf::create(openfolder_, 0, 0, openfolder_->get_width(), openfolder_->get_height()); - Cairo::RefPtr closedfolder_ = RTImage::createFromFile ("folder-open-small.png"); - closedfolder = Gdk::Pixbuf::create(closedfolder_, 0, 0, closedfolder_->get_width(), closedfolder_->get_height()); - Cairo::RefPtr icdrom_ = RTImage::createFromFile ("folder-open-small.png"); - icdrom = Gdk::Pixbuf::create(icdrom_, 0, 0, icdrom_->get_width(), icdrom_->get_height()); - Cairo::RefPtr ifloppy_ = RTImage::createFromFile ("folder-open-small.png"); - ifloppy = Gdk::Pixbuf::create(ifloppy_, 0, 0, ifloppy_->get_width(), ifloppy_->get_height()); - Cairo::RefPtr ihdd_ = RTImage::createFromFile ("folder-open-small.png"); - ihdd = Gdk::Pixbuf::create(ihdd_, 0, 0, ihdd_->get_width(), ihdd_->get_height()); - Cairo::RefPtr iremovable_ = RTImage::createFromFile ("folder-open-small.png"); - iremovable = Gdk::Pixbuf::create(iremovable_, 0, 0, iremovable_->get_width(), iremovable_->get_height()); - Cairo::RefPtr inetwork_ = RTImage::createFromFile ("folder-open-small.png"); - inetwork = Gdk::Pixbuf::create(inetwork_, 0, 0, inetwork_->get_width(), inetwork_->get_height()); + 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"); //Create the Tree model: dirTreeModel = Gtk::TreeStore::create(dtColumns); diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index ee2785924..35c964cff 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -48,12 +48,9 @@ ExifPanel::ExifPanel () : idata (nullptr) exifTree->set_grid_lines (Gtk::TREE_VIEW_GRID_LINES_NONE); exifTree->set_row_separator_func (sigc::mem_fun(*this, &ExifPanel::rowSeperatorFunc)); - Cairo::RefPtr delicon_ = RTImage::createFromFile ("cancel-small.png"); - delicon = Gdk::Pixbuf::create(delicon_, 0, 0, delicon_->get_width(), delicon_->get_height()); - Cairo::RefPtr keepicon_ = RTImage::createFromFile ("tick-small.png"); - keepicon = Gdk::Pixbuf::create(keepicon_, 0, 0, keepicon_->get_width(), keepicon_->get_height()); - Cairo::RefPtr editicon_ = RTImage::createFromFile ("add-small.png"); - editicon = Gdk::Pixbuf::create(editicon_, 0, 0, editicon_->get_width(), editicon_->get_height()); + 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 ()); diff --git a/rtgui/exifpanel.h b/rtgui/exifpanel.h index 9db4cb7fe..cd27cb780 100644 --- a/rtgui/exifpanel.h +++ b/rtgui/exifpanel.h @@ -59,9 +59,9 @@ private: add (isSeparator); } }; - Glib::RefPtr delicon; - Glib::RefPtr keepicon; - Glib::RefPtr editicon; + Glib::RefPtr delicon; + Glib::RefPtr keepicon; + Glib::RefPtr editicon; ExifColumns exifColumns; Gtk::TreeView* exifTree; diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index d8312ffd2..0a29ded24 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -33,11 +33,11 @@ //extern Glib::Threads::Thread* mainThread; bool FileBrowserEntry::iconsLoaded(false); -Cairo::RefPtr FileBrowserEntry::editedIcon; -Cairo::RefPtr FileBrowserEntry::recentlySavedIcon; -Cairo::RefPtr FileBrowserEntry::enqueuedIcon; -Cairo::RefPtr FileBrowserEntry::hdr; -Cairo::RefPtr FileBrowserEntry::ps; +Glib::RefPtr FileBrowserEntry::editedIcon; +Glib::RefPtr FileBrowserEntry::recentlySavedIcon; +Glib::RefPtr FileBrowserEntry::enqueuedIcon; +Glib::RefPtr FileBrowserEntry::hdr; +Glib::RefPtr FileBrowserEntry::ps; 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), cropgl(nullptr), state(SNormal), crop_custom_ratio(0.f) @@ -56,11 +56,11 @@ FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname) scale = 1; if (!iconsLoaded) { - editedIcon = RTImage::createFromFile ("tick-small.png"); - recentlySavedIcon = RTImage::createFromFile ("save-small.png"); - enqueuedIcon = RTImage::createFromFile ("gears-small.png"); - hdr = RTImage::createFromFile ("filetype-hdr.png"); - ps = RTImage::createFromFile ("filetype-ps.png"); + 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"); iconsLoaded = true; } @@ -117,10 +117,10 @@ void FileBrowserEntry::calcThumbnailSize () } } -std::vector > FileBrowserEntry::getIconsOnImageArea () +std::vector > FileBrowserEntry::getIconsOnImageArea () { - std::vector > ret; + std::vector > ret; if (!thumbnail) { return ret; @@ -141,10 +141,10 @@ std::vector > FileBrowserEntry::getIconsOnIma return ret; } -std::vector > FileBrowserEntry::getSpecificityIconsOnImageArea () +std::vector > FileBrowserEntry::getSpecificityIconsOnImageArea () { - std::vector > ret; + std::vector > ret; if (!thumbnail) { return ret; diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index 03a652c6b..b1fa8c54b 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -71,11 +71,11 @@ class FileBrowserEntry : public ThumbBrowserEntryBase, public: - static Cairo::RefPtr editedIcon; - static Cairo::RefPtr recentlySavedIcon; - static Cairo::RefPtr enqueuedIcon; - static Cairo::RefPtr hdr; - static Cairo::RefPtr ps; + static Glib::RefPtr editedIcon; + static Glib::RefPtr recentlySavedIcon; + static Glib::RefPtr enqueuedIcon; + static Glib::RefPtr hdr; + static Glib::RefPtr ps; FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname); ~FileBrowserEntry () override; @@ -92,8 +92,8 @@ public: void refreshQuickThumbnailImage () override; void calcThumbnailSize () override; - std::vector > getIconsOnImageArea () override; - std::vector > getSpecificityIconsOnImageArea () override; + std::vector > getIconsOnImageArea () override; + std::vector > getSpecificityIconsOnImageArea () override; void getIconSize (int& w, int& h) override; // thumbnaillistener interface diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index f9792a28a..14f00bc29 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -564,7 +564,7 @@ void MyExpander::init() MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) : enabled(false), inconsistent(false), flushEvent(false), expBox(nullptr), - child(nullptr), headerWidget(nullptr), + child(nullptr), headerWidget(nullptr), statusImage(nullptr), label(nullptr), useEnabled(useEnabled) { set_spacing(0); @@ -760,12 +760,12 @@ void MyExpander::set_inconsistent(bool isInconsistent) if (useEnabled) { if (isInconsistent) { - statusImage->from(inconsistentImage); + statusImage->set(inconsistentImage->get_pixbuf()); } else { if (enabled) { - statusImage->from(enabledImage); + statusImage->set(enabledImage->get_pixbuf()); } else { - statusImage->from(disabledImage); + statusImage->set(disabledImage->get_pixbuf()); } } } @@ -791,14 +791,14 @@ void MyExpander::setEnabled(bool isEnabled) enabled = false; if (!inconsistent) { - statusImage->from(disabledImage); + statusImage->set(disabledImage->get_pixbuf()); message.emit(); } } else { enabled = true; if (!inconsistent) { - statusImage->from(enabledImage); + statusImage->set(enabledImage->get_pixbuf()); message.emit(); } } @@ -834,9 +834,9 @@ void MyExpander::set_expanded( bool expanded ) if (!useEnabled) { if (expanded ) { - statusImage->from(openedImage); + statusImage->set(openedImage->get_pixbuf()); } else { - statusImage->from(closedImage); + statusImage->set(closedImage->get_pixbuf()); } } @@ -879,9 +879,9 @@ bool MyExpander::on_toggle(GdkEventButton* event) if (!useEnabled) { if (isVisible) { - statusImage->from(closedImage); + statusImage->set(closedImage->get_pixbuf()); } else { - statusImage->from(openedImage); + statusImage->set(openedImage->get_pixbuf()); } } @@ -906,10 +906,10 @@ bool MyExpander::on_enabled_change(GdkEventButton* event) if (event->button == 1) { if (enabled) { enabled = false; - statusImage->from(disabledImage); + statusImage->set(disabledImage->get_pixbuf()); } else { enabled = true; - statusImage->from(enabledImage); + statusImage->set(enabledImage->get_pixbuf()); } message.emit(); diff --git a/rtgui/main.cc b/rtgui/main.cc index d4c52154c..e22d1d281 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -65,6 +65,8 @@ Glib::ustring argv2; bool simpleEditor = false; bool gimpPlugin = false; bool remote = false; +unsigned char scale = 1; +float fontScale = 1.f; Glib::RefPtr cssForced; Glib::RefPtr cssRT; //Glib::Threads::Thread* mainThread; @@ -316,17 +318,62 @@ RTWindow *create_rt_window() } // 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 * scale); + #else + css = Glib::ustring::compose ("* { font-family: %1; font-size: %2pt }", options.fontFamily, options.fontSize * scale); + #endif + //GTK318 + fontScale = options.fontSize / 9; + } else if (scale == 2) { + 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 fontSize = pfd.get_size(); + bool isPix = pfd.get_size_is_absolute(); + printf("FONT SIZE = %d pt\n", fontSize); + + + double r = style->get_screen()->get_resolution(); + printf("RESOLUTION = %.3f\n", r); + + + if (isPix) { + // 1pt = 0.3527mm @ 96 ppi + double resolution = style->get_screen()->get_resolution(); + // px >inch >mm >pt >"scaled pt" + int pt = (int)(fontSize / 96. * 25.4 / 0.3527 * (96. / resolution) + 0.49); + // if resolution is lower than 192ppi, we're supposing that it's already expressed in a scale==1 scenario + if (resolution >= 192) { + // it's already scaled up, no need to set the font size + resolution /= 2.; // Reducing the value for a scale==1 case + pt /= 2.; + } else { + // fontSize is for scale==1, we have to scale up + css = Glib::ustring::compose ("* { font-size: %1px }", pt * scale); + } + fontScale = pt / 9; + } else { + int pt = fontSize / Pango::SCALE; + css = Glib::ustring::compose ("* { font-size: %1pt }", pt * scale); + fontScale = pt / 9; + } + } else { + printf("La taille n'est pas specifiee\n"); + fontScale = 1.f; + } + } + if (!css.empty()) { + printf("CSS: %s", css.c_str()); try { cssForced = Gtk::CssProvider::create(); - //GTK318 -#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20 - cssForced->load_from_data (Glib::ustring::compose ("* { font-family: %1; font-size: %2px }", options.fontFamily, options.fontSize)); -#else - cssForced->load_from_data (Glib::ustring::compose ("* { font-family: %1; font-size: %2pt }", options.fontFamily, options.fontSize)); -#endif - //GTK318 + 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 (...) { @@ -346,7 +393,6 @@ RTWindow *create_rt_window() //gdk_threads_enter (); RTWindow *rtWindow = new RTWindow(); - return rtWindow; } @@ -471,6 +517,12 @@ int main (int argc, char **argv) Glib::init(); // called by Gtk::Main, but this may be important for thread handling, so we call it ourselves now Gio::init (); + const gchar *gscale = g_getenv("GDK_SCALE"); + if (gscale && gscale[0] == '2') { + scale = 2; + g_setenv("GDK_SCALE", "1", true); + } + #ifdef WIN32 if (GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)) == 0x0003) { // started from msys2 console => do not buffer stdout diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index 4763b90e7..993b3e30b 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -28,7 +28,8 @@ namespace { -std::map> surfaceCache; +std::map > pixbufCache; +std::map > surfaceCache; } @@ -37,14 +38,22 @@ int RTImage::scaleBack = 0; RTImage::RTImage () {} -RTImage::RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName) -{ - setImage (fileName, rtlFileName); -} - RTImage::RTImage (RTImage &other) { - from(&other); + dpiBack = other.dpiBack; + scaleBack = other.scaleBack; + pixbuf = other.pixbuf; + surface = other.surface; + if (pixbuf) { + set(pixbuf); + } else if (surface) { + set(surface); + } +} + +RTImage::RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName) : Gtk::Image() +{ + setImage (fileName, rtlFileName); } RTImage::RTImage (Glib::RefPtr &pixbuf) @@ -54,13 +63,6 @@ RTImage::RTImage (Glib::RefPtr &pixbuf) } } -RTImage::RTImage (Glib::RefPtr &other) -{ - if (other) { - from(other.get()); - } -} - void RTImage::setImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName) { Glib::ustring imageName; @@ -92,15 +94,22 @@ void RTImage::changeImage (const Glib::ustring& imageName) { clear (); - auto iterator = surfaceCache.find (imageName); - - if (iterator == surfaceCache.end ()) { - const auto pixbuf = createFromFile(imageName); - iterator = surfaceCache.emplace (imageName, pixbuf).first; + if (pixbuf) { + auto iterator = pixbufCache.find (imageName); + printf("changeImage / pixbufCache[%d] : \"%s\" %s!\n", (int)(pixbufCache.size()), imageName.c_str(), iterator == pixbufCache.end () ? "not found" : "found"); + 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); + printf("changeImage / surfaceCache[%d] : \"%s\" %s!\n", (int)(surfaceCache.size()), imageName.c_str(), iterator == surfaceCache.end () ? "not found" : "found"); + if (iterator == surfaceCache.end ()) { + auto surf = createImgSurfFromFile(imageName); + iterator = surfaceCache.emplace (imageName, surf).first; + } + surface = iterator->second; + set(iterator->second); } - - surface = iterator->second; - set(iterator->second); } void RTImage::init() @@ -111,36 +120,26 @@ void RTImage::init() void RTImage::updateImages() { + for (auto& entry : pixbufCache) { + entry.second = createPixbufFromFile(entry.first); + } for (auto& entry : surfaceCache) { - entry.second = createFromFile(entry.first); + entry.second = createImgSurfFromFile(entry.first); } } -void RTImage::from(RTImage* other) +Glib::RefPtr RTImage::createPixbufFromFile (const Glib::ustring& fileName) { - if (!other) { - return; - } - - if (other->get_pixbuf()) { - set(other->get_pixbuf()); - } else { - surface = other->surface; - set(surface); - } + Cairo::RefPtr imgSurf = createImgSurfFromFile(fileName); + Glib::RefPtr pixbuf = Gdk::Pixbuf::create(imgSurf, 0, 0, imgSurf->get_width(), imgSurf->get_height()); + return pixbuf; } -void RTImage::from(Glib::RefPtr other) -{ - if (other) { - from (other.get()); - } -} - -Cairo::RefPtr RTImage::createFromFile (const Glib::ustring& fileName) +Cairo::RefPtr RTImage::createImgSurfFromFile (const Glib::ustring& fileName) { Cairo::RefPtr surf; + printf("Creating \"%s\"\n", fileName.c_str()); try { double requestedDPI = getDPI(); @@ -161,6 +160,8 @@ Cairo::RefPtr RTImage::createFromFile (const Glib::ustring& resizeImage(surf, getDPI() / requestedDPI); } + // 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); printf(" -> Cairo::ImageSurface is now %dx%d (scale: %.1f)\n", surf->get_width(), surf->get_height(), (float)x); @@ -170,6 +171,7 @@ Cairo::RefPtr RTImage::createFromFile (const Glib::ustring& surf->flush(); printf(" Cairo::ImageSurface is now %dx%d (scale: %.1f)\n", surf->get_width(), surf->get_height(), (float)x); } + */ } catch (const Glib::Exception& exception) { if (options.rtSettings.verbose) { std::cerr << "Failed to load image \"" << fileName << "\": " << exception.what() << std::endl; @@ -178,9 +180,3 @@ Cairo::RefPtr RTImage::createFromFile (const Glib::ustring& return surf; } - -/* -bool RTImage::on_configure_event(GdkEventConfigure* configure_event) -{ -} -*/ diff --git a/rtgui/rtimage.h b/rtgui/rtimage.h index 35652e163..54ab5b66d 100644 --- a/rtgui/rtimage.h +++ b/rtgui/rtimage.h @@ -33,11 +33,13 @@ class RTImage : public Gtk::Image, public RTScalable protected: Cairo::RefPtr surface; + Glib::RefPtr pixbuf; public: RTImage (); RTImage (RTImage &other); RTImage (Glib::RefPtr &pixbuf); + RTImage(Cairo::RefPtr other); RTImage (Glib::RefPtr &other); RTImage (const Glib::ustring& fileName, const Glib::ustring& rtlFileName = Glib::ustring()); @@ -49,8 +51,7 @@ public: static void setDPInScale (const double newDPI, const int newScale); static void setScale (const int newScale); - static Cairo::RefPtr createFromFile (const Glib::ustring& fileName); + static Glib::RefPtr createPixbufFromFile (const Glib::ustring& fileName); + static Cairo::RefPtr createImgSurfFromFile (const Glib::ustring& fileName); - void from(RTImage* other); - void from(Glib::RefPtr other); }; diff --git a/rtgui/rtscalable.cc b/rtgui/rtscalable.cc index 6d376d9d8..3f8c41a61 100644 --- a/rtgui/rtscalable.cc +++ b/rtgui/rtscalable.cc @@ -22,6 +22,8 @@ double RTScalable::dpi = 0.; int RTScalable::scale = 0; +extern float fontScale; +extern unsigned char scale; Gtk::TextDirection RTScalable::direction = Gtk::TextDirection::TEXT_DIR_NONE; void RTScalable::setDPInScale (const double newDPI, const int newScale) @@ -30,14 +32,17 @@ void RTScalable::setDPInScale (const double newDPI, const int newScale) // 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 = scale == 2 ? 192 : newDPI; + dpi = newDPI; + if (scale == 2 && newDPI < 192) { + dpi *= 2; + } printf("RTScalable::setDPInScale / New scale = %d & new DPI = %.3f (%.3f asked) -> Reloading all RTScalable\n", scale, dpi, newDPI); } } double RTScalable::getDPI () { - return dpi; + return dpi * fontScale; } int RTScalable::getScale () @@ -53,11 +58,15 @@ Gtk::TextDirection RTScalable::getDirection() void RTScalable::init(Gtk::Window *window) { printf("RTScalable::init\n"); - setDPInScale(window->get_screen()->get_resolution(), window->get_scale_factor()); + setDPInScale(window->get_screen()->get_resolution(), ::scale); + direction = window->get_direction(); } void RTScalable::resizeImage(Cairo::RefPtr &surf, double factor) { + if (options.fontFamily != "default") { + factor *= options.fontSize / 9; + } int newWidth = int((double)surf->get_width() * factor); int newHeight = int((double)surf->get_height() * factor); printf("Resizing from %dx%d to %dx%d (factor: %.5f)\n", surf->get_width(), surf->get_height(), newWidth, newHeight, factor); diff --git a/rtgui/rtscalable.h b/rtgui/rtscalable.h index 9f3f913b9..c375da46c 100644 --- a/rtgui/rtscalable.h +++ b/rtgui/rtscalable.h @@ -32,7 +32,7 @@ class RTScalable protected: static void setDPInScale (const double newDPI, const int newScale); - static double getDPI (); + static double getDPI (); // The returned value is tweaked DPI to adapt to main the font size. Maybe not an ideal solution. static int getScale (); static void resizeImage(Cairo::RefPtr &surf, double factor); Gtk::TextDirection getDirection(); diff --git a/rtgui/rtsurface.cc b/rtgui/rtsurface.cc index 4209012b7..d11e2c83f 100644 --- a/rtgui/rtsurface.cc +++ b/rtgui/rtsurface.cc @@ -33,11 +33,17 @@ std::map> surfaceCache; double RTSurface::dpiBack = 0.; int RTSurface::scaleBack = 0; -RTSurface::RTSurface () : RTScalable() { +RTSurface::RTSurface () : RTScalable() +{ Cairo::RefPtr imgSurf(new Cairo::ImageSurface(nullptr, false)); surface = imgSurf; } +RTSurface::RTSurface(const RTSurface& other) : RTScalable() +{ + surface = other.surface; +} + RTSurface::RTSurface (Glib::ustring fileName, Glib::ustring rtlFileName) : RTScalable() { Cairo::RefPtr imgSurf(new Cairo::ImageSurface(nullptr, false)); @@ -84,6 +90,8 @@ void RTSurface::changeImage (Glib::ustring imageName) resizeImage(surface, getDPI() / requestedDPI); } + // 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(surface->cobj(), &x, &y); printf(" -> Cairo::ImageSurface is now %dx%d (scale: %.1f)\n", surface->get_width(), surface->get_height(), (float)x); @@ -93,6 +101,7 @@ void RTSurface::changeImage (Glib::ustring imageName) surface->flush(); printf(" Cairo::ImageSurface is now %dx%d (scale: %.1f)\n", surface->get_width(), surface->get_height(), (float)x); } + */ iterator = surfaceCache.emplace (imageName, surface).first; } @@ -100,12 +109,12 @@ void RTSurface::changeImage (Glib::ustring imageName) surface = iterator->second; } -int RTSurface::getWidth() +int RTSurface::getWidth() const { return surface ? surface->get_width() : -1; } -int RTSurface::getHeight() +int RTSurface::getHeight() const { return surface ? surface->get_height() : -1; } @@ -130,3 +139,8 @@ void RTSurface::from(Glib::RefPtr other) { surface = other->surface; } + +bool RTSurface::hasSurface() const +{ + return surface ? true : false; +} diff --git a/rtgui/rtsurface.h b/rtgui/rtsurface.h index 4c2c50bb3..c40fa2850 100644 --- a/rtgui/rtsurface.h +++ b/rtgui/rtsurface.h @@ -33,12 +33,14 @@ public: Cairo::RefPtr surface; RTSurface (); + RTSurface (const RTSurface& other); RTSurface (Glib::ustring fileName, Glib::ustring rtlFileName = Glib::ustring()); void setImage (Glib::ustring fileName, Glib::ustring rtlFileName = Glib::ustring()); void changeImage (Glib::ustring imageName); - int getWidth(); - int getHeight(); + int getWidth() const; + int getHeight() const; + bool hasSurface() const; static void init(); static void updateImages (); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 9499c2902..943a4b683 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -25,9 +25,10 @@ #include "cursormanager.h" #include "rtimage.h" #include "whitebalance.h" -#include "rtscalable.h" #include "../rtengine/icons.h" +extern int scale; + #if defined(__APPLE__) static gboolean osx_should_quit_cb (GtkosxApplication *app, gpointer data) @@ -101,11 +102,11 @@ RTWindow::RTWindow () #ifndef WIN32 const std::vector> appIcons = { - RTImage::createFromFile("rawtherapee-logo-16.png"), - RTImage::createFromFile("rawtherapee-logo-24.png"), - RTImage::createFromFile("rawtherapee-logo-48.png"), - RTImage::createFromFile("rawtherapee-logo-128.png"), - RTImage::createFromFile("rawtherapee-logo-256.png") + 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); @@ -406,7 +407,8 @@ bool RTWindow::on_configure_event (GdkEventConfigure* event) } printf("RTWindow::on_configure_event : May update the RTImage and RTSurface\n"); - int newScale = get_window()->get_scale_factor(); + int newScale = scale; + printf("********** scale = %d / get_window()->get_scale_factor() = %d\n", scale, get_window()->get_scale_factor()); double newDPI = get_window()->get_screen()->get_resolution(); RTImage::setDPInScale(newDPI, newScale); // will update the RTImage on scale/resolution change RTSurface::setDPInScale(newDPI, newScale); // will update the RTSurface on scale/resolution change diff --git a/rtgui/splash.cc b/rtgui/splash.cc index f89e50b8e..17c399b45 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -29,7 +29,7 @@ extern Glib::ustring versionString; SplashImage::SplashImage () { - surface = RTImage::createFromFile ("splash.png"); + surface = RTImage::createImgSurfFromFile ("splash.png"); } bool SplashImage::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index f1ca76b7c..ed34c65c7 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -315,7 +315,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () for (size_t i = 0; i < bbIcons.size(); i++) { // Draw the image at 110, 90, except for the outermost 10 pixels. - cc->set_source(bbIcons[i], istartx, istarty); + Gdk::Cairo::set_source_pixbuf(cc, bbIcons[i], istartx, istarty); cc->rectangle(istartx, istarty, bbIcons[i]->get_width(), bbIcons[i]->get_height()); cc->fill(); istartx += bbIcons[i]->get_width() + igap; @@ -329,7 +329,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () for (size_t i = 0; i < bbSpecificityIcons.size(); ++i) { istartx2 -= bbSpecificityIcons[i]->get_width() - igap; - cc->set_source(bbSpecificityIcons[i], istartx2, istarty2 - bbSpecificityIcons[i]->get_height()); + Gdk::Cairo::set_source_pixbuf(cc, bbSpecificityIcons[i], istartx2, istarty2 - bbSpecificityIcons[i]->get_height()); cc->rectangle(istartx2, istarty2 - bbSpecificityIcons[i]->get_height(), bbSpecificityIcons[i]->get_width(), bbSpecificityIcons[i]->get_height()); cc->fill(); } @@ -700,14 +700,14 @@ bool ThumbBrowserEntryBase::insideWindow (int x, int y, int w, int h) return !(ofsX + startx > x + w || ofsX + startx + exp_width < x || ofsY + starty > y + h || ofsY + starty + exp_height < y); } -std::vector > ThumbBrowserEntryBase::getIconsOnImageArea() +std::vector > ThumbBrowserEntryBase::getIconsOnImageArea() { - return std::vector >(); + return std::vector >(); } -std::vector > ThumbBrowserEntryBase::getSpecificityIconsOnImageArea() +std::vector > ThumbBrowserEntryBase::getSpecificityIconsOnImageArea() { - return std::vector >(); + return std::vector >(); } void ThumbBrowserEntryBase::getIconSize(int& w, int& h) diff --git a/rtgui/thumbbrowserentrybase.h b/rtgui/thumbbrowserentrybase.h index ef2c01ea6..8237b7c6b 100644 --- a/rtgui/thumbbrowserentrybase.h +++ b/rtgui/thumbbrowserentrybase.h @@ -82,8 +82,8 @@ protected: Glib::RefPtr backBuffer; bool bbSelected, bbFramed; guint8* bbPreview; - std::vector > bbIcons; - std::vector > bbSpecificityIcons; + std::vector > bbIcons; + std::vector > bbSpecificityIcons; CursorShape cursor_type; void drawFrame (Cairo::RefPtr cr, const Gdk::RGBA& bg, const Gdk::RGBA& fg); @@ -188,8 +188,8 @@ public: virtual void drawProgressBar (Glib::RefPtr win, const Gdk::RGBA& foregr, const Gdk::RGBA& backgr, int x, int w, int y, int h) {} - virtual std::vector > getIconsOnImageArea (); - virtual std::vector > getSpecificityIconsOnImageArea (); + virtual std::vector > getIconsOnImageArea (); + virtual std::vector > getSpecificityIconsOnImageArea (); virtual void getIconSize (int& w, int& h); virtual bool motionNotify (int x, int y); diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index 6866d6e19..564ff5ee0 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -34,34 +34,34 @@ using namespace rtengine; using namespace rtengine::procparams; -Glib::RefPtr WhiteBalance::wbIcon[toUnderlying(WBEntry::Type::CUSTOM) + 1]; +Glib::RefPtr WhiteBalance::wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM) + 1]; /* -Glib::RefPtr WhiteBalance::wbCameraPB, WhiteBalance::wbAutoPB, WhiteBalance::wbSunPB, WhiteBalance::wbTungstenPB, +Glib::RefPtr WhiteBalance::wbCameraPB, WhiteBalance::wbAutoPB, WhiteBalance::wbSunPB, WhiteBalance::wbTungstenPB, WhiteBalance::wbCloudyPB, WhiteBalance::wbShadePB, WhiteBalance::wbFluorescentPB, WhiteBalance::wbLampPB, WhiteBalance::wbFlashPB, WhiteBalance::wbLedPB, WhiteBalance::wbCustomPB; */ void WhiteBalance::init () { - wbIcon[toUnderlying(WBEntry::Type::CAMERA)] = Glib::RefPtr( new RTImage("wb-camera-small.png")); - wbIcon[toUnderlying(WBEntry::Type::AUTO)] = Glib::RefPtr( new RTImage("wb-auto-small.png")); - wbIcon[toUnderlying(WBEntry::Type::DAYLIGHT)] = Glib::RefPtr( new RTImage("wb-sun-small.png")); - wbIcon[toUnderlying(WBEntry::Type::CLOUDY)] = Glib::RefPtr( new RTImage("wb-cloudy-small.png")); - wbIcon[toUnderlying(WBEntry::Type::SHADE)] = Glib::RefPtr( new RTImage("wb-shade-small.png")); - wbIcon[toUnderlying(WBEntry::Type::WATER)] = Glib::RefPtr( new RTImage("wb-water-small.png")); - //wbIcon[toUnderlying(WBEntry::Type::WATER2)] = Glib::RefPtr( new RTImage("wb-water-small.png")); - wbIcon[toUnderlying(WBEntry::Type::TUNGSTEN)] = Glib::RefPtr( new RTImage("wb-tungsten-small.png")); - wbIcon[toUnderlying(WBEntry::Type::FLUORESCENT)] = Glib::RefPtr( new RTImage("wb-fluorescent-small.png")); - wbIcon[toUnderlying(WBEntry::Type::LAMP)] = Glib::RefPtr( new RTImage("wb-lamp-small.png")); - wbIcon[toUnderlying(WBEntry::Type::FLASH)] = Glib::RefPtr( new RTImage("wb-flash-small.png")); - wbIcon[toUnderlying(WBEntry::Type::LED)] = Glib::RefPtr( new RTImage("wb-led-small.png")); - wbIcon[toUnderlying(WBEntry::Type::CUSTOM)] = Glib::RefPtr( new RTImage("wb-custom-small.png")); + 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 (unsigned int i = 0; i < toUnderlying(WBEntry::Type::CUSTOM) + 1; i++) { - wbIcon[i].reset(); + wbPixbufs[i].reset(); } } @@ -175,7 +175,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] = wbIcon[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLUO_HEADER"); row[methodColumns.colId] = i + 100; } @@ -183,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] = wbIcon[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_WATER_HEADER"); row[methodColumns.colId] = i + 100; } @@ -191,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] = wbIcon[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LAMP_HEADER"); row[methodColumns.colId] = i + 100; } @@ -199,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] = wbIcon[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LED_HEADER"); row[methodColumns.colId] = i + 100; } @@ -207,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] = wbIcon[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLASH_HEADER"); row[methodColumns.colId] = i + 100; } @@ -220,12 +220,12 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB || currType == WBEntry::Type::LED ) { childrow = *(refTreeModel->append(row.children())); - childrow[methodColumns.colIcon] = wbIcon[toUnderlying(currType)]; + childrow[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; childrow[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; childrow[methodColumns.colId] = i; } else { row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbIcon[toUnderlying(currType)]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; row[methodColumns.colId] = i; } diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index 42275e93f..2db46b7af 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -45,7 +45,7 @@ protected: class MethodColumns : public Gtk::TreeModel::ColumnRecord { public: - Gtk::TreeModelColumn< Glib::RefPtr > colIcon; + Gtk::TreeModelColumn< Glib::RefPtr > colIcon; Gtk::TreeModelColumn colLabel; Gtk::TreeModelColumn colId; MethodColumns() @@ -56,7 +56,7 @@ protected: } }; - static Glib::RefPtr wbIcon[rtengine::toUnderlying(rtengine::procparams::WBEntry::Type::CUSTOM) + 1]; + static Glib::RefPtr wbPixbufs[rtengine::toUnderlying(rtengine::procparams::WBEntry::Type::CUSTOM) + 1]; Glib::RefPtr refTreeModel; MethodColumns methodColumns; MyComboBox* method;