diff --git a/CMakeLists.txt b/CMakeLists.txt index 55d8ef011..6ef2b45f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,15 +203,15 @@ endif (AUTO_GDK_FLUSH) # check for libraries find_package(PkgConfig) -pkg_check_modules (GTK REQUIRED gtk+-2.0>=2.12) -pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.16) -pkg_check_modules (GLIBMM REQUIRED glibmm-2.4>=2.16) -pkg_check_modules (GTKMM REQUIRED gtkmm-2.4>=2.22) -pkg_check_modules (GIO REQUIRED gio-2.0>=2.16) -pkg_check_modules (GIOMM REQUIRED giomm-2.4>=2.12) -pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.16) -pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.16) -pkg_check_modules (SIGC REQUIRED sigc++-2.0) +pkg_check_modules (GTK REQUIRED gtk+-3.0>=3.16) +pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.44) +pkg_check_modules (GLIBMM REQUIRED glibmm-2.4>=2.44) +pkg_check_modules (GTKMM REQUIRED gtkmm-3.0>=3.16) +pkg_check_modules (GIO REQUIRED gio-2.0>=2.44) +pkg_check_modules (GIOMM REQUIRED giomm-2.4>=2.44) +pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.44) +pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.44) +pkg_check_modules (SIGC REQUIRED sigc++-2.0>=2.4) # NOTE: The new mechanism has been tested with BUILD_SHARED = OFF if (WIN32) add_definitions (-DWIN32) @@ -225,8 +225,8 @@ if (WIN32) set (EXTRA_LIB "-lws2_32 -lshlwapi") endif (WIN32) # you may need lcms v1.xx for older version : pkg_check_modules (LCMS REQUIRED lcms<=1.99) -pkg_check_modules (LCMS REQUIRED lcms2) -find_package (EXPAT REQUIRED expat>=2.0) +pkg_check_modules (LCMS REQUIRED lcms2>=2.6) +pkg_check_modules (EXPAT REQUIRED expat>=2.1) pkg_check_modules (FFTW3F REQUIRED fftw3f) pkg_check_modules (IPTCDATA REQUIRED libiptcdata) pkg_check_modules(FFTW3 fftw3) @@ -245,9 +245,9 @@ if (WITH_BZIP) endif (BZIP2_FOUND) endif (WITH_BZIP) -#Check for libcanberra-gtk (sound events on Linux) +#Check for libcanberra-gtk3 (sound events on Linux) if (UNIX AND (NOT APPLE)) - pkg_check_modules (CANBERRA-GTK REQUIRED libcanberra-gtk) + pkg_check_modules (CANBERRA-GTK REQUIRED libcanberra-gtk3) endif (UNIX AND (NOT APPLE)) if (WITH_MYFILE_MMAP) diff --git a/rtdata/languages/default b/rtdata/languages/default index ad2c8ae28..8adf5409d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -199,6 +199,7 @@ FILECHOOSER_FILTER_SAME;Same format as current photo FILECHOOSER_FILTER_TIFF;TIFF files GENERAL_ABOUT;About GENERAL_AFTER;After +GENERAL_APPLY;Apply GENERAL_ASIMAGE;As Image GENERAL_AUTO;Automatic GENERAL_BEFORE;Before @@ -214,6 +215,7 @@ GENERAL_NA;n/a GENERAL_NONE;None GENERAL_NO;No GENERAL_OK;OK +GENERAL_OPEN;Open GENERAL_PORTRAIT;Portrait GENERAL_SAVE;Save GENERAL_UNCHANGED;(Unchanged) diff --git a/rtdata/themes/rtcommon.css b/rtdata/themes/rtcommon.css new file mode 100644 index 000000000..6c9b3b179 --- /dev/null +++ b/rtdata/themes/rtcommon.css @@ -0,0 +1,198 @@ +/* + This file is part of RawTherapee. + + Copyright (c) 2004-2011 Gabor Horvath + + RawTherapee is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + RawTherapee is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with RawTherapee. If not, see . + + + Please keep this gtkrc in sync with the other ones from Clearlooks based themes. +*/ + +@define-color rt_salt_pinch #95B0DB; +@define-color rt_base_color #dddddd; +@define-color rt_fg_color #0A0A0A; +@define-color rt_tooltip_fg_color #000000; +@define-color rt_selected_bg_color #95B0DB; +@define-color rt_selected_fg_color #FFFFFF; +@define-color rt_text_color #000000; +@define-color rt_bg_color #A1A1A1; +@define-color rt_tooltip_bg_color #F5F5B5; +@define-color rt_tool_bg #a0a0a0; +@define-color rt_tool_border #7d7d7d; + +GtkLabel, GtkComboBox, GtkEntry, GtkDrawingArea, GtkTreeView, GtkListTree { + color: #AAAAAA; +} + +GtkFrame > GtkLabel { + color: #EEEEEE; +} + +GtkComboBox:insensitive, GtkButton:insensitive { + color: #686868; +} + +ProgressBar { + padding: 5px; +} + +GtkDrawingArea { + border-radius: 0; +} + +GtkDrawingArea:selected { + color: #CCCCCC; + background-color: #505050; +} + +GtkDrawingArea:active { + color: #D8D8D8; + background-color: #505050; +} + +GtkDrawingArea:hover { + color: #D8D8D8; +} + +GtkLabel:insensitive, GtkEntry:insensitive, GtkSpinButton:insensitive { + color: rgba(128,128,128,0.5); +} + +/* Normal state */ +GtkImage { + margin: 2px; + padding: 2px; +} + +GtkFrame { + background-color: rgba(128,128,128,0.15); +} + +GtkNotebook tab GtkLabel, +GtkNotebook tab GtkImage { + margin: 2px; + padding: 4px; + font-size: 120%; + font-weight: bold; +} + +GtkNotebook { + padding: 5px; +} + +GtkButton { + margin: 2px; + padding: 2px; + border-style: solid; + border-width: 1px; + border-radius: 4px; + color: #AAAAAA; +} +GtkButton.RTFlat { + border-style: none; + border-radius: 0; +} +GtkButton.RTFlat:hover { + border-style: none; +} + +/* Horizontal group of buttons in 1 column */ +GtkButton.Top { + border-radius: 4px 4px 0 0; + border-style: solid solid none solid; + margin-bottom: 0; +} +GtkButton.MiddleV { + border-radius: 0; + border-style: none solid none solid; + margin-top: 0; + margin-bottom: 0; +} +GtkButton.Bottom { + border-radius: 0 0 4px 4px; + border-style: none solid solid solid; + margin-top: 0; +} +/* Horizontal group of buttons in 1 row */ +GtkButton.Left { + border-radius: 4px 0 0 4px; + border-style: solid none solid solid; + margin-right: 0; +} +GtkButton.MiddleH { + border-radius: 0; + border-style: solid none solid none; + margin-left: 0; + margin-right: 0; +} +GtkButton.Right { + border-radius: 0 4px 4px 0; + border-style: solid solid solid none; + margin-left: 0; +} + +GtkEntry, GtkSpinButton { + padding: 2px; + margin: 2px; +} + + +GtkNotebook tab GtkButton, GtkNotebook tab GtkImage { + padding: 1px; +} + +GtkMenu { + background-color: #1A1A1A; +} + +GtkMenu GtkSeparator { +} + +#ExpanderBox { + background-color: #2F3333; + border-color: #252525; + border-style: solid; + border-width: 1px; + border-radius: 4px; +} + +#ExpanderBox2 { + background-color: #424747; + border-color: #282b2b; + border-style: solid; + border-width: 1px; + border-radius: 4px; +} + +#MyExpanderTitle { + font-size: 120%; +} +#MyExpanderTitle GtkLabel { + color: #CCCCCC; +} +#MyExpanderTitle:hover { + background-color: rgba(230, 255, 255, 0.15); +} +#MyExpanderTitle:hover GtkLabel { + color: #D8D8D8; +} + +#ExpanderBox2 GtkSeparator, #ExpanderBox3 GtkSeparator { + color: #1A1A1A; +} + +.BIG { + padding: 8pt; +} diff --git a/rtdata/themes/slim.css b/rtdata/themes/slim.css new file mode 100644 index 000000000..6a878976e --- /dev/null +++ b/rtdata/themes/slim.css @@ -0,0 +1,23 @@ +/* + This file is part of RawTherapee. + + Copyright (c) 2004-2011 Gabor Horvath + + RawTherapee is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + RawTherapee is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with RawTherapee. If not, see . +*/ + +* { + padding: 1px; + margin: 1px; +} diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc index 19ab16cfb..cc9bafc4d 100644 --- a/rtengine/dfmanager.cc +++ b/rtengine/dfmanager.cc @@ -570,12 +570,13 @@ std::vector *DFManager::getBadPixels ( const std::string &mak, const std found = true; } - if( settings->verbose ) + if( settings->verbose ) { if(found) { printf("%s.badpixels found\n", s.str().c_str()); } else { printf("%s.badpixels not found\n", s.str().c_str()); } + } } @@ -589,12 +590,13 @@ std::vector *DFManager::getBadPixels ( const std::string &mak, const std found = true; } - if( settings->verbose ) + if( settings->verbose ) { if(found) { printf("%s.badpixels found\n", s.str().c_str()); } else { printf("%s.badpixels not found\n", s.str().c_str()); } + } } if(!found) { diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index 0c2509e7d..b2f76a9ad 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -24,6 +24,7 @@ #include "rtthumbnail.h" #include "rawimagesource.h" #include "StopWatch.h" +#include "utils.h" using namespace rtengine; using namespace procparams; @@ -85,26 +86,16 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext unsigned char *dst; #pragma omp for schedule(static,10) - for (unsigned int i = 0; i < (unsigned int)(h); i++) { + for (unsigned int i = 0; i < (unsigned int)(h); ++i) { src = data + i * w * 3; dst = previewImage->get_data() + i * w * 4; - for (unsigned int j = 0; j < (unsigned int)(w); j++) { + for (unsigned int j = 0; j < (unsigned int)(w); ++j) { unsigned char r = *(src++); unsigned char g = *(src++); unsigned char b = *(src++); -#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ - *(dst++) = b; - *(dst++) = g; - *(dst++) = r; - *(dst++) = 0; -#else - *(dst++) = 0; - *(dst++) = r; - *(dst++) = g; - *(dst++) = b; -#endif + poke255_uc(dst, r, g, b); } } } @@ -179,17 +170,8 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext unsigned char r = *(src++); unsigned char g = *(src++); unsigned char b = *(src++); -#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ - *(dst++) = b; - *(dst++) = g; - *(dst++) = r; - *(dst++) = 0; -#else - *(dst++) = 0; - *(dst++) = r; - *(dst++) = g; - *(dst++) = b; -#endif + + poke255_uc(dst, r, g, b); } } } diff --git a/rtengine/previewimage.h b/rtengine/previewimage.h index 5135ddd9a..26b9a85d2 100644 --- a/rtengine/previewimage.h +++ b/rtengine/previewimage.h @@ -20,7 +20,7 @@ #define _PREVIEWIMAGE_ #include -#include "cairomm/cairomm.h" +#include namespace rtengine { diff --git a/rtengine/utils.cc b/rtengine/utils.cc index b45e4b436..2366f3a0c 100644 --- a/rtengine/utils.cc +++ b/rtengine/utils.cc @@ -29,6 +29,51 @@ using namespace std; namespace rtengine { +void poke255_uc(unsigned char* &dest, unsigned char r, unsigned char g, unsigned char b) +{ +#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ + *(dest++) = b; + *(dest++) = g; + *(dest++) = r; + *(dest++) = 0; +#else + *(dest++) = 0; + *(dest++) = r; + *(dest++) = g; + *(dest++) = b; +#endif +} + +void poke01_d(unsigned char* &dest, double r, double g, double b) +{ +#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ + *(dest++) = (unsigned char)(b * 255.); + *(dest++) = (unsigned char)(g * 255.); + *(dest++) = (unsigned char)(r * 255.); + *(dest++) = 0; +#else + *(dest++) = 0; + *(dest++) = (unsigned char)(r * 255.); + *(dest++) = (unsigned char)(g * 255.); + *(dest++) = (unsigned char)(b * 255.); +#endif +} + +void poke01_f(unsigned char* &dest, float r, float g, float b) +{ +#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ + *(dest++) = (unsigned char)(b * 255.f); + *(dest++) = (unsigned char)(g * 255.f); + *(dest++) = (unsigned char)(r * 255.f); + *(dest++) = 0; +#else + *(dest++) = 0; + *(dest++) = (unsigned char)(r * 255.f); + *(dest++) = (unsigned char)(g * 255.f); + *(dest++) = (unsigned char)(b * 255.f); +#endif +} + void bilinearInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh) { diff --git a/rtengine/utils.h b/rtengine/utils.h index 3040e39b9..1e742ffb3 100644 --- a/rtengine/utils.h +++ b/rtengine/utils.h @@ -22,6 +22,13 @@ namespace rtengine { +// update a point of a Cairo::Surface by accessing the raw data +void poke255_uc(unsigned char* &dest, unsigned char r, unsigned char g, unsigned char b); +// update a point of a Cairo::Surface by accessing the raw data +void poke01_d(unsigned char* &dest, double r, double g, double b); +// update a point of a Cairo::Surface by accessing the raw data +void poke01_f(unsigned char* &dest, float r, float g, float b); + void bilinearInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh); void nearestInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh); void rotate (unsigned char* img, int& w, int& h, int deg); diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index c47f27e2e..f571e9923 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -35,13 +35,27 @@ static double one2one(double val) Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1, Gtk::Image *imgIcon2, double2double_fun slider2value_, double2double_fun value2slider_) { - Gtk::HBox *hbox2 = NULL; + set_orientation(Gtk::ORIENTATION_VERTICAL); + set_hexpand(true); + set_vexpand(false); label = NULL; adjusterListener = NULL; afterReset = false; blocked = false; automatic = NULL; eventPending = false; + grid = NULL; + imageIcon1 = imgIcon1; + + if (imageIcon1) { + setExpandAlignProperties(imageIcon1, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + } + + imageIcon2 = imgIcon2; + + if (imageIcon2) { + setExpandAlignProperties(imageIcon2, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + } slider2value = slider2value_ ? slider2value_ : one2one; value2slider = value2slider_ ? value2slider_ : one2one; @@ -54,75 +68,74 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep delay = options.adjusterDelay; // delay is no more static, so we can set the delay individually (useful for the RAW editor tab) set_border_width (0); - set_spacing (0); - - hbox = Gtk::manage (new Gtk::HBox ()); - hbox->set_border_width(0); - hbox->set_spacing(2); + set_column_spacing(0); + set_column_homogeneous(false); + set_row_spacing(0); + set_row_homogeneous(false); editedCheckBox = NULL; if (!vlabel.empty()) { adjustmentName = vlabel; - label = Gtk::manage (new Gtk::Label (adjustmentName, Gtk::ALIGN_LEFT)); + label = Gtk::manage (new Gtk::Label (adjustmentName)); + setExpandAlignProperties(label, true, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); } reset = Gtk::manage (new Gtk::Button ()); reset->add (*Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png"))); + setExpandAlignProperties(reset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); reset->set_relief (Gtk::RELIEF_NONE); - reset->set_border_width (0); reset->set_tooltip_text (M("ADJUSTER_RESET_TO_DEFAULT")); + reset->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); reset->set_can_focus(false); spin = Gtk::manage (new MySpinButton ()); - spin->set_has_frame(false); - spin->set_name("FramelessSpinButton"); + setExpandAlignProperties(spin, false, false, Gtk::ALIGN_CENTER, !vlabel.empty() ? Gtk::ALIGN_BASELINE : 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); slider = Gtk::manage (new MyHScale ()); + setExpandAlignProperties(slider, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); slider->set_draw_value (false); - - pack_start (*hbox, true, true); + //slider->set_has_origin(false); // ------------------ This will remove the colored part on the left of the slider's knob if (vlabel.empty()) { - // No label, everything goes in hbox - if (imgIcon1) { - hbox->pack_start (*imgIcon1, Gtk::PACK_SHRINK, 0); + // No label, everything goes in a single row + attach_next_to(*slider, Gtk::POS_LEFT, 1, 1); + + if (imageIcon1) { + attach_next_to(*imageIcon1, *slider, Gtk::POS_LEFT, 1, 1); } - hbox->pack_start (*slider, Gtk::PACK_EXPAND_WIDGET, 0); - - if (imgIcon2) { - hbox->pack_start (*imgIcon2, Gtk::PACK_SHRINK, 0); + if (imageIcon2) { + attach_next_to(*imageIcon2, *slider, Gtk::POS_RIGHT, 1, 1); + attach_next_to(*spin, *imageIcon2, Gtk::POS_RIGHT, 1, 1); + } else { + attach_next_to(*spin, *slider, Gtk::POS_RIGHT, 1, 1); } - hbox->pack_end (*reset, Gtk::PACK_SHRINK, 0); - hbox->pack_end (*spin, Gtk::PACK_SHRINK, 0); + attach_next_to(*reset, *spin, Gtk::POS_RIGHT, 1, 1); } else { // A label is provided, spreading the widgets in 2 rows - hbox->pack_start (*label); - hbox->pack_end (*reset, Gtk::PACK_SHRINK, 0); - hbox->pack_end (*spin, Gtk::PACK_SHRINK, 0); + attach_next_to(*label, Gtk::POS_LEFT, 1, 1); + attach_next_to(*spin, Gtk::POS_RIGHT, 1, 1); + // A second HBox is necessary + grid = Gtk::manage(new Gtk::Grid()); + grid->attach_next_to(*slider, Gtk::POS_LEFT, 1, 1); - if (!imgIcon1 || !imgIcon2) { - pack_start (*slider, true, true); - } else { - // A second HBox is necessary - hbox2 = Gtk::manage (new Gtk::HBox()); - - if (imgIcon1) { - hbox2->pack_start (*imgIcon1, Gtk::PACK_SHRINK, 0); - } - - hbox2->pack_start (*slider, true, true); - - if (imgIcon2) { - hbox2->pack_start (*imgIcon2, Gtk::PACK_SHRINK, 0); - } - - pack_start (*hbox2, true, true); + if (imageIcon1) { + grid->attach_next_to(*imageIcon1, *slider, Gtk::POS_LEFT, 1, 1); } + + if (imageIcon2) { + grid->attach_next_to(*imageIcon2, Gtk::POS_RIGHT, 1, 1); + grid->attach_next_to(*reset, *imageIcon2, Gtk::POS_RIGHT, 1, 1); + } else { + grid->attach_next_to(*reset, *slider, Gtk::POS_RIGHT, 1, 1); + } + + attach_next_to(*grid, *label, Gtk::POS_BOTTOM, 2, 1); } setLimits (vmin, vmax, vstep, vdefault); @@ -135,7 +148,6 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep sliderChange = slider->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::sliderChanged) ); spinChange = spin->signal_value_changed().connect ( sigc::mem_fun(*this, &Adjuster::spinChanged), true); reset->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &Adjuster::resetPressed) ); - slider->set_update_policy (Gtk::UPDATE_CONTINUOUS); show_all (); } @@ -158,19 +170,24 @@ void Adjuster::addAutoButton (Glib::ustring tooltip) if (!automatic) { automatic = new Gtk::CheckButton (); //automatic->add (*Gtk::manage (new RTImage ("processing.png"))); - automatic->set_border_width (0); 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) ); - hbox->pack_end (*automatic, Gtk::PACK_SHRINK, 0); - hbox->reorder_child (*automatic, 0); + if (grid) { + // Hombre, adding the checbox next to the reset button because adding it next to the spin button (as before) + // would diminish the available size for the label and would require a much heavier reorganization of the grid ! + grid->attach_next_to(*automatic, *reset, Gtk::POS_RIGHT, 1, 1); + } else { + attach_next_to(*automatic, *reset, Gtk::POS_RIGHT, 1, 1); + } } } void Adjuster::delAutoButton () { if (automatic) { - removeIfThere(hbox, automatic); + removeIfThere(grid, automatic); delete automatic; automatic = NULL; } @@ -524,13 +541,30 @@ void Adjuster::showEditedCB () { if (label) { - removeIfThere(hbox, label, false); + removeIfThere(this, label, false); } if (!editedCheckBox) { editedCheckBox = Gtk::manage(new Gtk::CheckButton (adjustmentName)); - hbox->pack_start (*editedCheckBox, Gtk::PACK_SHRINK, 2); - hbox->reorder_child (*editedCheckBox, 0); + editedCheckBox->set_vexpand(false); + + if (grid) { + editedCheckBox->set_hexpand(true); + editedCheckBox->set_halign(Gtk::ALIGN_START); + editedCheckBox->set_valign(Gtk::ALIGN_CENTER); + attach_next_to(*editedCheckBox, *spin, Gtk::POS_LEFT, 1, 1); + } else { + editedCheckBox->set_hexpand(false); + editedCheckBox->set_halign(Gtk::ALIGN_START); + editedCheckBox->set_valign(Gtk::ALIGN_CENTER); + + if (imageIcon1) { + attach_next_to(*editedCheckBox, *imageIcon1, Gtk::POS_LEFT, 1, 1); + } else { + attach_next_to(*editedCheckBox, *slider, Gtk::POS_LEFT, 1, 1); + } + } + editedChange = editedCheckBox->signal_toggled().connect( sigc::mem_fun(*this, &Adjuster::editedToggled) ); editedCheckBox->show(); } @@ -539,7 +573,7 @@ void Adjuster::showEditedCB () void Adjuster::refreshLabelStyle () { - /* Glib::RefPtr style = label->get_style (); + /* Glib::RefPtr style = label->get_style_context (); Pango::FontDescription fd = style->get_font (); fd.set_weight (editedState==Edited ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL); style->set_font (fd); diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index 4b9ad36a4..7ee2c7f7d 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -35,13 +35,15 @@ public: typedef double(*double2double_fun)(double val); -class Adjuster : public Gtk::VBox +class Adjuster : public Gtk::Grid { protected: Glib::ustring adjustmentName; - Gtk::HBox* hbox; + Gtk::Grid* grid; Gtk::Label* label; + Gtk::Image *imageIcon1; + Gtk::Image *imageIcon2; MyHScale* slider; MySpinButton* spin; Gtk::Button* reset; @@ -144,6 +146,7 @@ public: void setNbDisplayedChars (int nbr) { spin->set_width_chars(nbr); + spin->set_max_width_chars(nbr); } void setEditedState (EditedState eState); EditedState getEditedState (); diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 8dc843a8e..36dcc0dc5 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -52,31 +52,28 @@ BatchQueue::BatchQueue (FileCatalog* aFileCatalog) : processing(NULL), fileCatal pmenu->attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1); p++; - pmenu->attach (*Gtk::manage(head = new Gtk::ImageMenuItem (M("FILEBROWSER_POPUPMOVEHEAD"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(head = new MyImageMenuItem (M("FILEBROWSER_POPUPMOVEHEAD"), "toleftend.png")), 0, 1, p, p + 1); p++; - head->set_image(*Gtk::manage(new RTImage ("toleftend.png"))); - pmenu->attach (*Gtk::manage(tail = new Gtk::ImageMenuItem (M("FILEBROWSER_POPUPMOVEEND"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(tail = new MyImageMenuItem (M("FILEBROWSER_POPUPMOVEEND"), "torightend.png")), 0, 1, p, p + 1); p++; - tail->set_image(*Gtk::manage(new RTImage ("torightend.png"))); pmenu->attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1); p++; - pmenu->attach (*Gtk::manage(cancel = new Gtk::ImageMenuItem (M("FILEBROWSER_POPUPCANCELJOB"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(cancel = new MyImageMenuItem (M("FILEBROWSER_POPUPCANCELJOB"), "gtk-close.png")), 0, 1, p, p + 1); p++; - cancel->set_image(*Gtk::manage(new RTImage ("gtk-close.png"))); pmenu->show_all (); // Accelerators pmaccelgroup = Gtk::AccelGroup::create (); pmenu->set_accel_group (pmaccelgroup); - open->add_accelerator ("activate", pmenu->get_accel_group(), GDK_e, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); - selall->add_accelerator ("activate", pmenu->get_accel_group(), GDK_a, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); - head->add_accelerator ("activate", pmenu->get_accel_group(), GDK_Home, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); - tail->add_accelerator ("activate", pmenu->get_accel_group(), GDK_End, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); - cancel->add_accelerator ("activate", pmenu->get_accel_group(), GDK_Delete, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); + open->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_e, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + selall->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_a, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + head->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Home, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); + tail->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_End, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); + cancel->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Delete, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); open->signal_activate().connect(sigc::mem_fun(*this, &BatchQueue::openLastSelectedItemInEditor)); cancel->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &BatchQueue::cancelItems), &selected)); @@ -154,19 +151,19 @@ bool BatchQueue::keyPressed (GdkEventKey* event) { bool ctrl = event->state & GDK_CONTROL_MASK; - if ((event->keyval == GDK_A || event->keyval == GDK_a) && ctrl) { + if ((event->keyval == GDK_KEY_A || event->keyval == GDK_KEY_a) && ctrl) { selectAll (); return true; - } else if ((event->keyval == GDK_E || event->keyval == GDK_e) && ctrl) { + } else if ((event->keyval == GDK_KEY_E || event->keyval == GDK_KEY_e) && ctrl) { openLastSelectedItemInEditor(); return true; - } else if (event->keyval == GDK_Home) { + } else if (event->keyval == GDK_KEY_Home) { headItems (&selected); return true; - } else if (event->keyval == GDK_End) { + } else if (event->keyval == GDK_KEY_End) { tailItems (&selected); return true; - } else if (event->keyval == GDK_Delete) { + } else if (event->keyval == GDK_KEY_Delete) { cancelItems (&selected); return true; } @@ -1052,7 +1049,6 @@ struct NLParams { int bqnotifylistenerUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected NLParams* params = static_cast(data); params->listener->queueSizeChanged (params->qsize, params->queueEmptied, params->queueError, params->queueErrorMessage); delete params; @@ -1074,7 +1070,7 @@ void BatchQueue::notifyListener (bool queueEmptied) } params->queueEmptied = queueEmptied; params->queueError = false; - g_idle_add (bqnotifylistenerUI, params); + add_idle (bqnotifylistenerUI, params); } } @@ -1104,6 +1100,6 @@ void BatchQueue::error (Glib::ustring msg) params->queueEmptied = false; params->queueError = true; params->queueErrorMessage = msg; - g_idle_add (bqnotifylistenerUI, params); + add_idle (bqnotifylistenerUI, params); } } diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index 4e97ebc9f..fdfa57f4f 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -52,9 +52,9 @@ protected: Glib::ustring nameTemplate; - Gtk::ImageMenuItem* cancel; - Gtk::ImageMenuItem* head; - Gtk::ImageMenuItem* tail; + MyImageMenuItem* cancel; + MyImageMenuItem* head; + MyImageMenuItem* tail; Gtk::MenuItem* selall; Gtk::MenuItem* open; Gtk::Menu* pmenu; diff --git a/rtgui/batchqueuebuttonset.cc b/rtgui/batchqueuebuttonset.cc index 380c4abe3..f3023d838 100644 --- a/rtgui/batchqueuebuttonset.cc +++ b/rtgui/batchqueuebuttonset.cc @@ -20,8 +20,6 @@ #include "multilangmgr.h" #include "../rtengine/safegtk.h" -extern Glib::ustring argv0; - bool BatchQueueButtonSet::iconsLoaded = false; Cairo::RefPtr BatchQueueButtonSet::cancelIcon; diff --git a/rtgui/batchqueueentry.cc b/rtgui/batchqueueentry.cc index f5ca6a6d5..b7d48f80e 100644 --- a/rtgui/batchqueueentry.cc +++ b/rtgui/batchqueueentry.cc @@ -98,7 +98,7 @@ void BatchQueueEntry::calcThumbnailSize () } -void BatchQueueEntry::drawProgressBar (Glib::RefPtr win, Glib::RefPtr gc, const Gdk::Color& foregr, const Gdk::Color& backgr, int x, int w, int y, int h) +void BatchQueueEntry::drawProgressBar (Glib::RefPtr win, const Gdk::RGBA& foregr, const Gdk::RGBA& backgr, int x, int w, int y, int h) { if (processing) { @@ -112,19 +112,19 @@ void BatchQueueEntry::drawProgressBar (Glib::RefPtr win, Glib::RefP cr->line_to (px + pw, py); cr->set_line_width (ph); cr->set_line_cap (Cairo::LINE_CAP_ROUND); - cr->set_source_rgb (foregr.get_red_p(), foregr.get_green_p(), foregr.get_blue_p()); + cr->set_source_rgb (foregr.get_red(), foregr.get_green(), foregr.get_blue()); cr->stroke (); cr->move_to (px, py); cr->line_to (px + pw, py); cr->set_line_width (ph * 3.0 / 4.0); - cr->set_source_rgb (backgr.get_red_p(), backgr.get_green_p(), backgr.get_blue_p()); + cr->set_source_rgb (backgr.get_red(), backgr.get_green(), backgr.get_blue()); cr->stroke (); cr->move_to (px, py); cr->line_to (px + pw * progress, py); cr->set_line_width (ph / 2.0); - cr->set_source_rgb (foregr.get_red_p(), foregr.get_green_p(), foregr.get_blue_p()); + cr->set_source_rgb (foregr.get_red(), foregr.get_green(), foregr.get_blue()); cr->stroke (); } } diff --git a/rtgui/batchqueueentry.h b/rtgui/batchqueueentry.h index 4ee3eb1a3..c2bf7fd4d 100644 --- a/rtgui/batchqueueentry.h +++ b/rtgui/batchqueueentry.h @@ -60,7 +60,7 @@ public: void refreshThumbnailImage (); void calcThumbnailSize (); - void drawProgressBar (Glib::RefPtr win, Glib::RefPtr gc, const Gdk::Color& foregr, const Gdk::Color& backgr, int x, int w, int y, int h); + void drawProgressBar (Glib::RefPtr win, const Gdk::RGBA& foregr, const Gdk::RGBA& backgr, int x, int w, int y, int h); void removeButtonSet (); diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index db78913b0..d9fec34e5 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -61,8 +61,8 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) // construct batch queue panel with the extra "start" and "stop" button Gtk::VBox* batchQueueButtonBox = Gtk::manage (new Gtk::VBox); - start = Gtk::manage (new Gtk::ToggleButton (M("FILEBROWSER_STARTPROCESSING"))); - stop = Gtk::manage (new Gtk::ToggleButton (M("FILEBROWSER_STOPPROCESSING"))); + start = Gtk::manage (new Gtk::ToggleButton ()); + stop = Gtk::manage (new Gtk::ToggleButton ()); autoStart = Gtk::manage (new Gtk::CheckButton (M("BATCHQUEUE_AUTOSTART"))); start->set_tooltip_markup (M("FILEBROWSER_STARTPROCESSINGHINT")); stop->set_tooltip_markup (M("FILEBROWSER_STOPPROCESSINGHINT")); @@ -72,8 +72,10 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) autoStart->set_active (options.procQueueEnabled); start->set_image (*Gtk::manage (new RTImage ("gtk-media-play.png"))); + start->get_style_context()->add_class("BIG"); startConnection = start->signal_toggled().connect (sigc::mem_fun(*this, &BatchQueuePanel::startBatchProc)); stop->set_image (*Gtk::manage (new RTImage ("gtk-media-stop.png"))); + stop->get_style_context()->add_class("BIG"); stopConnection = stop->signal_toggled().connect (sigc::mem_fun(*this, &BatchQueuePanel::stopBatchProc)); batchQueueButtonBox->pack_start (*start, Gtk::PACK_SHRINK, 4); batchQueueButtonBox->pack_start (*stop, Gtk::PACK_SHRINK, 4); @@ -95,7 +97,7 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) useFolder = Gtk::manage (new Gtk::RadioButton (M("PREFERENCES_OUTDIRFOLDER") + ":")); hb3->pack_start (*useFolder, Gtk::PACK_SHRINK, 4); -#if defined(__APPLE__) || defined(__linux__) +#if 0 //defined(__APPLE__) || defined(__linux__) // At the time of writing (2013-11-11) the gtkmm FileChooserButton with ACTION_SELECT_FOLDER // is so buggy on these platforms (OS X and Linux) that we rather employ this ugly button hack. // When/if GTKMM gets fixed we can go back to use the FileChooserButton, like we do on Windows. @@ -105,7 +107,7 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) outdirFolderButton->signal_pressed().connect( sigc::mem_fun(*this, &BatchQueuePanel::pathFolderButtonPressed) ); outdirFolderButton->set_tooltip_markup (M("PREFERENCES_OUTDIRFOLDERHINT")); outdirFolderButton->set_label(makeFolderLabel(options.savePathFolder)); - Gtk::Image* folderImg = Gtk::manage (new Gtk::Image (Gtk::Stock::DIRECTORY, Gtk::ICON_SIZE_MENU)); + Gtk::Image* folderImg = Gtk::manage (new RTImage ("gtk-directory.png")); folderImg->show (); outdirFolderButton->set_image (*folderImg); outdirFolder = 0; @@ -131,9 +133,10 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) // Output file format selection fformat = Gtk::manage (new Gtk::Frame (M("PREFERENCES_FILEFORMAT"))); saveFormatPanel = Gtk::manage (new SaveFormatPanel ()); + setExpandAlignProperties(saveFormatPanel, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); fformat->add (*saveFormatPanel); + fformat->set_border_width(4); - saveFormatPanel->init (options.saveFormatBatch); outdirTemplate->set_text (options.savePathTemplate); useTemplate->set_active (options.saveUsePathTemplate); useFolder->set_active (!options.saveUsePathTemplate); @@ -149,8 +152,8 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) pack_start (*topBox, Gtk::PACK_SHRINK); topBox->pack_start (*batchQueueButtonBox, Gtk::PACK_SHRINK, 4); - topBox->pack_start (*fdir); - topBox->pack_start (*fformat, Gtk::PACK_SHRINK, 4); + topBox->pack_start (*fdir, Gtk::PACK_EXPAND_WIDGET, 4); + topBox->pack_start (*fformat, Gtk::PACK_EXPAND_WIDGET, 4); // add middle browser area pack_start (*batchQueue); @@ -184,6 +187,8 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) show_all (); + saveFormatPanel->init (options.saveFormatBatch); + if (batchQueue->loadBatchQueue ()) { g_idle_add_full (G_PRIORITY_LOW, processLoadedBatchQueueUIThread, batchQueue, NULL); } @@ -218,7 +223,10 @@ void BatchQueuePanel::updateTab (int qsize, int forceOrientation) vbb->set_spacing (2); vbb->set_tooltip_markup (M("MAIN_FRAME_BATCHQUEUE_TOOLTIP")); vbb->show_all (); - nb->set_tab_label(*this, *vbb); + + if (nb) { + nb->set_tab_label(*this, *vbb); + } } else { Gtk::HBox* hbb = Gtk::manage (new Gtk::HBox ()); @@ -236,7 +244,10 @@ void BatchQueuePanel::updateTab (int qsize, int forceOrientation) hbb->set_spacing (2); hbb->set_tooltip_markup (M("MAIN_FRAME_BATCHQUEUE_TOOLTIP")); hbb->show_all (); - nb->set_tab_label(*this, *hbb); + + if (nb) { + nb->set_tab_label(*this, *hbb); + } } } @@ -326,8 +337,8 @@ void BatchQueuePanel::pathFolderButtonPressed () { Gtk::FileChooserDialog fc(M("PREFERENCES_OUTDIRFOLDER"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER ); - fc.add_button( Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - fc.add_button( Gtk::StockID("gtk-ok"), Gtk::RESPONSE_OK); + fc.add_button( "_Cancel", Gtk::RESPONSE_CANCEL); // STOCKICON WAS THERE + fc.add_button( "_OK", Gtk::RESPONSE_OK); // STOCKICON WAS THERE fc.set_filename(options.savePathFolder); fc.set_transient_for(*parent); int result = fc.run(); @@ -361,7 +372,7 @@ bool BatchQueuePanel::handleShortcutKey (GdkEventKey* event) if (ctrl) { switch(event->keyval) { - case GDK_s: + case GDK_KEY_s: if (start->get_active()) { stopBatchProc(); } else { diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index 74da927dd..ba09504a9 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -29,7 +29,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA method = Gtk::manage (new MyComboBoxText ()); for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - method->append_text(procparams::RAWParams::BayerSensor::methodstring[i]); + method->append(procparams::RAWParams::BayerSensor::methodstring[i]); } method->set_active(0); @@ -188,7 +188,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe void BayerProcess::setBatchMode(bool batchMode) { - method->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); method->set_active(procparams::RAWParams::BayerSensor::numMethods); // No name dcbOptions->hide(); lmmseOptions->hide(); diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index d9b426fc8..6aabefad1 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -44,9 +44,9 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB Gtk::Label* metLabel = Gtk::manage (new Gtk::Label (M("TP_BWMIX_MET") + ":")); metHBox->pack_start (*metLabel, Gtk::PACK_SHRINK); method = Gtk::manage (new MyComboBoxText ()); - method->append_text (M("TP_BWMIX_MET_DESAT")); - method->append_text (M("TP_BWMIX_MET_LUMEQUAL")); - method->append_text (M("TP_BWMIX_MET_CHANMIX")); + method->append (M("TP_BWMIX_MET_DESAT")); + method->append (M("TP_BWMIX_MET_LUMEQUAL")); + method->append (M("TP_BWMIX_MET_CHANMIX")); method->set_active (0); metHBox->pack_start (*method); @@ -97,8 +97,6 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB autoconn = autoch->signal_toggled().connect( sigc::mem_fun(*this, &BlackWhite::autoch_toggled) ); neutral = Gtk::manage (new Gtk::Button (M("TP_BWMIX_NEUTRAL"))); - RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); - neutral->set_image(*resetImg); neutral->set_tooltip_text (M("TP_BWMIX_NEUTRAL_TIP")); neutralconn = neutral->signal_pressed().connect( sigc::mem_fun(*this, &BlackWhite::neutral_pressed) ); neutral->show(); @@ -120,21 +118,21 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB settingHBox->pack_start (*settingLabel, Gtk::PACK_SHRINK); setting = Gtk::manage (new MyComboBoxText ()); - setting->append_text (M("TP_BWMIX_SET_NORMCONTAST")); - setting->append_text (M("TP_BWMIX_SET_HIGHCONTAST")); - setting->append_text (M("TP_BWMIX_SET_LUMINANCE")); - setting->append_text (M("TP_BWMIX_SET_LANDSCAPE")); - setting->append_text (M("TP_BWMIX_SET_PORTRAIT")); - setting->append_text (M("TP_BWMIX_SET_LOWSENSIT")); - setting->append_text (M("TP_BWMIX_SET_HIGHSENSIT")); - setting->append_text (M("TP_BWMIX_SET_PANCHRO")); - setting->append_text (M("TP_BWMIX_SET_HYPERPANCHRO")); - setting->append_text (M("TP_BWMIX_SET_ORTHOCHRO")); - setting->append_text (M("TP_BWMIX_SET_RGBABS")); - setting->append_text (M("TP_BWMIX_SET_RGBREL")); - setting->append_text (M("TP_BWMIX_SET_ROYGCBPMABS")); - setting->append_text (M("TP_BWMIX_SET_ROYGCBPMREL")); - setting->append_text (M("TP_BWMIX_SET_INFRARED")); + setting->append (M("TP_BWMIX_SET_NORMCONTAST")); + setting->append (M("TP_BWMIX_SET_HIGHCONTAST")); + setting->append (M("TP_BWMIX_SET_LUMINANCE")); + setting->append (M("TP_BWMIX_SET_LANDSCAPE")); + setting->append (M("TP_BWMIX_SET_PORTRAIT")); + setting->append (M("TP_BWMIX_SET_LOWSENSIT")); + setting->append (M("TP_BWMIX_SET_HIGHSENSIT")); + setting->append (M("TP_BWMIX_SET_PANCHRO")); + setting->append (M("TP_BWMIX_SET_HYPERPANCHRO")); + setting->append (M("TP_BWMIX_SET_ORTHOCHRO")); + setting->append (M("TP_BWMIX_SET_RGBABS")); + setting->append (M("TP_BWMIX_SET_RGBREL")); + setting->append (M("TP_BWMIX_SET_ROYGCBPMABS")); + setting->append (M("TP_BWMIX_SET_ROYGCBPMREL")); + setting->append (M("TP_BWMIX_SET_INFRARED")); setting->set_active (0); settingHBox->pack_start (*setting); @@ -171,15 +169,15 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB Gtk::Label *filterLabel = Gtk::manage (new Gtk::Label (M("TP_BWMIX_FILTER") + ":")); filterHBox->pack_start (*filterLabel, Gtk::PACK_SHRINK); filter = Gtk::manage (new MyComboBoxText ()); - filter->append_text (M("TP_BWMIX_FILTER_NONE")); - filter->append_text (M("TP_BWMIX_FILTER_RED")); - filter->append_text (M("TP_BWMIX_FILTER_REDYELLOW")); - filter->append_text (M("TP_BWMIX_FILTER_YELLOW")); - filter->append_text (M("TP_BWMIX_FILTER_GREENYELLOW")); - filter->append_text (M("TP_BWMIX_FILTER_GREEN")); - filter->append_text (M("TP_BWMIX_FILTER_BLUEGREEN")); - filter->append_text (M("TP_BWMIX_FILTER_BLUE")); - filter->append_text (M("TP_BWMIX_FILTER_PURPLE")); + filter->append (M("TP_BWMIX_FILTER_NONE")); + filter->append (M("TP_BWMIX_FILTER_RED")); + filter->append (M("TP_BWMIX_FILTER_REDYELLOW")); + filter->append (M("TP_BWMIX_FILTER_YELLOW")); + filter->append (M("TP_BWMIX_FILTER_GREENYELLOW")); + filter->append (M("TP_BWMIX_FILTER_GREEN")); + filter->append (M("TP_BWMIX_FILTER_BLUEGREEN")); + filter->append (M("TP_BWMIX_FILTER_BLUE")); + filter->append (M("TP_BWMIX_FILTER_PURPLE")); filter->set_active (0); filterHBox->pack_start (*filter); @@ -248,8 +246,8 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB algoHBox->pack_start (*alLabel, Gtk::PACK_SHRINK); algo = Gtk::manage (new MyComboBoxText ()); - algo->append_text (M("TP_BWMIX_ALGO_LI")); - algo->append_text (M("TP_BWMIX_ALGO_SP")); + algo->append (M("TP_BWMIX_ALGO_LI")); + algo->append (M("TP_BWMIX_ALGO_SP")); algo->set_active (1); algoHBox->pack_start (*algo); mixerVBox->pack_start(*algoHBox); @@ -364,10 +362,10 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB bottomMilestonesbw.push_back( GradientMilestone(1., 1., 1., 1.) ); beforeCurveMode = Gtk::manage (new MyComboBoxText ()); - beforeCurveMode->append_text (M("TP_BWMIX_TCMODE_STANDARD")); - beforeCurveMode->append_text (M("TP_BWMIX_TCMODE_WEIGHTEDSTD")); - beforeCurveMode->append_text (M("TP_BWMIX_TCMODE_FILMLIKE")); - beforeCurveMode->append_text (M("TP_BWMIX_TCMODE_SATANDVALBLENDING")); + beforeCurveMode->append (M("TP_BWMIX_TCMODE_STANDARD")); + beforeCurveMode->append (M("TP_BWMIX_TCMODE_WEIGHTEDSTD")); + beforeCurveMode->append (M("TP_BWMIX_TCMODE_FILMLIKE")); + beforeCurveMode->append (M("TP_BWMIX_TCMODE_SATANDVALBLENDING")); beforeCurveMode->set_active (0); beforeCurveCEG = new CurveEditorGroup (options.lastBWCurvesDir, M("TP_BWMIX_CURVEEDITOR1")); @@ -389,8 +387,8 @@ BlackWhite::BlackWhite (): FoldableToolPanel(this, "blackwhite", M("TP_BWMIX_LAB //----------- Curve 2 ------------------------------ /* afterCurveMode = Gtk::manage (new MyComboBoxText ()); - afterCurveMode->append_text (M("TP_BWMIX_TCMODE_STANDARD")); - // afterCurveMode->append_text (M("TP_BWMIX_TCMODE_WEIGHTEDSTD")); + afterCurveMode->append (M("TP_BWMIX_TCMODE_STANDARD")); + // afterCurveMode->append (M("TP_BWMIX_TCMODE_WEIGHTEDSTD")); afterCurveMode->set_active (0); */ afterCurveCEG = new CurveEditorGroup (options.lastBWCurvesDir, M("TP_BWMIX_CURVEEDITOR2")); @@ -424,7 +422,6 @@ BlackWhite::~BlackWhite () int BWChangedUI (void* data) { - GThreadLock lock; (static_cast(data))->BWComputed_ (); return 0; } @@ -434,7 +431,7 @@ void BlackWhite::BWChanged (double redbw, double greenbw, double bluebw) nextredbw = redbw; nextgreenbw = greenbw; nextbluebw = bluebw; - g_idle_add (BWChangedUI, this); + add_idle (BWChangedUI, this); } bool BlackWhite::BWComputed_ () @@ -1254,17 +1251,17 @@ void BlackWhite::setBatchMode (bool batchMode) gammaRed->showEditedCB (); gammaGreen->showEditedCB (); gammaBlue->showEditedCB (); - method->append_text (M("GENERAL_UNCHANGED")); - filter->append_text (M("GENERAL_UNCHANGED")); - setting->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); + filter->append (M("GENERAL_UNCHANGED")); + setting->append (M("GENERAL_UNCHANGED")); luminanceCEG->setBatchMode (batchMode); beforeCurveCEG->setBatchMode (batchMode); beforeCurveCEG->show(); - beforeCurveMode->append_text (M("GENERAL_UNCHANGED")); + beforeCurveMode->append (M("GENERAL_UNCHANGED")); afterCurveCEG->setBatchMode (batchMode); afterCurveCEG->show(); -// afterCurveMode->append_text (M("GENERAL_UNCHANGED")); - algo->append_text (M("GENERAL_UNCHANGED")); +// afterCurveMode->append (M("GENERAL_UNCHANGED")); + algo->append (M("GENERAL_UNCHANGED")); showLuminance(); showFilter(); diff --git a/rtgui/chmixer.cc b/rtgui/chmixer.cc index 356a274e8..7d71da9a9 100644 --- a/rtgui/chmixer.cc +++ b/rtgui/chmixer.cc @@ -37,7 +37,7 @@ ChMixer::ChMixer (): FoldableToolPanel(this, "chmixer", M("TP_CHMIXER_LABEL")) Gtk::Label* rlabel = Gtk::manage (new Gtk::Label ()); rlabel->set_markup (Glib::ustring("\t") + M("TP_CHMIXER_RED") + Glib::ustring(":")); - rlabel->set_alignment(Gtk::ALIGN_LEFT); + rlabel->set_alignment(Gtk::ALIGN_START); red[0] = Gtk::manage (new Adjuster ("", -200, 200, 1, 100, imgIcon[0])); red[1] = Gtk::manage (new Adjuster ("", -200, 200, 1, 0, imgIcon[1])); @@ -55,7 +55,7 @@ ChMixer::ChMixer (): FoldableToolPanel(this, "chmixer", M("TP_CHMIXER_LABEL")) Gtk::Label* glabel = Gtk::manage (new Gtk::Label ()); glabel->set_markup (Glib::ustring("\t") + M("TP_CHMIXER_GREEN") + Glib::ustring(":")); - glabel->set_alignment(Gtk::ALIGN_LEFT); + glabel->set_alignment(Gtk::ALIGN_START); green[0] = Gtk::manage (new Adjuster ("", -200, 200, 1, 0, imgIcon[3])); @@ -74,7 +74,7 @@ ChMixer::ChMixer (): FoldableToolPanel(this, "chmixer", M("TP_CHMIXER_LABEL")) Gtk::Label* blabel = Gtk::manage (new Gtk::Label ()); blabel->set_markup (Glib::ustring("\t") + M("TP_CHMIXER_BLUE") + Glib::ustring(":")); - blabel->set_alignment(Gtk::ALIGN_LEFT); + blabel->set_alignment(Gtk::ALIGN_START); blue[0] = Gtk::manage (new Adjuster ("", -200, 200, 1, 0, imgIcon[6])); blue[1] = Gtk::manage (new Adjuster ("", -200, 200, 1, 0, imgIcon[7])); blue[2] = Gtk::manage (new Adjuster ("", -200, 200, 1, 100, imgIcon[8])); diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 4c85ca32e..00f5a28e1 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -70,8 +70,8 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel(this, "colorappearance", Gtk::Label* wbmLab = Gtk::manage (new Gtk::Label (M("TP_COLORAPP_MODEL") + ":")); wbmHBox->pack_start (*wbmLab, Gtk::PACK_SHRINK); wbmodel = Gtk::manage (new MyComboBoxText ()); - wbmodel->append_text (M("TP_COLORAPP_WBRT")); - wbmodel->append_text (M("TP_COLORAPP_WBCAM")); + wbmodel->append (M("TP_COLORAPP_WBRT")); + wbmodel->append (M("TP_COLORAPP_WBCAM")); wbmodel->set_active (0); wbmHBox->pack_start (*wbmodel); p1VBox->pack_start (*wbmHBox); @@ -114,10 +114,10 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel(this, "colorappearance", Gtk::Label* alLabel = Gtk::manage (new Gtk::Label (M("TP_COLORAPP_ALGO") + ":")); alHBox->pack_start (*alLabel, Gtk::PACK_SHRINK); algo = Gtk::manage (new MyComboBoxText ()); - algo->append_text (M("TP_COLORAPP_ALGO_JC")); - algo->append_text (M("TP_COLORAPP_ALGO_JS")); - algo->append_text (M("TP_COLORAPP_ALGO_QM")); - algo->append_text (M("TP_COLORAPP_ALGO_ALL")); + algo->append (M("TP_COLORAPP_ALGO_JC")); + algo->append (M("TP_COLORAPP_ALGO_JS")); + algo->append (M("TP_COLORAPP_ALGO_QM")); + algo->append (M("TP_COLORAPP_ALGO_ALL")); algo->set_active (0); alHBox->pack_start (*algo); p2VBox->pack_start (*alHBox); @@ -229,8 +229,8 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel(this, "colorappearance", p2VBox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET, 4); toneCurveMode = Gtk::manage (new MyComboBoxText ()); - toneCurveMode->append_text (M("TP_COLORAPP_TCMODE_LIGHTNESS")); - toneCurveMode->append_text (M("TP_COLORAPP_TCMODE_BRIGHTNESS")); + toneCurveMode->append (M("TP_COLORAPP_TCMODE_LIGHTNESS")); + toneCurveMode->append (M("TP_COLORAPP_TCMODE_BRIGHTNESS")); toneCurveMode->set_active (0); toneCurveMode->set_tooltip_text(M("TP_COLORAPP_TCMODE_LABEL1")); @@ -245,8 +245,8 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel(this, "colorappearance", tcmodeconn = toneCurveMode->signal_changed().connect( sigc::mem_fun(*this, &ColorAppearance::curveMode1Changed), true ); toneCurveMode2 = Gtk::manage (new MyComboBoxText ()); - toneCurveMode2->append_text (M("TP_COLORAPP_TCMODE_LIGHTNESS")); - toneCurveMode2->append_text (M("TP_COLORAPP_TCMODE_BRIGHTNESS")); + toneCurveMode2->append (M("TP_COLORAPP_TCMODE_LIGHTNESS")); + toneCurveMode2->append (M("TP_COLORAPP_TCMODE_BRIGHTNESS")); toneCurveMode2->set_active (0); toneCurveMode2->set_tooltip_text(M("TP_COLORAPP_TCMODE_LABEL2")); @@ -258,9 +258,9 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel(this, "colorappearance", tcmode2conn = toneCurveMode2->signal_changed().connect( sigc::mem_fun(*this, &ColorAppearance::curveMode2Changed), true ); toneCurveMode3 = Gtk::manage (new MyComboBoxText ()); - toneCurveMode3->append_text (M("TP_COLORAPP_TCMODE_CHROMA")); - toneCurveMode3->append_text (M("TP_COLORAPP_TCMODE_SATUR")); - toneCurveMode3->append_text (M("TP_COLORAPP_TCMODE_COLORF")); + toneCurveMode3->append (M("TP_COLORAPP_TCMODE_CHROMA")); + toneCurveMode3->append (M("TP_COLORAPP_TCMODE_SATUR")); + toneCurveMode3->append (M("TP_COLORAPP_TCMODE_COLORF")); toneCurveMode3->set_active (0); toneCurveMode3->set_tooltip_text(M("TP_COLORAPP_TCMODE_LABEL3")); @@ -368,10 +368,10 @@ ColorAppearance::ColorAppearance () : FoldableToolPanel(this, "colorappearance", Gtk::Label* surrLabel = Gtk::manage (new Gtk::Label (M("TP_COLORAPP_SURROUND") + ":")); surrHBox->pack_start (*surrLabel, Gtk::PACK_SHRINK); surround = Gtk::manage (new MyComboBoxText ()); - surround->append_text (M("TP_COLORAPP_SURROUND_AVER")); - surround->append_text (M("TP_COLORAPP_SURROUND_DIM")); - surround->append_text (M("TP_COLORAPP_SURROUND_DARK")); - surround->append_text (M("TP_COLORAPP_SURROUND_EXDARK")); + surround->append (M("TP_COLORAPP_SURROUND_AVER")); + surround->append (M("TP_COLORAPP_SURROUND_DIM")); + surround->append (M("TP_COLORAPP_SURROUND_DARK")); + surround->append (M("TP_COLORAPP_SURROUND_EXDARK")); surround->set_active (1); surrHBox->pack_start (*surround); p3VBox->pack_start (*surrHBox); @@ -1013,14 +1013,13 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit } int autoCamChangedUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected (static_cast(data))->autoCamComputed_ (); return 0; } void ColorAppearance::autoCamChanged (double ccam) { nextCcam = ccam; - g_idle_add (autoCamChangedUI, this); + add_idle (autoCamChangedUI, this); } bool ColorAppearance::autoCamComputed_ () @@ -1035,14 +1034,13 @@ bool ColorAppearance::autoCamComputed_ () } int adapCamChangedUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected (static_cast(data))->adapCamComputed_ (); return 0; } void ColorAppearance::adapCamChanged (double cadap) { nextCadap = cadap; - g_idle_add (adapCamChangedUI, this); + add_idle (adapCamChangedUI, this); } bool ColorAppearance::adapCamComputed_ () @@ -1287,12 +1285,12 @@ void ColorAppearance::setBatchMode (bool batchMode) qcontrast->showEditedCB (); colorh->showEditedCB (); - surround->append_text (M("GENERAL_UNCHANGED")); - wbmodel->append_text (M("GENERAL_UNCHANGED")); - algo->append_text (M("GENERAL_UNCHANGED")); - toneCurveMode->append_text (M("GENERAL_UNCHANGED")); - toneCurveMode2->append_text (M("GENERAL_UNCHANGED")); - toneCurveMode3->append_text (M("GENERAL_UNCHANGED")); + surround->append (M("GENERAL_UNCHANGED")); + wbmodel->append (M("GENERAL_UNCHANGED")); + algo->append (M("GENERAL_UNCHANGED")); + toneCurveMode->append (M("GENERAL_UNCHANGED")); + toneCurveMode2->append (M("GENERAL_UNCHANGED")); + toneCurveMode3->append (M("GENERAL_UNCHANGED")); curveEditorG->setBatchMode (batchMode); curveEditorG2->setBatchMode (batchMode); diff --git a/rtgui/coloredbar.cc b/rtgui/coloredbar.cc index 192f791fe..ebef8d432 100644 --- a/rtgui/coloredbar.cc +++ b/rtgui/coloredbar.cc @@ -18,6 +18,7 @@ */ #include "coloredbar.h" +#include "../rtengine/utils.h" ColoredBar::ColoredBar (eRTOrientation orient) { @@ -37,7 +38,8 @@ void ColoredBar::expose(Cairo::RefPtr destSurface) } draw(); - copySurface(destSurface); + Gdk::Rectangle rect(x, y, w, h); + copySurface(destSurface, &rect); } /* @@ -51,7 +53,20 @@ void ColoredBar::expose(Glib::RefPtr destWindow) } draw(); - copySurface(destWindow); + Gdk::Rectangle rect(x, y, w, h); + copySurface(destWindow, &rect); +} + +void ColoredBar::expose(const Cairo::RefPtr< Cairo::Context> &cr) +{ + // look out if the Surface has to be redrawn + if (!surfaceCreated()) { + return; + } + + draw(); + Gdk::Rectangle rect(x, y, w, h); + copySurface(cr, &rect); } /* @@ -65,7 +80,8 @@ void ColoredBar::expose(BackBuffer *backBuffer) } draw(); - copySurface(backBuffer); + Gdk::Rectangle rect(x, y, w, h); + copySurface(backBuffer, &rect); } void ColoredBar::draw() @@ -110,53 +126,54 @@ void ColoredBar::draw() } else { // ask the ColorProvider to provide colors :) for each pixels if (colorProvider) { + unsigned char *dst; + unsigned char *surfaceData = surface->get_data(); + int surfW = getWidth(); + cr->set_antialias(Cairo::ANTIALIAS_NONE); cr->set_line_width(1.); switch (orientation) { case (RTO_Left2Right): - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - double x_ = double( x); - double y_ = double((h - 1) - y); - double x01 = x_ / double(w - 1); - double y01 = double(y) / double(h - 1); + for (int py = 0; py < h; ++py) { + for (int px = 0; px < w; ++px) { + double x_ = double( px); + //double y_ = double((h-1)-py); unused + double x01 = x_ / double(w - 1); + double y01 = double(py) / double(h - 1); colorProvider->colorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); - cr->set_source_rgb(ccRed, ccGreen, ccBlue); - cr->rectangle(x_, y_, 1., 1.); - cr->fill(); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); } } break; case (RTO_Right2Left): - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - double x_ = double((w - 1) - x); - double y_ = double((h - 1) - y); - double x01 = double(x) / double(w - 1); - double y01 = double(y) / double(h - 1); + for (int py = 0; py < h; ++py) { + for (int px = 0; px < w; ++px) { + //double x_ = double((w-1)-px); unused + //double y_ = double((h-1)-py); unused + double x01 = double(px) / double(w - 1); + double y01 = double(py) / double(h - 1); colorProvider->colorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); - cr->set_source_rgb(ccRed, ccGreen, ccBlue); - cr->rectangle(x_, y_, 1., 1.); - cr->fill(); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); } } break; case (RTO_Bottom2Top): - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - double x_ = double((w - 1) - x); - double y_ = double((h - 1) - y); - double x01 = double(x) / double(w - 1); - double y01 = double(y) / double(h - 1); + for (int py = 0; py < h; ++py) { + for (int px = 0; px < w; ++px) { + //double x_ = double((w-1)-px); unused + //double y_ = double((h-1)-py); unused + double x01 = double(px) / double(w - 1); + double y01 = double(py) / double(h - 1); colorProvider->colorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); - cr->set_source_rgb(ccRed, ccGreen, ccBlue); - cr->rectangle(x_, y_, 1., 1.); - cr->fill(); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); } } @@ -164,21 +181,93 @@ void ColoredBar::draw() case (RTO_Top2Bottom): default: - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - double x_ = double( x); - double y_ = double( y); + for (int py = 0; py < h; ++py) { + for (int px = 0; px < w; ++px) { + double x_ = double( px); + double y_ = double( py); double x01 = x_ / double(w - 1); double y01 = y_ / double(h - 1); colorProvider->colorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); - cr->set_source_rgb(ccRed, ccGreen, ccBlue); - cr->rectangle(x_, y_, 1., 1.); - cr->fill(); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); } } break; } + + + + /* + unsigned char *dst; + unsigned char *surfaceData = surface->get_data(); + int surfW = getWidth(); + + cr->set_antialias(Cairo::ANTIALIAS_NONE); + cr->set_line_width(1.); + switch (orientation) { + case (RTO_Left2Right): + for (int py=0; pycolorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + } + } + break; + case (RTO_Right2Left): + for (int py=0; pycolorForValue (x01, y01, CCET_BACKGROUND, colorCallerId, this); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + } + } + break; + case (RTO_Bottom2Top): + for (int py=0; pycolorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + } + } + break; + case (RTO_Top2Bottom): + default: + for (int py=0; pycolorForValue (y01, x01, CCET_BACKGROUND, colorCallerId, this); + + rtengine::poke01_d(surfaceData, ccRed, ccGreen, ccBlue); + } + } + break; + } + + */ + + } } diff --git a/rtgui/coloredbar.h b/rtgui/coloredbar.h index 917085e3c..27428582f 100644 --- a/rtgui/coloredbar.h +++ b/rtgui/coloredbar.h @@ -42,6 +42,7 @@ public: void expose(Glib::RefPtr destWindow); void expose(Cairo::RefPtr destSurface); void expose(BackBuffer *backBuffer); + void expose(const Cairo::RefPtr< Cairo::Context> &cr); bool canGetColors(); diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index 5b6f21412..bb0a5f126 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -15,11 +15,11 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR //---------------method method = Gtk::manage (new MyComboBoxText ()); - method->append_text (M("TP_COLORTONING_LAB")); - method->append_text (M("TP_COLORTONING_RGBSLIDERS")); - method->append_text (M("TP_COLORTONING_RGBCURVES")); - method->append_text (M("TP_COLORTONING_SPLITCOCO")); - method->append_text (M("TP_COLORTONING_SPLITLR")); + method->append (M("TP_COLORTONING_LAB")); + method->append (M("TP_COLORTONING_RGBSLIDERS")); + method->append (M("TP_COLORTONING_RGBCURVES")); + method->append (M("TP_COLORTONING_SPLITCOCO")); + method->append (M("TP_COLORTONING_SPLITLR")); method->set_active (0); method->set_tooltip_text (M("TP_COLORTONING_METHOD_TOOLTIP")); @@ -79,10 +79,10 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR //----------------------red green blue yellow colours twocolor = Gtk::manage (new MyComboBoxText ()); - twocolor->append_text (M("TP_COLORTONING_TWOSTD")); - twocolor->append_text (M("TP_COLORTONING_TWOALL")); - twocolor->append_text (M("TP_COLORTONING_TWOBY")); - twocolor->append_text (M("TP_COLORTONING_TWO2")); + twocolor->append (M("TP_COLORTONING_TWOSTD")); + twocolor->append (M("TP_COLORTONING_TWOALL")); + twocolor->append (M("TP_COLORTONING_TWOBY")); + twocolor->append (M("TP_COLORTONING_TWO2")); twocolor->set_tooltip_text (M("TP_COLORTONING_TWOCOLOR_TOOLTIP")); twocolor->set_active (0); @@ -297,8 +297,6 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR neutrHBox->set_border_width (2); neutral = Gtk::manage (new Gtk::Button (M("TP_COLORTONING_NEUTRAL"))); - RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); - neutral->set_image(*resetImg); neutral->set_tooltip_text (M("TP_COLORTONING_NEUTRAL_TIP")); neutralconn = neutral->signal_pressed().connect( sigc::mem_fun(*this, &ColorToning::neutral_pressed) ); neutral->show(); @@ -664,7 +662,6 @@ void ColorToning::adjusterChanged (ThresholdAdjuster* a, double newBottom, doubl int CTChanged_UI (void* data) { - GThreadLock lock; (static_cast(data))->CTComp_ (); return 0; } @@ -675,7 +672,7 @@ void ColorToning::autoColorTonChanged(int bwct, int satthres, int satprot) nextbw = bwct; nextsatth = satthres; nextsatpr = satprot; - g_idle_add (CTChanged_UI, this); + add_idle (CTChanged_UI, this); } bool ColorToning::CTComp_ () @@ -1101,8 +1098,8 @@ void ColorToning::trimValues (rtengine::procparams::ProcParams* pp) void ColorToning::setBatchMode (bool batchMode) { ToolPanel::setBatchMode (batchMode); - method->append_text (M("GENERAL_UNCHANGED")); - twocolor->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); + twocolor->append (M("GENERAL_UNCHANGED")); hlColSat->showEditedCB (); shadowsColSat->showEditedCB (); redlow->showEditedCB (); diff --git a/rtgui/coordinateadjuster.cc b/rtgui/coordinateadjuster.cc index 76ad1d50c..a64d11e86 100644 --- a/rtgui/coordinateadjuster.cc +++ b/rtgui/coordinateadjuster.cc @@ -46,7 +46,7 @@ CoordinateAdjuster::AxisAdjuster::AxisAdjuster(CoordinateAdjuster *parent, const spinButton = Gtk::manage( new Gtk::SpinButton() ); label = Gtk::manage (new Gtk::Label(axis->label)); - //label->set_alignment(Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + //label->set_alignment(Gtk::ALIGN_MIDDLE, Gtk::ALIGN_MIDDLE); spinButton = Gtk::manage (new Gtk::SpinButton()); spinButton->set_name("AxisAdjuster"); diff --git a/rtgui/crop.cc b/rtgui/crop.cc index 609ab9e64..2c8deb597 100644 --- a/rtgui/crop.cc +++ b/rtgui/crop.cc @@ -71,7 +71,8 @@ Crop::Crop (): FoldableToolPanel(this, "crop", M("TP_CROP_LABEL"), false, true) pack_start (*hb2, Gtk::PACK_SHRINK, 4); - selectCrop = Gtk::manage (new Gtk::Button (M("TP_CROP_SELECTCROP"))); + selectCrop = Gtk::manage (new Gtk::Button ()); + selectCrop->set_tooltip_text(M("TP_CROP_SELECTCROP")); selectCrop->set_image (*Gtk::manage (new RTImage ("crop.png"))); pack_start (*selectCrop, Gtk::PACK_SHRINK, 2); @@ -189,25 +190,25 @@ Crop::Crop (): FoldableToolPanel(this, "crop", M("TP_CROP_LABEL"), false, true) // populate the combobox for (int i = 0; i < NumberOfCropRatios; i++) { - ratio->append_text (cropratio[i].label); + ratio->append (cropratio[i].label); } ratio->set_active (0); - orientation->append_text (M("GENERAL_LANDSCAPE")); - orientation->append_text (M("GENERAL_PORTRAIT")); - orientation->append_text (M("GENERAL_ASIMAGE")); + orientation->append (M("GENERAL_LANDSCAPE")); + orientation->append (M("GENERAL_PORTRAIT")); + orientation->append (M("GENERAL_ASIMAGE")); orientation->set_active (2); - guide->append_text (M("TP_CROP_GTNONE")); - guide->append_text (M("TP_CROP_GTFRAME")); - guide->append_text (M("TP_CROP_GTRULETHIRDS")); - guide->append_text (M("TP_CROP_GTDIAGONALS")); - guide->append_text (M("TP_CROP_GTHARMMEANS")); - guide->append_text (M("TP_CROP_GTGRID")); - guide->append_text (M("TP_CROP_GTTRIANGLE1")); - guide->append_text (M("TP_CROP_GTTRIANGLE2")); - guide->append_text (M("TP_CROP_GTEPASSPORT")); + guide->append (M("TP_CROP_GTNONE")); + guide->append (M("TP_CROP_GTFRAME")); + guide->append (M("TP_CROP_GTRULETHIRDS")); + guide->append (M("TP_CROP_GTDIAGONALS")); + guide->append (M("TP_CROP_GTHARMMEANS")); + guide->append (M("TP_CROP_GTGRID")); + guide->append (M("TP_CROP_GTTRIANGLE1")); + guide->append (M("TP_CROP_GTTRIANGLE2")); + guide->append (M("TP_CROP_GTEPASSPORT")); guide->set_active (0); w->set_range (0, maxw); @@ -510,14 +511,12 @@ void Crop::enabledChanged () int notifyListenerUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected (static_cast(data))->notifyListener (); return 0; } int refreshSpinsUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected RefreshSpinHelper* rsh = static_cast(data); rsh->crop->refreshSpins (rsh->notify); delete rsh; @@ -528,14 +527,14 @@ void Crop::hFlipCrop () { nx = maxw - nx - nw; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::vFlipCrop () { ny = maxh - ny - nh; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::rotateCrop (int deg, bool hflip, bool vflip) @@ -575,7 +574,7 @@ void Crop::rotateCrop (int deg, bool hflip, bool vflip) } lastRotationDeg = deg; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::positionChanged () @@ -589,7 +588,7 @@ void Crop::positionChanged () int W = nw; int H = nh; cropMoved (X, Y, W, H); - g_idle_add (notifyListenerUI, this); + add_idle (notifyListenerUI, this); } void Crop::widthChanged () @@ -602,7 +601,7 @@ void Crop::widthChanged () int W = (int)w->get_value (); int H = nh; cropWidth2Resized (X, Y, W, H); - g_idle_add (notifyListenerUI, this); + add_idle (notifyListenerUI, this); } void Crop::heightChanged () @@ -615,7 +614,7 @@ void Crop::heightChanged () int W = nw; int H = (int)h->get_value (); cropHeight2Resized (X, Y, W, H); - g_idle_add (notifyListenerUI, this); + add_idle (notifyListenerUI, this); } // Fixed ratio toggle button @@ -667,7 +666,7 @@ void Crop::adjustCropToRatio() } // This will save the options - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, true)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, true)); } void Crop::refreshSize () @@ -747,7 +746,6 @@ struct setdimparams { int sizeChangedUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected setdimparams* params = static_cast(data); params->crop->setDimensions (params->x, params->y); delete params; @@ -761,7 +759,7 @@ void Crop::sizeChanged (int x, int y, int ow, int oh) params->x = x; params->y = y; params->crop = this; - g_idle_add (sizeChangedUI, params); + add_idle (sizeChangedUI, params); } bool Crop::refreshSpins (bool notify) @@ -825,7 +823,7 @@ void Crop::cropMoved (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); // Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins)); } @@ -869,7 +867,7 @@ void Crop::cropWidth1Resized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H) @@ -909,7 +907,7 @@ void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H) @@ -952,7 +950,7 @@ void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H) @@ -992,7 +990,7 @@ void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropTopLeftResized (int &X, int &Y, int &W, int &H) @@ -1034,7 +1032,7 @@ void Crop::cropTopLeftResized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropTopRightResized (int &X, int &Y, int &W, int &H) @@ -1074,7 +1072,7 @@ void Crop::cropTopRightResized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropBottomLeftResized (int &X, int &Y, int &W, int &H) @@ -1114,7 +1112,7 @@ void Crop::cropBottomLeftResized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropBottomRightResized (int &X, int &Y, int &W, int &H) @@ -1151,7 +1149,7 @@ void Crop::cropBottomRightResized (int &X, int &Y, int &W, int &H) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropInit (int &x, int &y, int &w, int &h) @@ -1269,13 +1267,13 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2) nw = W; nh = H; - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); + add_idle (refreshSpinsUI, new RefreshSpinHelper (this, false)); } void Crop::cropManipReady () { - g_idle_add (notifyListenerUI, this); + add_idle (notifyListenerUI, this); } double Crop::getRatio () @@ -1308,8 +1306,8 @@ void Crop::setBatchMode (bool batchMode) ToolPanel::setBatchMode (batchMode); - ratio->append_text (M("GENERAL_UNCHANGED")); - orientation->append_text (M("GENERAL_UNCHANGED")); - guide->append_text (M("GENERAL_UNCHANGED")); + ratio->append (M("GENERAL_UNCHANGED")); + orientation->append (M("GENERAL_UNCHANGED")); + guide->append (M("GENERAL_UNCHANGED")); removeIfThere (this, ppibox); } diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 4342c4973..1253407bc 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -218,8 +218,6 @@ void CropHandler::getPosition (int& x, int& y) int createpixbufs (void* data) { - GThreadLock lock; - CropHandlerIdleHelper* chi = static_cast(data); if (chi->destroyed) { @@ -334,7 +332,7 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp cih = ah; cis = askip; chi->pending++; - g_idle_add (createpixbufs, chi); + add_idle (createpixbufs, chi); } cimg.unlock (); diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index e787a11e1..30f194b8c 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -65,7 +65,7 @@ ZoomStep zoomSteps[] = { CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_, bool isDetailWindow) : onResizeArea(false), deleted(false), fitZoomEnabled(true), fitZoom(false), isLowUpdatePriority(isLowUpdatePriority_), - backColor(options.bgcolor), decorated(true), titleHeight(30), + cursor_type(CSUndefined), backColor(options.bgcolor), decorated(true), titleHeight(30), sideBorderWidth(3), lowerBorderWidth(3), upperBorderWidth(1), sepWidth(2), xpos(30), ypos(30), imgX(0), imgY(0), imgW(1), imgH(1), iarea(parent), cropZoom(0), cropgl(NULL), pmlistener(NULL), observedCropWin(NULL), ipc(ipc_), isFlawnOver(false) @@ -95,7 +95,7 @@ CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, buttonSet.add (bZoom100); buttonSet.add (bClose); - buttonSet.setColors (Gdk::Color("black"), Gdk::Color("white")); + buttonSet.setColors (Gdk::RGBA("black"), Gdk::RGBA("white")); buttonSet.setButtonListener (this); int bsw, bsh; @@ -923,25 +923,27 @@ void CropWindow::updateCursor (int x, int y) EditSubscriber *editSubscriber = iarea->getCurrSubscriber(); ToolMode tm = iarea->getToolMode (); + CursorShape newType = cursor_type; + if (state == SNormal) { if (onArea (CropWinButtons, x, y)) { - cursorManager.setCursor (iarea->get_window(), CSArrow); + newType = CSArrow; } else if (onArea (CropToolBar, x, y)) { - cursorManager.setCursor (iarea->get_window(), CSMove); + newType = CSMove; } else if (onArea (CropResize, x, y)) { - cursorManager.setCursor (iarea->get_window(), CSResizeDiagonal); + newType = CSResizeDiagonal; } else if (tm == TMHand && (onArea (CropTopLeft, x, y))) { - cursorManager.setCursor (iarea->get_window(), CSResizeTopLeft); + newType = CSResizeTopLeft; } else if (tm == TMHand && (onArea (CropTopRight, x, y))) { - cursorManager.setCursor (iarea->get_window(), CSResizeTopRight); + newType = CSResizeTopRight; } else if (tm == TMHand && (onArea (CropBottomLeft, x, y))) { - cursorManager.setCursor (iarea->get_window(), CSResizeBottomLeft); + newType = CSResizeBottomLeft; } else if (tm == TMHand && (onArea (CropBottomRight, x, y))) { - cursorManager.setCursor (iarea->get_window(), CSResizeBottomRight); + newType = CSResizeBottomRight; } else if (tm == TMHand && (onArea (CropTop, x, y) || onArea (CropBottom, x, y))) { - cursorManager.setCursor (iarea->get_window(), CSResizeHeight); + newType = CSResizeHeight; } else if (tm == TMHand && (onArea (CropLeft, x, y) || onArea (CropRight, x, y))) { - cursorManager.setCursor (iarea->get_window(), CSResizeWidth); + newType = CSResizeWidth; } else if (onArea (CropImage, x, y)) { int objectID = -1; @@ -952,45 +954,50 @@ void CropWindow::updateCursor (int x, int y) } if (objectID > -1) { - cursorManager.setCursor (iarea->get_window(), editSubscriber->getCursor(objectID)); + newType = editSubscriber->getCursor(objectID); } else if (tm == TMHand) { if (onArea (CropObserved, x, y)) { - cursorManager.setCursor (iarea->get_window(), CSMove); + newType = CSMove; } else { - cursorManager.setCursor (iarea->get_window(), CSOpenHand); + newType = CSOpenHand; } } else if (tm == TMSpotWB) { - cursorManager.setCursor (iarea->get_window(), CSSpotWB); + newType = CSSpotWB; } else if (tm == TMCropSelect) { - cursorManager.setCursor (iarea->get_window(), CSCropSelect); + newType = CSCropSelect; } else if (tm == TMStraighten) { - cursorManager.setCursor (iarea->get_window(), CSStraighten); + newType = CSStraighten; } } else { - cursorManager.setCursor (iarea->get_window(), CSArrow); + newType = CSArrow; } } else if (state == SCropSelecting) { - cursorManager.setCursor (iarea->get_window(), CSCropSelect); + newType = CSCropSelect; } else if (state == SRotateSelecting) { - cursorManager.setCursor (iarea->get_window(), CSStraighten); + newType = CSStraighten; } else if (state == SCropMove || state == SCropWinMove || state == SObservedMove) { - cursorManager.setCursor (iarea->get_window(), CSMove); + newType = CSMove; } else if (state == SHandMove || state == SCropImgMove) { - cursorManager.setCursor (iarea->get_window(), CSClosedHand); + newType = CSClosedHand; } else if (state == SResizeW1 || state == SResizeW2) { - cursorManager.setCursor (iarea->get_window(), CSResizeWidth); + newType = CSResizeWidth; } else if (state == SResizeH1 || state == SResizeH2) { - cursorManager.setCursor (iarea->get_window(), CSResizeHeight); + newType = CSResizeHeight; } else if (state == SResizeTL) { - cursorManager.setCursor (iarea->get_window(), CSResizeTopLeft); + newType = CSResizeTopLeft; } else if (state == SResizeTR) { - cursorManager.setCursor (iarea->get_window(), CSResizeTopRight); + newType = CSResizeTopRight; } else if (state == SResizeBL) { - cursorManager.setCursor (iarea->get_window(), CSResizeBottomLeft); + newType = CSResizeBottomLeft; } else if (state == SResizeBR) { - cursorManager.setCursor (iarea->get_window(), CSResizeBottomRight); + newType = CSResizeBottomRight; } else if (state == SCropWinResize) { - cursorManager.setCursor (iarea->get_window(), CSResizeDiagonal); + newType = CSResizeDiagonal; + } + + if (newType != cursor_type) { + cursor_type = newType; + CursorManager::setWidgetCursor(iarea->get_window(), cursor_type); } } @@ -1002,27 +1009,28 @@ void CropWindow::expose (Cairo::RefPtr cr) drawDecoration (cr); } - int x = xpos, y = ypos, h = height, w = width; + int x = xpos, y = ypos; // draw the background backColor = iarea->previewModePanel->GetbackColor(); + Glib::RefPtr style = iarea->get_style_context(); options.bgcolor = backColor; if (backColor == 0) { - Gdk::Color cback = iarea->get_style()->get_bg(Gtk::STATE_NORMAL); - cr->set_source_rgb (cback.get_red_p(), cback.get_green_p(), cback.get_blue_p()); - } else if (backColor == 1) { - cr->set_source_rgb (0, 0, 0); - } else if (backColor == 2) { - cr->set_source_rgb (1, 1, 1); + iarea->get_style_context()->render_background(cr, x + imgAreaX, y + imgAreaY, imgAreaW, imgAreaH); + } else { + if (backColor == 1) { + cr->set_source_rgb (0, 0, 0); + } else if (backColor == 2) { + cr->set_source_rgb (1, 1, 1); + } + + cr->set_line_width (0.); + cr->rectangle (x + imgAreaX, y + imgAreaY, imgAreaW, imgAreaH); + cr->stroke_preserve (); + cr->fill (); } - cr->set_line_width (0.); - cr->rectangle (x + imgAreaX, y + imgAreaY, imgAreaW, imgAreaH); - cr->stroke_preserve (); - cr->fill (); - - // draw image if (state == SCropImgMove || state == SCropWinResize) { // draw a rough image @@ -1037,7 +1045,11 @@ void CropWindow::expose (Cairo::RefPtr cr) Glib::RefPtr rough = iarea->getPreviewHandler()->getRoughImage (cropX, cropY, imgAreaW, imgAreaH, zoomSteps[cropZoom].zoom); if (rough) { - iarea->get_window()->draw_pixbuf (iarea->get_style()->get_base_gc(Gtk::STATE_NORMAL), rough, 0, 0, x + imgAreaX + (imgAreaW - rough->get_width()) / 2, y + imgAreaY + (imgAreaH - rough->get_height()) / 2, -1, -1, Gdk::RGB_DITHER_NORMAL, 0, 0); + int posX = x + imgAreaX + (imgAreaW - rough->get_width()) / 2; + int posY = y + imgAreaY + (imgAreaH - rough->get_height()) / 2; + Gdk::Cairo::set_source_pixbuf(cr, rough, posX, posY); + cr->rectangle(posX, posY, rough->get_width(), rough->get_height()); + cr->fill(); // if (cropHandler.cropParams.enabled) // drawCrop (cr, x+imgX, y+imgY, imgW, imgH, cropX, cropY, zoomSteps[cropZoom].zoom, cropHandler.cropParams); } @@ -1445,9 +1457,17 @@ void CropWindow::expose (Cairo::RefPtr cr) } //printf("zoomSteps[cropZoom].zoom=%d\n",zoomSteps[cropZoom].zoom); - iarea->get_window()->draw_pixbuf (iarea->get_style()->get_base_gc(Gtk::STATE_NORMAL), tmp, 0, 0, x + imgX, y + imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0); + int posX = x + imgX; + int posY = y + imgY; + Gdk::Cairo::set_source_pixbuf(cr, tmp, posX, posY); + cr->rectangle(posX, posY, tmp->get_width(), tmp->get_height()); + cr->fill(); } else { - iarea->get_window()->draw_pixbuf (iarea->get_style()->get_base_gc(Gtk::STATE_NORMAL), cropHandler.cropPixbuf, 0, 0, x + imgX, y + imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0); + int posX = x + imgX; + int posY = y + imgY; + Gdk::Cairo::set_source_pixbuf(cr, cropHandler.cropPixbuf, posX, posY); + cr->rectangle(posX, posY, cropHandler.cropPixbuf->get_width(), cropHandler.cropPixbuf->get_height()); + cr->fill(); } if (cropHandler.cropParams.enabled) { @@ -1571,7 +1591,11 @@ void CropWindow::expose (Cairo::RefPtr cr) Glib::RefPtr rough = iarea->getPreviewHandler()->getRoughImage (cropX, cropY, imgAreaW, imgAreaH, zoomSteps[cropZoom].zoom); if (rough) { - iarea->get_window()->draw_pixbuf (iarea->get_style()->get_base_gc(Gtk::STATE_NORMAL), rough, 0, 0, x + imgAreaX + (imgAreaW - rough->get_width()) / 2, y + imgAreaY + (imgAreaH - rough->get_height()) / 2, -1, -1, Gdk::RGB_DITHER_NORMAL, 0, 0); + int posX = x + imgAreaX + (imgAreaW - rough->get_width()) / 2; + int posY = y + imgAreaY + (imgAreaH - rough->get_height()) / 2; + Gdk::Cairo::set_source_pixbuf(cr, rough, posX, posY); + cr->rectangle(posX, posY, rough->get_width(), rough->get_height()); + cr->fill(); if (cropHandler.cropParams.enabled) { drawCrop (cr, x + imgAreaX + (imgAreaW - rough->get_width()) / 2, y + imgAreaY + (imgAreaH - rough->get_height()) / 2, rough->get_width(), rough->get_height(), cropX, cropY, zoomSteps[cropZoom].zoom, cropHandler.cropParams, (this == iarea->mainCropWindow), true, zoomSteps[cropZoom].zoom <= cropHandler.getFitZoom()); diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index aad6b9ef5..69b3e566a 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -28,6 +28,7 @@ #include #include "cropguilistener.h" #include "pointermotionlistener.h" +#include "cursormanager.h" class CropWindow; class CropWindowListener @@ -54,6 +55,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E bool fitZoomEnabled; bool fitZoom; bool isLowUpdatePriority; + CursorShape cursor_type; // decoration LWButton *bZoomIn, *bZoomOut, *bZoom100, /**bZoomFit,*/ *bClose; diff --git a/rtgui/cursormanager.cc b/rtgui/cursormanager.cc index 45426a557..f29d0f6ec 100644 --- a/rtgui/cursormanager.cc +++ b/rtgui/cursormanager.cc @@ -21,25 +21,35 @@ #include "../rtengine/safegtk.h" #include "rtimage.h" -CursorManager cursorManager; +CursorManager mainWindowCursorManager; +CursorManager editWindowCursorManager; -void CursorManager::init (Glib::RefPtr mainWin) +void CursorManager::init (Glib::RefPtr mainWindow) { - cResizeWidth = new Gdk::Cursor (Gdk::SB_H_DOUBLE_ARROW); - cResizeHeight = new Gdk::Cursor (Gdk::SB_V_DOUBLE_ARROW); - cResizeDiag = new Gdk::Cursor (Gdk::BOTTOM_RIGHT_CORNER); - cResizeTopLeft = new Gdk::Cursor (Gdk::TOP_LEFT_CORNER); - cResizeTopRight = new Gdk::Cursor (Gdk::TOP_RIGHT_CORNER); - cResizeBottomLeft = new Gdk::Cursor (Gdk::BOTTOM_LEFT_CORNER); - cResizeBottomRight = new Gdk::Cursor (Gdk::BOTTOM_RIGHT_CORNER); - cCropMove = new Gdk::Cursor (Gdk::FLEUR); - cCropMoving = new Gdk::Cursor (Gdk::HAND2); - cCropSelection = new Gdk::Cursor (Gdk::CROSSHAIR); - cLeftTanMove = new Gdk::Cursor (Gdk::SB_LEFT_ARROW); - cRightTanMove = new Gdk::Cursor (Gdk::SB_RIGHT_ARROW); - cAdd = new Gdk::Cursor (Gdk::PLUS); - cWait = new Gdk::Cursor (Gdk::CLOCK); + display = Gdk::Display::get_default (); +#ifndef NDEBUG + + if (!display) { + printf("Error: no default display!\n"); + } + +#endif + + cResizeWidth = Gdk::Cursor::create (display, Gdk::SB_H_DOUBLE_ARROW); + cResizeHeight = Gdk::Cursor::create (display, Gdk::SB_V_DOUBLE_ARROW); + cResizeDiag = Gdk::Cursor::create (display, Gdk::BOTTOM_RIGHT_CORNER); + cResizeTopLeft = Gdk::Cursor::create (display, Gdk::TOP_LEFT_CORNER); + cResizeTopRight = Gdk::Cursor::create (display, Gdk::TOP_RIGHT_CORNER); + cResizeBottomLeft = Gdk::Cursor::create (display, Gdk::BOTTOM_LEFT_CORNER); + cResizeBottomRight = Gdk::Cursor::create (display, Gdk::BOTTOM_RIGHT_CORNER); + cCropMove = Gdk::Cursor::create (display, Gdk::FLEUR); + cCropMoving = Gdk::Cursor::create (display, Gdk::HAND2); + cCropSelection = Gdk::Cursor::create (display, Gdk::CROSSHAIR); + cLeftTanMove = Gdk::Cursor::create (display, Gdk::SB_LEFT_ARROW); + cRightTanMove = Gdk::Cursor::create (display, Gdk::SB_RIGHT_ARROW); + cAdd = Gdk::Cursor::create (display, Gdk::PLUS); + cWait = Gdk::Cursor::create (display, Gdk::CLOCK); Glib::RefPtr hand = safe_create_from_file("cross.png"); Glib::RefPtr close_hand = safe_create_from_file("closedhand.png"); @@ -50,16 +60,16 @@ void CursorManager::init (Glib::RefPtr mainWin) Glib::RefPtr move1DV = safe_create_from_file("move-1D-v.png"); Glib::RefPtr moveRotate = safe_create_from_file("move-rotate.png"); - cHand = hand ? new Gdk::Cursor (cAdd->get_display(), hand, 10, 10) : new Gdk::Cursor (Gdk::HAND2); - cClosedHand = close_hand ? new Gdk::Cursor (cAdd->get_display(), close_hand, 10, 10) : new Gdk::Cursor (Gdk::HAND2); - cWB = wbpick ? new Gdk::Cursor (cAdd->get_display(), wbpick, 1, 12) : new Gdk::Cursor (Gdk::ARROW); - cHidden = empty ? new Gdk::Cursor (cAdd->get_display(), empty, 12, 12) : new Gdk::Cursor (Gdk::FLEUR); - cMove2D = move2D ? new Gdk::Cursor (cAdd->get_display(), move2D, 11, 11) : new Gdk::Cursor (Gdk::FLEUR); - cMove1DH = move1DH ? new Gdk::Cursor (cAdd->get_display(), move1DH, 11, 11) : new Gdk::Cursor (Gdk::FLEUR); - cMove1DV = move1DV ? new Gdk::Cursor (cAdd->get_display(), move1DV, 11, 11) : new Gdk::Cursor (Gdk::FLEUR); - cMoveRotate = moveRotate ? new Gdk::Cursor (cAdd->get_display(), moveRotate, 11, 11) : new Gdk::Cursor (Gdk::CIRCLE); + cHand = hand ? Gdk::Cursor::create (cAdd->get_display(), hand, 10, 10) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2); + cClosedHand = close_hand ? Gdk::Cursor::create (cAdd->get_display(), close_hand, 10, 10) : Gdk::Cursor::create (cAdd->get_display(), Gdk::HAND2); + cWB = wbpick ? Gdk::Cursor::create (cAdd->get_display(), wbpick, 1, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::ARROW); + cHidden = empty ? Gdk::Cursor::create (cAdd->get_display(), empty, 12, 12) : Gdk::Cursor::create (cAdd->get_display(), Gdk::FLEUR); + cMove2D = move2D ? Gdk::Cursor::create (cAdd->get_display(), move2D, 11, 11) : Gdk::Cursor::create (cAdd->get_display(), Gdk::FLEUR); + cMove1DH = move1DH ? Gdk::Cursor::create (cAdd->get_display(), move1DH, 11, 11) : Gdk::Cursor::create (cAdd->get_display(), Gdk::FLEUR); + cMove1DV = move1DV ? Gdk::Cursor::create (cAdd->get_display(), move1DV, 11, 11) : Gdk::Cursor::create (cAdd->get_display(), Gdk::FLEUR); + cMoveRotate = moveRotate ? Gdk::Cursor::create (cAdd->get_display(), moveRotate, 11, 11) : Gdk::Cursor::create (cAdd->get_display(), Gdk::CIRCLE); - mainWindow = mainWin; + window = mainWindow; } /* Set the cursor of the given window */ @@ -71,55 +81,87 @@ void CursorManager::setCursor (Glib::RefPtr window, CursorShape sha { window->set_cursor (); } else if (shape == CSOpenHand) { - window->set_cursor (*cHand); + window->set_cursor (cHand); } else if (shape == CSClosedHand) { - window->set_cursor (*cClosedHand); + window->set_cursor (cClosedHand); } else if (shape == CSMove) { - window->set_cursor (*cCropMove); + window->set_cursor (cCropMove); } else if (shape == CSResizeWidth) { - window->set_cursor (*cResizeWidth); + window->set_cursor (cResizeWidth); } else if (shape == CSResizeHeight) { - window->set_cursor (*cResizeHeight); + window->set_cursor (cResizeHeight); } else if (shape == CSResizeDiagonal) { - window->set_cursor (*cResizeDiag); + window->set_cursor (cResizeDiag); } else if (shape == CSResizeTopLeft) { - window->set_cursor (*cResizeTopLeft); + window->set_cursor (cResizeTopLeft); } else if (shape == CSResizeTopRight) { - window->set_cursor (*cResizeTopRight); + window->set_cursor (cResizeTopRight); } else if (shape == CSResizeBottomLeft) { - window->set_cursor (*cResizeBottomLeft); + window->set_cursor (cResizeBottomLeft); } else if (shape == CSResizeBottomRight) { - window->set_cursor (*cResizeBottomRight); + window->set_cursor (cResizeBottomRight); } else if (shape == CSMove2D) { - window->set_cursor (*cMove2D); + window->set_cursor (cMove2D); } else if (shape == CSMove1DH) { - window->set_cursor (*cMove1DH); + window->set_cursor (cMove1DH); } else if (shape == CSMove1DV) { - window->set_cursor (*cMove1DV); + window->set_cursor (cMove1DV); } else if (shape == CSMoveRotate) { - window->set_cursor (*cMoveRotate); + window->set_cursor (cMoveRotate); } else if (shape == CSSpotWB) { - window->set_cursor (*cWB); + window->set_cursor (cWB); } else if (shape == CSCropSelect) { - window->set_cursor (*cHand); + window->set_cursor (cHand); } else if (shape == CSMoveLeft) { - window->set_cursor (*cLeftTanMove); + window->set_cursor (cLeftTanMove); } else if (shape == CSMoveRight) { - window->set_cursor (*cRightTanMove); + window->set_cursor (cRightTanMove); } else if (shape == CSStraighten) { - window->set_cursor (*cHand); + window->set_cursor (cHand); } else if (shape == CSWait) { - window->set_cursor (*cWait); + window->set_cursor (cWait); } else if (shape == CSPlus) { - window->set_cursor (*cAdd); + window->set_cursor (cAdd); } else if (shape == CSEmpty) { - window->set_cursor (*cHidden); + window->set_cursor (cHidden); } } +void CursorManager::setWidgetCursor (Glib::RefPtr window, CursorShape shape) +{ + if (window->get_display() == mainWindowCursorManager.display) { + mainWindowCursorManager.setCursor(window, shape); + } else if (window->get_display() == editWindowCursorManager.display) { + editWindowCursorManager.setCursor(window, shape); + } + +#ifndef NDEBUG + else { + printf("CursorManager::setWidgetCursor / Error: Display not found!\n"); + } + +#endif +} + +void CursorManager::setCursorOfMainWindow (Glib::RefPtr window, CursorShape shape) +{ + if (window->get_display() == mainWindowCursorManager.display) { + mainWindowCursorManager.setCursor(shape); + } else if (window->get_display() == editWindowCursorManager.display) { + editWindowCursorManager.setCursor(shape); + } + +#ifndef NDEBUG + else { + printf("CursorManager::setCursorOfMainWindow / Error: Display not found!\n"); + } + +#endif +} + /* Set the cursor of the main window */ void CursorManager::setCursor (CursorShape shape) { - setCursor(mainWindow, shape); + setCursor (window, shape); } diff --git a/rtgui/cursormanager.h b/rtgui/cursormanager.h index b51fb1e38..05377ac5d 100644 --- a/rtgui/cursormanager.h +++ b/rtgui/cursormanager.h @@ -22,7 +22,7 @@ #include enum CursorShape { - CSArrow, CSOpenHand, CSClosedHand, CSMove, CSMoveLeft, + CSUndefined, CSArrow, CSOpenHand, CSClosedHand, CSMove, CSMoveLeft, CSMoveRight, CSResizeWidth, CSResizeHeight, CSResizeDiagonal, CSResizeTopLeft, CSResizeTopRight, CSResizeBottomLeft, CSResizeBottomRight, CSMove2D, CSMove1DH, CSMove1DV, CSMoveRotate, @@ -32,39 +32,45 @@ enum CursorShape { class CursorManager { -protected: - Gdk::Cursor* cResizeWidth; - Gdk::Cursor* cResizeHeight; - Gdk::Cursor* cResizeDiag; - Gdk::Cursor* cResizeTopLeft; - Gdk::Cursor* cResizeTopRight; - Gdk::Cursor* cResizeBottomLeft; - Gdk::Cursor* cResizeBottomRight; - Gdk::Cursor* cCropMove; - Gdk::Cursor* cCropMoving; - Gdk::Cursor* cLeftTanMove; - Gdk::Cursor* cRightTanMove; - Gdk::Cursor* cNormal; - Gdk::Cursor* cCropSelection; - Gdk::Cursor* cAdd; - Gdk::Cursor* cWait; - Gdk::Cursor* cHand; - Gdk::Cursor* cClosedHand; - Gdk::Cursor* cWB; - Gdk::Cursor* cHidden; - Gdk::Cursor* cMove2D; - Gdk::Cursor* cMove1DH; - Gdk::Cursor* cMove1DV; - Gdk::Cursor* cMoveRotate; - Glib::RefPtr mainWindow; +private: + Glib::RefPtr cResizeWidth; + Glib::RefPtr cResizeHeight; + Glib::RefPtr cResizeDiag; + Glib::RefPtr cResizeTopLeft; + Glib::RefPtr cResizeTopRight; + Glib::RefPtr cResizeBottomLeft; + Glib::RefPtr cResizeBottomRight; + Glib::RefPtr cCropMove; + Glib::RefPtr cCropMoving; + Glib::RefPtr cLeftTanMove; + Glib::RefPtr cRightTanMove; + Glib::RefPtr cNormal; + Glib::RefPtr cCropSelection; + Glib::RefPtr cAdd; + Glib::RefPtr cWait; + Glib::RefPtr cHand; + Glib::RefPtr cClosedHand; + Glib::RefPtr cWB; + Glib::RefPtr cHidden; + Glib::RefPtr cMove2D; + Glib::RefPtr cMove1DH; + Glib::RefPtr cMove1DV; + Glib::RefPtr cMoveRotate; + + Glib::RefPtr display; + Glib::RefPtr window; + + void setCursor (CursorShape shape); + void setCursor (Glib::RefPtr window, CursorShape shape); public: - void init (Glib::RefPtr mainWin); - void setCursor (Glib::RefPtr window, CursorShape shape); - void setCursor (CursorShape shape); + void init (Glib::RefPtr mainWindow); + static void setWidgetCursor (Glib::RefPtr window, CursorShape shape); + static void setCursorOfMainWindow (Glib::RefPtr window, CursorShape shape); }; -extern CursorManager cursorManager; +extern CursorManager mainWindowCursorManager; +extern CursorManager editWindowCursorManager; #endif diff --git a/rtgui/curveeditorgroup.cc b/rtgui/curveeditorgroup.cc index c1915436d..09e43f670 100644 --- a/rtgui/curveeditorgroup.cc +++ b/rtgui/curveeditorgroup.cc @@ -32,7 +32,7 @@ CurveEditorGroup::CurveEditorGroup (Glib::ustring& curveDir, Glib::ustring group { // We set the label to the one provided as parameter, even if it's an empty string - curveGroupLabel = Gtk::manage (new Gtk::Label (groupLabel + ":", Gtk::ALIGN_LEFT)); + curveGroupLabel = Gtk::manage (new Gtk::Label (groupLabel + ":", Gtk::ALIGN_START)); } CurveEditorGroup::~CurveEditorGroup() @@ -133,20 +133,20 @@ void CurveEditorGroup::newLine() } int j = numberOfPackedCurve; + + /* bool hasRelatedWidget = false; - - for (int i = (int)(curveEditors.size()) - 1; i >= j; i--) { - if (curveEditors[i]->relatedWidget != NULL) { + for (int i = (int)(curveEditors.size())-1; i >= j; i--) { + if (curveEditors[i]->relatedWidget != NULL) hasRelatedWidget = true; - } } - - for (int i = (int)(curveEditors.size()) - 1; i >= j; i--) { + */ + for (int i = (int)(curveEditors.size()) - 1; i >= j; --i) { if (curveEditors[i]->relatedWidget != NULL) { headerBox->pack_end (*curveEditors[i]->relatedWidget, Gtk::PACK_EXPAND_WIDGET, 2); } - headerBox->pack_end (*curveEditors[i]->curveType->buttonGroup, hasRelatedWidget ? Gtk::PACK_SHRINK : Gtk::PACK_EXPAND_WIDGET, 2); + headerBox->pack_end (*curveEditors[i]->curveType->buttonGroup, /*hasRelatedWidget ? Gtk::PACK_SHRINK :*/ Gtk::PACK_EXPAND_WIDGET, 2); numberOfPackedCurve++; } @@ -426,17 +426,17 @@ Glib::ustring CurveEditorSubGroup::outputFile () FileChooserLastFolderPersister persister(&dialog, curveDir); dialog.set_current_name (lastFilename); - dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::StockID("gtk-save"), Gtk::RESPONSE_APPLY); + dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + dialog.add_button(M("GENERAL_SAVE"), Gtk::RESPONSE_APPLY); - Gtk::FileFilter filter_pp; - filter_pp.set_name(M("FILECHOOSER_FILTER_CURVE")); - filter_pp.add_pattern("*.rtc"); + Glib::RefPtr filter_pp = Gtk::FileFilter::create(); + filter_pp->set_name(M("FILECHOOSER_FILTER_CURVE")); + filter_pp->add_pattern("*.rtc"); dialog.add_filter(filter_pp); - Gtk::FileFilter filter_any; - filter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - filter_any.add_pattern("*"); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); + filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + filter_any->add_pattern("*"); dialog.add_filter(filter_any); //dialog.set_do_overwrite_confirmation (true); @@ -470,17 +470,17 @@ Glib::ustring CurveEditorSubGroup::inputFile () Gtk::FileChooserDialog dialog(M("CURVEEDITOR_LOADDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN); FileChooserLastFolderPersister persister(&dialog, curveDir); - dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::StockID("gtk-apply"), Gtk::RESPONSE_APPLY); + dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + dialog.add_button(M("GENERAL_APPLY"), Gtk::RESPONSE_APPLY); - Gtk::FileFilter filter_pp; - filter_pp.set_name(M("FILECHOOSER_FILTER_CURVE")); - filter_pp.add_pattern("*.rtc"); + Glib::RefPtr filter_pp = Gtk::FileFilter::create(); + filter_pp->set_name(M("FILECHOOSER_FILTER_CURVE")); + filter_pp->add_pattern("*.rtc"); dialog.add_filter(filter_pp); - Gtk::FileFilter filter_any; - filter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - filter_any.add_pattern("*"); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); + filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + filter_any->add_pattern("*"); dialog.add_filter(filter_any); int result = dialog.run(); diff --git a/rtgui/darkframe.cc b/rtgui/darkframe.cc index e16817cb6..79af18a8b 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -52,19 +52,19 @@ DarkFrame::DarkFrame () : FoldableToolPanel(this, "darkframe", M("TP_DARKFRAME_L // Set filename filters b_filter_asCurrent = false; - Gtk::FileFilter *filter_any = Gtk::manage(new Gtk::FileFilter); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); filter_any->add_pattern("*"); filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); - darkFrameFile->add_filter (*filter_any); + darkFrameFile->add_filter (filter_any); // filters for all supported non-raw extensions for (size_t i = 0; i < options.parseExtensions.size(); i++) { if (options.parseExtensionsEnabled[i] && options.parseExtensions[i].uppercase() != "JPG" && options.parseExtensions[i].uppercase() != "JPEG" && options.parseExtensions[i].uppercase() != "PNG" && options.parseExtensions[i].uppercase() != "TIF" && options.parseExtensions[i].uppercase() != "TIFF" ) { - Gtk::FileFilter *filter_df = Gtk::manage(new Gtk::FileFilter); + Glib::RefPtr filter_df = Gtk::FileFilter::create(); filter_df->add_pattern("*." + options.parseExtensions[i]); filter_df->add_pattern("*." + options.parseExtensions[i].uppercase()); filter_df->set_name(options.parseExtensions[i].uppercase()); - darkFrameFile->add_filter (*filter_df); + darkFrameFile->add_filter (filter_df); //printf("adding filter %s \n",options.parseExtensions[i].uppercase().c_str()); } } @@ -114,8 +114,8 @@ void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi if (b_filter_asCurrent) { //First, remove last filter_asCurrent if it was set for a raw file - std::vector filters = darkFrameFile->list_filters(); - darkFrameFile->remove_filter(**(filters.end() - 1)); + std::vector< Glib::RefPtr > filters = darkFrameFile->list_filters(); + darkFrameFile->remove_filter(*(filters.end() - 1)); b_filter_asCurrent = false; } @@ -134,11 +134,11 @@ void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi //exclude non-raw if (israw) { b_filter_asCurrent = true; - Gtk::FileFilter *filter_asCurrent = Gtk::manage(new Gtk::FileFilter); + Glib::RefPtr filter_asCurrent = Gtk::FileFilter::create(); filter_asCurrent->add_pattern("*." + filetype); filter_asCurrent->set_name(M("FILECHOOSER_FILTER_SAME") + " (" + filetype + ")"); - darkFrameFile->add_filter (*filter_asCurrent); - darkFrameFile->set_filter (*filter_asCurrent); + darkFrameFile->add_filter (filter_asCurrent); + darkFrameFile->set_filter (filter_asCurrent); } } } diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index ad896789f..a19f2d888 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -46,72 +46,87 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, activeParamControl = -1; // custom curve - customCurveBox = new Gtk::VBox (); - customCurveBox->set_spacing(4); - Gtk::HBox* customCurveAndButtons = Gtk::manage (new Gtk::HBox ()); - customCurveAndButtons->set_spacing(4); + customCurveGrid = new Gtk::Grid (); + customCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + customCurveGrid->set_row_spacing(options.slimUI ? 2 : 4); + customCurveGrid->set_column_spacing(options.slimUI ? 2 : 4); + customCurve = Gtk::manage (new MyDiagonalCurve ()); - customCurve->set_size_request (GRAPH_SIZE + 2 * RADIUS, GRAPH_SIZE + 2 * RADIUS); customCurve->setType (DCT_Spline); - Gtk::Box* custombbox; // curvebboxpos 0=above, 1=right, 2=below, 3=left + Gtk::Grid* custombbox = Gtk::manage (new Gtk::Grid ()); // curvebboxpos 0=above, 1=right, 2=below, 3=left + custombbox->set_orientation(Gtk::ORIENTATION_VERTICAL); - if (options.curvebboxpos == 1 || options.curvebboxpos == 3) { - custombbox = Gtk::manage (new Gtk::VBox ()); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + setExpandAlignProperties(custombbox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); } else { - custombbox = Gtk::manage (new Gtk::HBox ()); + setExpandAlignProperties(custombbox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); } - custombbox->set_spacing(4); - - pasteCustom = Gtk::manage (new Gtk::Button ()); - pasteCustom->add (*Gtk::manage (new RTImage ("edit-paste.png"))); - copyCustom = Gtk::manage (new Gtk::Button ()); - copyCustom->add (*Gtk::manage (new RTImage ("edit-copy.png"))); - saveCustom = Gtk::manage (new Gtk::Button ()); - saveCustom->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); - loadCustom = Gtk::manage (new Gtk::Button ()); - loadCustom->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editPointCustom = Gtk::manage (new Gtk::ToggleButton ()); editPointCustom->add (*Gtk::manage (new RTImage ("gtk-edit.png"))); + editPointCustom->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); editPointCustom->set_tooltip_text(M("CURVEEDITOR_EDITPOINT_HINT")); + setExpandAlignProperties(editPointCustom, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); editCustom = Gtk::manage (new Gtk::ToggleButton()); editCustom->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editCustom->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); editCustom->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); + setExpandAlignProperties(editCustom, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); editCustom->hide(); + copyCustom = Gtk::manage (new Gtk::Button ()); + copyCustom->add (*Gtk::manage (new RTImage ("edit-copy.png"))); + copyCustom->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(copyCustom, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + pasteCustom = Gtk::manage (new Gtk::Button ()); + pasteCustom->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(pasteCustom, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + loadCustom = Gtk::manage (new Gtk::Button ()); + loadCustom->add (*Gtk::manage (new RTImage ("gtk-open.png"))); + loadCustom->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(loadCustom, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + saveCustom = Gtk::manage (new Gtk::Button ()); + saveCustom->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); + saveCustom->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(saveCustom, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); - custombbox->pack_end (*pasteCustom, Gtk::PACK_SHRINK, 0); - custombbox->pack_end (*copyCustom, Gtk::PACK_SHRINK, 0); - custombbox->pack_end (*saveCustom, Gtk::PACK_SHRINK, 0); - custombbox->pack_end (*loadCustom, Gtk::PACK_SHRINK, 0); - custombbox->pack_start(*editPointCustom, Gtk::PACK_SHRINK, 0); - custombbox->pack_start(*editCustom, Gtk::PACK_SHRINK, 0); - - customCurveAndButtons->pack_start (*customCurve, Gtk::PACK_EXPAND_WIDGET, 0); - customCurveAndButtons->pack_start (*custombbox, Gtk::PACK_SHRINK, 0); - customCurveBox->pack_start (*customCurveAndButtons, Gtk::PACK_EXPAND_WIDGET); - - if (options.curvebboxpos == 0) { - removeIfThere (customCurveAndButtons, custombbox, false); - customCurveBox->pack_start (*custombbox); - customCurveBox->reorder_child(*custombbox, 0); - } else if (options.curvebboxpos == 2) { - removeIfThere (customCurveAndButtons, custombbox, false); - customCurveBox->pack_start (*custombbox); - } else if (options.curvebboxpos == 3) { - customCurveAndButtons->reorder_child(*custombbox, 0); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + custombbox->attach(*editCustom, 0, 0, 1, 1); + custombbox->attach(*editPointCustom, 1, 0, 1, 1); + custombbox->attach(*copyCustom, 2, 0, 1, 1); + custombbox->attach(*pasteCustom, 3, 0, 1, 1); + custombbox->attach(*loadCustom, 4, 0, 1, 1); + custombbox->attach(*saveCustom, 5, 0, 1, 1); + } else { + custombbox->attach(*editCustom, 0, 0, 1, 1); + custombbox->attach(*editPointCustom, 0, 1, 1, 1); + custombbox->attach(*copyCustom, 0, 2, 1, 1); + custombbox->attach(*pasteCustom, 0, 3, 1, 1); + custombbox->attach(*loadCustom, 0, 4, 1, 1); + custombbox->attach(*saveCustom, 0, 5, 1, 1); } customCoordAdjuster = Gtk::manage (new CoordinateAdjuster(customCurve, this)); - customCurveBox->pack_start(*customCoordAdjuster, Gtk::PACK_SHRINK, 0); - if (options.curvebboxpos == 2) { - customCurveBox->reorder_child(*customCoordAdjuster, 2); + // Button box position: 0=above, 1=right, 2=below, 3=left + customCurveGrid->add(*customCurve); + customCurve->set_hexpand(true); + + if (options.curvebboxpos == 0) { + customCurveGrid->attach_next_to(*custombbox, *customCurve, Gtk::POS_TOP, 1, 1); + customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurve, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 1) { + customCurveGrid->attach_next_to(*custombbox, *customCurve, Gtk::POS_RIGHT, 1, 1); + customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurve, Gtk::POS_BOTTOM, 2, 1); + } else if (options.curvebboxpos == 2) { + customCurveGrid->attach_next_to(*customCoordAdjuster, *customCurve, Gtk::POS_BOTTOM, 1, 1); + customCurveGrid->attach_next_to(*custombbox, *customCoordAdjuster, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 3) { + customCurveGrid->attach_next_to(*custombbox, *customCurve, Gtk::POS_LEFT, 1, 1); + customCurveGrid->attach_next_to(*customCoordAdjuster, *custombbox, Gtk::POS_BOTTOM, 2, 1); } - customCoordAdjuster->show_all(); - - customCurveBox->show_all (); + customCurveGrid->show_all (); customCoordAdjuster->hide(); saveCustom->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::savePressed) ); @@ -129,71 +144,88 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, // NURBS curve - NURBSCurveBox = new Gtk::VBox (); - NURBSCurveBox->set_spacing(4); - Gtk::HBox* NURBSCurveAndButtons = Gtk::manage (new Gtk::HBox ()); - NURBSCurveAndButtons->set_spacing(4); + NURBSCurveGrid = new Gtk::Grid (); + NURBSCurveGrid->set_row_spacing(4); + NURBSCurveGrid->set_column_spacing(4); + NURBSCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + NURBSCurve = Gtk::manage (new MyDiagonalCurve ()); - NURBSCurve->set_size_request (GRAPH_SIZE + 2 * RADIUS, GRAPH_SIZE + 2 * RADIUS); NURBSCurve->setType (DCT_NURBS); - Gtk::Box* NURBSbbox; + Gtk::Grid* NURBSbbox = Gtk::manage (new Gtk::Grid ()); + NURBSbbox->set_orientation(Gtk::ORIENTATION_VERTICAL); - if (options.curvebboxpos == 1 || options.curvebboxpos == 3) { - NURBSbbox = Gtk::manage (new Gtk::VBox ()); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + setExpandAlignProperties(NURBSbbox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); } else { - NURBSbbox = Gtk::manage (new Gtk::HBox ()); + setExpandAlignProperties(NURBSbbox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); } - NURBSbbox->set_spacing(4); - - pasteNURBS = Gtk::manage (new Gtk::Button ()); - pasteNURBS->add (*Gtk::manage (new RTImage ("edit-paste.png"))); - copyNURBS = Gtk::manage (new Gtk::Button ()); - copyNURBS->add (*Gtk::manage (new RTImage ("edit-copy.png"))); - saveNURBS = Gtk::manage (new Gtk::Button ()); - saveNURBS->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); - loadNURBS = Gtk::manage (new Gtk::Button ()); - loadNURBS->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editPointNURBS = Gtk::manage (new Gtk::ToggleButton ()); editPointNURBS->add (*Gtk::manage (new RTImage ("gtk-edit.png"))); + editPointNURBS->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); editPointNURBS->set_tooltip_text(M("CURVEEDITOR_EDITPOINT_HINT")); + setExpandAlignProperties(editPointNURBS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); editNURBS = Gtk::manage (new Gtk::ToggleButton()); editNURBS->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editNURBS->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); editNURBS->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); + setExpandAlignProperties(editNURBS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); editNURBS->hide(); - NURBSbbox->pack_end (*pasteNURBS, Gtk::PACK_SHRINK, 0); - NURBSbbox->pack_end (*copyNURBS, Gtk::PACK_SHRINK, 0); - NURBSbbox->pack_end (*saveNURBS, Gtk::PACK_SHRINK, 0); - NURBSbbox->pack_end (*loadNURBS, Gtk::PACK_SHRINK, 0); - NURBSbbox->pack_start(*editPointNURBS, Gtk::PACK_SHRINK, 0); - NURBSbbox->pack_start(*editNURBS, Gtk::PACK_SHRINK, 0); + copyNURBS = Gtk::manage (new Gtk::Button ()); + copyNURBS->add (*Gtk::manage (new RTImage ("edit-copy.png"))); + copyNURBS->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(copyNURBS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + pasteNURBS = Gtk::manage (new Gtk::Button ()); + pasteNURBS->add (*Gtk::manage (new RTImage ("edit-paste.png"))); + pasteNURBS->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(pasteNURBS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + loadNURBS = Gtk::manage (new Gtk::Button ()); + loadNURBS->add (*Gtk::manage (new RTImage ("gtk-open.png"))); + loadNURBS->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(loadNURBS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + saveNURBS = Gtk::manage (new Gtk::Button ()); + saveNURBS->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); + saveNURBS->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(saveNURBS, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); - NURBSCurveAndButtons->pack_start (*NURBSCurve, Gtk::PACK_EXPAND_WIDGET, 0); - NURBSCurveAndButtons->pack_start (*NURBSbbox, Gtk::PACK_SHRINK, 0); - NURBSCurveBox->pack_start (*NURBSCurveAndButtons, Gtk::PACK_EXPAND_WIDGET); - - if (options.curvebboxpos == 0) { - removeIfThere (NURBSCurveAndButtons, NURBSbbox, false); - NURBSCurveBox->pack_start (*NURBSbbox); - NURBSCurveBox->reorder_child(*NURBSbbox, 0); - } else if (options.curvebboxpos == 2) { - removeIfThere (NURBSCurveAndButtons, NURBSbbox, false); - NURBSCurveBox->pack_start (*NURBSbbox); - } else if (options.curvebboxpos == 3) { - NURBSCurveAndButtons->reorder_child(*NURBSbbox, 0); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + NURBSbbox->attach(*editNURBS, 0, 0, 1, 1); + NURBSbbox->attach(*editPointNURBS, 1, 0, 1, 1); + NURBSbbox->attach(*copyNURBS, 2, 0, 1, 1); + NURBSbbox->attach(*pasteNURBS, 3, 0, 1, 1); + NURBSbbox->attach(*loadNURBS, 4, 0, 1, 1); + NURBSbbox->attach(*saveNURBS, 5, 0, 1, 1); + } else { + NURBSbbox->attach(*editNURBS, 0, 0, 1, 1); + NURBSbbox->attach(*editPointNURBS, 0, 1, 1, 1); + NURBSbbox->attach(*copyNURBS, 0, 2, 1, 1); + NURBSbbox->attach(*pasteNURBS, 0, 3, 1, 1); + NURBSbbox->attach(*loadNURBS, 0, 4, 1, 1); + NURBSbbox->attach(*saveNURBS, 0, 5, 1, 1); } NURBSCoordAdjuster = Gtk::manage (new CoordinateAdjuster(NURBSCurve, this)); - NURBSCurveBox->pack_start(*NURBSCoordAdjuster, Gtk::PACK_SHRINK, 0); - if (options.curvebboxpos == 2) { - NURBSCurveBox->reorder_child(*NURBSCoordAdjuster, 2); + // Button box position: 0=above, 1=right, 2=below, 3=left + NURBSCurveGrid->add(*NURBSCurve); + NURBSCurve->set_hexpand(true); + + if (options.curvebboxpos == 0) { + NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurve, Gtk::POS_TOP, 1, 1); + NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurve, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 1) { + NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurve, Gtk::POS_RIGHT, 1, 1); + NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurve, Gtk::POS_BOTTOM, 2, 1); + } else if (options.curvebboxpos == 2) { + NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSCurve, Gtk::POS_BOTTOM, 1, 1); + NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCoordAdjuster, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 3) { + NURBSCurveGrid->attach_next_to(*NURBSbbox, *NURBSCurve, Gtk::POS_LEFT, 1, 1); + NURBSCurveGrid->attach_next_to(*NURBSCoordAdjuster, *NURBSbbox, Gtk::POS_BOTTOM, 2, 1); } - NURBSCoordAdjuster->show_all(); - - NURBSCurveBox->show_all (); + NURBSCurveGrid->show_all (); NURBSCoordAdjuster->hide(); saveNURBS->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::savePressed) ); @@ -211,46 +243,62 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, // parametric curve - paramCurveBox = new Gtk::VBox (); - paramCurveBox->set_spacing(4); - Gtk::HBox* paramCurveAndButtons = Gtk::manage (new Gtk::HBox ()); - paramCurveAndButtons->set_spacing(4); - Gtk::VBox* paramCurveAndShcVBox = Gtk::manage (new Gtk::VBox ()); + paramCurveGrid = new Gtk::Grid (); + paramCurveGrid->set_row_spacing(4); + paramCurveGrid->set_column_spacing(4); + paramCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + paramCurve = Gtk::manage (new MyDiagonalCurve ()); - paramCurve->set_size_request (GRAPH_SIZE + 2 * RADIUS, GRAPH_SIZE + 2 * RADIUS); paramCurve->setType (DCT_Parametric); - Gtk::Box* parambbox; + Gtk::Grid* parambbox = Gtk::manage (new Gtk::Grid ()); + parambbox->set_orientation(Gtk::ORIENTATION_VERTICAL); - if (options.curvebboxpos == 1 || options.curvebboxpos == 3) { - parambbox = Gtk::manage (new Gtk::VBox ()); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + setExpandAlignProperties(parambbox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); } else { - parambbox = Gtk::manage (new Gtk::HBox ()); + setExpandAlignProperties(parambbox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); } - parambbox->set_spacing(4); - shcSelector = Gtk::manage (new SHCSelector ()); - shcSelector->set_size_request (GRAPH_SIZE - 100, 10); // width, height - //* shcSelector->set_size_request ((GRAPH_SIZE+2*RADIUS)-20, 20); + shcSelector->set_name("CurveSHCSelector"); // To handle the 4px gap between the SHCSelector and the curve through CSS - pasteParam = Gtk::manage (new Gtk::Button ()); - pasteParam->add (*Gtk::manage (new RTImage ("edit-paste.png"))); - copyParam = Gtk::manage (new Gtk::Button ()); - copyParam->add (*Gtk::manage (new RTImage ("edit-copy.png"))); - saveParam = Gtk::manage (new Gtk::Button ()); - saveParam->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); - loadParam = Gtk::manage (new Gtk::Button ()); - loadParam->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editParam = Gtk::manage (new Gtk::ToggleButton()); editParam->add (*Gtk::manage (new RTImage ("editmodehand.png"))); editParam->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); + editParam->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(editParam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); editParam->hide(); - parambbox->pack_end (*pasteParam, Gtk::PACK_SHRINK, 0); - parambbox->pack_end (*copyParam, Gtk::PACK_SHRINK, 0); - parambbox->pack_end (*saveParam, Gtk::PACK_SHRINK, 0); - parambbox->pack_end (*loadParam, Gtk::PACK_SHRINK, 0); - parambbox->pack_start(*editParam, Gtk::PACK_SHRINK, 0); + copyParam = Gtk::manage (new Gtk::Button ()); + copyParam->add (*Gtk::manage (new RTImage ("edit-copy.png"))); + copyParam->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(copyParam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + pasteParam = Gtk::manage (new Gtk::Button ()); + pasteParam->add (*Gtk::manage (new RTImage ("edit-paste.png"))); + pasteParam->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(pasteParam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + loadParam = Gtk::manage (new Gtk::Button ()); + loadParam->add (*Gtk::manage (new RTImage ("gtk-open.png"))); + loadParam->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(loadParam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + saveParam = Gtk::manage (new Gtk::Button ()); + saveParam->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); + saveParam->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(saveParam, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + parambbox->attach(*editParam, 0, 0, 1, 1); + parambbox->attach(*copyParam, 1, 0, 1, 1); + parambbox->attach(*pasteParam, 2, 0, 1, 1); + parambbox->attach(*loadParam, 3, 0, 1, 1); + parambbox->attach(*saveParam, 4, 0, 1, 1); + } else { + parambbox->attach(*editParam, 0, 0, 1, 1); + parambbox->attach(*copyParam, 0, 1, 1, 1); + parambbox->attach(*pasteParam, 0, 2, 1, 1); + parambbox->attach(*loadParam, 0, 3, 1, 1); + parambbox->attach(*saveParam, 0, 4, 1, 1); + } saveParam->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::savePressed) ); loadParam->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::loadPressed) ); @@ -279,41 +327,46 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, evshadows->add (*shadows); // paramCurveSliderBox needed to set vspacing(4) between curve+shc and sliders without vspacing between each slider - Gtk::VBox* paramCurveSliderBox = Gtk::manage (new Gtk::VBox ()); - paramCurveSliderBox->set_spacing(4); + Gtk::Grid* paramCurveSliderBox = Gtk::manage (new Gtk::Grid()); + paramCurveSliderBox->set_orientation(Gtk::ORIENTATION_VERTICAL); + paramCurveSliderBox->set_column_spacing(options.slimUI ? 2 : 4); + paramCurveSliderBox->set_row_spacing(options.slimUI ? 2 : 4); - paramCurveSliderBox->pack_start (*evhighlights); - paramCurveSliderBox->pack_start (*evlights); - paramCurveSliderBox->pack_start (*evdarks); - paramCurveSliderBox->pack_start (*evshadows); + paramCurveSliderBox->attach_next_to(*evhighlights, Gtk::POS_TOP, 1, 1); + paramCurveSliderBox->attach_next_to(*evlights, Gtk::POS_TOP, 1, 1); + paramCurveSliderBox->attach_next_to(*evdarks, Gtk::POS_TOP, 1, 1); + paramCurveSliderBox->attach_next_to(*evshadows, Gtk::POS_TOP, 1, 1); - paramCurveBox->show_all (); + paramCurveGrid->show_all (); - paramCurveAndShcVBox->pack_start (*paramCurve, Gtk::PACK_EXPAND_WIDGET); - paramCurveAndShcVBox->pack_start (*shcSelector, Gtk::PACK_EXPAND_WIDGET); - paramCurveAndButtons->pack_start (*paramCurveAndShcVBox); - paramCurveAndButtons->pack_start (*parambbox, Gtk::PACK_SHRINK); - paramCurveBox->pack_start (*paramCurveAndButtons); - paramCurveBox->pack_start (*paramCurveSliderBox); + // Button box position: 0=above, 1=right, 2=below, 3=left + paramCurveGrid->add(*paramCurve); + paramCurve->set_hexpand(true); if (options.curvebboxpos == 0) { - removeIfThere (paramCurveAndButtons, parambbox, false); - paramCurveBox->pack_start (*parambbox); - paramCurveBox->reorder_child(*parambbox, 0); + paramCurveGrid->attach_next_to(*parambbox, *paramCurve, Gtk::POS_TOP, 1, 1); + paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1); + paramCurveGrid->attach_next_to(*paramCurveSliderBox, *shcSelector, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 1) { + paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1); + paramCurveGrid->attach_next_to(*parambbox, *paramCurve, Gtk::POS_RIGHT, 1, 2); + paramCurveGrid->attach_next_to(*paramCurveSliderBox, *shcSelector, Gtk::POS_BOTTOM, 2, 1); } else if (options.curvebboxpos == 2) { - removeIfThere (paramCurveAndButtons, parambbox, false); - paramCurveBox->pack_start (*parambbox); - //paramCurveBox->reorder_child(*parambbox, 1); + paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1); + paramCurveGrid->attach_next_to(*parambbox, *shcSelector, Gtk::POS_BOTTOM, 1, 1); + paramCurveGrid->attach_next_to(*paramCurveSliderBox, *parambbox, Gtk::POS_BOTTOM, 1, 1); } else if (options.curvebboxpos == 3) { - paramCurveAndButtons->reorder_child(*parambbox, 0); + paramCurveGrid->attach_next_to(*shcSelector, *paramCurve, Gtk::POS_BOTTOM, 1, 1); + paramCurveGrid->attach_next_to(*parambbox, *paramCurve, Gtk::POS_LEFT, 1, 2); + paramCurveGrid->attach_next_to(*paramCurveSliderBox, *parambbox, Gtk::POS_BOTTOM, 2, 1); } - paramCurveBox->show_all (); + paramCurveGrid->show_all (); // parametric curve end - customCurveBox->reference (); - paramCurveBox->reference (); + customCurveGrid->reference (); + paramCurveGrid->reference (); customCurve->setCurveListener (parent); // Send the message directly to the parent NURBSCurve->setCurveListener (parent); @@ -341,9 +394,9 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, DiagonalCurveEditorSubGroup::~DiagonalCurveEditorSubGroup() { - delete customCurveBox; - delete paramCurveBox; - delete NURBSCurveBox; + delete customCurveGrid; + delete paramCurveGrid; + delete NURBSCurveGrid; } /* @@ -665,10 +718,10 @@ void DiagonalCurveEditorSubGroup::switchGUI() customCurve->setPoints (dCurve->customCurveEd); customCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId()); customCurve->setColoredBar(leftBar, bottomBar); - customCurve->forceResize(); + customCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editCustom, editCustomConn); - parent->pack_start (*customCurveBox); - customCurveBox->check_resize(); + parent->pack_start (*customCurveGrid); + customCurveGrid->check_resize(); break; case (DCT_Parametric): { @@ -696,9 +749,9 @@ void DiagonalCurveEditorSubGroup::switchGUI() shcSelector->setBgGradient(bgGradient); shcSelector->setMargins( (leftBar ? MyCurve::getBarWidth() + CBAR_MARGIN : RADIUS), RADIUS ); paramCurve->setColoredBar(leftBar, NULL); - paramCurve->forceResize(); + paramCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editParam, editParamConn); - parent->pack_start (*paramCurveBox); + parent->pack_start (*paramCurveGrid); break; } @@ -706,10 +759,10 @@ void DiagonalCurveEditorSubGroup::switchGUI() NURBSCurve->setPoints (dCurve->NURBSCurveEd); NURBSCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId()); NURBSCurve->setColoredBar(leftBar, bottomBar); - NURBSCurve->forceResize(); + NURBSCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editNURBS, editNURBSConn); - parent->pack_start (*NURBSCurveBox); - NURBSCurveBox->check_resize(); + parent->pack_start (*NURBSCurveGrid); + NURBSCurveGrid->check_resize(); break; default: // (DCT_Linear, DCT_Unchanged) @@ -1095,9 +1148,9 @@ const std::vector DiagonalCurveEditorSubGroup::getCurveFromGUI (int type */ void DiagonalCurveEditorSubGroup::removeEditor () { - removeIfThere (parent, customCurveBox, false); - removeIfThere (parent, paramCurveBox, false); - removeIfThere (parent, NURBSCurveBox, false); + removeIfThere (parent, customCurveGrid, false); + removeIfThere (parent, paramCurveGrid, false); + removeIfThere (parent, NURBSCurveGrid, false); } bool DiagonalCurveEditorSubGroup::curveReset(CurveEditor *ce) diff --git a/rtgui/diagonalcurveeditorsubgroup.h b/rtgui/diagonalcurveeditorsubgroup.h index 8178eb56a..e33edfeaf 100644 --- a/rtgui/diagonalcurveeditorsubgroup.h +++ b/rtgui/diagonalcurveeditorsubgroup.h @@ -30,9 +30,9 @@ class DiagonalCurveEditorSubGroup : public CurveEditorSubGroup, public SHCListen friend class DiagonalCurveEditor; protected: - Gtk::VBox* customCurveBox; - Gtk::VBox* NURBSCurveBox; - Gtk::VBox* paramCurveBox; + Gtk::Grid* customCurveGrid; + Gtk::Grid* NURBSCurveGrid; + Gtk::Grid* paramCurveGrid; MyDiagonalCurve* customCurve; MyDiagonalCurve* NURBSCurve; diff --git a/rtgui/dirbrowser.cc b/rtgui/dirbrowser.cc index 914b74ef5..07eab4984 100644 --- a/rtgui/dirbrowser.cc +++ b/rtgui/dirbrowser.cc @@ -57,7 +57,7 @@ DirBrowser::DirBrowser () : dirTreeModel(), dirtree->set_rules_hint(false); dirtree->set_reorderable(false); dirtree->set_enable_search(false); - scrolledwindow4->set_flags(Gtk::CAN_FOCUS); + scrolledwindow4->set_can_focus(true); scrolledwindow4->set_border_width(2); scrolledwindow4->set_shadow_type(Gtk::SHADOW_NONE); scrolledwindow4->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -356,7 +356,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) { Gtk::TreeModel::Path path; - path.append_index(0); + path.push_back(0); char* dcpy = strdup (absDirPath.c_str()); char* dir = strtok (dcpy, "/\\"); @@ -366,9 +366,9 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) #ifndef WIN32 Gtk::TreeModel::iterator j = dirTreeModel->get_iter (path); path.up (); - path.append_index (0); + path.push_back (0); row_expanded(j, path); - path.append_index (0); + path.push_back (0); #endif while (dir) { @@ -394,14 +394,14 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) if (str == dirstr) { #endif path.up (); - path.append_index (ix); + path.push_back (ix); row_expanded(i, path); - path.append_index (0); + path.push_back (0); break; } - ix++; - i++; + ++ix; + ++i; } count++; diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 5eac04b2a..c5e57b543 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -56,8 +56,8 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP ctboxL->pack_start (*labmL, Gtk::PACK_SHRINK, 1); Lmethod = Gtk::manage (new MyComboBoxText ()); - Lmethod->append_text (M("TP_DIRPYRDENOISE_CUR")); - Lmethod->append_text (M("TP_DIRPYRDENOISE_SLI")); + Lmethod->append (M("TP_DIRPYRDENOISE_CUR")); + Lmethod->append (M("TP_DIRPYRDENOISE_SLI")); Lmethod->set_active(0); Lmethodconn = Lmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::LmethodChanged) ); @@ -100,10 +100,10 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP ctboxC->set_tooltip_markup (M("TP_DIRPYRDENOISE_CTYPE_TOOLTIP")); Cmethod = Gtk::manage (new MyComboBoxText ()); - Cmethod->append_text (M("TP_DIRPYRDENOISE_MAN")); - Cmethod->append_text (M("TP_DIRPYRDENOISE_AUT")); - Cmethod->append_text (M("TP_DIRPYRDENOISE_PON")); - Cmethod->append_text (M("TP_DIRPYRDENOISE_PRE")); + Cmethod->append (M("TP_DIRPYRDENOISE_MAN")); + Cmethod->append (M("TP_DIRPYRDENOISE_AUT")); + Cmethod->append (M("TP_DIRPYRDENOISE_PON")); + Cmethod->append (M("TP_DIRPYRDENOISE_PRE")); Cmethod->set_active(0); Cmethodconn = Cmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::CmethodChanged) ); @@ -113,9 +113,9 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP ctboxC2->set_tooltip_markup (M("TP_DIRPYRDENOISE_C2TYPE_TOOLTIP")); C2method = Gtk::manage (new MyComboBoxText ()); - C2method->append_text (M("TP_DIRPYRDENOISE_MANU")); - C2method->append_text (M("TP_DIRPYRDENOISE_AUTO")); - C2method->append_text (M("TP_DIRPYRDENOISE_PREV")); + C2method->append (M("TP_DIRPYRDENOISE_MANU")); + C2method->append (M("TP_DIRPYRDENOISE_AUTO")); + C2method->append (M("TP_DIRPYRDENOISE_PREV")); C2method->set_active(0); C2methodconn = C2method->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::C2methodChanged) ); @@ -139,8 +139,8 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP hb1->set_tooltip_markup (M("TP_DIRPYRDENOISE_METHOD_TOOLTIP")); dmethod = Gtk::manage (new MyComboBoxText ()); - dmethod->append_text (M("TP_DIRPYRDENOISE_LAB")); - dmethod->append_text (M("TP_DIRPYRDENOISE_RGB")); + dmethod->append (M("TP_DIRPYRDENOISE_LAB")); + dmethod->append (M("TP_DIRPYRDENOISE_RGB")); dmethod->set_active(0); hb1->pack_end (*dmethod, Gtk::PACK_EXPAND_WIDGET, 4); pack_start( *hb1, Gtk::PACK_SHRINK, 4); @@ -208,31 +208,31 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP hsep2->show (); methodmed = Gtk::manage (new MyComboBoxText ()); - methodmed->append_text (M("TP_DIRPYRDENOISE_LM")); - methodmed->append_text (M("TP_DIRPYRDENOISE_ABM")); - methodmed->append_text (M("TP_DIRPYRDENOISE_LPLABM")); - methodmed->append_text (M("TP_DIRPYRDENOISE_LABM")); - methodmed->append_text (M("TP_DIRPYRDENOISE_RGBM")); + methodmed->append (M("TP_DIRPYRDENOISE_LM")); + methodmed->append (M("TP_DIRPYRDENOISE_ABM")); + methodmed->append (M("TP_DIRPYRDENOISE_LPLABM")); + methodmed->append (M("TP_DIRPYRDENOISE_LABM")); + methodmed->append (M("TP_DIRPYRDENOISE_RGBM")); methodmed->set_active (0); methodmed->set_tooltip_text (M("TP_DIRPYRDENOISE_METM_TOOLTIP")); methodmedconn = methodmed->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::methodmedChanged) ); rgbmethod = Gtk::manage (new MyComboBoxText ()); - rgbmethod->append_text (M("TP_DIRPYRDENOISE_SOFT")); - rgbmethod->append_text (M("TP_DIRPYRDENOISE_33")); - rgbmethod->append_text (M("TP_DIRPYRDENOISE_55SOFT")); + rgbmethod->append (M("TP_DIRPYRDENOISE_SOFT")); + rgbmethod->append (M("TP_DIRPYRDENOISE_33")); + rgbmethod->append (M("TP_DIRPYRDENOISE_55SOFT")); rgbmethod->set_active (0); rgbmethod->set_tooltip_text (M("TP_DIRPYRDENOISE_MET_TOOLTIP")); rgbmethodconn = rgbmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::rgbmethodChanged) ); medmethod = Gtk::manage (new MyComboBoxText ()); - medmethod->append_text (M("TP_DIRPYRDENOISE_SOFT")); - medmethod->append_text (M("TP_DIRPYRDENOISE_33")); - medmethod->append_text (M("TP_DIRPYRDENOISE_55SOFT")); - medmethod->append_text (M("TP_DIRPYRDENOISE_55")); - medmethod->append_text (M("TP_DIRPYRDENOISE_77")); - medmethod->append_text (M("TP_DIRPYRDENOISE_99")); + medmethod->append (M("TP_DIRPYRDENOISE_SOFT")); + medmethod->append (M("TP_DIRPYRDENOISE_33")); + medmethod->append (M("TP_DIRPYRDENOISE_55SOFT")); + medmethod->append (M("TP_DIRPYRDENOISE_55")); + medmethod->append (M("TP_DIRPYRDENOISE_77")); + medmethod->append (M("TP_DIRPYRDENOISE_99")); medmethod->set_active (0); medmethod->set_tooltip_text (M("TP_DIRPYRDENOISE_MET_TOOLTIP")); medmethodconn = medmethod->signal_changed().connect ( sigc::mem_fun(*this, &DirPyrDenoise::medmethodChanged) ); @@ -258,11 +258,11 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP hb11->set_tooltip_markup (M("TP_DIRPYRDENOISE_METHOD11_TOOLTIP")); smethod = Gtk::manage (new MyComboBoxText ()); - smethod->append_text (M("TP_DIRPYRDENOISE_SHAL")); -// smethod->append_text (M("TP_DIRPYRDENOISE_SHBI")); - smethod->append_text (M("TP_DIRPYRDENOISE_SHALBI")); -// smethod->append_text (M("TP_DIRPYRDENOISE_SHALAL")); -// smethod->append_text (M("TP_DIRPYRDENOISE_SHBIBI")); + smethod->append (M("TP_DIRPYRDENOISE_SHAL")); +// smethod->append (M("TP_DIRPYRDENOISE_SHBI")); + smethod->append (M("TP_DIRPYRDENOISE_SHALBI")); +// smethod->append (M("TP_DIRPYRDENOISE_SHALAL")); +// smethod->append (M("TP_DIRPYRDENOISE_SHBIBI")); smethod->set_active(1); hb11->pack_start (*smethod, Gtk::PACK_EXPAND_WIDGET, 4); pack_start( *hb11, Gtk::PACK_SHRINK, 4); @@ -343,7 +343,6 @@ DirPyrDenoise::~DirPyrDenoise () } int chromaChangedUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected (static_cast(data))->chromaComputed_ (); return 0; } @@ -353,7 +352,7 @@ void DirPyrDenoise::chromaChanged (double autchroma, double autred, double autbl // printf("CHROM=%f\n",nextchroma); nextred = autred; nextblue = autblue; - g_idle_add (chromaChangedUI, this); + add_idle(chromaChangedUI, this); } bool DirPyrDenoise::chromaComputed_ () @@ -369,7 +368,6 @@ bool DirPyrDenoise::chromaComputed_ () } int TilePrevChangedUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected (static_cast(data))->TilePrevComputed_ (); return 0; } @@ -384,7 +382,7 @@ void DirPyrDenoise::noiseTilePrev (int tileX, int tileY, int prevX, int prevY, i nextsizeT = sizeT; nextsizeP = sizeP; - g_idle_add (TilePrevChangedUI, this); + add_idle(TilePrevChangedUI, this); } @@ -437,7 +435,6 @@ void DirPyrDenoise::updatePrevLabel () int noiseChangedUI (void* data) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected (static_cast(data))->noiseComputed_ (); return 0; } @@ -447,7 +444,7 @@ void DirPyrDenoise::noiseChanged (double nresid, double highresid) { nextnresid = nresid; nexthighresid = highresid; - g_idle_add (noiseChangedUI, this); + add_idle(noiseChangedUI, this); } bool DirPyrDenoise::noiseComputed_ () @@ -1235,14 +1232,14 @@ void DirPyrDenoise::setBatchMode (bool batchMode) NoiscurveEditorG->setBatchMode (batchMode); CCcurveEditorG->setBatchMode (batchMode); - dmethod->append_text (M("GENERAL_UNCHANGED")); - Lmethod->append_text (M("GENERAL_UNCHANGED")); - Cmethod->append_text (M("GENERAL_UNCHANGED")); - C2method->append_text (M("GENERAL_UNCHANGED")); - smethod->append_text (M("GENERAL_UNCHANGED")); - medmethod->append_text (M("GENERAL_UNCHANGED")); - methodmed->append_text (M("GENERAL_UNCHANGED")); - rgbmethod->append_text (M("GENERAL_UNCHANGED")); + dmethod->append (M("GENERAL_UNCHANGED")); + Lmethod->append (M("GENERAL_UNCHANGED")); + Cmethod->append (M("GENERAL_UNCHANGED")); + C2method->append (M("GENERAL_UNCHANGED")); + smethod->append (M("GENERAL_UNCHANGED")); + medmethod->append (M("GENERAL_UNCHANGED")); + methodmed->append (M("GENERAL_UNCHANGED")); + rgbmethod->append (M("GENERAL_UNCHANGED")); } diff --git a/rtgui/dirpyrequalizer.cc b/rtgui/dirpyrequalizer.cc index 5d8a7011e..f92b09431 100644 --- a/rtgui/dirpyrequalizer.cc +++ b/rtgui/dirpyrequalizer.cc @@ -107,8 +107,8 @@ DirPyrEqualizer::DirPyrEqualizer () : FoldableToolPanel(this, "dirpyrequalizer", // algoHBox->pack_start (*alLabel, Gtk::PACK_SHRINK); /* algo = Gtk::manage (new MyComboBoxText ()); - algo->append_text (M("TP_DIRPYREQUALIZER_ALGO_FI")); - algo->append_text (M("TP_DIRPYREQUALIZER_ALGO_LA")); + algo->append (M("TP_DIRPYREQUALIZER_ALGO_FI")); + algo->append (M("TP_DIRPYREQUALIZER_ALGO_LA")); algo->set_active (1); // algoHBox->pack_start (*algo); // pack_start(*algoHBox); @@ -279,7 +279,7 @@ void DirPyrEqualizer::setBatchMode (bool batchMode) threshold->showEditedCB(); skinprotect->showEditedCB(); hueskin->showEditedCB (); -// algo->append_text (M("GENERAL_UNCHANGED")); +// algo->append (M("GENERAL_UNCHANGED")); } void DirPyrEqualizer::adjusterChanged (Adjuster* a, double newval) diff --git a/rtgui/distortion.cc b/rtgui/distortion.cc index d63868e85..c4bebdb4d 100644 --- a/rtgui/distortion.cc +++ b/rtgui/distortion.cc @@ -27,7 +27,7 @@ Distortion::Distortion (): FoldableToolPanel(this, "distortion", M("TP_DISTORTIO { rlistener = NULL; - autoDistor = Gtk::manage (new Gtk::Button (M("TP_DISTORTION_AUTO"))); + autoDistor = Gtk::manage (new Gtk::Button ()); // M("TP_DISTORTION_AUTO") autoDistor->set_image (*Gtk::manage (new RTImage ("distortion-auto.png"))); autoDistor->set_tooltip_text (M("TP_DISTORTION_AUTO_TIP")); idConn = autoDistor->signal_pressed().connect( sigc::mem_fun(*this, &Distortion::idPressed) ); diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 7a234acb3..d199f73e5 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -180,7 +180,6 @@ EditorPanel::EditorPanel (FilePanel* filePanel) // Save buttons Gtk::HBox* iops = Gtk::manage (new Gtk::HBox ()); - //Gtk::Image *saveButtonImage = Gtk::manage (new Gtk::Image (Gtk::StockID("gtk-save"), Gtk::ICON_SIZE_BUTTON)); Gtk::Image *saveButtonImage = Gtk::manage (new RTImage ("gtk-save-large.png")); saveimgas = Gtk::manage (new Gtk::Button ()); saveimgas->add(*saveButtonImage); @@ -206,9 +205,15 @@ EditorPanel::EditorPanel (FilePanel* filePanel) // Status box statusBox = Gtk::manage (new Gtk::HBox ()); + cssProvider = Gtk::CssProvider::create(); progressLabel = Gtk::manage (new Gtk::ProgressBar()); + progressLabel->set_show_text(true); + setExpandAlignProperties(progressLabel, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); progressLabel->set_fraction(0.0); - //progressLabel->modify_bg( Gtk::STATE_NORMAL,Gdk::Color("grey") ); // Disable, because in single mode this is may be permanent red without processing + + if (cssProvider) { + progressLabel->get_style_context()->add_provider (cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); // Can't find the gtkmm version of the enum! + } statusBox->pack_start (*progressLabel); iops->pack_start(*statusBox, Gtk::PACK_SHRINK, 2); @@ -497,7 +502,7 @@ void EditorPanel::on_realize () realized = true; Gtk::VBox::on_realize (); // This line is needed to avoid autoexpansion of the window :-/ - vboxright->set_size_request (options.toolPanelWidth, -1); + //vboxright->set_size_request (options.toolPanelWidth, -1); tpc->updateToolState(); } @@ -693,11 +698,12 @@ struct spparams { double val; Glib::ustring str; Gtk::ProgressBar *pProgress; + Glib::RefPtr cssProvider; + }; int setprogressStrUI( void *p ) { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected spparams *s = static_cast(p); if( ! s->str.empty() ) { @@ -707,10 +713,14 @@ int setprogressStrUI( void *p ) if( s->val >= 0 ) { s->pProgress->set_fraction( s->val ); - if( s->val < 1.0 ) { - s->pProgress->modify_bg( Gtk::STATE_NORMAL, Gdk::Color("red") ); - } else { - s->pProgress->modify_bg( Gtk::STATE_NORMAL, Gdk::Color("grey") ); + if (s->cssProvider) { + if( s->val < 1.0 ) { + s->cssProvider->load_from_data("ProgressBar { background-color: red }"); + } else { + s->cssProvider->load_from_data("ProgressBar { background-color: grey }"); + } + + s->pProgress->get_style_context()->set_background(s->pProgress->get_window()); } } @@ -723,7 +733,7 @@ void EditorPanel::setProgress (double p) spparams *s = new spparams; s->val = p; s->pProgress = progressLabel; - g_idle_add (setprogressStrUI, s); + add_idle (setprogressStrUI, s); } void EditorPanel::setProgressStr (Glib::ustring str) @@ -732,7 +742,7 @@ void EditorPanel::setProgressStr (Glib::ustring str) s->str = str; s->val = -1; s->pProgress = progressLabel; - g_idle_add (setprogressStrUI, s); + add_idle (setprogressStrUI, s); } // This is only called from the ThreadUI, so within the gtk thread @@ -992,7 +1002,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) // Editor Layout switch(event->keyval) { - case GDK_L: + case GDK_KEY_L: if (tbTopPanel_1) { tbTopPanel_1->set_active (!tbTopPanel_1->get_active()); // toggle top panel } @@ -1008,7 +1018,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) return true; break; - case GDK_l: + case GDK_KEY_l: if (!shift && !alt /*&& !ctrl*/) { hidehp->set_active (!hidehp->get_active()); // toggle History (left panel) return true; @@ -1027,7 +1037,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) break; - case GDK_m: // Maximize preview panel: hide top AND right AND history panels + case GDK_KEY_m: // Maximize preview panel: hide top AND right AND history panels if (!ctrl && !alt) { toggleSidePanels(); return true; @@ -1035,7 +1045,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) break; - case GDK_M: // Maximize preview panel: hide top AND right AND history panels AND (fit image preview) + case GDK_KEY_M: // Maximize preview panel: hide top AND right AND history panels AND (fit image preview) if (!ctrl && !alt) { toggleSidePanelsZoomFit(); return true; @@ -1064,83 +1074,83 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) if (!ctrl) { // Normal switch(event->keyval) { - case GDK_bracketright: + case GDK_KEY_bracketright: tpc->coarse->rotateRight(); return true; - case GDK_bracketleft: + case GDK_KEY_bracketleft: tpc->coarse->rotateLeft(); return true; - case GDK_i: - case GDK_I: + case GDK_KEY_i: + case GDK_KEY_I: info->set_active (!info->get_active()); return true; - case GDK_B: + case GDK_KEY_B: beforeAfter->set_active (!beforeAfter->get_active()); return true; - case GDK_plus: - case GDK_equal: - case GDK_KP_Add: + case GDK_KEY_plus: + case GDK_KEY_equal: + case GDK_KEY_KP_Add: iareapanel->imageArea->zoomPanel->zoomInClicked(); return true; - case GDK_minus: - case GDK_underscore: - case GDK_KP_Subtract: + case GDK_KEY_minus: + case GDK_KEY_underscore: + case GDK_KEY_KP_Subtract: iareapanel->imageArea->zoomPanel->zoomOutClicked(); return true; - case GDK_z://GDK_1 + case GDK_KEY_z://GDK_1 iareapanel->imageArea->zoomPanel->zoom11Clicked(); return true; /* #ifndef __WIN32__ - case GDK_9: // toggle background color of the preview + case GDK_KEY_9: // toggle background color of the preview iareapanel->imageArea->previewModePanel->togglebackColor(); return true; #endif */ - case GDK_r: //preview mode Red + case GDK_KEY_r: //preview mode Red iareapanel->imageArea->previewModePanel->toggleR(); return true; - case GDK_g: //preview mode Green + case GDK_KEY_g: //preview mode Green iareapanel->imageArea->previewModePanel->toggleG(); return true; - case GDK_b: //preview mode Blue + case GDK_KEY_b: //preview mode Blue iareapanel->imageArea->previewModePanel->toggleB(); return true; - case GDK_v: //preview mode Luminosity + case GDK_KEY_v: //preview mode Luminosity iareapanel->imageArea->previewModePanel->toggleL(); return true; - case GDK_F: //preview mode Focus Mask + case GDK_KEY_F: //preview mode Focus Mask iareapanel->imageArea->previewModePanel->toggleFocusMask(); return true; - case GDK_f: + case GDK_KEY_f: iareapanel->imageArea->zoomPanel->zoomFitClicked(); return true; - case GDK_less: + case GDK_KEY_less: iareapanel->imageArea->indClippedPanel->toggleClipped(true); return true; - case GDK_greater: + case GDK_KEY_greater: iareapanel->imageArea->indClippedPanel->toggleClipped(false); return true; - case GDK_F5: + case GDK_KEY_F5: openThm->openDefaultViewer((event->state & GDK_SHIFT_MASK) ? 2 : 1); return true; - case GDK_y: // synchronize filebrowser with image in Editor + case GDK_KEY_y: // synchronize filebrowser with image in Editor if (!simpleEditor && fPanel && !fname.empty()) { fPanel->fileCatalog->selectImage(fname, false); return true; @@ -1148,7 +1158,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) break; // to avoid gcc complain - case GDK_x: // clear filters and synchronize filebrowser with image in Editor + case GDK_KEY_x: // clear filters and synchronize filebrowser with image in Editor if (!simpleEditor && fPanel && !fname.empty()) { fPanel->fileCatalog->selectImage(fname, true); return true; @@ -1159,35 +1169,35 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) } else { // With control switch (event->keyval) { - case GDK_S: + case GDK_KEY_S: saveProfile(); setProgressStr(M("PROGRESSBAR_PROCESSING_PROFILESAVED")); return true; - case GDK_s: + case GDK_KEY_s: saveAsPressed(); return true; - case GDK_b: + case GDK_KEY_b: if (!simpleEditor) { queueImgPressed(); } return true; - case GDK_e: + case GDK_KEY_e: sendToGimpPressed(); return true; - case GDK_z: + case GDK_KEY_z: history->undo (); return true; - case GDK_Z: + case GDK_KEY_Z: history->redo (); return true; - case GDK_F5: + case GDK_KEY_F5: openThm->openDefaultViewer(3); return true; } @@ -1196,12 +1206,12 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) if (alt) { switch (event->keyval) { - case GDK_s: + case GDK_KEY_s: history->addBookmarkPressed (); setProgressStr(M("PROGRESSBAR_SNAPSHOT_ADDED")); return true; - case GDK_f: + case GDK_KEY_f: iareapanel->imageArea->zoomPanel->zoomFitCropClicked(); return true; } @@ -1209,7 +1219,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) if (shift) { switch (event->keyval) { - case GDK_F3: // open Previous image from Editor's perspective + case GDK_KEY_F3: // open Previous image from Editor's perspective if (!simpleEditor && fPanel && !fname.empty()) { EditorPanel::openPreviousEditorImage(); return true; @@ -1217,7 +1227,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) break; // to avoid gcc complain - case GDK_F4: // open next image from Editor's perspective + case GDK_KEY_F4: // open next image from Editor's perspective if (!simpleEditor && fPanel && !fname.empty()) { EditorPanel::openNextEditorImage(); return true; @@ -1880,7 +1890,7 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition) histogramPanel->unreference(); } - histogramPanel->reorder(Gtk::ALIGN_LEFT); + histogramPanel->reorder(Gtk::POS_LEFT); leftbox->reorder_child(*histogramPanel, 0); break; @@ -1900,7 +1910,7 @@ void EditorPanel::updateHistogramPosition (int oldPosition, int newPosition) histogramPanel->unreference(); } - histogramPanel->reorder(Gtk::ALIGN_RIGHT); + histogramPanel->reorder(Gtk::POS_RIGHT); vboxright->reorder_child(*histogramPanel, 0); break; } diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index abe511ad1..db5b75aac 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -54,6 +54,7 @@ private: Glib::ustring lastSaveAsFileName; bool realized; + Glib::RefPtr cssProvider; // to be able to set the ProgressBar's background protected: Gtk::ProgressBar *progressLabel; diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index 3b99f57e5..a88e472cb 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -81,7 +81,6 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) } #endif //GLIBMM_EXCEPTIONS_ENABLED set_title_decorated(""); - property_allow_shrink() = true; set_modal(false); set_resizable(true); @@ -105,7 +104,7 @@ void EditWindow::on_realize () { Gtk::Window::on_realize (); - cursorManager.init (get_window()); + editWindowCursorManager.init (get_window()); } bool EditWindow::on_window_state_event(GdkEventWindowState* event) @@ -121,10 +120,10 @@ bool EditWindow::on_window_state_event(GdkEventWindowState* event) return true; } -void EditWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) +void EditWindow::on_mainNB_switch_page(Gtk::Widget* widget, guint page_num) { //if (page_num > 1) { - EditorPanel *ep = static_cast(mainNB->get_nth_page(page_num)); + EditorPanel *ep = static_cast(widget); if (mainNB->get_n_pages() > 1 && page_num <= (filesEdited.size() - 1)) { set_title_decorated(ep->getFileName()); @@ -147,12 +146,10 @@ void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) closeb->set_image (*Gtk::manage(new RTImage ("gtk-close.png"))); closeb->set_relief (Gtk::RELIEF_NONE); closeb->set_focus_on_click (false); - // make the button as small as possible - Glib::RefPtr style = Gtk::RcStyle::create (); - style->set_xthickness (0); - style->set_ythickness (0); - closeb->modify_style (style); + // make the button as small as possible thanks via css + closeb->set_name("notebook_close_button"); + closeb->signal_clicked().connect( sigc::bind (sigc::mem_fun(*this, &EditWindow::remEditorPanel) , ep)); hb->pack_end (*closeb); hb->set_spacing (2); @@ -209,12 +206,12 @@ bool EditWindow::keyPressed (GdkEventKey* event) { bool ctrl = event->state & GDK_CONTROL_MASK; - if(event->keyval == GDK_F11) { + if(event->keyval == GDK_KEY_F11) { toggleFullscreen(); return true; } else { if(mainNB->get_n_pages () > 0) { //pass the handling for the editor panels, if there are any - if (event->keyval == GDK_w && ctrl) { //remove editor panel + if (event->keyval == GDK_KEY_w && ctrl) { //remove editor panel EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); remEditorPanel (ep); return true; diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index fa47de489..c130bafe6 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -51,7 +51,7 @@ public: bool keyPressed (GdkEventKey* event); bool on_delete_event(GdkEventAny* event); bool on_window_state_event(GdkEventWindowState* event); - void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num); + void on_mainNB_switch_page(Gtk::Widget* page, guint page_num); void set_title_decorated(Glib::ustring fname); void on_realize (); diff --git a/rtgui/exifpanel.cc b/rtgui/exifpanel.cc index 9a8656592..c68f05de1 100644 --- a/rtgui/exifpanel.cc +++ b/rtgui/exifpanel.cc @@ -77,33 +77,53 @@ ExifPanel::ExifPanel () : idata(NULL) pack_start (*scrolledWindow); - Gtk::HBox* buttons1 = Gtk::manage(new Gtk::HBox ()); - Gtk::HBox* buttons2 = Gtk::manage(new Gtk::HBox ()); + Gtk::Grid* buttons = Gtk::manage(new Gtk::Grid()); + buttons->set_row_homogeneous(true); + buttons->set_column_homogeneous(true); + setExpandAlignProperties(buttons, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + Gtk::Grid* buttons1 = Gtk::manage(new Gtk::Grid()); + buttons1->set_row_homogeneous(true); + buttons1->set_column_homogeneous(true); + setExpandAlignProperties(buttons1, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + Gtk::Grid* buttons2 = Gtk::manage(new Gtk::Grid()); + buttons2->set_row_homogeneous(true); + buttons2->set_column_homogeneous(true); + setExpandAlignProperties(buttons2, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); - remove = Gtk::manage(new Gtk::Button (M("EXIFPANEL_REMOVE"))); + remove = Gtk::manage(new Gtk::Button ()); // M("EXIFPANEL_REMOVE") remove->set_image (*Gtk::manage(new Gtk::Image (delicon))); remove->set_tooltip_text (M("EXIFPANEL_REMOVEHINT")); - buttons1->pack_start (*remove); + 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 = Gtk::manage(new Gtk::Button ()); // M("EXIFPANEL_KEEP") keep->set_image (*Gtk::manage(new Gtk::Image (keepicon))); keep->set_tooltip_text (M("EXIFPANEL_KEEPHINT")); - buttons1->pack_start (*keep); + 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 = Gtk::manage(new Gtk::Button ()); // M("EXIFPANEL_ADDEDIT") add->set_image (*Gtk::manage(new Gtk::Image (editicon))); add->set_tooltip_text (M("EXIFPANEL_ADDEDITHINT")); - buttons1->pack_start (*add); + add->get_style_context()->add_class("Right"); + setExpandAlignProperties(add, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); + buttons1->attach_next_to(*add, Gtk::POS_RIGHT, 1, 1); - reset = Gtk::manage(new Gtk::Button (M("EXIFPANEL_RESET"))); + reset = Gtk::manage(new Gtk::Button ()); // M("EXIFPANEL_RESET") reset->set_image (*Gtk::manage(new RTImage ("gtk-undo-ltr.png", "gtk-undo-rtl.png"))); reset->set_tooltip_text (M("EXIFPANEL_RESETHINT")); - buttons2->pack_start (*reset); + reset->get_style_context()->add_class("Left"); + setExpandAlignProperties(reset, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); + buttons2->attach_next_to(*reset, Gtk::POS_LEFT, 1, 1); - resetAll = Gtk::manage(new Gtk::Button (M("EXIFPANEL_RESETALL"))); + resetAll = Gtk::manage(new Gtk::Button ()); // M("EXIFPANEL_RESETALL") resetAll->set_image (*Gtk::manage(new RTImage ("gtk-undoall-ltr.png", "gtk-undoall-rtl.png"))); resetAll->set_tooltip_text (M("EXIFPANEL_RESETALLHINT")); - buttons2->pack_start (*resetAll); + resetAll->get_style_context()->add_class("Right"); + setExpandAlignProperties(resetAll, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); + buttons2->attach_next_to(*resetAll, Gtk::POS_RIGHT, 1, 1); pack_end (*buttons2, Gtk::PACK_SHRINK); pack_end (*buttons1, Gtk::PACK_SHRINK); @@ -397,7 +417,7 @@ void ExifPanel::resetAllPressed () void ExifPanel::addPressed () { - Gtk::Dialog* dialog = new Gtk::Dialog (M("EXIFPANEL_ADDTAGDLG_TITLE"), *((Gtk::Window*)get_toplevel()), true, true); + Gtk::Dialog* dialog = new Gtk::Dialog (M("EXIFPANEL_ADDTAGDLG_TITLE"), *((Gtk::Window*)get_toplevel()), true); dialog->add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); dialog->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); @@ -407,10 +427,10 @@ void ExifPanel::addPressed () Gtk::Label* tlabel = new Gtk::Label (M("EXIFPANEL_ADDTAGDLG_SELECTTAG") + ":"); MyComboBoxText* tcombo = new MyComboBoxText (); - tcombo->append_text ("Artist"); - tcombo->append_text ("Copyright"); - tcombo->append_text ("ImageDescription"); - tcombo->append_text ("Exif.UserComment"); + tcombo->append ("Artist"); + tcombo->append ("Copyright"); + tcombo->append ("ImageDescription"); + tcombo->append ("Exif.UserComment"); hb1->pack_start (*tlabel, Gtk::PACK_SHRINK, 4); hb1->pack_start (*tcombo); @@ -428,7 +448,7 @@ void ExifPanel::addPressed () tcombo->set_active_text (sel); if (tcombo->get_active () < 0) { - tcombo->append_text (sel); + tcombo->append (sel); tcombo->set_active_text (sel); } @@ -437,8 +457,8 @@ void ExifPanel::addPressed () ventry->set_activates_default (true); dialog->set_default_response (Gtk::RESPONSE_OK); - dialog->get_vbox()->pack_start (*hb1, Gtk::PACK_SHRINK); - dialog->get_vbox()->pack_start (*hb2, Gtk::PACK_SHRINK, 4); + dialog->get_content_area()->pack_start (*hb1, Gtk::PACK_SHRINK); + dialog->get_content_area()->pack_start (*hb2, Gtk::PACK_SHRINK, 4); tlabel->show (); tcombo->show (); vlabel->show (); diff --git a/rtgui/exportpanel.cc b/rtgui/exportpanel.cc index 67ea092f2..abe078670 100644 --- a/rtgui/exportpanel.cc +++ b/rtgui/exportpanel.cc @@ -37,7 +37,7 @@ ExportPanel::ExportPanel () : listener (NULL) Gtk::Label* labExportTitle = Gtk::manage ( new Gtk::Label (M("EXPORT_FASTEXPORTOPTIONS")) ); labExportTitle->set_use_markup (true); labExportTitle->set_tooltip_text (M("EXPORT_INSTRUCTIONS")); - labExportTitle->set_alignment(Gtk::ALIGN_LEFT); + labExportTitle->set_alignment(Gtk::ALIGN_START); pack_start(*labExportTitle, Gtk::PACK_SHRINK, 4); bypass_ALL = Gtk::manage ( new Gtk::CheckButton (M("EXPORT_BYPASS_ALL"))); @@ -66,7 +66,7 @@ ExportPanel::ExportPanel () : listener (NULL) raw_bayer_method = Gtk::manage (new MyComboBoxText ()); for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - raw_bayer_method->append_text(procparams::RAWParams::BayerSensor::methodstring[i]); + raw_bayer_method->append(procparams::RAWParams::BayerSensor::methodstring[i]); } raw_bayer_method->set_active(0); @@ -89,7 +89,7 @@ ExportPanel::ExportPanel () : listener (NULL) raw_xtrans_method = Gtk::manage (new MyComboBoxText ()); for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) { - raw_xtrans_method->append_text(procparams::RAWParams::XTransSensor::methodstring[i]); + raw_xtrans_method->append(procparams::RAWParams::XTransSensor::methodstring[i]); } raw_xtrans_method->set_active(0); @@ -149,17 +149,22 @@ ExportPanel::ExportPanel () : listener (NULL) pack_start (*hbox, Gtk::PACK_SHRINK, 4); MaxWidth->set_digits (0); + MaxWidth->set_width_chars(5); + MaxWidth->set_max_width_chars(5); MaxWidth->set_increments (1, 100); MaxWidth->set_value (options.fastexport_resize_width); MaxWidth->set_range (32, 3000); MaxHeight->set_digits (0); + MaxHeight->set_width_chars(5); + MaxHeight->set_max_width_chars(5); MaxHeight->set_increments (1, 100); MaxHeight->set_value (options.fastexport_resize_height); MaxHeight->set_range (32, 3000); // Buttons - btnFastExport = Gtk::manage ( new Gtk::Button (M("EXPORT_PUTTOQUEUEFAST")) ); + btnFastExport = Gtk::manage ( new Gtk::Button () ); + btnFastExport->set_tooltip_text(M("EXPORT_PUTTOQUEUEFAST")); btnFastExport->set_image (*Gtk::manage (new RTImage ("processing.png"))); pack_start(*btnFastExport, Gtk::PACK_SHRINK, 4); diff --git a/rtgui/favoritbrowser.cc b/rtgui/favoritbrowser.cc index 8ce4caf8f..0232bf466 100644 --- a/rtgui/favoritbrowser.cc +++ b/rtgui/favoritbrowser.cc @@ -49,10 +49,22 @@ FavoritBrowser::FavoritBrowser () : listener (NULL), lastSelectedDir ("") treeView->set_tooltip_column (2); treeView->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &FavoritBrowser::selectionChanged)); - add = Gtk::manage (new Gtk::Button (M("MAIN_FRAME_PLACES_ADD"))); - del = Gtk::manage (new Gtk::Button (M("MAIN_FRAME_PLACES_DEL"))); + add = Gtk::manage (new Gtk::Button ()); + add->set_tooltip_text(M("MAIN_FRAME_PLACES_ADD")); + add->set_hexpand(true); + add->set_vexpand(false); + add->set_halign(Gtk::ALIGN_FILL); + add->set_valign(Gtk::ALIGN_START); add->set_image (*Gtk::manage (new RTImage ("gtk-add.png"))); + add->get_style_context()->add_class("Left"); + del = Gtk::manage (new Gtk::Button ()); + del->set_tooltip_text(M("MAIN_FRAME_PLACES_DEL")); + del->set_hexpand(true); + del->set_vexpand(false); + del->set_halign(Gtk::ALIGN_FILL); + del->set_valign(Gtk::ALIGN_START); del->set_image (*Gtk::manage (new RTImage ("list-remove.png"))); + del->get_style_context()->add_class("Right"); Gtk::HBox* buttonBox = Gtk::manage (new Gtk::HBox ()); buttonBox->pack_start (*add); buttonBox->pack_start (*del); diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 294c074bb..3f567f16d 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -47,10 +47,9 @@ FileBrowser::FileBrowser () pmenu = new Gtk::Menu (); pmenu->attach (*Gtk::manage(open = new Gtk::MenuItem (M("FILEBROWSER_POPUPOPEN"))), 0, 1, p, p + 1); p++; - pmenu->attach (*Gtk::manage(develop = new Gtk::ImageMenuItem (M("FILEBROWSER_POPUPPROCESS"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(develop = new MyImageMenuItem (M("FILEBROWSER_POPUPPROCESS"), "processing.png")), 0, 1, p, p + 1); p++; - develop->set_image(*Gtk::manage(new RTImage ("processing.png"))); - pmenu->attach (*Gtk::manage(developfast = new Gtk::ImageMenuItem (M("FILEBROWSER_POPUPPROCESSFAST"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(developfast = new Gtk::MenuItem (M("FILEBROWSER_POPUPPROCESSFAST"))), 0, 1, p, p + 1); p++; pmenu->attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1); @@ -103,7 +102,7 @@ FileBrowser::FileBrowser () Gtk::Menu* submenuLabel = Gtk::manage (new Gtk::Menu ()); for (int i = 0; i <= 5; i++) { - submenuLabel->attach (*Gtk::manage(colorlabel[i] = new Gtk::ImageMenuItem (M(Glib::ustring::compose("%1%2", "FILEBROWSER_POPUPCOLORLABEL", i)))), 0, 1, p, p + 1); + submenuLabel->attach (*Gtk::manage(colorlabel[i] = new MyImageMenuItem (M(Glib::ustring::compose("%1%2", "FILEBROWSER_POPUPCOLORLABEL", i)), i == 0 ? "cglabel0.png" : Glib::ustring::compose("%1%2%3", "clabel", i, ".png"))), 0, 1, p, p + 1); p++; } @@ -111,18 +110,11 @@ FileBrowser::FileBrowser () menuLabel->set_submenu (*submenuLabel); } else { for (int i = 0; i <= 5; i++) { - pmenu->attach (*Gtk::manage(colorlabel[i] = new Gtk::ImageMenuItem (M(Glib::ustring::compose("%1%2", "FILEBROWSER_POPUPCOLORLABEL", i)))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(colorlabel[i] = new MyImageMenuItem (M(Glib::ustring::compose("%1%2", "FILEBROWSER_POPUPCOLORLABEL", i)), i == 0 ? "cglabel0.png" : Glib::ustring::compose("%1%2%3", "clabel", i, ".png"))), 0, 1, p, p + 1); p++; } } - //set color label images - colorlabel[0]->set_image(*Gtk::manage(new RTImage ("cglabel0.png"))); - - for (int i = 1; i <= 5; i++) { - colorlabel[i]->set_image(*Gtk::manage(new RTImage (Glib::ustring::compose("%1%2%3", "clabel", i, ".png")))); - } - pmenu->attach (*Gtk::manage(new Gtk::SeparatorMenuItem ()), 0, 1, p, p + 1); p++; @@ -242,9 +234,8 @@ FileBrowser::FileBrowser () * Profile Operations * *********************/ if (options.menuGroupProfileOperations) { - pmenu->attach (*Gtk::manage(menuProfileOperations = new Gtk::ImageMenuItem (M("FILEBROWSER_POPUPPROFILEOPERATIONS"))), 0, 1, p, p + 1); + pmenu->attach (*Gtk::manage(menuProfileOperations = new MyImageMenuItem (M("FILEBROWSER_POPUPPROFILEOPERATIONS"), "logoicon-wind.png")), 0, 1, p, p + 1); p++; - menuProfileOperations->set_image(*Gtk::manage(new RTImage ("logoicon-wind.png"))); Gtk::Menu* submenuProfileOperations = Gtk::manage (new Gtk::Menu ()); @@ -302,14 +293,14 @@ FileBrowser::FileBrowser () * *********************/ pmaccelgroup = Gtk::AccelGroup::create (); pmenu->set_accel_group (pmaccelgroup); - selall->add_accelerator ("activate", pmenu->get_accel_group(), GDK_a, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); - trash->add_accelerator ("activate", pmenu->get_accel_group(), GDK_Delete, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); - untrash->add_accelerator ("activate", pmenu->get_accel_group(), GDK_Delete, Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE); - open->add_accelerator ("activate", pmenu->get_accel_group(), GDK_Return, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); - develop->add_accelerator ("activate", pmenu->get_accel_group(), GDK_B, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); - copyprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_C, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); - pasteprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_V, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); - partpasteprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_V, Gdk::CONTROL_MASK | Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE); + selall->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_a, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + trash->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Delete, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); + untrash->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Delete, Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE); + open->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_Return, (Gdk::ModifierType)0, Gtk::ACCEL_VISIBLE); + develop->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_B, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + copyprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_C, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + pasteprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_V, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE); + partpasteprof->add_accelerator ("activate", pmenu->get_accel_group(), GDK_KEY_V, Gdk::CONTROL_MASK | Gdk::SHIFT_MASK, Gtk::ACCEL_VISIBLE); // Bind to event handlers open->signal_activate().connect (sigc::bind(sigc::mem_fun(*this, &FileBrowser::menuItemActivated), open)); @@ -356,17 +347,10 @@ FileBrowser::FileBrowser () pmenuColorLabels = new Gtk::Menu (); for (int i = 0; i <= 5; i++) { - pmenuColorLabels->attach (*Gtk::manage(colorlabel_pop[i] = new Gtk::ImageMenuItem (M(Glib::ustring::compose("%1%2", "FILEBROWSER_POPUPCOLORLABEL", i)))), 0, 1, c, c + 1); + pmenuColorLabels->attach (*Gtk::manage(colorlabel_pop[i] = new MyImageMenuItem (M(Glib::ustring::compose("%1%2", "FILEBROWSER_POPUPCOLORLABEL", i)), i == 0 ? "cglabel0.png" : Glib::ustring::compose("%1%2%3", "clabel", i, ".png"))), 0, 1, c, c + 1); c++; } - //set color label images - colorlabel_pop[0]->set_image(*Gtk::manage(new RTImage ("cglabel0.png"))); - - for (int i = 1; i <= 5; i++) { - colorlabel_pop[i]->set_image(*Gtk::manage(new RTImage (Glib::ustring::compose("%1%2%3", "clabel", i, ".png")))); - } - pmenuColorLabels->show_all (); // Has to be located after creation of applyprof and applypartprof @@ -762,8 +746,8 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) rtengine::procparams::ProcParams pp = mselected[0]->thumbnail->getProcParams(); Gtk::FileChooserDialog fc("Dark Frame", Gtk::FILE_CHOOSER_ACTION_OPEN ); FileChooserLastFolderPersister persister(&fc, options.lastDarkframeDir); - fc.add_button( Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - fc.add_button( Gtk::StockID("gtk-apply"), Gtk::RESPONSE_APPLY); + fc.add_button( M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + fc.add_button( M("GENERAL_APPLY"), Gtk::RESPONSE_APPLY); if(!pp.raw.dark_frame.empty()) { fc.set_filename( pp.raw.dark_frame ); @@ -838,8 +822,8 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m) rtengine::procparams::ProcParams pp = mselected[0]->thumbnail->getProcParams(); Gtk::FileChooserDialog fc("Flat Field", Gtk::FILE_CHOOSER_ACTION_OPEN ); FileChooserLastFolderPersister persister(&fc, options.lastFlatfieldDir); - fc.add_button( Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - fc.add_button( Gtk::StockID("gtk-apply"), Gtk::RESPONSE_APPLY); + fc.add_button( M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + fc.add_button( M("GENERAL_APPLY"), Gtk::RESPONSE_APPLY); if(!pp.raw.ff_file.empty()) { fc.set_filename( pp.raw.ff_file ); @@ -1071,58 +1055,58 @@ bool FileBrowser::keyPressed (GdkEventKey* event) bool alt = event->state & GDK_MOD1_MASK; bool altgr = event->state & GDK_MOD2_MASK; - if ((event->keyval == GDK_C || event->keyval == GDK_c || event->keyval == GDK_Insert) && ctrl) { + if ((event->keyval == GDK_KEY_C || event->keyval == GDK_KEY_c || event->keyval == GDK_KEY_Insert) && ctrl) { copyProfile (); return true; - } else if ((event->keyval == GDK_V || event->keyval == GDK_v) && ctrl && !shift) { + } else if ((event->keyval == GDK_KEY_V || event->keyval == GDK_KEY_v) && ctrl && !shift) { pasteProfile (); return true; - } else if (event->keyval == GDK_Insert && shift) { + } else if (event->keyval == GDK_KEY_Insert && shift) { pasteProfile (); return true; - } else if ((event->keyval == GDK_V || event->keyval == GDK_v) && ctrl && shift) { + } else if ((event->keyval == GDK_KEY_V || event->keyval == GDK_KEY_v) && ctrl && shift) { partPasteProfile (); return true; - } else if (event->keyval == GDK_Delete && !shift) { + } else if (event->keyval == GDK_KEY_Delete && !shift) { menuItemActivated (trash); return true; - } else if (event->keyval == GDK_Delete && shift) { + } else if (event->keyval == GDK_KEY_Delete && shift) { menuItemActivated (untrash); return true; - } else if ((event->keyval == GDK_B || event->keyval == GDK_b) && ctrl) { + } else if ((event->keyval == GDK_KEY_B || event->keyval == GDK_KEY_b) && ctrl) { menuItemActivated (develop); return true; - } else if ((event->keyval == GDK_A || event->keyval == GDK_a) && ctrl) { + } else if ((event->keyval == GDK_KEY_A || event->keyval == GDK_KEY_a) && ctrl) { menuItemActivated (selall); return true; - } else if (event->keyval == GDK_F2 && !ctrl) { + } else if (event->keyval == GDK_KEY_F2 && !ctrl) { menuItemActivated (rename); return true; - } else if (event->keyval == GDK_F3 && !(ctrl || shift || alt)) { // open Previous image from FileBrowser perspective + } else if (event->keyval == GDK_KEY_F3 && !(ctrl || shift || alt)) { // open Previous image from FileBrowser perspective FileBrowser::openPrevImage (); return true; - } else if (event->keyval == GDK_F4 && !(ctrl || shift || alt)) { // open Next image from FileBrowser perspective + } else if (event->keyval == GDK_KEY_F4 && !(ctrl || shift || alt)) { // open Next image from FileBrowser perspective FileBrowser::openNextImage (); return true; - } else if (event->keyval == GDK_Left) { + } else if (event->keyval == GDK_KEY_Left) { selectPrev (1, shift); return true; - } else if (event->keyval == GDK_Right) { + } else if (event->keyval == GDK_KEY_Right) { selectNext (1, shift); return true; - } else if (event->keyval == GDK_Up) { + } else if (event->keyval == GDK_KEY_Up) { selectPrev (numOfCols, shift); return true; - } else if (event->keyval == GDK_Down) { + } else if (event->keyval == GDK_KEY_Down) { selectNext (numOfCols, shift); return true; - } else if (event->keyval == GDK_Home) { + } else if (event->keyval == GDK_KEY_Home) { selectFirst (shift); return true; - } else if (event->keyval == GDK_End) { + } else if (event->keyval == GDK_KEY_End) { selectLast (shift); return true; - } else if(event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { + } else if(event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_KP_Enter) { std::vector mselected; for (size_t i = 0; i < selected.size(); i++) { @@ -1130,7 +1114,7 @@ bool FileBrowser::keyPressed (GdkEventKey* event) } openRequested(mselected); - } else if (event->keyval == GDK_F5) { + } else if (event->keyval == GDK_KEY_F5) { int dest = 1; if (event->state & GDK_SHIFT_MASK) { @@ -1141,10 +1125,10 @@ bool FileBrowser::keyPressed (GdkEventKey* event) openDefaultViewer (dest); return true; - } else if (event->keyval == GDK_Page_Up) { + } else if (event->keyval == GDK_KEY_Page_Up) { scrollPage(GDK_SCROLL_UP); return true; - } else if (event->keyval == GDK_Page_Down) { + } else if (event->keyval == GDK_KEY_Page_Down) { scrollPage(GDK_SCROLL_DOWN); return true; } diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index a444b0a0e..ab9443cad 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -73,11 +73,11 @@ class FileBrowser : public ThumbBrowserBase, protected: Gtk::MenuItem* rank[6]; - Gtk::ImageMenuItem* colorlabel[6]; + MyImageMenuItem* colorlabel[6]; Gtk::MenuItem* trash; Gtk::MenuItem* untrash; - Gtk::ImageMenuItem* develop; - Gtk::ImageMenuItem* developfast; + Gtk::MenuItem* develop; + Gtk::MenuItem* developfast; Gtk::MenuItem* rename; Gtk::MenuItem* remove; Gtk::MenuItem* removeInclProc; @@ -89,7 +89,7 @@ protected: Gtk::MenuItem* menuRank; Gtk::MenuItem* menuLabel; Gtk::MenuItem* menuFileOperations; - Gtk::ImageMenuItem* menuProfileOperations; + MyImageMenuItem* menuProfileOperations; Gtk::MenuItem* menuExtProg; Gtk::MenuItem** amiExtProg; Gtk::MenuItem* miOpenDefaultViewer; @@ -117,7 +117,7 @@ protected: Gtk::MenuItem* clearFromCacheFull; Gtk::Menu* pmenu; - Gtk::ImageMenuItem* colorlabel_pop[6]; + MyImageMenuItem* colorlabel_pop[6]; Gtk::Menu* pmenuColorLabels; void* colorLabel_actionData; void menuColorlabelActivated (Gtk::MenuItem* m); // use only when menu is invoked via FileBrowser::buttonPressed to pass actionData diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 4e31c2a25..0585a9311 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -29,6 +29,8 @@ #define CROPRESIZEBORDER 4 +extern Glib::Threads::Thread* mainThread; + bool FileBrowserEntry::iconsLoaded(false); Glib::RefPtr FileBrowserEntry::editedIcon; Glib::RefPtr FileBrowserEntry::recentlySavedIcon; @@ -644,58 +646,62 @@ void FileBrowserEntry::updateCursor (int x, int y) return; } + CursorShape newCursor = CSUndefined; + ToolMode tm = iatlistener->getToolBar()->getTool (); Glib::RefPtr w = parent->getDrawingArea ()->get_window(); if (!selected) { - cursorManager.setCursor (w, CSArrow); - return; - } - - if (state == SNormal) { + newCursor = CSArrow; + } else if (state == SNormal) { if (tm == TMHand && (onArea (CropTop, x, y) || onArea (CropBottom, x, y))) { - cursorManager.setCursor (w, CSResizeHeight); + newCursor = CSResizeHeight; } else if (tm == TMHand && (onArea (CropLeft, x, y) || onArea (CropRight, x, y))) { - cursorManager.setCursor (w, CSResizeWidth); + newCursor = CSResizeWidth; } else if (tm == TMHand && (onArea (CropTopLeft, x, y))) { - cursorManager.setCursor (w, CSResizeTopLeft); + newCursor = CSResizeTopLeft; } else if (tm == TMHand && (onArea (CropTopRight, x, y))) { - cursorManager.setCursor (w, CSResizeTopRight); + newCursor = CSResizeTopRight; } else if (tm == TMHand && (onArea (CropBottomLeft, x, y))) { - cursorManager.setCursor (w, CSResizeBottomLeft); + newCursor = CSResizeBottomLeft; } else if (tm == TMHand && (onArea (CropBottomRight, x, y))) { - cursorManager.setCursor (w, CSResizeBottomRight); + newCursor = CSResizeBottomRight; } else if (onArea (CropImage, x, y)) { if (tm == TMHand) { - cursorManager.setCursor (w, CSArrow); + newCursor = CSArrow; } else if (tm == TMSpotWB) { - cursorManager.setCursor (w, CSSpotWB); + newCursor = CSSpotWB; } else if (tm == TMCropSelect) { - cursorManager.setCursor (w, CSCropSelect); + newCursor = CSCropSelect; } else if (tm == TMStraighten) { - cursorManager.setCursor (w, CSStraighten); + newCursor = CSStraighten; } } else { - cursorManager.setCursor (w, CSArrow); + newCursor = CSArrow; } } else if (state == SCropSelecting) { - cursorManager.setCursor (w, CSCropSelect); + newCursor = CSCropSelect; } else if (state == SRotateSelecting) { - cursorManager.setCursor (w, CSStraighten); + newCursor = CSStraighten; } else if (state == SCropMove) { - cursorManager.setCursor (w, CSMove); + newCursor = CSMove; } else if (state == SResizeW1 || state == SResizeW2) { - cursorManager.setCursor (w, CSResizeWidth); + newCursor = CSResizeWidth; } else if (state == SResizeH1 || state == SResizeH2) { - cursorManager.setCursor (w, CSResizeHeight); + newCursor = CSResizeHeight; } else if (state == SResizeTL) { - cursorManager.setCursor (w, CSResizeTopLeft); + newCursor = CSResizeTopLeft; } else if (state == SResizeTR) { - cursorManager.setCursor (w, CSResizeTopRight); + newCursor = CSResizeTopRight; } else if (state == SResizeBL) { - cursorManager.setCursor (w, CSResizeBottomLeft); + newCursor = CSResizeBottomLeft; } else if (state == SResizeBR) { - cursorManager.setCursor (w, CSResizeBottomRight); + newCursor = CSResizeBottomRight; + } + + if (newCursor != cursor_type) { + cursor_type = newCursor; + CursorManager::setCursorOfMainWindow (w, cursor_type); } } diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index d40b7d720..9a52af18a 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -63,7 +63,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : set_size_request(0, 250); // construct trash panel with the extra "empty trash" button trashButtonBox = Gtk::manage( new Gtk::VBox ); - Gtk::Button* emptyT = Gtk::manage( new Gtk::Button (M("FILEBROWSER_EMPTYTRASH"))); + Gtk::Button* emptyT = Gtk::manage( new Gtk::Button ()); emptyT->set_tooltip_markup (M("FILEBROWSER_EMPTYTRASHHINT")); emptyT->set_image (*Gtk::manage(new RTImage ("trash.png"))); emptyT->signal_pressed().connect (sigc::mem_fun(*this, &FileCatalog::emptyTrash)); @@ -100,6 +100,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) : Query = Gtk::manage(new Gtk::Entry ()); // cannot use Gtk::manage here as FileCatalog::getFilter will fail on Query->get_text() Query->set_text(""); Query->set_width_chars (20); // TODO !!! add this value to options? + Query->set_max_width_chars (20); Query->set_tooltip_markup (M("FILEBROWSER_QUERYHINT")); Gtk::HBox* hbQuery = Gtk::manage(new Gtk::HBox ()); buttonQueryClear = Gtk::manage(new Gtk::Button ()); @@ -629,7 +630,7 @@ void FileCatalog::_refreshProgressBar () } if (!previewsToLoad ) { - hbb->pack_start (*Gtk::manage (new Gtk::Image (Gtk::Stock::DIRECTORY, Gtk::ICON_SIZE_MENU))); + hbb->pack_start (*Gtk::manage (new RTImage ("gtk-directory.png"))); int filteredCount = min(fileBrowser->getNumFiltered(), previewsLoaded); label = Gtk::manage (new Gtk::Label (M("MAIN_FRAME_FILEBROWSER") + @@ -637,7 +638,7 @@ void FileCatalog::_refreshProgressBar () + Glib::ustring::format(previewsLoaded) + (filteredCount != previewsLoaded ? "]" : ")"))); } else { - hbb->pack_start (*Gtk::manage (new Gtk::Image (Gtk::Stock::FIND, Gtk::ICON_SIZE_MENU))); + hbb->pack_start (*Gtk::manage (new RTImage ("gtk-find.png"))); label = Gtk::manage (new Gtk::Label (M("MAIN_FRAME_FILEBROWSER") + " [" + Glib::ustring::format(std::fixed, std::setprecision(0), std::setw(3), (double)previewsLoaded / previewsToLoad * 100 ) + "%]" )); filepanel->loadingThumbs("", (double)previewsLoaded / previewsToLoad); } @@ -650,7 +651,10 @@ void FileCatalog::_refreshProgressBar () hbb->set_spacing (2); hbb->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP")); hbb->show_all (); - nb->set_tab_label(*filepanel, *hbb); + + if (nb) { + nb->set_tab_label(*filepanel, *hbb); + } } } @@ -944,8 +948,8 @@ void FileCatalog::copyMoveRequested (std::vector tbe, bool m } Gtk::FileChooserDialog fc(fc_title, Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER ); - fc.add_button( Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - fc.add_button( Gtk::StockID("gtk-ok"), Gtk::RESPONSE_OK); + fc.add_button( M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + fc.add_button( M("GENERAL_OK"), Gtk::RESPONSE_OK); // open dialog at the 1-st file's path fc.set_filename(tbe[0]->filename); //!!! TODO prevent dialog closing on "enter" key press @@ -1245,12 +1249,12 @@ void FileCatalog::renameRequested (std::vector tbe) dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); Gtk::Label l; - dialog.get_vbox()->pack_start (l, Gtk::PACK_SHRINK); + dialog.get_content_area()->pack_start (l, Gtk::PACK_SHRINK); Gtk::Entry nfentry; - dialog.get_vbox()->pack_start (nfentry, Gtk::PACK_SHRINK); - dialog.get_vbox()->show_all (); + dialog.get_content_area()->pack_start (nfentry, Gtk::PACK_SHRINK); + dialog.get_content_area()->show_all (); nfentry.set_activates_default (true); dialog.set_default_response (Gtk::RESPONSE_OK); @@ -1941,7 +1945,7 @@ bool FileCatalog::Query_key_pressed (GdkEventKey *event) bool shift = event->state & GDK_SHIFT_MASK; switch (event->keyval) { - case GDK_Escape: + case GDK_KEY_Escape: // Clear Query if the Escape character is pressed within it if (!shift) { @@ -2031,7 +2035,7 @@ bool FileCatalog::BrowsePath_key_pressed (GdkEventKey *event) bool shift = event->state & GDK_SHIFT_MASK; switch (event->keyval) { - case GDK_Escape: + case GDK_KEY_Escape: // On Escape character Reset BrowsePath to selectedDirectory if (!shift) { @@ -2205,7 +2209,7 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) // GUI Layout switch(event->keyval) { - case GDK_l: + case GDK_KEY_l: if (!alt) { tbLeftPanel_1->set_active (!tbLeftPanel_1->get_active()); // toggle left panel } @@ -2221,7 +2225,7 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) return true; - case GDK_m: + case GDK_KEY_m: if (!ctrl && !alt) { toggleSidePanels(); } @@ -2231,7 +2235,7 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (shift) { switch(event->keyval) { - case GDK_Escape: + case GDK_KEY_Escape: BrowsePath->set_text(selectedDirectory); // set focus on something neutral, this is useful to remove focus from BrowsePath and Query // when need to execute a shortcut, which otherwise will be typed into those fields @@ -2281,8 +2285,8 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (!alt && !shift) { switch(event->keyval) { - case GDK_Return: - case GDK_KP_Enter: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: if (BrowsePath->is_focus()) { FileCatalog::buttonBrowsePathPressed (); return true; @@ -2369,8 +2373,8 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (!alt && !shift) { switch(event->keyval) { - case GDK_Return: - case GDK_KP_Enter: + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: if (BrowsePath->is_focus()) { FileCatalog::buttonBrowsePathPressed (); return true; @@ -2420,8 +2424,8 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (!ctrl && !alt) { switch(event->keyval) { - case GDK_d: - case GDK_D: + case GDK_KEY_d: + case GDK_KEY_D: categoryButtonToggled(bFilterClear, false); return true; } @@ -2430,26 +2434,26 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (!ctrl || (alt && !options.tabbedUI)) { switch(event->keyval) { - case GDK_bracketright: + case GDK_KEY_bracketright: coarsePanel->rotateRight(); return true; - case GDK_bracketleft: + case GDK_KEY_bracketleft: coarsePanel->rotateLeft(); return true; - case GDK_i: - case GDK_I: + case GDK_KEY_i: + case GDK_KEY_I: exifInfo->set_active (!exifInfo->get_active()); return true; - case GDK_plus: - case GDK_equal: + case GDK_KEY_plus: + case GDK_KEY_equal: zoomIn(); return true; - case GDK_minus: - case GDK_underscore: + case GDK_KEY_minus: + case GDK_KEY_underscore: zoomOut(); return true; } @@ -2457,18 +2461,18 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (ctrl && !alt) { switch (event->keyval) { - case GDK_o: + case GDK_KEY_o: BrowsePath->select_region(0, BrowsePath->get_text_length()); BrowsePath->grab_focus(); return true; - case GDK_f: + case GDK_KEY_f: Query->select_region(0, Query->get_text_length()); Query->grab_focus(); return true; - case GDK_t: - case GDK_T: + case GDK_KEY_t: + case GDK_KEY_T: modifierKey = 0; // HOMBRE: yet another hack.... otherwise the shortcut won't work categoryButtonToggled(bTrash, false); return true; @@ -2477,8 +2481,8 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (!ctrl && !alt && shift) { switch (event->keyval) { - case GDK_t: - case GDK_T: + case GDK_KEY_t: + case GDK_KEY_T: if (inTabMode) { if (options.showFilmStripToolBar) { hideToolBar(); @@ -2495,8 +2499,8 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) if (!ctrl && !alt && !shift) { switch (event->keyval) { - case GDK_t: - case GDK_T: + case GDK_KEY_t: + case GDK_KEY_T: if (inTabMode) { if (options.showFilmStripToolBar) { hideToolBar(); diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 5be2ab0df..5d446a599 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -130,7 +130,7 @@ FilePanel::FilePanel () : parent(NULL) fileCatalog->setFileSelectionChangeListener (tpc); fileCatalog->setFileSelectionListener (this); - g_idle_add (FilePanelInitUI, this); + add_idle (FilePanelInitUI, this); show_all (); } @@ -172,7 +172,6 @@ void FilePanel::setAspect () void FilePanel::init () { - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected dirBrowser->fillDirTree (); placesBrowser->refreshPlacesList (); @@ -194,7 +193,7 @@ void FilePanel::init () } } -void FilePanel::on_NB_switch_page(GtkNotebookPage* page, guint page_num) +void FilePanel::on_NB_switch_page(Gtk::Widget* page, guint page_num) { if (page_num == 1) { // switching the inspector "on" diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index 9d31628e4..68f021043 100644 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -63,7 +63,7 @@ protected: int error; - void on_NB_switch_page(GtkNotebookPage* page, guint page_num); + void on_NB_switch_page(Gtk::Widget* page, guint page_num); public: FilePanel (); diff --git a/rtgui/filterpanel.cc b/rtgui/filterpanel.cc index bc4396aca..734e8d603 100644 --- a/rtgui/filterpanel.cc +++ b/rtgui/filterpanel.cc @@ -213,7 +213,7 @@ void FilterPanel::setFilter (ExifFilterSettings& defefs, bool updateLists) curefs.expcomp.clear(); for (std::set::iterator i = defefs.expcomp.begin(); i != defefs.expcomp.end(); i++) { - expcomp->append_text (*i); + expcomp->append (*i); curefs.expcomp.insert(*i); } @@ -223,7 +223,7 @@ void FilterPanel::setFilter (ExifFilterSettings& defefs, bool updateLists) curefs.lenses.clear(); for (std::set::iterator i = defefs.lenses.begin(); i != defefs.lenses.end(); i++) { - lens->append_text (*i); + lens->append (*i); curefs.lenses.insert(*i); } @@ -233,7 +233,7 @@ void FilterPanel::setFilter (ExifFilterSettings& defefs, bool updateLists) curefs.cameras.clear(); for (std::set::iterator i = defefs.cameras.begin(); i != defefs.cameras.end(); i++) { - camera->append_text(*i); + camera->append(*i); curefs.cameras.insert(*i); } @@ -243,7 +243,7 @@ void FilterPanel::setFilter (ExifFilterSettings& defefs, bool updateLists) curefs.filetypes.clear(); for (std::set::iterator i = defefs.filetypes.begin(); i != defefs.filetypes.end(); i++) { - filetype->append_text(*i); + filetype->append(*i); curefs.filetypes.insert(*i); } diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index 516bed44a..9ae637562 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -42,60 +42,65 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u curveBBoxPos = options.curvebboxpos; // ControlPoints curve - CPointsCurveBox = new Gtk::VBox (); - CPointsCurveBox->set_spacing(4); - Gtk::HBox* CPointsCurveAndButtons = Gtk::manage (new Gtk::HBox ()); - CPointsCurveAndButtons->set_spacing(4); + CPointsCurveGrid = new Gtk::Grid (); + CPointsCurveGrid->set_row_spacing(options.slimUI ? 2 : 4); + CPointsCurveGrid->set_column_spacing(options.slimUI ? 2 : 4); + CPointsCurveGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + CPointsCurve = Gtk::manage (new MyFlatCurve ()); - CPointsCurve->set_size_request (GRAPH_SIZE + 2 * RADIUS + 1, GRAPH_SIZE + 2 * RADIUS + 1); CPointsCurve->setType (FCT_MinMaxCPoints); - Gtk::Box* CPointsbbox; // curvebboxpos 0=above, 1=right, 2=below, 3=left + Gtk::Grid* CPointsbbox = Gtk::manage (new Gtk::Grid ()); // curvebboxpos 0=above, 1=right, 2=below, 3=left + CPointsbbox->set_orientation(Gtk::ORIENTATION_VERTICAL); - if (options.curvebboxpos == 1 || options.curvebboxpos == 3) { - CPointsbbox = Gtk::manage (new Gtk::VBox ()); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + setExpandAlignProperties(CPointsbbox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); } else { - CPointsbbox = Gtk::manage (new Gtk::HBox ()); + setExpandAlignProperties(CPointsbbox, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START); } - CPointsbbox->set_spacing(4); - - pasteCPoints = Gtk::manage (new Gtk::Button ()); - pasteCPoints->add (*Gtk::manage (new RTImage ("edit-paste.png"))); - copyCPoints = Gtk::manage (new Gtk::Button ()); - copyCPoints->add (*Gtk::manage (new RTImage ("edit-copy.png"))); - saveCPoints = Gtk::manage (new Gtk::Button ()); - saveCPoints->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); - loadCPoints = Gtk::manage (new Gtk::Button ()); - loadCPoints->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editCPoints = Gtk::manage (new Gtk::ToggleButton()); - editPointCPoints = Gtk::manage (new Gtk::ToggleButton ()); - editPointCPoints->add (*Gtk::manage (new RTImage ("gtk-edit.png"))); - editPointCPoints->set_tooltip_text(M("CURVEEDITOR_EDITPOINT_HINT")); editCPoints->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(editCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); editCPoints->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); editCPoints->hide(); + editPointCPoints = Gtk::manage (new Gtk::ToggleButton ()); + editPointCPoints->add (*Gtk::manage (new RTImage ("gtk-edit.png"))); + editPointCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + editPointCPoints->set_tooltip_text(M("CURVEEDITOR_EDITPOINT_HINT")); + setExpandAlignProperties(editPointCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + copyCPoints = Gtk::manage (new Gtk::Button ()); + copyCPoints->add (*Gtk::manage (new RTImage ("edit-copy.png"))); + copyCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(copyCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + pasteCPoints = Gtk::manage (new Gtk::Button ()); + pasteCPoints->add (*Gtk::manage (new RTImage ("edit-paste.png"))); + pasteCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(pasteCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + loadCPoints = Gtk::manage (new Gtk::Button ()); + loadCPoints->add (*Gtk::manage (new RTImage ("gtk-open.png"))); + loadCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(loadCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); + saveCPoints = Gtk::manage (new Gtk::Button ()); + saveCPoints->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); + saveCPoints->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); + setExpandAlignProperties(saveCPoints, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_END); - CPointsbbox->pack_end (*pasteCPoints, Gtk::PACK_SHRINK, 0); - CPointsbbox->pack_end (*copyCPoints, Gtk::PACK_SHRINK, 0); - CPointsbbox->pack_end (*saveCPoints, Gtk::PACK_SHRINK, 0); - CPointsbbox->pack_end (*loadCPoints, Gtk::PACK_SHRINK, 0); - CPointsbbox->pack_start(*editPointCPoints, Gtk::PACK_SHRINK, 0); - CPointsbbox->pack_start(*editCPoints, Gtk::PACK_SHRINK, 0); - - CPointsCurveAndButtons->pack_start (*CPointsCurve, Gtk::PACK_EXPAND_WIDGET, 0); - CPointsCurveAndButtons->pack_start (*CPointsbbox, Gtk::PACK_SHRINK, 0); - CPointsCurveBox->pack_start (*CPointsCurveAndButtons, Gtk::PACK_EXPAND_WIDGET); - - if (options.curvebboxpos == 0) { - removeIfThere (CPointsCurveAndButtons, CPointsbbox, false); - CPointsCurveBox->pack_start (*CPointsbbox); - CPointsCurveBox->reorder_child(*CPointsbbox, 0); - } else if (options.curvebboxpos == 2) { - removeIfThere (CPointsCurveAndButtons, CPointsbbox, false); - CPointsCurveBox->pack_start (*CPointsbbox); - } else if (options.curvebboxpos == 3) { - CPointsCurveAndButtons->reorder_child(*CPointsbbox, 0); + if (options.curvebboxpos == 0 || options.curvebboxpos == 2) { + CPointsbbox->attach(*editCPoints, 0, 0, 1, 1); + CPointsbbox->attach(*editPointCPoints, 1, 0, 1, 1); + CPointsbbox->attach(*copyCPoints, 2, 0, 1, 1); + CPointsbbox->attach(*pasteCPoints, 3, 0, 1, 1); + CPointsbbox->attach(*loadCPoints, 4, 0, 1, 1); + CPointsbbox->attach(*saveCPoints, 5, 0, 1, 1); + } else { + CPointsbbox->attach(*editCPoints, 0, 0, 1, 1); + CPointsbbox->attach(*editPointCPoints, 0, 1, 1, 1); + CPointsbbox->attach(*copyCPoints, 0, 2, 1, 1); + CPointsbbox->attach(*pasteCPoints, 0, 3, 1, 1); + CPointsbbox->attach(*loadCPoints, 0, 4, 1, 1); + CPointsbbox->attach(*saveCPoints, 0, 5, 1, 1); } { @@ -106,16 +111,27 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u axis.at(2).setValues(M("CURVEEDITOR_AXIS_LEFT_TAN"), 5, 0.01, 0.1, 0., 1.); axis.at(3).setValues(M("CURVEEDITOR_AXIS_RIGHT_TAN"), 5, 0.01, 0.1, 0., 1.); CPointsCoordAdjuster = Gtk::manage (new CoordinateAdjuster(CPointsCurve, this, axis)); - CPointsCurveBox->pack_start(*CPointsCoordAdjuster, Gtk::PACK_SHRINK, 0); - - if (options.curvebboxpos == 2) { - CPointsCurveBox->reorder_child(*CPointsCoordAdjuster, 2); - } - - CPointsCoordAdjuster->show_all(); } - CPointsCurveBox->show_all (); + // Button box position: 0=above, 1=right, 2=below, 3=left + CPointsCurveGrid->add(*CPointsCurve); + CPointsCurve->set_hexpand(true); + + if (options.curvebboxpos == 0) { + CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurve, Gtk::POS_TOP, 1, 1); + CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 1) { + CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurve, Gtk::POS_RIGHT, 1, 1); + CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, Gtk::POS_BOTTOM, 2, 1); + } else if (options.curvebboxpos == 2) { + CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsCurve, Gtk::POS_BOTTOM, 1, 1); + CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCoordAdjuster, Gtk::POS_BOTTOM, 1, 1); + } else if (options.curvebboxpos == 3) { + CPointsCurveGrid->attach_next_to(*CPointsbbox, *CPointsCurve, Gtk::POS_LEFT, 1, 1); + CPointsCurveGrid->attach_next_to(*CPointsCoordAdjuster, *CPointsbbox, Gtk::POS_BOTTOM, 2, 1); + } + + CPointsCurveGrid->show_all (); CPointsCoordAdjuster->hide(); saveCPoints->signal_clicked().connect( sigc::mem_fun(*this, &FlatCurveEditorSubGroup::savePressed) ); @@ -135,7 +151,7 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u FlatCurveEditorSubGroup::~FlatCurveEditorSubGroup() { - delete CPointsCurveBox; + delete CPointsCurveGrid; } /* @@ -336,10 +352,10 @@ void FlatCurveEditorSubGroup::switchGUI() CPointsCurve->setPoints (dCurve->controlPointsCurveEd); CPointsCurve->setColorProvider(dCurve->getCurveColorProvider(), dCurve->getCurveCallerId()); CPointsCurve->setColoredBar(leftBar, bottomBar); - CPointsCurve->forceResize(); + CPointsCurve->queue_resize_no_redraw(); updateEditButton(dCurve, editCPoints, editCPointsConn); - parent->pack_start (*CPointsCurveBox); - CPointsCurveBox->check_resize(); + parent->pack_start (*CPointsCurveGrid); + CPointsCurveGrid->check_resize(); break; default: // (DCT_Linear, DCT_Unchanged) @@ -575,7 +591,7 @@ const std::vector FlatCurveEditorSubGroup::getCurveFromGUI (int type) */ void FlatCurveEditorSubGroup::removeEditor () { - removeIfThere (parent, CPointsCurveBox, false); + removeIfThere (parent, CPointsCurveGrid, false); } bool FlatCurveEditorSubGroup::curveReset(CurveEditor *ce) diff --git a/rtgui/flatcurveeditorsubgroup.h b/rtgui/flatcurveeditorsubgroup.h index 8cd2a6d9a..5ec3846d9 100644 --- a/rtgui/flatcurveeditorsubgroup.h +++ b/rtgui/flatcurveeditorsubgroup.h @@ -30,7 +30,7 @@ class FlatCurveEditorSubGroup: public CurveEditorSubGroup friend class FlatCurveEditor; protected: - Gtk::VBox* CPointsCurveBox; + Gtk::Grid* CPointsCurveGrid; MyFlatCurve* CPointsCurve; diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 0d346f8c1..c8a2f397c 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -54,10 +54,10 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L hbffbt->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_FLATFIELD_BLURTYPE") + ":"))); hbffbt->set_spacing(4); flatFieldBlurType = Gtk::manage (new MyComboBoxText ()); - flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_AREA")); - flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_VERTICAL")); - flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_HORIZONTAL")); - flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_VERTHORIZ")); + flatFieldBlurType->append(M("TP_FLATFIELD_BT_AREA")); + flatFieldBlurType->append(M("TP_FLATFIELD_BT_VERTICAL")); + flatFieldBlurType->append(M("TP_FLATFIELD_BT_HORIZONTAL")); + flatFieldBlurType->append(M("TP_FLATFIELD_BT_VERTHORIZ")); flatFieldBlurType->set_active(0); hbffbt->pack_end (*flatFieldBlurType); @@ -87,19 +87,19 @@ FlatField::FlatField () : FoldableToolPanel(this, "flatfield", M("TP_FLATFIELD_L // Set filename filters b_filter_asCurrent = false; - Gtk::FileFilter *filter_any = Gtk::manage(new Gtk::FileFilter); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); filter_any->add_pattern("*"); filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); - flatFieldFile->add_filter (*filter_any); + flatFieldFile->add_filter (filter_any); // filters for all supported non-raw extensions for (size_t i = 0; i < options.parseExtensions.size(); i++) { if (options.parseExtensionsEnabled[i] && options.parseExtensions[i].uppercase() != "JPG" && options.parseExtensions[i].uppercase() != "JPEG" && options.parseExtensions[i].uppercase() != "PNG" && options.parseExtensions[i].uppercase() != "TIF" && options.parseExtensions[i].uppercase() != "TIFF" ) { - Gtk::FileFilter *filter_ff = Gtk::manage(new Gtk::FileFilter); + Glib::RefPtr filter_ff = Gtk::FileFilter::create(); filter_ff->add_pattern("*." + options.parseExtensions[i]); filter_ff->add_pattern("*." + options.parseExtensions[i].uppercase()); filter_ff->set_name(options.parseExtensions[i].uppercase()); - flatFieldFile->add_filter (*filter_ff); + flatFieldFile->add_filter (filter_ff); //printf("adding filter %s \n",options.parseExtensions[i].uppercase().c_str()); } } @@ -175,8 +175,8 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi if (b_filter_asCurrent) { //First, remove last filter_asCurrent if it was set for a raw file - std::vector filters = flatFieldFile->list_filters(); - flatFieldFile->remove_filter(**(filters.end() - 1)); + std::vector< Glib::RefPtr > filters = flatFieldFile->list_filters(); + flatFieldFile->remove_filter(*(filters.end() - 1)); b_filter_asCurrent = false; } @@ -195,11 +195,11 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi if (israw) { b_filter_asCurrent = true; //prevent re-adding this filter on every pp3 file read - Gtk::FileFilter *filter_asCurrent = Gtk::manage(new Gtk::FileFilter); + Glib::RefPtr filter_asCurrent = Gtk::FileFilter::create(); filter_asCurrent->add_pattern("*." + filetype); filter_asCurrent->set_name(M("FILECHOOSER_FILTER_SAME") + " (" + filetype + ")"); - flatFieldFile->add_filter (*filter_asCurrent); - flatFieldFile->set_filter (*filter_asCurrent); + flatFieldFile->add_filter (filter_asCurrent); + flatFieldFile->set_filter (filter_asCurrent); } } } diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 141273179..d8574b5f9 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ +#include #include "../rtengine/rt_math.h" #include "guiutils.h" @@ -27,6 +28,8 @@ #include +//extern Glib::Threads::Thread* mainThread; + using namespace std; #if TRACE_MYRWMUTEX==1 && !defined NDEBUG @@ -40,6 +43,66 @@ Glib::RefPtr MyExpander::disabledPBuf; Glib::RefPtr MyExpander::openedPBuf; Glib::RefPtr MyExpander::closedPBuf; +guint add_idle (GSourceFunc function, gpointer data) +{ + return gdk_threads_add_idle(function, data); + //gtk_main_iteration_do(false); +} + + +/* +gboolean giveMeAGo(void* data) { + GThreadLock *threadMutex = static_cast(data); + printf("A\n"); + Glib::Threads::Mutex::Lock GUILock(threadMutex->GUI); + printf("B\n"); + { + Glib::Threads::Mutex::Lock operationLock(threadMutex->operation); + printf("C\n"); + + threadMutex->operationCond.signal(); + printf("D\n"); + operationLock.release(); // because we're not sure that "lock" destructor happens here... + } + threadMutex->GUICond.wait(threadMutex->GUI); + printf("E\n"); + + GUILock.release(); + + return false; +} + +GThreadLock::GThreadLock() : sameThread(false) { + if (Glib::Threads::Thread::self() == mainThread) { + sameThread = true; + return; + } + + printf("10\n"); + { + Glib::Threads::Mutex::Lock operationLock(operation); + + printf("20\n"); + gdk_threads_add_idle(giveMeAGo, this); + + printf("30\n"); + operationCond.wait(operation); + printf("40\n"); + operationLock.release(); + } +} + +GThreadLock::~GThreadLock() { + if (!sameThread) { + printf("50\n"); + Glib::Threads::Mutex::Lock lock(GUI); + printf("60\n"); + GUICond.signal(); + printf("Fin\n"); + } +} +*/ + Glib::ustring escapeHtmlChars(const Glib::ustring &src) { @@ -74,6 +137,14 @@ Glib::ustring escapeHtmlChars(const Glib::ustring &src) return dst; } +void setExpandAlignProperties(Gtk::Widget *widget, bool hExpand, bool vExpand, enum Gtk::Align hAlign, enum Gtk::Align vAlign) +{ + widget->set_hexpand(hExpand); + widget->set_vexpand(vExpand); + widget->set_halign(hAlign); + widget->set_valign(vAlign); +} + bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference) { @@ -404,17 +475,15 @@ void drawCrop (Cairo::RefPtr cr, int imx, int imy, int imw, int cr->reset_clip (); } -bool ExpanderBox::on_expose_event(GdkEventExpose* event) -{ - bool retVal = Gtk::EventBox::on_expose_event(event); +/* +bool ExpanderBox::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { if (!options.useSystemTheme) { Glib::RefPtr window = get_window(); - Glib::RefPtr style = get_style (); - Cairo::RefPtr cr = window->create_cairo_context(); + Glib::RefPtr style = get_style_context (); - int x_, y_, w_, h_, foo; - window->get_geometry(x_, y_, w_, h_, foo); + int x_, y_, w_, h_; + window->get_geometry(x_, y_, w_, h_); double x = 0.; double y = 0.; double w = double(w_); @@ -423,19 +492,22 @@ bool ExpanderBox::on_expose_event(GdkEventExpose* event) cr->set_antialias (Cairo::ANTIALIAS_NONE); // draw a frame + style->render_background(cr, x, y, w, h); + / * cr->set_line_width (1.0); - Gdk::Color c = style->get_fg (Gtk::STATE_NORMAL); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->move_to(x + 0.5, y + 0.5); - cr->line_to(x + w, y + 0.5); - cr->line_to(x + w, y + h); - cr->line_to(x + 0.5, y + h); - cr->line_to(x + 0.5, y + 0.5); + Gdk::RGBA c = style->get_color (Gtk::STATE_FLAG_NORMAL); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->move_to(x+0.5, y+0.5); + cr->line_to(x+w, y+0.5); + cr->line_to(x+w, y+h); + cr->line_to(x+0.5, y+h); + cr->line_to(x+0.5, y+0.5); cr->stroke (); + * / } - - return retVal; + return Gtk::EventBox::on_draw(cr); } +*/ ExpanderBox::ExpanderBox( Gtk::Container *p): pC(p) { @@ -443,11 +515,22 @@ ExpanderBox::ExpanderBox( Gtk::Container *p): pC(p) updateStyle(); } -void ExpanderBox::on_style_changed (const Glib::RefPtr& style) +void ExpanderBox::on_style_updated () { updateStyle(); } +void ExpanderBox::setLevel(int level) +{ + if (level <= 1) { + set_name("ExpanderBox"); + } else if (level == 2) { + set_name("ExpanderBox2"); + } else if (level >= 3) { + set_name("ExpanderBox3"); + } +} + void ExpanderBox::updateStyle() { set_border_width(options.slimUI ? 2 : 8); // Outer space around the tool's frame 2:7 @@ -561,7 +644,7 @@ MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) : } label = Gtk::manage(new Gtk::Label()); - label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + label->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); label->set_markup(Glib::ustring("") + escapeHtmlChars(titleLabel) + Glib::ustring("")); headerHBox->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0); @@ -621,6 +704,13 @@ void MyExpander::updateStyle() } } +void MyExpander::setLevel (int level) +{ + if (expBox) { + expBox->setLevel(level); + } +} + void MyExpander::setLabel (Glib::ustring newLabel) { if (label) { @@ -819,7 +909,6 @@ bool MyExpander::on_enabled_change(GdkEventButton* event) */ MyScrolledWindow::MyScrolledWindow () { - set_size_request(-1, 30); } bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event) @@ -829,8 +918,8 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event) return true; } - Gtk::Adjustment *adjust = get_vadjustment(); - Gtk::VScrollbar *scroll = get_vscrollbar(); + Glib::RefPtr adjust = get_vadjustment(); + Gtk::Scrollbar *scroll = get_vscrollbar(); if (adjust && scroll) { double upper = adjust->get_upper(); @@ -865,6 +954,16 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event) return true; } +void MyScrolledWindow::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + natural_height = minimum_height = 50; +} + +void MyScrolledWindow::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + natural_height = minimum_height = 50; +} + MyComboBoxText::MyComboBoxText () { set_size_request(40, -1); @@ -883,6 +982,16 @@ bool MyComboBoxText::on_scroll_event (GdkEventScroll* event) return false; } +void MyComboBoxText::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = natural_width = 70; +} +void MyComboBoxText::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + minimum_width = natural_width = 70; +} + + MyComboBox::MyComboBox () { set_size_request(40, -1); @@ -901,17 +1010,26 @@ bool MyComboBox::on_scroll_event (GdkEventScroll* event) return false; } +void MyComboBox::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = natural_width = 70; +} +void MyComboBox::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + minimum_width = natural_width = 70; +} + MySpinButton::MySpinButton () { Gtk::Border border; - border.bottom = 0; - border.top = 0; - border.left = 3; - border.right = 3; + border.set_bottom(0); + border.set_top(0); + border.set_left(3); + border.set_right(3); set_inner_border(border); set_numeric(true); set_wrap(false); - set_alignment(Gtk::ALIGN_RIGHT); + set_alignment(Gtk::ALIGN_END); } void MySpinButton::updateSize() @@ -936,6 +1054,7 @@ void MySpinButton::updateSize() maxLen = digits + digits2 + (vMin < 0 ? 1 : 0) + (digits > 0 ? 1 : 0); set_max_length(maxLen); set_width_chars(maxLen); + set_max_width_chars(maxLen); } bool MySpinButton::on_key_press_event (GdkEventKey* event) @@ -951,7 +1070,7 @@ bool MySpinButton::on_key_press_event (GdkEventKey* event) return false; } else { if(event->string[0] == ',') { - event->keyval = GDK_period; + event->keyval = GDK_KEY_period; event->string[0] = '.'; } @@ -1100,7 +1219,58 @@ void TextOrIcon::switchTo(TOITypes type) show_all(); } +MyImageMenuItem::MyImageMenuItem(Glib::ustring label, Glib::ustring imageFileName) +{ + 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) ); + box->attach_next_to(*image, Gtk::POS_LEFT, 1, 1); + } + + box->attach_next_to(*this->label, Gtk::POS_RIGHT, 1, 1); + box->set_column_spacing(4); + box->set_row_spacing(0); + add(*box); +} + +const RTImage *MyImageMenuItem::getImage() +{ + return image; +} + + BackBuffer::BackBuffer() : x(0), y(0), w(0), h(0), offset(0, 0), dirty(true) {} +BackBuffer::BackBuffer(int width, int height, Cairo::Format format) : x(0), y(0), w(width), h(height), offset(0, 0), dirty(true) +{ + if (w > 0 && h > 0) { + surface = Cairo::ImageSurface::create(format, w, h); + } else { + w = h = 0; + } +} + +BackBuffer::BackBuffer(int width, int height, Glib::RefPtr referenceWindow) : x(0), y(0), w(width), h(height), offset(0, 0), dirty(true) +{ + if (w > 0 && h > 0 && referenceWindow) { + Cairo::RefPtr surf = referenceWindow->create_similar_image_surface(Cairo::FORMAT_RGB24, w, h, 0); + Cairo::SurfaceType type = surf->get_type(); + + if (type == Cairo::SURFACE_TYPE_IMAGE || type == Cairo::SURFACE_TYPE_WIN32) { + surface = Cairo::RefPtr::cast_static(surf); + + if (!surface || !surface->get_width() || !surface->get_height()) { + printf("ERRRROOOOORRRR!\n"); + } + } else { + printf("ERROR: wrong surface type. 0 or 7 was expected, but we've got %d instead.\n", type); + } + } else { + w = h = 0; + } +} void BackBuffer::setSrcOffset(int x, int y) { @@ -1109,6 +1279,12 @@ void BackBuffer::setSrcOffset(int x, int y) offset.y = y; } +// Note: newW & newH must be > 0 +bool BackBuffer::setDrawRectangle(Glib::RefPtr window, Gdk::Rectangle &rectangle, bool updateBackBufferSize) +{ + return setDrawRectangle(window, rectangle.get_x(), rectangle.get_y(), rectangle.get_width(), rectangle.get_height(), updateBackBufferSize); +} + // Note: newW & newH must be > 0 bool BackBuffer::setDrawRectangle(Glib::RefPtr window, int newX, int newY, int newW, int newH, bool updateBackBufferSize) { @@ -1122,7 +1298,7 @@ bool BackBuffer::setDrawRectangle(Glib::RefPtr window, int newX, in h = newH; // WARNING: we're assuming that the surface type won't change during all the execution time of RT. I guess it may be wrong when the user change the gfx card display settings!? - if (updateBackBufferSize && newSize && window) { + if (((updateBackBufferSize && newSize) || !surface) && window) { // allocate a new Surface surface.clear(); // ... don't know if this is necessary? surface = Cairo::ImageSurface::create(Cairo::FORMAT_RGB24, w, h); @@ -1132,6 +1308,12 @@ bool BackBuffer::setDrawRectangle(Glib::RefPtr window, int newX, in return dirty; } +// Note: newW & newH must be > 0 +bool BackBuffer::setDrawRectangle(Cairo::Format format, Gdk::Rectangle &rectangle, bool updateBackBufferSize) +{ + return setDrawRectangle(format, rectangle.get_x(), rectangle.get_y(), rectangle.get_width(), rectangle.get_height(), updateBackBufferSize); +} + // Note: newW & newH must be > 0 bool BackBuffer::setDrawRectangle(Cairo::Format format, int newX, int newY, int newW, int newH, bool updateBackBufferSize) { @@ -1145,7 +1327,7 @@ bool BackBuffer::setDrawRectangle(Cairo::Format format, int newX, int newY, int h = newH; // WARNING: we're assuming that the surface type won't change during all the execution time of RT. I guess it may be wrong when the user change the gfx card display settings!? - if (updateBackBufferSize && newSize) { + if ((updateBackBufferSize && newSize) || !surface) { // allocate a new Surface surface.clear(); // ... don't know if this is necessary? surface = Cairo::ImageSurface::create(format, w, h); @@ -1155,10 +1337,58 @@ bool BackBuffer::setDrawRectangle(Cairo::Format format, int newX, int newY, int return dirty; } +/* + * Copy uint8 RGB raw data to an ImageSurface. We're assuming that the source contains enough data for the given srcX, srcY, srcW, srcH -> no error checking! + */ +void BackBuffer::copyRGBCharData(const unsigned char *srcData, int srcX, int srcY, int srcW, int srcH, int srcRowStride, int dstX, int dstY) +{ + const unsigned char *src; + unsigned char *dst; + unsigned char r, g, b; + + if (!surface) { + return; + } + + //printf("copyRGBCharData: src: (X:%d Y:%d, W:%d H:%d) / dst: (X: %d Y:%d)\n", srcX, srcY, srcW, srcH, dstX, dstY); + + unsigned char *dstData = surface->get_data(); + int surfW = surface->get_width(); + int surfH = surface->get_height(); + + if (!srcData || dstX >= surfW || dstY >= surfH || srcW <= 0 || srcH <= 0 || srcX < 0 || srcY < 0) { + return; + } + + for (unsigned int i = 0; i < (unsigned int)(srcH); ++i) { + if (dstY + i >= surfH) { + break; + } + + src = srcData + i * srcRowStride; + dst = dstData + ((dstY + i) * surfW + dstX) * 4; + + for (unsigned int j = 0; j < (unsigned int)(srcW); ++j) { + if (dstX + j >= surfW) { + break; + } + + r = *(src++); + g = *(src++); + b = *(src++); + + rtengine::poke255_uc(dst, r, g, b); + } + } + + surface->mark_dirty(); + +} + /* * Copy the backbuffer to a Gdk::Window */ -void BackBuffer::copySurface(Glib::RefPtr window, GdkRectangle *rectangle) +void BackBuffer::copySurface(Glib::RefPtr window, Gdk::Rectangle *destRectangle) { if (surface && window) { // TODO: look out if window can be different on each call, and if not, store a reference to the window @@ -1171,13 +1401,20 @@ void BackBuffer::copySurface(Glib::RefPtr window, GdkRectangle *rec // now copy the off-screen Surface to the destination Surface Cairo::RefPtr crDest = Cairo::Context::create(destSurface); - crDest->set_source(surface, x - offsetX, y - offsetY); crDest->set_line_width(0.); - if (rectangle) { - crDest->rectangle(rectangle->x, rectangle->y, rectangle->width, rectangle->height); + if (destRectangle) { + crDest->set_source(surface, -offsetX + destRectangle->get_x(), -offsetY + destRectangle->get_y()); + int w_ = destRectangle->get_width() > 0 ? destRectangle->get_width() : w; + int h_ = destRectangle->get_height() > 0 ? destRectangle->get_height() : h; + //printf("BackBuffer::copySurface / rectangle1(%d, %d, %d, %d)\n", destRectangle->get_x(), destRectangle->get_y(), w_, h_); + crDest->rectangle(destRectangle->get_x(), destRectangle->get_y(), w_, h_); + //printf("BackBuffer::copySurface / rectangle1\n"); } else { + crDest->set_source(surface, -offsetX + x, -offsetY + y); + //printf("BackBuffer::copySurface / rectangle2(%d, %d, %d, %d)\n", x, y, w, h); crDest->rectangle(x, y, w, h); + //printf("BackBuffer::copySurface / rectangle2\n"); } crDest->fill(); @@ -1187,22 +1424,35 @@ void BackBuffer::copySurface(Glib::RefPtr window, GdkRectangle *rec /* * Copy the BackBuffer to another BackBuffer */ -void BackBuffer::copySurface(BackBuffer *destBackBuffer, GdkRectangle *rectangle) +void BackBuffer::copySurface(BackBuffer *destBackBuffer, Gdk::Rectangle *destRectangle) { if (surface && destBackBuffer) { + Cairo::RefPtr destSurface = destBackBuffer->getSurface(); + + if (!destSurface) { + return; + } + // compute the source offset int offsetX = rtengine::LIM(offset.x, 0, surface->get_width()); int offsetY = rtengine::LIM(offset.y, 0, surface->get_height()); // now copy the off-screen Surface to the destination Surface - Cairo::RefPtr crDest = Cairo::Context::create(destBackBuffer->getSurface()); - crDest->set_source(surface, x - offsetX, y - offsetY); + Cairo::RefPtr crDest = Cairo::Context::create(destSurface); crDest->set_line_width(0.); - if (rectangle) { - crDest->rectangle(rectangle->x, rectangle->y, rectangle->width, rectangle->height); + if (destRectangle) { + crDest->set_source(surface, -offsetX + destRectangle->get_x(), -offsetY + destRectangle->get_y()); + int w_ = destRectangle->get_width() > 0 ? destRectangle->get_width() : w; + int h_ = destRectangle->get_height() > 0 ? destRectangle->get_height() : h; + //printf("BackBuffer::copySurface / rectangle3(%d, %d, %d, %d)\n", destRectangle->get_x(), destRectangle->get_y(), w_, h_); + crDest->rectangle(destRectangle->get_x(), destRectangle->get_y(), w_, h_); + //printf("BackBuffer::copySurface / rectangle3\n"); } else { + crDest->set_source(surface, -offsetX + x, -offsetY + y); + //printf("BackBuffer::copySurface / rectangle4(%d, %d, %d, %d)\n", x, y, w, h); crDest->rectangle(x, y, w, h); + //printf("BackBuffer::copySurface / rectangle4\n"); } crDest->fill(); @@ -1212,7 +1462,7 @@ void BackBuffer::copySurface(BackBuffer *destBackBuffer, GdkRectangle *rectangle /* * Copy the BackBuffer to another Cairo::Surface */ -void BackBuffer::copySurface(Cairo::RefPtr destSurface, GdkRectangle *rectangle) +void BackBuffer::copySurface(Cairo::RefPtr destSurface, Gdk::Rectangle *destRectangle) { if (surface && destSurface) { // compute the source offset @@ -1221,13 +1471,54 @@ void BackBuffer::copySurface(Cairo::RefPtr destSurface, Gdk // now copy the off-screen Surface to the destination Surface Cairo::RefPtr crDest = Cairo::Context::create(destSurface); - crDest->set_source(surface, x - offsetX, y - offsetY); crDest->set_line_width(0.); - if (rectangle) { - crDest->rectangle(rectangle->x, rectangle->y, rectangle->width, rectangle->height); + if (destRectangle) { + crDest->set_source(surface, -offsetX + destRectangle->get_x(), -offsetY + destRectangle->get_y()); + int w_ = destRectangle->get_width() > 0 ? destRectangle->get_width() : w; + int h_ = destRectangle->get_height() > 0 ? destRectangle->get_height() : h; + //printf("BackBuffer::copySurface / rectangle5(%d, %d, %d, %d)\n", destRectangle->get_x(), destRectangle->get_y(), w_, h_); + crDest->rectangle(destRectangle->get_x(), destRectangle->get_y(), w_, h_); + //printf("BackBuffer::copySurface / rectangle5\n"); } else { + crDest->set_source(surface, -offsetX + x, -offsetY + y); + //printf("BackBuffer::copySurface / rectangle6(%d, %d, %d, %d)\n", x, y, w, h); crDest->rectangle(x, y, w, h); + //printf("BackBuffer::copySurface / rectangle6\n"); + } + + crDest->fill(); + } +} + +/* + * Copy the BackBuffer to another Cairo::Surface + */ +void BackBuffer::copySurface(Cairo::RefPtr crDest, Gdk::Rectangle *destRectangle) +{ + if (surface && crDest) { + // compute the source offset + int offsetX = rtengine::LIM(offset.x, 0, surface->get_width()); + int offsetY = rtengine::LIM(offset.y, 0, surface->get_height()); + + // now copy the off-screen Surface to the destination Surface + int srcSurfW = surface->get_width(); + int srcSurfH = surface->get_height(); + //printf("srcSurf: w: %d, h: %d\n", srcSurfW, srcSurfH); + crDest->set_line_width(0.); + + if (destRectangle) { + crDest->set_source(surface, -offsetX + destRectangle->get_x(), -offsetY + destRectangle->get_y()); + int w_ = destRectangle->get_width() > 0 ? destRectangle->get_width() : w; + int h_ = destRectangle->get_height() > 0 ? destRectangle->get_height() : h; + //printf("BackBuffer::copySurface / rectangle7(%d, %d, %d, %d)\n", destRectangle->get_x(), destRectangle->get_y(), w_, h_); + crDest->rectangle(destRectangle->get_x(), destRectangle->get_y(), w_, h_); + //printf("BackBuffer::copySurface / rectangle7\n"); + } else { + crDest->set_source(surface, -offsetX + x, -offsetY + y); + //printf("BackBuffer::copySurface / rectangle8(%d, %d, %d, %d)\n", x, y, w, h); + crDest->rectangle(x, y, w, h); + //printf("BackBuffer::copySurface / rectangle8\n"); } crDest->fill(); diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 1e65f2753..07322d90f 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -20,7 +20,9 @@ #define __GUI_UTILS_ #include +#include #include "../rtengine/rtengine.h" +#include "rtimage.h" #include #include @@ -32,6 +34,45 @@ Glib::ustring getExtension (const Glib::ustring& filename); bool confirmOverwrite (Gtk::Window& parent, const std::string& filename); void writeFailed (Gtk::Window& parent, const std::string& filename); void drawCrop (Cairo::RefPtr cr, int imx, int imy, int imw, int imh, int startx, int starty, double scale, const rtengine::procparams::CropParams& cparams, bool drawGuide = true, bool useBgColor = true, bool fullImageVisible = true); +gboolean acquireGUI(void* data); +void setExpandAlignProperties(Gtk::Widget *widget, bool hExpand, bool vExpand, enum Gtk::Align hAlign, enum Gtk::Align vAlign); + +guint add_idle (GSourceFunc function, gpointer data); + +/** + * @brief Lock GTK for critical section. + * + * Will unlock on destruction. To use: + * + * + * { + * GThreadLock lock; + * // critical code + * } + * + * + * This is a replacement for the former gdk_threads_enter / gdk_threads_leave pair that has been deprecated. + * It does the same, but there may be a speed penalty, hopefully negligible. + */ + +/* + * + * This, doesn't work. But we have to find a replacement for gdk_threads_enter and gdk_threads_leave that are deprecated and will be removed. + * + * +class GThreadLock +{ +public: + Glib::Threads::Mutex operation; + Glib::Threads::Cond operationCond; + Glib::Threads::Mutex GUI; + Glib::Threads::Cond GUICond; + bool sameThread; + + GThreadLock(); + ~GThreadLock(); +}; +*/ /** * @brief Lock GTK for critical section. @@ -76,6 +117,7 @@ public: } }; + /** * @brief Glue box to control visibility of the MyExpender's content ; also handle the frame around it */ @@ -91,6 +133,7 @@ public: delete pC; } + void setLevel(int level); void updateStyle(); void show() {} @@ -101,8 +144,8 @@ public: void showBox(); void hideBox(); - void on_style_changed (const Glib::RefPtr& style); - bool on_expose_event(GdkEventExpose* event); + void on_style_updated (); +// bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); }; /** @@ -143,7 +186,7 @@ private: /// Update the style of this widget, depending in the "slim" option void updateStyle(); - void on_style_changed (const Glib::RefPtr& style) + void on_style_updated () { updateStyle(); } @@ -180,6 +223,9 @@ public: }; type_signal_enabled_toggled signal_enabled_toggled(); + /// Set the nesting level of the Expander to adapt its style accordingly + void setLevel(int level); + /// Set a new label string. If it has been instantiated with a Gtk::Widget, this method will do nothing void setLabel (Glib::ustring newLabel); /// Set a new label string. If it has been instantiated with a Gtk::Widget, this method will do nothing @@ -229,6 +275,8 @@ class MyScrolledWindow : public Gtk::ScrolledWindow { bool on_scroll_event (GdkEventScroll* event); + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const; + void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; public: MyScrolledWindow(); @@ -241,6 +289,8 @@ class MyComboBox : public Gtk::ComboBox { bool on_scroll_event (GdkEventScroll* event); + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; public: MyComboBox (); @@ -253,6 +303,8 @@ class MyComboBoxText : public Gtk::ComboBoxText { bool on_scroll_event (GdkEventScroll* event); + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; public: MyComboBoxText (); @@ -374,6 +426,18 @@ public: void switchTo(TOITypes type); }; +class MyImageMenuItem : public Gtk::MenuItem +{ +private: + Gtk::Grid *box; + RTImage *image; + Gtk::Label *label; + +public: + MyImageMenuItem (Glib::ustring label, Glib::ustring imageFileName); + const RTImage *getImage(); +}; + /** * @brief Define a gradient milestone */ @@ -423,10 +487,31 @@ public: } }; +class RefCount +{ +private: + int refCount; +public: + RefCount() : refCount(1) {} + + void reference() + { + ++refCount; + } + void unreference() + { + --refCount; + + if (!refCount) { + delete this; + } + } +}; + /** - * @brief Handle backbuffers as automatically as possible + * @brief Handle back buffers as automatically as possible, and suitable to be used with Glib::RefPtr */ -class BackBuffer +class BackBuffer : public RefCount { protected: @@ -437,16 +522,22 @@ protected: public: BackBuffer(); + BackBuffer(int w, int h, Cairo::Format format = Cairo::FORMAT_RGB24); + BackBuffer(int w, int h, Glib::RefPtr referenceWindow); // set the destination drawing rectangle; return true if the dimensions are different // Note: newW & newH must be > 0 + bool setDrawRectangle(Glib::RefPtr window, Gdk::Rectangle &rectangle, bool updateBackBufferSize = true); bool setDrawRectangle(Glib::RefPtr window, int newX, int newY, int newW, int newH, bool updateBackBufferSize = true); + bool setDrawRectangle(Cairo::Format format, Gdk::Rectangle &rectangle, bool updateBackBufferSize = true); bool setDrawRectangle(Cairo::Format format, int newX, int newY, int newW, int newH, bool updateBackBufferSize = true); void setSrcOffset(int x, int y); - void copySurface(Glib::RefPtr window, GdkRectangle *rectangle = NULL); - void copySurface(BackBuffer *destBackBuffer, GdkRectangle *rectangle = NULL); - void copySurface(Cairo::RefPtr destSurface, GdkRectangle *rectangle = NULL); + void copyRGBCharData(const unsigned char *srcData, int srcX, int srcY, int srcW, int srcH, int srcRowStride, int dstX, int dstY); + void copySurface(Glib::RefPtr window, Gdk::Rectangle *rectangle = NULL); + void copySurface(BackBuffer *destBackBuffer, Gdk::Rectangle *rectangle = NULL); + void copySurface(Cairo::RefPtr destSurface, Gdk::Rectangle *rectangle = NULL); + void copySurface(Cairo::RefPtr crDest, Gdk::Rectangle *destRectangle = NULL); void setDirty(bool isDirty) { @@ -488,13 +579,12 @@ public: } int getWidth() { - return surface ? surface->get_width() : 0; + return surface ? surface->get_width() : 0; // sending back the allocated width } int getHeight() { - return surface ? surface->get_height() : 0; + return surface ? surface->get_height() : 0; // sending back the allocated height } }; - #endif diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index e5d3d560e..7d4b0c235 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -29,7 +29,6 @@ using namespace rtengine; -extern Glib::ustring argv0; extern Options options; @@ -39,16 +38,28 @@ extern Options options; HistogramPanel::HistogramPanel () { + set_vexpand(false); + set_hexpand(true); + set_valign(Gtk::ALIGN_START); + set_halign(Gtk::ALIGN_FILL); + histogramArea = Gtk::manage (new HistogramArea (this)); + histogramArea->set_hexpand(true); + histogramArea->set_vexpand(true); histogramRGBArea = Gtk::manage (new HistogramRGBArea ()); + histogramRGBArea->set_hexpand(true); + histogramRGBArea->set_vexpand(false); + histogramRGBArea->set_halign(Gtk::ALIGN_FILL); + histogramRGBArea->set_valign(Gtk::ALIGN_END); histogramRGBArea->show(); - gfxVBox = Gtk::manage (new Gtk::VBox (false, 2)); - histogramRGBArea->setParent(gfxVBox); - gfxVBox->pack_start (*histogramArea, Gtk::PACK_EXPAND_WIDGET, 0); + gfxGrid = Gtk::manage (new Gtk::Grid ()); + gfxGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + histogramRGBArea->setParent(gfxGrid); + gfxGrid->add(*histogramArea); if (options.histogramBar) { - gfxVBox->pack_start (*histogramRGBArea, Gtk::PACK_SHRINK, 0); + gfxGrid->add (*histogramRGBArea); } redImage = new RTImage ("histRed.png"); @@ -113,7 +124,8 @@ HistogramPanel::HistogramPanel () showFull->set_tooltip_text (M("HISTOGRAM_TOOLTIP_FULL")); showBAR->set_tooltip_text (M("HISTOGRAM_TOOLTIP_BAR")); - buttonVBox = Gtk::manage (new Gtk::VBox (false, 2)); + buttonGrid = Gtk::manage (new Gtk::Grid ()); + buttonGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); showRed->set_active (true); showGreen->set_active (true); showBlue->set_active (true); @@ -133,6 +145,39 @@ HistogramPanel::HistogramPanel () showFull->set_image (showFull->get_active() ? *fullImage : *fullImage_g); showBAR->set_image (showBAR->get_active() ? *barImage : *barImage_g); + showRed->set_hexpand(false); + showRed->set_vexpand(false); + showRed->set_halign(Gtk::ALIGN_CENTER); + showRed->set_valign(Gtk::ALIGN_START); + showGreen->set_hexpand(false); + showGreen->set_vexpand(false); + showGreen->set_halign(Gtk::ALIGN_CENTER); + showGreen->set_valign(Gtk::ALIGN_START); + showBlue->set_hexpand(false); + showRed->set_vexpand(false); + showBlue->set_halign(Gtk::ALIGN_CENTER); + showBlue->set_valign(Gtk::ALIGN_START); + showValue->set_hexpand(false); + showValue->set_vexpand(false); + showValue->set_halign(Gtk::ALIGN_CENTER); + showValue->set_valign(Gtk::ALIGN_START); + showChro->set_hexpand(false); + showChro->set_vexpand(false); + showChro->set_halign(Gtk::ALIGN_CENTER); + showChro->set_valign(Gtk::ALIGN_START); + showRAW->set_hexpand(false); + showRAW->set_vexpand(false); + showRAW->set_halign(Gtk::ALIGN_CENTER); + showRAW->set_valign(Gtk::ALIGN_START); + showFull->set_hexpand(false); + showFull->set_vexpand(false); + showFull->set_halign(Gtk::ALIGN_CENTER); + showFull->set_valign(Gtk::ALIGN_START); + showBAR->set_hexpand(false); + showBAR->set_vexpand(false); + showBAR->set_halign(Gtk::ALIGN_CENTER); + showBAR->set_valign(Gtk::ALIGN_START); + showRed->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::red_toggled), showRed ); showGreen->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::green_toggled), showGreen ); showBlue->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::blue_toggled), showBlue ); @@ -142,22 +187,22 @@ HistogramPanel::HistogramPanel () showFull->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::full_toggled), showFull ); showBAR->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::bar_toggled), showBAR ); - buttonVBox->pack_start (*showRed, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showGreen, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showBlue, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showValue, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showChro, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showRAW, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showFull, Gtk::PACK_SHRINK, 0); - buttonVBox->pack_start (*showBAR, Gtk::PACK_SHRINK, 0); + buttonGrid->add (*showRed); + buttonGrid->add (*showGreen); + buttonGrid->add (*showBlue); + buttonGrid->add (*showValue); + buttonGrid->add (*showChro); + buttonGrid->add (*showRAW); + buttonGrid->add (*showFull); + buttonGrid->add (*showBAR); // Put the button vbox next to the window's border to be less disturbing if (options.histogramPosition == 1) { - pack_start (*buttonVBox, Gtk::PACK_SHRINK, 2); - pack_start (*gfxVBox, Gtk::PACK_EXPAND_WIDGET, 2); + add (*buttonGrid); + add (*gfxGrid); } else { - pack_start (*gfxVBox, Gtk::PACK_EXPAND_WIDGET, 2); - pack_start (*buttonVBox, Gtk::PACK_SHRINK, 2); + add (*gfxGrid); + add (*buttonGrid); } show_all (); @@ -190,42 +235,32 @@ HistogramPanel::~HistogramPanel () void HistogramPanel::resized (Gtk::Allocation& req) { + /* rconn.block (true); - int gHeight = req.get_width() / 2; - - if (gHeight > 150) { - gHeight = 150; - } else if (gHeight < 100) { - gHeight = 100; - } - - int bHeight = req.get_width() / 30; - - if (bHeight > 10) { - bHeight = 10; - } else if (bHeight < 5 ) { - bHeight = 5; - } - + int gHeight = req.get_width()/2; + if (gHeight > 150) gHeight = 150; else if (gHeight < 100) gHeight = 100; + int bHeight = req.get_width()/30; + if (bHeight > 10) bHeight = 10; else if (bHeight < 5 ) bHeight = 5; histogramArea->set_size_request (req.get_width(), gHeight); histogramRGBArea->set_size_request (req.get_width(), bHeight); rconn.block (false); + */ - histogramArea->renderHistogram (); + histogramArea->updateBackBuffer (); histogramArea->queue_draw (); if (histogramRGBArea->getFreeze() == true) { histogramRGBArea->updateFreeze(false); // set histogramRGBArea invalid; - histogramRGBArea->renderRGBMarks(-1, -1, -1); + histogramRGBArea->updateBackBuffer(-1, -1, -1); // re-set freeze to old state histogramRGBArea->updateFreeze(true); histogramRGBArea->queue_draw (); } else { // set histogramRGBArea invalid; - histogramRGBArea->renderRGBMarks(-1, -1, -1); + histogramRGBArea->updateBackBuffer(-1, -1, -1); histogramRGBArea->queue_draw (); } } @@ -292,14 +327,14 @@ void HistogramPanel::rgbv_toggled () histogramArea->queue_draw (); histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showBAR->get_active(), showChro->get_active()); - histogramRGBArea->renderRGBMarks (0, 0, 0); + histogramRGBArea->updateBackBuffer (0, 0, 0); histogramArea->queue_draw (); } void HistogramPanel::setHistRGBInvalid () { // do something to un-show vertical bars - histogramRGBArea->renderRGBMarks(-1, -1, -1); + histogramRGBArea->updateBackBuffer(-1, -1, -1); histogramRGBArea->queue_draw (); } @@ -320,25 +355,31 @@ void HistogramPanel::pointerMoved (bool validPos, Glib::ustring profile, Glib::u if (!validPos) { // do something to un-show vertical bars - histogramRGBArea->renderRGBMarks(-1, -1, -1); + histogramRGBArea->updateBackBuffer(-1, -1, -1); histogramRGBArea->queue_draw (); } else { // do something to show vertical bars - histogramRGBArea->renderRGBMarks(r, g, b, profile, profileW); + histogramRGBArea->updateBackBuffer(r, g, b, profile, profileW); histogramRGBArea->queue_draw (); } } /* * Move the vertical button bar to the right side - * only allowed values for align are Gtk::ALIGN_LEFT and Gtk::ALIGN_RIGHT + * only allowed values for align are Gtk::POS_LEFT and Gtk::POS_RIGHT */ -void HistogramPanel::reorder (Gtk::AlignmentEnum align) +void HistogramPanel::reorder (Gtk::PositionType align) { - if (align == Gtk::ALIGN_LEFT) { - reorder_child(*buttonVBox, 0); + if (align == Gtk::POS_LEFT) { + gfxGrid->reference(); + removeIfThere(this, gfxGrid, false); + add (*gfxGrid); + gfxGrid->unreference(); } else { - reorder_child(*buttonVBox, 1); + buttonGrid->reference(); + removeIfThere(this, buttonGrid, false); + add (*buttonGrid); + buttonGrid->unreference(); } } @@ -357,6 +398,8 @@ HistogramRGBArea::HistogramRGBArea () ://needChroma unactive by default frozen(false), valid(false), needRed(true), needGreen(true), needBlue(true), needLuma(true), rawMode(false), showMode(options.histogramBar), barDisplayed(options.histogramBar), needChroma(false) { + //set_size_request(60, 12); + harih = new HistogramRGBAreaIdleHelper; harih->harea = this; harih->destroyed = false; @@ -373,6 +416,45 @@ HistogramRGBArea::~HistogramRGBArea () } } + +Gtk::SizeRequestMode HistogramRGBArea::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; +} + +void HistogramRGBArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + int minimumWidth = 0; + int naturalWidth = 0; + get_preferred_width_vfunc(minimumWidth, naturalWidth); + get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height); +} + +void HistogramRGBArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 60; + natural_width = 200; +} + +void HistogramRGBArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + int bHeight = width / 30; + + if (bHeight > 10) { + bHeight = 10; + } else if (bHeight < 5 ) { + bHeight = 5; + } + + minimum_height = bHeight; + natural_height = bHeight; +} + +void HistogramRGBArea::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + bool HistogramRGBArea::getFreeze() { return(frozen); @@ -389,14 +471,9 @@ void HistogramRGBArea::updateFreeze (bool f) return; } -void HistogramRGBArea::renderRGBMarks (int r, int g, int b, Glib::ustring profile, Glib::ustring profileW) +void HistogramRGBArea::updateBackBuffer (int r, int g, int b, Glib::ustring profile, Glib::ustring profileW) { - - if (!is_realized ()) { - return; - } - - if (frozen) { + if (!get_realized () || frozen || !showMode) { return; } @@ -404,83 +481,76 @@ void HistogramRGBArea::renderRGBMarks (int r, int g, int b, Glib::ustring profil GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected Glib::RefPtr window = get_window(); - int winx, winy, winw, winh, wind; - window->get_geometry(winx, winy, winw, winh, wind); + int winx, winy, winw, winh; + window->get_geometry(winx, winy, winw, winh); - overlay = Gdk::Pixmap::create (window, winw, winh, -1); - Glib::RefPtr ovrl = Gdk::GC::create(overlay); + // This will create or update the size of the BackBuffer::surface + setDrawRectangle(window, 0, 0, winw, winh, true); - Glib::RefPtr style = get_style (); + if (surface) { + Cairo::RefPtr cc = Cairo::Context::create(surface); + Glib::RefPtr style = get_style_context(); + Gdk::RGBA c; - if (!showMode) { - ovrl->set_foreground (style->get_bg (Gtk::STATE_NORMAL)); - overlay->draw_rectangle (ovrl, true, 0, 0, winw, winh); + cc->set_antialias(Cairo::ANTIALIAS_NONE); + cc->set_line_join(Cairo::LINE_JOIN_MITER); + cc->set_source_rgb (mgray.get_red(), mgray.get_green(), mgray.get_blue()); + cc->rectangle(0, 0, winw, winh); + cc->fill(); - if (rgbgc_ && overlay) { - window->draw_drawable (rgbgc_, overlay, 0, 0, 0, 0, -1, -1); - } + cc->set_line_width (1.0); - return; - } else { - ovrl->set_foreground (mgray); - overlay->draw_rectangle (ovrl, true, 0, 0, winw, winh); - - if (rgbgc_ && overlay) { - window->draw_drawable (rgbgc_, overlay, 0, 0, 0, 0, -1, -1); - } - } - - Cairo::RefPtr cr = overlay->create_cairo_context(); - cr->set_line_width (1.0); - - if ( r != -1 && g != -1 && b != -1 ) { - if (needRed) { - // Red - cr->set_source_rgb(1.0, 0.0, 0.0); - cr->move_to((int)(r * (winw / 256.0)), 0); - cr->line_to((int)(r * (winw / 256.0)), winh - 0); - cr->stroke(); - } - - if (needGreen) { - // Green - cr->set_source_rgb(0.0, 1.0, 0.0); - cr->move_to((int)(g * (winw / 256.0)), 0); - cr->line_to((int)(g * (winw / 256.0)), winh - 0); - cr->stroke(); - } - - if (needBlue) { - // Blue - cr->set_source_rgb(0.0, 0.0, 1.0); - cr->move_to((int)(b * (winw / 256.0)), 0); - cr->line_to((int)(b * (winw / 256.0)), winh - 0); - cr->stroke(); - } - - if(needLuma || needChroma) { - float Lab_L, Lab_a, Lab_b; - rgb2lab( profile, profileW, r, g, b, Lab_L, Lab_a, Lab_b); - - if (needLuma) { - // Luma - cr->set_source_rgb(1.0, 1.0, 1.0); - cr->move_to((int)((Lab_L) * (winw / 100.0)), 0); - cr->line_to((int)((Lab_L) * (winw / 100.0)), winh - 0); - cr->stroke(); + if ( r != -1 && g != -1 && b != -1 ) { + if (needRed) { + // Red + cc->set_source_rgb(1.0, 0.0, 0.0); + cc->move_to((int)(r * (winw / 256.0)), 0); + cc->line_to((int)(r * (winw / 256.0)), winh - 0); + cc->stroke(); } - if (needChroma) { - // Chroma - float chromaval = sqrt(Lab_a * Lab_a + Lab_b * Lab_b) / 1.8; - // float chromaval = sqrt(Lab_a*Lab_a + Lab_b*Lab_b); - cr->set_source_rgb(0.0, 0.0, 0.0); - cr->move_to((int)(chromaval * (winw / 100.0)), 0); - cr->line_to((int)(chromaval * (winw / 100.0)), winh - 0); - cr->stroke(); + if (needGreen) { + // Green + cc->set_source_rgb(0.0, 1.0, 0.0); + cc->move_to((int)(g * (winw / 256.0)), 0); + cc->line_to((int)(g * (winw / 256.0)), winh - 0); + cc->stroke(); + } + + if (needBlue) { + // Blue + cc->set_source_rgb(0.0, 0.0, 1.0); + cc->move_to((int)(b * (winw / 256.0)), 0); + cc->line_to((int)(b * (winw / 256.0)), winh - 0); + cc->stroke(); + } + + if(needLuma || needChroma) { + float Lab_L, Lab_a, Lab_b; + rgb2lab( profile, profileW, r, g, b, Lab_L, Lab_a, Lab_b); + + if (needLuma) { + // Luma + cc->set_source_rgb(1.0, 1.0, 1.0); + cc->move_to((int)((Lab_L) * (winw / 100.0)), 0); + cc->line_to((int)((Lab_L) * (winw / 100.0)), winh - 0); + cc->stroke(); + } + + if (needChroma) { + // Chroma + float chromaval = sqrt(Lab_a * Lab_a + Lab_b * Lab_b) / 1.8; + // float chromaval = sqrt(Lab_a*Lab_a + Lab_b*Lab_b); + cc->set_source_rgb(0.0, 0.0, 0.0); + cc->move_to((int)(chromaval * (winw / 100.0)), 0); + cc->line_to((int)(chromaval * (winw / 100.0)), winh - 0); + cc->stroke(); + } } } } + + setDirty(false); } void HistogramRGBArea::rgb2lab (Glib::ustring profile, Glib::ustring profileW, int r, int g, int b, float &LAB_l, float &LAB_a, float &LAB_b) @@ -646,7 +716,7 @@ int histrgbupdate (void* data) return 0; } - harih->harea->renderRGBMarks(-1, -1, -1); + harih->harea->updateBackBuffer(-1, -1, -1); harih->harea->queue_draw (); harih->pending--; @@ -686,7 +756,7 @@ void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, if (bar && !barDisplayed) { // Toggled on, add (show) the widget - parent->pack_start(*this, Gtk::PACK_SHRINK, 0); + parent->add(*this); options.histogramBar = true; barDisplayed = true; } else if (!bar && barDisplayed) { @@ -709,36 +779,27 @@ void HistogramRGBArea::on_realize () Gtk::DrawingArea::on_realize(); Glib::RefPtr window = get_window(); - rgbgc_ = Gdk::GC::create(window); - add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK); - - Glib::RefPtr rgbcolormap = get_default_colormap(); - black = Gdk::Color ("black"); - red = Gdk::Color ("red"); - green = Gdk::Color ("green"); - blue = Gdk::Color ("blue"); - lgray = Gdk::Color ("gray75"); - mgray = Gdk::Color ("gray50"); - dgray = Gdk::Color ("gray25"); - rgbcolormap->alloc_color(black); - rgbcolormap->alloc_color(white); - rgbcolormap->alloc_color(red); - rgbcolormap->alloc_color(green); - rgbcolormap->alloc_color(blue); - rgbcolormap->alloc_color(lgray); - rgbcolormap->alloc_color(mgray); - rgbcolormap->alloc_color(dgray); + add_events(Gdk::BUTTON_PRESS_MASK); + black = Gdk::RGBA ("black"); + red = Gdk::RGBA ("red"); + green = Gdk::RGBA ("green"); + blue = Gdk::RGBA ("blue"); + lgray = Gdk::RGBA ("gray75"); + mgray = Gdk::RGBA ("gray50"); + dgray = Gdk::RGBA ("gray25"); } -bool HistogramRGBArea::on_expose_event(GdkEventExpose* event) +bool HistogramRGBArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { - Glib::RefPtr window = get_window(); + // on_realize & updateBackBuffer have to be called before + if (surface) { + if (isDirty()) { // not sure this could happen... + updateBackBuffer(-1, -1, -1); + } - // on_realize & RenderRGBMarks have to be called before - if (rgbgc_ && overlay) { - window->draw_drawable (rgbgc_, overlay, 0, 0, 0, 0, -1, -1); + copySurface(cr, NULL); } return true; @@ -754,10 +815,10 @@ bool HistogramRGBArea::on_button_press_event (GdkEventButton* event) return true; } -void HistogramRGBArea::on_style_changed (const Glib::RefPtr& style) +void HistogramRGBArea::on_style_updated () { - white = get_style()->get_base(Gtk::STATE_NORMAL); + white = get_style_context()->get_color(Gtk::STATE_FLAG_NORMAL); queue_draw (); } @@ -775,6 +836,8 @@ HistogramArea::HistogramArea (FullModeListener *fml) : //needChroma unactive by bhist(256); chist(256); + //set_size_request(100, -1); + haih = new HistogramAreaIdleHelper; haih->harea = this; haih->destroyed = false; @@ -792,6 +855,44 @@ HistogramArea::~HistogramArea () } +Gtk::SizeRequestMode HistogramArea::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; +} + +void HistogramArea::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + int minimumWidth = 0; + int naturalWidth = 0; + get_preferred_width_vfunc (minimumWidth, naturalWidth); + get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height); +} + +void HistogramArea::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 60; + natural_width = 200; +} + +void HistogramArea::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + int gHeight = width / 2; + + if (gHeight > 150) { + gHeight = 150; + } else if (gHeight < 100) { + gHeight = 100; + } + + minimum_height = gHeight * 0.7; + natural_height = gHeight; +} + +void HistogramArea::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool full, bool c) { @@ -803,7 +904,7 @@ void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, boo fullMode = !full; needChroma = c; - renderHistogram (); + updateBackBuffer (); } int histupdateUI (void* data) @@ -821,7 +922,7 @@ int histupdateUI (void* data) return 0; } - haih->harea->renderHistogram (); + haih->harea->updateBackBuffer (); haih->harea->queue_draw (); haih->pending--; @@ -852,23 +953,26 @@ void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu g_idle_add (histupdateUI, haih); } -void HistogramArea::renderHistogram () +void HistogramArea::updateBackBuffer () { - if (!is_realized ()) { + if (!get_realized ()) { return; } Glib::RefPtr window = get_window(); - int winx, winy, winw, winh, wind; - window->get_geometry(winx, winy, winw, winh, wind); + int winx, winy, winw, winh; + window->get_geometry(winx, winy, winw, winh); - backBuffer = Gdk::Pixmap::create (window, winw, winh, -1); + // This will create or update the size of the BackBuffer::surface + setDrawRectangle(window, 0, 0, winw, winh, true); - Glib::RefPtr bgc = Gdk::GC::create(backBuffer); + Cairo::RefPtr cr = Cairo::Context::create(surface); - bgc->set_foreground (white); - backBuffer->draw_rectangle (bgc, true, 0, 0, winw, winh); + cr->set_antialias(Cairo::ANTIALIAS_NONE); + cr->set_source_rgb (white.get_red(), white.get_green(), white.get_blue()); + cr->rectangle(0, 0, w, h); + cr->fill(); if (valid) { // For RAW mode use the other hists @@ -968,73 +1072,92 @@ void HistogramArea::renderHistogram () realhistheight = winh - 2; } - Cairo::RefPtr cr = backBuffer->create_cairo_context(); cr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL); cr->set_line_width (1.0); int ui = 0, oi = 0; if (needLuma && !rawMode) { - drawCurve(cr, lhist, realhistheight, winw, winh); + drawCurve(cr, lhist, realhistheight, w, h); cr->set_source_rgb (0.75, 0.75, 0.75); cr->fill_preserve (); cr->set_source_rgb (0.5, 0.5, 0.5); cr->stroke (); - drawMarks(cr, lhist, realhistheight, winw, ui, oi); + drawMarks(cr, lhist, realhistheight, w, ui, oi); } if (needChroma && !rawMode) { - drawCurve(cr, chist, realhistheight, winw, winh); + drawCurve(cr, chist, realhistheight, w, h); cr->set_source_rgb (0.6, 0.6, 0.6); // cr->fill_preserve (); // cr->set_source_rgb (0.2, 0.2, 0.1); cr->stroke (); - drawMarks(cr, chist, realhistheight, winw, ui, oi); + drawMarks(cr, chist, realhistheight, w, ui, oi); } if (needRed) { - drawCurve(cr, rhchanged, realhistheight, winw, winh); + drawCurve(cr, rhchanged, realhistheight, w, h); cr->set_source_rgb (1.0, 0.0, 0.0); cr->stroke (); - drawMarks(cr, rhchanged, realhistheight, winw, ui, oi); + drawMarks(cr, rhchanged, realhistheight, w, ui, oi); } if (needGreen) { - drawCurve(cr, ghchanged, realhistheight, winw, winh); + drawCurve(cr, ghchanged, realhistheight, w, h); cr->set_source_rgb (0.0, 1.0, 0.0); cr->stroke (); - drawMarks(cr, ghchanged, realhistheight, winw, ui, oi); + drawMarks(cr, ghchanged, realhistheight, w, ui, oi); } if (needBlue) { - drawCurve(cr, bhchanged, realhistheight, winw, winh); + drawCurve(cr, bhchanged, realhistheight, w, h); cr->set_source_rgb (0.0, 0.0, 1.0); cr->stroke (); - drawMarks(cr, bhchanged, realhistheight, winw, ui, oi); + drawMarks(cr, bhchanged, realhistheight, w, ui, oi); } } - bgc->set_foreground (mgray); - backBuffer->draw_rectangle (bgc, false, 0, 0, winw - 1, winh - 1); + cr->set_antialias(Cairo::ANTIALIAS_NONE); + cr->set_line_join(Cairo::LINE_JOIN_BEVEL); + cr->set_source_rgb (mgray.get_red(), mgray.get_green(), mgray.get_blue()); + cr->rectangle(0.5, 0.5, w - 1, h - 1); + cr->stroke(); - bgc->set_line_attributes (1, Gdk::LINE_ON_OFF_DASH, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + cr->set_line_join(Cairo::LINE_JOIN_MITER); + std::valarray ch_ds (1); + ch_ds[0] = 4; + cr->set_dash (ch_ds, 0); - backBuffer->draw_line (bgc, winw / 4, 0, winw / 4, winh); - backBuffer->draw_line (bgc, 2 * winw / 4, 0, 2 * winw / 4, winh); - backBuffer->draw_line (bgc, 3 * winw / 4, 0, 3 * winw / 4, winh); - backBuffer->draw_line (bgc, 0, winh / 4, winw, winh / 4); - backBuffer->draw_line (bgc, 0, 2 * winh / 4, winw, 2 * winh / 4); - backBuffer->draw_line (bgc, 0, 3 * winh / 4, winw, 3 * winh / 4); + cr->move_to(w / 4 + 0.5, 1.5); + cr->line_to(w / 4 + 0.5, h - 2); + cr->stroke(); + cr->move_to(2 * w / 4 + 0.5, 1.5); + cr->line_to(2 * w / 4 + 0.5, h - 2); + cr->stroke(); + cr->move_to(3 * w / 4 + 0.5, 1.5); + cr->line_to(3 * w / 4 + 0.5, h - 2); + cr->stroke(); + cr->move_to(1.5, w / 4 + 0.5); + cr->line_to(w - 2, w / 4 + 0.5); + cr->stroke(); + cr->move_to(1.5, 2 * w / 4 + 0.5); + cr->line_to(w - 2, 2 * w / 4 + 0.5); + cr->stroke(); + cr->move_to(1.5, 3 * w / 4 + 0.5); + cr->line_to(w - 2, 3 * w / 4 + 0.5); + cr->stroke(); - bgc->set_line_attributes (1, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + cr->unset_dash(); - oldwidth = winw; - oldheight = winh; + oldwidth = w; + oldheight = h; + + setDirty(false); } void HistogramArea::on_realize () @@ -1042,26 +1165,15 @@ void HistogramArea::on_realize () Gtk::DrawingArea::on_realize(); Glib::RefPtr window = get_window(); - gc_ = Gdk::GC::create(window); - add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK); - Glib::RefPtr colormap = get_default_colormap(); - - black = Gdk::Color ("black"); - red = Gdk::Color ("red"); - green = Gdk::Color ("green"); - blue = Gdk::Color ("blue"); - lgray = Gdk::Color ("gray75"); - mgray = Gdk::Color ("gray50"); - dgray = Gdk::Color ("gray25"); - colormap->alloc_color(black); - colormap->alloc_color(white); - colormap->alloc_color(red); - colormap->alloc_color(green); - colormap->alloc_color(blue); - colormap->alloc_color(lgray); - colormap->alloc_color(mgray); - colormap->alloc_color(dgray); + add_events(Gdk::BUTTON_PRESS_MASK); + black = Gdk::RGBA ("black"); + red = Gdk::RGBA ("red"); + green = Gdk::RGBA ("green"); + blue = Gdk::RGBA ("blue"); + lgray = Gdk::RGBA ("gray75"); + mgray = Gdk::RGBA ("gray50"); + dgray = Gdk::RGBA ("gray25"); } void HistogramArea::drawCurve(Cairo::RefPtr &cr, @@ -1076,7 +1188,9 @@ void HistogramArea::drawCurve(Cairo::RefPtr &cr, val = vsize - 1; } - cr->line_to ((i / 255.0) * (hsize - 1), vsize - 1 - val); + double posX = (i / 255.0) * (hsize - 1); + double posY = vsize - 1 - val; + cr->line_to (posX, posY); } cr->line_to (hsize - 1, vsize - 1); @@ -1098,26 +1212,26 @@ void HistogramArea::drawMarks(Cairo::RefPtr &cr, cr->fill(); } -void HistogramArea::on_style_changed (const Glib::RefPtr& style) +void HistogramArea::on_style_updated () { - white = get_style()->get_base(Gtk::STATE_NORMAL); + white = get_style_context()->get_color(Gtk::STATE_FLAG_NORMAL); queue_draw (); } -bool HistogramArea::on_expose_event(GdkEventExpose* event) +bool HistogramArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { Glib::RefPtr window = get_window(); - int winx, winy, winw, winh, wind; - window->get_geometry(winx, winy, winw, winh, wind); + int winx, winy, winw, winh; + window->get_geometry(winx, winy, winw, winh); if (winw != oldwidth && winh != oldheight) { - renderHistogram (); + updateBackBuffer (); } - window->draw_drawable (gc_, backBuffer, 0, 0, 0, 0, -1, -1); + copySurface(cr, NULL); return true; } @@ -1133,7 +1247,7 @@ bool HistogramArea::on_button_press_event (GdkEventButton* event) myFullModeListener->toggle_button_full (); } - renderHistogram (); + updateBackBuffer (); queue_draw (); } diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 16a0747e3..5d3fe9c0f 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -22,8 +22,10 @@ #include #include +#include #include "../rtengine/LUT.h" #include "../rtengine/improccoordinator.h" +#include "guiutils.h" #include "pointermotionlistener.h" @@ -41,24 +43,21 @@ struct HistogramRGBAreaIdleHelper { int pending; }; -class HistogramRGBArea : public Gtk::DrawingArea +class HistogramRGBArea : public Gtk::DrawingArea, public BackBuffer { typedef const double (*TMatrix)[3]; protected: - Glib::RefPtr rgbgc_; - Glib::RefPtr overlay; - - Gdk::Color black; - Gdk::Color white; - Gdk::Color red; - Gdk::Color green; - Gdk::Color blue; - Gdk::Color lgray; - Gdk::Color mgray; - Gdk::Color dgray; + Gdk::RGBA black; + Gdk::RGBA white; + Gdk::RGBA red; + Gdk::RGBA green; + Gdk::RGBA blue; + Gdk::RGBA lgray; + Gdk::RGBA mgray; + Gdk::RGBA dgray; int val; int r; @@ -77,7 +76,7 @@ protected: bool barDisplayed; bool needChroma; - Gtk::VBox* parent; + Gtk::Grid* parent; HistogramRGBAreaIdleHelper* harih; @@ -86,11 +85,11 @@ public: HistogramRGBArea(); ~HistogramRGBArea(); - void renderRGBMarks (int r, int g, int b, Glib::ustring profile = "", Glib::ustring profileW = ""); + void updateBackBuffer (int r, int g, int b, Glib::ustring profile = "", Glib::ustring profileW = ""); void updateFreeze (bool f); bool getFreeze (); bool getShow (); - void setParent (Gtk::VBox* p) + void setParent (Gtk::Grid* p) { parent = p; }; @@ -99,11 +98,16 @@ public: void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool show, bool c); void on_realize(); - bool on_expose_event(GdkEventExpose* event); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); private: void rgb2lab (Glib::ustring profile, Glib::ustring profileW, int r, int g, int b, float &LAB_l, float &LAB_a, float &LAB_b); + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const; + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; // Some ... }; @@ -111,25 +115,23 @@ private: class FullModeListener { public: + virtual ~FullModeListener() {} virtual void toggle_button_full () {} }; -class HistogramArea : public Gtk::DrawingArea +class HistogramArea : public Gtk::DrawingArea, public BackBuffer { protected: - Glib::RefPtr gc_; - Glib::RefPtr backBuffer; - - Gdk::Color black; - Gdk::Color white; - Gdk::Color red; - Gdk::Color green; - Gdk::Color blue; - Gdk::Color lgray; - Gdk::Color mgray; - Gdk::Color dgray; + Gdk::RGBA black; + Gdk::RGBA white; + Gdk::RGBA red; + Gdk::RGBA green; + Gdk::RGBA blue; + Gdk::RGBA lgray; + Gdk::RGBA mgray; + Gdk::RGBA dgray; LUTu lhist, rhist, ghist, bhist, chist; LUTu lhistRaw, rhistRaw, ghistRaw, bhistRaw; @@ -147,27 +149,31 @@ public: HistogramArea(FullModeListener *fml = NULL); ~HistogramArea(); - void renderHistogram (); + void updateBackBuffer (); void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma); void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool full , bool c); void on_realize(); - bool on_expose_event(GdkEventExpose* event); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); + private: - void drawCurve(Cairo::RefPtr &cr, - LUTu & data, double scale, int hsize, int vsize); - void drawMarks(Cairo::RefPtr &cr, - LUTu & data, double scale, int hsize, int & ui, int & oi); + void drawCurve(Cairo::RefPtr &cr, LUTu & data, double scale, int hsize, int vsize); + void drawMarks(Cairo::RefPtr &cr, LUTu & data, double scale, int hsize, int & ui, int & oi); + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const; + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; }; -class HistogramPanel : public Gtk::HBox, public PointerMotionListener, public FullModeListener +class HistogramPanel : public Gtk::Grid, public PointerMotionListener, public FullModeListener { protected: - Gtk::VBox* gfxVBox; - Gtk::VBox* buttonVBox; + Gtk::Grid* gfxGrid; + Gtk::Grid* buttonGrid; HistogramArea* histogramArea; HistogramRGBArea* histogramRGBArea; Gtk::ToggleButton* showRed; @@ -217,7 +223,7 @@ public: // TODO should be protected void setHistRGBInvalid (); - void reorder (Gtk::AlignmentEnum align); + void reorder (Gtk::PositionType position); void red_toggled (); void green_toggled (); void blue_toggled (); diff --git a/rtgui/history.cc b/rtgui/history.cc index 57f7549db..4aa6dc774 100644 --- a/rtgui/history.cc +++ b/rtgui/history.cc @@ -19,12 +19,12 @@ #include "history.h" #include "multilangmgr.h" #include "rtimage.h" +#include "guiutils.h" using namespace rtengine; using namespace rtengine::procparams; Glib::ustring eventDescrArray[NUMOFEVENTS]; -extern Glib::ustring argv0; History::History (bool bookmarkSupport) : blistener(NULL), tpc (NULL), bmnum (1) { @@ -77,13 +77,19 @@ History::History (bool bookmarkSupport) : blistener(NULL), tpc (NULL), bmnum (1) pack_end (*hsepb, Gtk::PACK_SHRINK, 0); Gtk::HBox* ahbox = Gtk::manage (new Gtk::HBox ()); - addBookmark = Gtk::manage (new Gtk::Button (M("HISTORY_NEWSNAPSHOT"))); + addBookmark = Gtk::manage (new Gtk::Button ()); // M("HISTORY_NEWSNAPSHOT") + setExpandAlignProperties(addBookmark, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + //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 ("gtk-add.png")); addBookmark->set_image (*addimg); ahbox->pack_start (*addBookmark); - delBookmark = Gtk::manage (new Gtk::Button (M("HISTORY_DELSNAPSHOT"))); + delBookmark = Gtk::manage (new Gtk::Button ()); // M("HISTORY_DELSNAPSHOT") + 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 ("list-remove.png")); delBookmark->set_image (*delimg); ahbox->pack_start (*delBookmark); @@ -278,7 +284,7 @@ void History::procParamsChanged (ProcParams* params, ProcEvent ev, Glib::ustring if (!selection->get_selected_rows().empty()) { - Gtk::TreeView::Selection::ListHandle_Path selp = selection->get_selected_rows(); + std::vector selp = selection->get_selected_rows(); hTreeView->scroll_to_row (*selp.begin()); } @@ -345,7 +351,7 @@ void History::undo () int size = historyModel->children().size (); if (size > 1) { - selection->select (historyModel->children()[size - 2]); + selection->select (historyModel->children().operator [](size - 2)); } } } @@ -366,7 +372,7 @@ void History::redo () int size = historyModel->children().size (); if (size > 1) { - selection->select (historyModel->children()[size - 2]); + selection->select (historyModel->children().operator [](size - 2)); } } } diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 6e4668ab4..0e204dcee 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -91,9 +91,9 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch dcpIllLabel->show (); dcpIll = Gtk::manage (new MyComboBoxText ()); dcpIll->set_tooltip_text (M("TP_ICM_DCPILLUMINANT_TOOLTIP")); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT") + " 1"); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT") + " 2"); + dcpIll->append (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); + dcpIll->append (M("TP_ICM_DCPILLUMINANT") + " 1"); + dcpIll->append (M("TP_ICM_DCPILLUMINANT") + " 2"); dcpIll->show (); dcpTemperatures[0] = 0; dcpTemperatures[1] = 0; @@ -134,7 +134,7 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch // blend cms matrix no longer used //iVBox->pack_start (*ckbBlendCMSMatrix, Gtk::PACK_SHRINK, 2); - saveRef = Gtk::manage (new Gtk::Button (M("TP_ICM_SAVEREFERENCE"))); + saveRef = Gtk::manage (new Gtk::Button ()); // M("TP_ICM_SAVEREFERENCE") saveRef->set_image (*Gtk::manage (new RTImage ("gtk-save-large.png"))); saveRef->set_tooltip_markup (M("TP_ICM_SAVEREFERENCE_TOOLTIP")); iVBox->pack_start (*saveRef, Gtk::PACK_SHRINK, 2); @@ -159,7 +159,7 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch std::vector wpnames = rtengine::getWorkingProfiles (); for (size_t i = 0; i < wpnames.size(); i++) { - wnames->append_text (wpnames[i]); + wnames->append (wpnames[i]); } wnames->set_active (0); @@ -182,13 +182,13 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch onames = Gtk::manage (new MyComboBoxText ()); oVBox->pack_start (*onames, Gtk::PACK_SHRINK); - onames->append_text (M("TP_ICM_NOICM")); + onames->append (M("TP_ICM_NOICM")); onames->set_active (0); std::vector opnames = iccStore->getOutputProfiles (); for (size_t i = 0; i < opnames.size(); i++) { - onames->append_text (opnames[i]); + onames->append (opnames[i]); } onames->set_active (0); @@ -208,7 +208,7 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch std::vector wpgamma = rtengine::getGamma (); for (size_t i = 0; i < wpgamma.size(); i++) { - wgamma->append_text (wpgamma[i]); + wgamma->append (wpgamma[i]); } wgamma->set_active (0); @@ -252,27 +252,27 @@ ICMPanel::ICMPanel () : FoldableToolPanel(this, "icm", M("TP_ICM_LABEL")), iunch // ---------------------------- Output gamma list entries - Gtk::FileFilter filter_icc; - filter_icc.set_name(M("FILECHOOSER_FILTER_COLPROF")); - filter_icc.add_pattern("*.dcp"); - filter_icc.add_pattern("*.DCP"); - filter_icc.add_pattern("*.icc"); - filter_icc.add_pattern("*.icm"); - filter_icc.add_pattern("*.ICC"); - filter_icc.add_pattern("*.ICM"); - Gtk::FileFilter filter_iccdng; - filter_iccdng.set_name(M("FILECHOOSER_FILTER_COLPROF") + " + DNG"); - filter_iccdng.add_pattern("*.dcp"); - filter_iccdng.add_pattern("*.DCP"); - filter_iccdng.add_pattern("*.dng"); - filter_iccdng.add_pattern("*.DNG"); - filter_iccdng.add_pattern("*.icc"); - filter_iccdng.add_pattern("*.icm"); - filter_iccdng.add_pattern("*.ICC"); - filter_iccdng.add_pattern("*.ICM"); - Gtk::FileFilter filter_any; - filter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - filter_any.add_pattern("*"); + Glib::RefPtr filter_icc = Gtk::FileFilter::create(); + filter_icc->set_name(M("FILECHOOSER_FILTER_COLPROF")); + filter_icc->add_pattern("*.dcp"); + filter_icc->add_pattern("*.DCP"); + filter_icc->add_pattern("*.icc"); + filter_icc->add_pattern("*.icm"); + filter_icc->add_pattern("*.ICC"); + filter_icc->add_pattern("*.ICM"); + Glib::RefPtr filter_iccdng = Gtk::FileFilter::create(); + filter_iccdng->set_name(M("FILECHOOSER_FILTER_COLPROF") + " + DNG"); + filter_iccdng->add_pattern("*.dcp"); + filter_iccdng->add_pattern("*.DCP"); + filter_iccdng->add_pattern("*.dng"); + filter_iccdng->add_pattern("*.DNG"); + filter_iccdng->add_pattern("*.icc"); + filter_iccdng->add_pattern("*.icm"); + filter_iccdng->add_pattern("*.ICC"); + filter_iccdng->add_pattern("*.ICM"); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); + filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + filter_any->add_pattern("*"); ipDialog->add_filter (filter_icc); ipDialog->add_filter (filter_iccdng); @@ -318,11 +318,11 @@ void ICMPanel::updateDCP (int dcpIlluminant, Glib::ustring dcp_name) if (dcpTemperatures[0] != 0 || dcpTemperatures[1] != 0) { int curr_active = dcpIll->get_active_row_number(); ignoreDcpSignal = true; - dcpIll->clear_items (); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT") + " 1"); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT") + " 2"); - dcpIll->append_text (M("GENERAL_UNCHANGED")); + dcpIll->remove_all (); + dcpIll->append (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); + dcpIll->append (M("TP_ICM_DCPILLUMINANT") + " 1"); + dcpIll->append (M("TP_ICM_DCPILLUMINANT") + " 2"); + dcpIll->append (M("GENERAL_UNCHANGED")); dcpTemperatures[0] = 0; dcpTemperatures[1] = 0; dcpIll->set_active (curr_active); @@ -382,10 +382,10 @@ void ICMPanel::updateDCP (int dcpIlluminant, Glib::ustring dcp_name) sprintf(tempstr2, "%.0fK", temp2); int curr_active = dcpIll->get_active_row_number(); ignoreDcpSignal = true; - dcpIll->clear_items (); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); - dcpIll->append_text (tempstr1); - dcpIll->append_text (tempstr2); + dcpIll->remove_all (); + dcpIll->append (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); + dcpIll->append (tempstr1); + dcpIll->append (tempstr2); dcpTemperatures[0] = temp1; dcpTemperatures[1] = temp2; dcpIll->set_active (curr_active); @@ -422,13 +422,13 @@ void ICMPanel::updateDCP (int dcpIlluminant, Glib::ustring dcp_name) if (dcpTemperatures[0] != 0 || dcpTemperatures[1] != 0) { int curr_active = dcpIll->get_active_row_number(); ignoreDcpSignal = true; - dcpIll->clear_items (); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT") + " 1"); - dcpIll->append_text (M("TP_ICM_DCPILLUMINANT") + " 2"); + dcpIll->remove_all (); + dcpIll->append (M("TP_ICM_DCPILLUMINANT_INTERPOLATED")); + dcpIll->append (M("TP_ICM_DCPILLUMINANT") + " 1"); + dcpIll->append (M("TP_ICM_DCPILLUMINANT") + " 2"); if (isBatchMode) { - dcpIll->append_text (M("GENERAL_UNCHANGED")); + dcpIll->append (M("GENERAL_UNCHANGED")); } dcpTemperatures[0] = 0; @@ -460,26 +460,26 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited) inone->set_active (true); ckbBlendCMSMatrix->set_sensitive (false); updateDCP(pp->icm.dcpIlluminant, ""); - } else if (pp->icm.input == "(embedded)" || ((pp->icm.input == "(camera)" || pp->icm.input == "") && icamera->get_state() == Gtk::STATE_INSENSITIVE)) { + } else if (pp->icm.input == "(embedded)" || ((pp->icm.input == "(camera)" || pp->icm.input == "") && icamera->get_state() == Gtk::STATE_FLAG_INSENSITIVE)) { iembedded->set_active (true); ckbBlendCMSMatrix->set_sensitive (false); updateDCP(pp->icm.dcpIlluminant, ""); - } else if ((pp->icm.input == "(cameraICC)") && icameraICC->get_state() != Gtk::STATE_INSENSITIVE) { + } else if ((pp->icm.input == "(cameraICC)") && icameraICC->get_state() != Gtk::STATE_FLAG_INSENSITIVE) { icameraICC->set_active (true); ckbBlendCMSMatrix->set_sensitive (true); updateDCP(pp->icm.dcpIlluminant, ""); - } else if ((pp->icm.input == "(cameraICC)") && icamera->get_state() != Gtk::STATE_INSENSITIVE && icameraICC->get_state() == Gtk::STATE_INSENSITIVE) { + } else if ((pp->icm.input == "(cameraICC)") && icamera->get_state() != Gtk::STATE_FLAG_INSENSITIVE && icameraICC->get_state() == Gtk::STATE_FLAG_INSENSITIVE) { // this is the case when (cameraICC) is instructed by packaged profiles, but ICC file is not found // therefore falling back UI to explicitly reflect the (camera) option icamera->set_active (true); ckbBlendCMSMatrix->set_sensitive (false); updateDCP(pp->icm.dcpIlluminant, ""); - } else if ((pp->icm.input == "(cameraICC)") && icamera->get_state() == Gtk::STATE_INSENSITIVE && icameraICC->get_state() == Gtk::STATE_INSENSITIVE) { + } else if ((pp->icm.input == "(cameraICC)") && icamera->get_state() == Gtk::STATE_FLAG_INSENSITIVE && icameraICC->get_state() == Gtk::STATE_FLAG_INSENSITIVE) { // If neither (camera) nor (cameraICC) are available, as is the case when loading a non-raw, activate (embedded). iembedded->set_active (true); ckbBlendCMSMatrix->set_sensitive (false); updateDCP(pp->icm.dcpIlluminant, ""); - } else if ((pp->icm.input == "(camera)" || pp->icm.input == "") && icamera->get_state() != Gtk::STATE_INSENSITIVE) { + } else if ((pp->icm.input == "(camera)" || pp->icm.input == "") && icamera->get_state() != Gtk::STATE_FLAG_INSENSITIVE) { icamera->set_active (true); ckbBlendCMSMatrix->set_sensitive (false); updateDCP(pp->icm.dcpIlluminant, ""); @@ -907,26 +907,26 @@ void ICMPanel::saveReferencePressed () FileChooserLastFolderPersister persister(&dialog, options.lastProfilingReferenceDir); dialog.set_current_name (lastRefFilename); - dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::StockID("gtk-save"), Gtk::RESPONSE_OK); + dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + dialog.add_button(M("GENERAL_SAVE"), Gtk::RESPONSE_OK); Gtk::CheckButton applyWB(M("TP_ICM_SAVEREFERENCE_APPLYWB")); applyWB.set_tooltip_text (M("TP_ICM_SAVEREFERENCE_APPLYWB_TOOLTIP")); applyWB.set_active(true); Gtk::HBox* hbox = Gtk::manage( new Gtk::HBox() ); hbox->pack_end(applyWB, Gtk::PACK_SHRINK, 2); - Gtk::VBox *vbox = dialog.get_vbox(); - vbox->pack_end(*hbox, Gtk::PACK_SHRINK, 2); + Gtk::Box *box = dialog.get_content_area(); + box->pack_end(*hbox, Gtk::PACK_SHRINK, 2); - Gtk::FileFilter filter_tif; - filter_tif.set_name(M("FILECHOOSER_FILTER_TIFF")); - filter_tif.add_pattern("*.tif"); - filter_tif.add_pattern("*.tiff"); + Glib::RefPtr filter_tif = Gtk::FileFilter::create(); + filter_tif->set_name(M("FILECHOOSER_FILTER_TIFF")); + filter_tif->add_pattern("*.tif"); + filter_tif->add_pattern("*.tiff"); dialog.add_filter(filter_tif); - Gtk::FileFilter filter_any; - filter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - filter_any.add_pattern("*"); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); + filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + filter_any->add_pattern("*"); dialog.add_filter(filter_any); dialog.show_all_children(); @@ -969,10 +969,10 @@ void ICMPanel::setBatchMode (bool batchMode) iVBox->pack_start (*iunchanged, Gtk::PACK_SHRINK, 4); iVBox->reorder_child (*iunchanged, 5); removeIfThere (this, saveRef); - onames->append_text (M("GENERAL_UNCHANGED")); - wnames->append_text (M("GENERAL_UNCHANGED")); - wgamma->append_text (M("GENERAL_UNCHANGED")); - dcpIll->append_text (M("GENERAL_UNCHANGED")); + onames->append (M("GENERAL_UNCHANGED")); + wnames->append (M("GENERAL_UNCHANGED")); + wgamma->append (M("GENERAL_UNCHANGED")); + dcpIll->append (M("GENERAL_UNCHANGED")); gampos->showEditedCB (); slpos->showEditedCB (); } diff --git a/rtgui/ilabel.cc b/rtgui/ilabel.cc index 591564305..5a8fcd8fc 100644 --- a/rtgui/ilabel.cc +++ b/rtgui/ilabel.cc @@ -33,27 +33,29 @@ void ILabel::on_realize() set_size_request (2 + labw, 2 + labh); } -bool ILabel::on_expose_event (GdkEventExpose* event) +bool ILabel::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { - Glib::RefPtr style = get_style (); - Glib::RefPtr window = get_window(); - Glib::RefPtr gc_ = style->get_bg_gc(get_state()); - Cairo::RefPtr cr = window->create_cairo_context(); + Glib::RefPtr style = get_style_context (); - Gdk::Color c = style->get_fg (get_state()); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + Gtk::StateFlags state = get_state_flags(); + Gdk::RGBA c = style->get_background_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle (0, 0, get_width (), get_height()); cr->fill (); Glib::RefPtr fn = create_pango_layout (label); fn->set_markup (label); - window->draw_layout(gc_, 1, 1, fn); + cr->move_to(1., 1.); + fn->add_to_cairo_context(cr); + c = style->get_color (state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill(); return true; } -void ILabel::on_style_changed (const Glib::RefPtr& style) +void ILabel::on_style_updated () { Glib::RefPtr fn = create_pango_layout(label); diff --git a/rtgui/ilabel.h b/rtgui/ilabel.h index aef5eb2ed..5f5f9ea3e 100644 --- a/rtgui/ilabel.h +++ b/rtgui/ilabel.h @@ -28,9 +28,9 @@ class ILabel : public Gtk::DrawingArea public: ILabel (Glib::ustring lab); - bool on_expose_event(GdkEventExpose* event); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); void on_realize(); - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); }; #endif diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index b77e90f09..1e8522b46 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -131,7 +131,7 @@ void ImageArea::setPreviewHandler (PreviewHandler* ph) previewHandler = ph; } -void ImageArea::on_style_changed (const Glib::RefPtr& style) +void ImageArea::on_style_updated () { // TODO: notify all crop windows that the style has been changed @@ -188,16 +188,16 @@ void ImageArea::redraw () } } -bool ImageArea::on_expose_event(GdkEventExpose* event) +bool ImageArea::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { dirty = false; - if (event->count) { - return true; - } + /* HOMBRE: How do we replace that?? - Glib::RefPtr window = get_window(); - Cairo::RefPtr cr = get_window()->create_cairo_context(); + if (event->count) + return true; + + */ if (mainCropWindow) { //printf("MainCropWindow (%d x %d)\n", window->get_width(), window->get_height()); @@ -207,7 +207,9 @@ bool ImageArea::on_expose_event(GdkEventExpose* event) if (options.showInfo == true && infotext != "") { int fnw, fnh; ilayout->get_pixel_size (fnw, fnh); - window->draw_pixbuf (get_style()->get_base_gc (Gtk::STATE_NORMAL), ipixbuf, 0, 0, 4, 4, fnw + 8, fnh + 8, Gdk::RGB_DITHER_NONE, 0, 0); + Gdk::Cairo::set_source_pixbuf(cr, ipixbuf, 4, 4); + cr->rectangle(4, 4, fnw + 8, fnh + 8); + cr->fill(); cr->set_source_rgb (1.0, 1.0, 1.0); cr->move_to (8, 8); ilayout->add_to_cairo_context (cr); diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index bd2c19093..4b5bd435e 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -93,14 +93,14 @@ public: // widget base events void on_realize (); - bool on_expose_event (GdkEventExpose* event); + bool on_draw (const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_motion_notify_event (GdkEventMotion* event); bool on_button_press_event (GdkEventButton* event); bool on_button_release_event (GdkEventButton* event); bool on_scroll_event (GdkEventScroll* event); bool on_leave_notify_event (GdkEventCrossing* event); void on_resized (Gtk::Allocation& req); - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); void syncBeforeAfterViews (); void setCropGUIListener (CropGUIListener* l); diff --git a/rtgui/inspector.cc b/rtgui/inspector.cc index 53f32dbbc..e9f7e6597 100644 --- a/rtgui/inspector.cc +++ b/rtgui/inspector.cc @@ -82,14 +82,19 @@ int InspectorBuffer::infoFromImage (const Glib::ustring& fname) return deg; } -Inspector::Inspector () : currImage(NULL), zoom(0.0), active(false) {} +Inspector::Inspector () : currImage(NULL), zoom(0.0), active(false) +{ + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_BACKGROUND); + style->add_class(GTK_STYLE_CLASS_FLAT); +} Inspector::~Inspector() { deleteBuffers(); } -bool Inspector::on_expose_event (GdkEventExpose* event) +bool Inspector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { Glib::RefPtr win = get_window(); @@ -114,7 +119,8 @@ bool Inspector::on_expose_event (GdkEventExpose* event) Coord topLeft; Coord displayedSize; Coord dest(0, 0); - win->get_size(availableSize.x, availableSize.y); + availableSize.x = win->get_width(); + availableSize.y = win->get_height(); int imW = currImage->imgBuffer.getWidth(); int imH = currImage->imgBuffer.getHeight(); @@ -158,22 +164,25 @@ bool Inspector::on_expose_event (GdkEventExpose* event) // Draw! - Gdk::Color c; - Cairo::RefPtr cr = win->create_cairo_context(); - Glib::RefPtr style = get_style(); + Gdk::RGBA c; + Glib::RefPtr style = get_style_context(); // draw the background - c = style->get_bg (Gtk::STATE_NORMAL); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + style->render_background(cr, 0, 0, get_width(), get_height()); + + /* --- old method + c = style->get_background_color (Gtk::STATE_FLAG_NORMAL); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_line_width (0); cr->rectangle (0, 0, availableSize.x, availableSize.y); cr->fill (); + */ currImage->imgBuffer.copySurface(win); // draw the frame - c = style->get_fg (Gtk::STATE_NORMAL); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color (Gtk::STATE_FLAG_NORMAL); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_line_width (1); cr->rectangle (0.5, 0.5, availableSize.x - 1, availableSize.y - 1); cr->stroke (); diff --git a/rtgui/inspector.h b/rtgui/inspector.h index 192e86d40..6a84449ba 100644 --- a/rtgui/inspector.h +++ b/rtgui/inspector.h @@ -48,7 +48,7 @@ private: double zoom; bool active; - bool on_expose_event (GdkEventExpose* event); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); void deleteBuffers(); public: diff --git a/rtgui/iptcpanel.cc b/rtgui/iptcpanel.cc index 301f7fc27..45c350625 100644 --- a/rtgui/iptcpanel.cc +++ b/rtgui/iptcpanel.cc @@ -20,8 +20,6 @@ #include "clipboard.h" #include "rtimage.h" -extern Glib::ustring argv0; - using namespace rtengine; using namespace rtengine::procparams; @@ -87,7 +85,7 @@ IPTCPanel::IPTCPanel () Gtk::ScrolledWindow* scrolledWindowkw = Gtk::manage( new Gtk::ScrolledWindow() ); scrolledWindowkw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scrolledWindowkw->add(*keywords); - keyword = Gtk::manage( new Gtk::ComboBoxEntryText () ); + keyword = Gtk::manage( new Gtk::ComboBoxText (true) ); keyword->set_size_request (32, -1); keyl->set_tooltip_text (M("IPTCPANEL_KEYWORDSHINT")); keywords->set_tooltip_text (M("IPTCPANEL_KEYWORDSHINT")); @@ -113,7 +111,7 @@ IPTCPanel::IPTCPanel () row++; Gtk::Label* catl = Gtk::manage( new Gtk::Label (M("IPTCPANEL_CATEGORY") + ":") ); - category = Gtk::manage( new Gtk::ComboBoxEntryText () ); + category = Gtk::manage( new Gtk::ComboBoxText (true) ); category->set_size_request (32, -1); catl->set_tooltip_text (M("IPTCPANEL_CATEGORYHINT")); category->set_tooltip_text (M("IPTCPANEL_CATEGORYHINT")); @@ -124,7 +122,7 @@ IPTCPanel::IPTCPanel () Gtk::ScrolledWindow* scrolledWindowsc = Gtk::manage( new Gtk::ScrolledWindow() ); scrolledWindowsc->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scrolledWindowsc->add(*suppCategories); - suppCategory = Gtk::manage( new Gtk::ComboBoxEntryText () ); + suppCategory = Gtk::manage( new Gtk::ComboBoxText (true) ); suppCategory->set_size_request (32, -1); scl->set_tooltip_text (M("IPTCPANEL_SUPPCATEGORIESHINT")); suppCategories->set_tooltip_text (M("IPTCPANEL_SUPPCATEGORIESHINT")); @@ -265,31 +263,39 @@ IPTCPanel::IPTCPanel () pack_start (*scrolledWindow); - Gtk::HBox* bbox = Gtk::manage( new Gtk::HBox () ); + Gtk::Grid* bbox = Gtk::manage( new Gtk::Grid () ); + setExpandAlignProperties(bbox, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); - reset = Gtk::manage( new Gtk::Button (M("IPTCPANEL_RESET")) ); + reset = Gtk::manage( new Gtk::Button () ); // M("IPTCPANEL_RESET") + reset->get_style_context()->add_class("Left"); reset->set_image (*Gtk::manage(new RTImage ("gtk-undo-ltr.png", "gtk-undo-rtl.png"))); - bbox->pack_start (*reset); + 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 = Gtk::manage( new Gtk::Button () ); // M("IPTCPANEL_EMBEDDED") + file->get_style_context()->add_class("MiddleH"); file->set_image (*Gtk::manage(new RTImage ("gtk-open.png"))); - bbox->pack_start (*file); + 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 ("edit-copy.png"))); - bbox->pack_start (*copy, Gtk::PACK_SHRINK, 0); + 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 ("edit-paste.png"))); - bbox->pack_start (*paste, Gtk::PACK_SHRINK, 0); + setExpandAlignProperties(paste, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); + bbox->attach_next_to (*paste, Gtk::POS_RIGHT, 1, 1); pack_end (*bbox, Gtk::PACK_SHRINK, 2); - Gtk::Tooltips* toolTip = Gtk::manage( new Gtk::Tooltips () ); - toolTip->set_tip (*reset, M("IPTCPANEL_RESETHINT")); - toolTip->set_tip (*file, M("IPTCPANEL_EMBEDDEDHINT")); - toolTip->set_tip (*copy, M("IPTCPANEL_COPYHINT")); - toolTip->set_tip (*paste, M("IPTCPANEL_PASTEHINT")); + reset->set_tooltip_text(M("IPTCPANEL_RESETHINT")); + file->set_tooltip_text(M("IPTCPANEL_EMBEDDEDHINT")); + copy->set_tooltip_text(M("IPTCPANEL_COPYHINT")); + paste->set_tooltip_text(M("IPTCPANEL_PASTEHINT")); reset->signal_clicked().connect( sigc::mem_fun(*this, &IPTCPanel::resetClicked) ); file->signal_clicked().connect( sigc::mem_fun(*this, &IPTCPanel::fileClicked) ); @@ -398,8 +404,8 @@ void IPTCPanel::addKeyWord () return; } - keywords->append_text (keyword->get_entry()->get_text()); - keyword->prepend_text (keyword->get_entry()->get_text()); + keywords->append (keyword->get_entry()->get_text()); + keyword->prepend (keyword->get_entry()->get_text()); std::vector items; for (Gtk::TreeModel::iterator i = keyword->get_model()->children().begin(); i != keyword->get_model()->children().end(); i++) { @@ -408,10 +414,10 @@ void IPTCPanel::addKeyWord () items.push_back (s); } - keyword->clear_items (); + keyword->remove_all (); for (unsigned int i = 0; i < 10 && i < items.size(); i++) { - keyword->append_text (items[i]); + keyword->append (items[i]); } keywords->scroll_to_row (keywords->get_model()->get_path(--keywords->get_model()->children().end())); @@ -432,10 +438,10 @@ void IPTCPanel::delKeyWord () keep.push_back (keywords->get_text (i)); } - keywords->clear_items (); + keywords->remove_all_columns (); for (unsigned int i = 0; i < keep.size(); i++) { - keywords->append_text (keep[i]); + keywords->append (keep[i]); } } @@ -450,8 +456,8 @@ void IPTCPanel::addSuppCategory () return; } - suppCategories->append_text (suppCategory->get_entry()->get_text()); - suppCategory->prepend_text (suppCategory->get_entry()->get_text()); + suppCategories->append (suppCategory->get_entry()->get_text()); + suppCategory->prepend (suppCategory->get_entry()->get_text()); std::vector items; for (Gtk::TreeModel::iterator i = suppCategory->get_model()->children().begin(); i != suppCategory->get_model()->children().end(); i++) { @@ -460,10 +466,10 @@ void IPTCPanel::addSuppCategory () items.push_back (s); } - suppCategory->clear_items (); + suppCategory->remove_all (); for (unsigned int i = 0; i < 10 && i < items.size(); i++) { - suppCategory->append_text (items[i]); + suppCategory->append (items[i]); } suppCategories->scroll_to_row (suppCategories->get_model()->get_path(--suppCategories->get_model()->children().end())); @@ -485,10 +491,10 @@ void IPTCPanel::delSuppCategory () keep.push_back (suppCategories->get_text (i)); } - suppCategories->clear_items (); + suppCategories->remove_all_columns (); for (unsigned int i = 0; i < keep.size(); i++) { - suppCategories->append_text (keep[i]); + suppCategories->append (keep[i]); } } @@ -540,9 +546,9 @@ void IPTCPanel::applyChangeList () captionWriter->set_text (""); headline->set_text (""); instructions->set_text (""); - keywords->clear_items (); + keywords->remove_all_columns (); category->get_entry()->set_text (""); - suppCategories->clear_items (); + suppCategories->remove_all_columns (); author->set_text (""); authorPos->set_text (""); credit->set_text (""); @@ -568,13 +574,13 @@ void IPTCPanel::applyChangeList () instructions->set_text (i->second.at(0)); } else if (i->first == "Keywords") for (unsigned int j = 0; j < i->second.size(); j++) { - keywords->append_text (i->second.at(j)); + keywords->append (i->second.at(j)); } else if (i->first == "Category" && !i->second.empty()) { category->get_entry()->set_text (i->second.at(0)); } else if (i->first == "SupplementalCategories") for (unsigned int j = 0; j < i->second.size(); j++) { - suppCategories->append_text (i->second.at(j)); + suppCategories->append (i->second.at(j)); } else if (i->first == "Author" && !i->second.empty()) { author->set_text (i->second.at(0)); diff --git a/rtgui/iptcpanel.h b/rtgui/iptcpanel.h index ce870d08d..fa71e1a3d 100644 --- a/rtgui/iptcpanel.h +++ b/rtgui/iptcpanel.h @@ -36,12 +36,12 @@ private: Gtk::Entry* captionWriter; Gtk::Entry* headline; Gtk::Entry* instructions; - Gtk::ComboBoxEntryText* keyword; + Gtk::ComboBoxText* keyword; Gtk::ListViewText* keywords; Gtk::Button* addKW; Gtk::Button* delKW; - Gtk::ComboBoxEntryText* category; - Gtk::ComboBoxEntryText* suppCategory; + Gtk::ComboBoxText* category; + Gtk::ComboBoxText* suppCategory; Gtk::ListViewText* suppCategories; Gtk::Button* addSC; Gtk::Button* delSC; diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 69c4737bc..d4487aa80 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -29,7 +29,8 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, "lensgeom", M("TP_LENSGE fill = Gtk::manage (new Gtk::CheckButton (M("TP_LENSGEOM_FILL"))); pack_start (*fill); - autoCrop = Gtk::manage (new Gtk::Button (M("TP_LENSGEOM_AUTOCROP"))); + autoCrop = Gtk::manage (new Gtk::Button ()); + autoCrop->set_tooltip_text(M("TP_LENSGEOM_AUTOCROP")); autoCrop->set_image (*Gtk::manage (new RTImage ("crop-auto.png"))); pack_start (*autoCrop, Gtk::PACK_SHRINK, 2); diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index f85fb79c0..e062ad077 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -36,10 +36,10 @@ LensProfilePanel::LensProfilePanel () : FoldableToolPanel(this, "lensprof", M("T fcbLCPFile = Gtk::manage(new MyFileChooserButton(M("TP_LENSPROFILE_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN)); - Gtk::FileFilter filterLCP; - filterLCP.set_name(M("FILECHOOSER_FILTER_LCP")); - filterLCP.add_pattern("*.lcp"); - filterLCP.add_pattern("*.LCP"); + Glib::RefPtr filterLCP = Gtk::FileFilter::create(); + filterLCP->set_name(M("FILECHOOSER_FILTER_LCP")); + filterLCP->add_pattern("*.lcp"); + filterLCP->add_pattern("*.LCP"); fcbLCPFile->add_filter(filterLCP); Glib::ustring defDir = lcpStore->getDefaultCommonDirectory(); diff --git a/rtgui/lwbutton.cc b/rtgui/lwbutton.cc index 52b7fd7e8..267e2550b 100644 --- a/rtgui/lwbutton.cc +++ b/rtgui/lwbutton.cc @@ -71,15 +71,15 @@ Cairo::RefPtr LWButton::getIcon () return icon; } -void LWButton::setColors (const Gdk::Color& bg, const Gdk::Color& fg) +void LWButton::setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg) { - bgr = bg.get_red_p (); - bgg = bg.get_green_p (); - bgb = bg.get_blue_p (); - fgr = fg.get_red_p (); - fgg = fg.get_green_p (); - fgb = fg.get_blue_p (); + bgr = bg.get_red (); + bgg = bg.get_green (); + bgb = bg.get_blue (); + fgr = fg.get_red (); + fgg = fg.get_green (); + fgb = fg.get_blue (); } bool LWButton::inside (int x, int y) diff --git a/rtgui/lwbutton.h b/rtgui/lwbutton.h index 2241235a2..2053911be 100644 --- a/rtgui/lwbutton.h +++ b/rtgui/lwbutton.h @@ -60,7 +60,7 @@ public: bool inside (int x, int y); void setIcon (Cairo::RefPtr i); Cairo::RefPtr getIcon (); - void setColors (const Gdk::Color& bg, const Gdk::Color& fg); + void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg); void setToolTip (const Glib::ustring& tooltip); bool motionNotify (int x, int y); diff --git a/rtgui/lwbuttonset.cc b/rtgui/lwbuttonset.cc index bfa4684af..7b2a6bda0 100644 --- a/rtgui/lwbuttonset.cc +++ b/rtgui/lwbuttonset.cc @@ -187,7 +187,7 @@ void LWButtonSet::getAllocatedDimensions (int& w, int& h) h = ah; } -void LWButtonSet::setColors (const Gdk::Color& bg, const Gdk::Color& fg) +void LWButtonSet::setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg) { for (size_t i = 0; i < buttons.size(); i++) { diff --git a/rtgui/lwbuttonset.h b/rtgui/lwbuttonset.h index 3c17e488d..5452fa434 100644 --- a/rtgui/lwbuttonset.h +++ b/rtgui/lwbuttonset.h @@ -38,7 +38,7 @@ public: void getMinimalDimensions (int& w, int& h); void getAllocatedDimensions (int& w, int& h); void arrangeButtons (int x, int y, int w, int h); - void setColors (const Gdk::Color& bg, const Gdk::Color& fg); + void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg); bool motionNotify (int x, int y); bool pressNotify (int x, int y); bool releaseNotify (int x, int y); diff --git a/rtgui/main.cc b/rtgui/main.cc index cc7c3cbe5..6c2187f6f 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -64,7 +64,10 @@ Glib::ustring creditsPath; Glib::ustring licensePath; Glib::ustring argv1; bool simpleEditor; -Glib::Thread* mainThread; +Glib::RefPtr css; +Glib::RefPtr cssSlim; +Glib::RefPtr cssForced; +//Glib::Threads::Thread* mainThread; // This recursive mutex will be used by gdk_threads_enter/leave instead of a simple mutex @@ -100,18 +103,24 @@ static void myGdkLockLeave() * -3 if at least one required procparam file was not found */ int processLineParams( int argc, char **argv ); +/* + * + * M A I N + * + */ int main(int argc, char **argv) { setlocale(LC_ALL, ""); setlocale(LC_NUMERIC, "C"); // to set decimal point to "." - // Uncomment the following line if you want to use the "--g-fatal-warnings" command line flag - //gtk_init (&argc, &argv); + gtk_init (&argc, &argv); // use the "--g-fatal-warnings" command line flag to make warnings fatal - Glib::thread_init(); + Glib::init(); // called by Gtk::Main, but this may be important for thread handling, so we call it ourselves now gdk_threads_set_lock_functions(G_CALLBACK(myGdkLockEnter), (G_CALLBACK(myGdkLockLeave))); gdk_threads_init(); Gio::init (); + //mainThread = Glib::Threads::Thread::self(); + #ifdef BUILD_BUNDLE char exname[512] = {0}; Glib::ustring exePath; @@ -154,8 +163,6 @@ int main(int argc, char **argv) licensePath = LICENCE_SEARCH_PATH; #endif - mainThread = Glib::Thread::self(); - if (!Options::load ()) { Gtk::Main m(&argc, &argv); Gtk::MessageDialog msgd ("Fatal error!\nThe RT_SETTINGS and/or RT_PATH environment variables are set, but use a relative path. The path must be absolute!", true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); @@ -276,20 +283,6 @@ int main(int argc, char **argv) simpleEditor = true; } - if (!options.useSystemTheme) { - std::vector rcfiles; - rcfiles.push_back (argv0 + "/themes/" + options.theme + ".gtkrc"); - - if (options.slimUI) { - rcfiles.push_back (argv0 + "/themes/slim"); - } - - // Set the font face and size - Gtk::RC::parse_string (Glib::ustring::compose( - "style \"clearlooks-default\" { font_name = \"%1\" }", options.font)); - Gtk::RC::set_default_files (rcfiles); - } - Gtk::Main m(&argc, &argv); Glib::ustring icon_path = Glib::build_filename(argv0, "images"); @@ -299,19 +292,78 @@ int main(int argc, char **argv) RTImage::setPaths(options); MyExpander::init(); // has to stay AFTER RTImage::setPaths -#ifndef WIN32 - // For an unknown reason, gtkmm 2.22 don't know the gtk-button-images property, while it exists in the documentation... - // Anyway, the problem was Linux only - static Glib::RefPtr settings = Gtk::Settings::get_default(); + // ------- loading theme files - if (settings) { - settings->property_gtk_button_images().set_value(true); - } else { - printf("Error: no default settings to update!\n"); + Glib::RefPtr cssDefault; + Glib::RefPtr screen = Gdk::Screen::get_default(); + + cssDefault = Gtk::CssProvider::get_default(); + Gtk::StyleContext::add_provider_for_screen(screen, cssDefault, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + Gtk::Settings::get_for_screen(screen)->set_property("gtk-application-prefer-dark-theme", true); + + if (!options.useSystemTheme && screen) { + + + css = Gtk::CssProvider::create(); + + //Glib::ustring filename(argv0+"/themes/"+options.theme+".css"); + // Forcing the default dark theme + Glib::ustring filename(argv0 + "/themes/rtcommon.css"); + + try { + css->load_from_path (filename); + Gtk::StyleContext::add_provider_for_screen(screen, css, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } catch (Glib::Error &err) { + printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str()); + } catch (...) { + printf("Error: Can't load css file \"%s\"\n", filename.c_str()); + } + + if (options.slimUI) { + filename = argv0 + "/themes/slim.css"; + cssSlim = Gtk::CssProvider::create(); + + try { + cssSlim->load_from_path (filename); + Gtk::StyleContext::add_provider_for_screen(screen, cssSlim, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + } catch (Glib::Error &err) { + printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str()); + } catch (...) { + printf("Error: Can't load css file \"%s\"\n", filename.c_str()); + } + } + + // Set the font face and size + if (options.font != "default") { + try { + cssForced = Gtk::CssProvider::create(); + Glib::ustring font(options.font); + size_t pos = font.find(','); + + if (pos != Glib::ustring::npos) { + font = font.replace(pos, 1, " "); + } + + cssForced->load_from_data (Glib::ustring::compose("* { font: %1; }", font)); + 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 (...) { + printf("Error: Can't find the font named \"%s\"\n", options.font.c_str()); + } + } + } + +#ifndef NDEBUG + else if (!screen) { + printf("ERROR: Can't get default screen!\n"); } #endif + // ------- end loading theme files + gdk_threads_enter (); RTWindow *rtWindow = new class RTWindow(); @@ -810,4 +862,3 @@ int processLineParams( int argc, char **argv ) return errors > 0 ? -2 : 0; } - diff --git a/rtgui/mycurve.cc b/rtgui/mycurve.cc index 55e566ada..4a0626d1c 100644 --- a/rtgui/mycurve.cc +++ b/rtgui/mycurve.cc @@ -34,24 +34,27 @@ MyCurve::MyCurve () : pipetteR(-1.f), pipetteG(-1.f), pipetteB(-1.f), pipetteVal leftBar = NULL; bottomBar = NULL; colorProvider = NULL; - sized = RS_Pending; snapToElmt = -100; curveIsDirty = true; edited_point = -1; - set_extension_events(Gdk::EXTENSION_EVENTS_ALL); -#if defined (__APPLE__) +//#if defined (__APPLE__) // Workaround: disabling POINTER_MOTION_HINT_MASK as for gtk 2.24.22 the get_pointer() function is buggy for quartz and modifier mask is not updated correctly. // This workaround should be removed when bug is fixed in GTK2 or when migrating to GTK3 - add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); -#else - add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); -#endif + //add_events(Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); +//#else + add_events(Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::BUTTON1_MOTION_MASK); +//#endif mcih = new MyCurveIdleHelper; mcih->myCurve = this; mcih->destroyed = false; mcih->pending = 0; + + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_BACKGROUND); + style->add_class(GTK_STYLE_CLASS_FLAT); + style->add_class(GTK_STYLE_CLASS_NOTEBOOK); } MyCurve::~MyCurve () @@ -86,6 +89,51 @@ int MyCurve::calcDimensions () return newRequestedH; } +Gtk::SizeRequestMode MyCurve::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; +} + +void MyCurve::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + int minimumWidth = 0; + int naturalWidth = 0; + get_preferred_width_vfunc (minimumWidth, naturalWidth); + get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height); +} + +void MyCurve::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + natural_width = minimum_width = GRAPH_SIZE + 2 * RADIUS; +} + +void MyCurve::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + minimum_height = width; + + if (leftBar && !bottomBar) { + minimum_height -= getBarWidth() + CBAR_MARGIN - RADIUS; + } + + if (!leftBar && bottomBar) { + minimum_height += getBarWidth() + CBAR_MARGIN - RADIUS; + } + + /* + graphW = width - RADIUS - (leftBar ? (getBarWidth()+CBAR_MARGIN) : RADIUS); + graphH = minimum_height - RADIUS - (bottomBar ? (getBarWidth()+CBAR_MARGIN) : RADIUS); + graphX = width - RADIUS - graphW; + graphY = RADIUS + graphH; + */ + + natural_height = minimum_height; +} + +void MyCurve::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + void MyCurve::setColoredBar (ColoredBar *left, ColoredBar *bottom) { leftBar = left; @@ -145,7 +193,7 @@ float MyCurve::getVal(LUTf &curve, int x) } } -void MyCurve::on_style_changed (const Glib::RefPtr& style) +void MyCurve::on_style_updated () { setDirty(true); queue_draw (); diff --git a/rtgui/mycurve.h b/rtgui/mycurve.h index 96574e12a..e607ab798 100644 --- a/rtgui/mycurve.h +++ b/rtgui/mycurve.h @@ -35,7 +35,7 @@ #define CBAR_MARGIN 2 /** spacing between the colored bar and the graph */ #define SQUARE 2 /** half length of the square shape of the tangent handles */ #define MIN_DISTANCE 5 /** min distance between control points */ -#define GRAPH_SIZE 200 /** size of the curve editor graphic */ +#define GRAPH_SIZE 150 /** size of the curve editor graphic */ /** @brief Flat or Diagonal curve type For compatibility and simplicity reason, order shouldn't change, and must be identical to the order specified in the curveType widget @@ -53,12 +53,6 @@ enum SnapToType { ST_Neighbors /// Point snapped to the neighbor points }; -enum ResizeState { - RS_Pending = 1, /// Resize has to occurs - RS_Done = 2, /// Resize has been done - RS_Force = 4 /// Resize has to occurs even without CONFIGURE event -}; - class MyCurveIdleHelper; class CurveEditor; @@ -98,7 +92,6 @@ protected: double snapToMinDistX, snapToMinDistY; double snapToValX, snapToValY; MyCurveIdleHelper* mcih; - enum ResizeState sized; bool curveIsDirty; int edited_point; // > -1 when a point is being numerically edited @@ -130,18 +123,15 @@ public: { return; } ; - void forceResize() - { - sized = RS_Force; - } void refresh(); void setCurveDirty () { curveIsDirty = true; } - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); virtual std::vector getPoints () = 0; virtual void setPoints (const std::vector& p) = 0; + virtual bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) = 0; virtual bool handleEvents (GdkEvent* event) = 0; virtual void reset (const std::vector &resetCurve, double identityValue = 0.5) = 0; @@ -154,6 +144,12 @@ public: { return options.slimUI ? CBAR_WIDTH_SLIM : CBAR_WIDTH_STD; } + + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const; + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; }; class MyCurveIdleHelper diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index 98eb6c283..f55f2d907 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -37,6 +37,11 @@ MyDiagonalCurve::MyDiagonalCurve () : activeParam(-1), bghistvalid(false) editedPos.resize(2); editedPos.at(0) = editedPos.at(1) = 0.0; + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_FRAME); + //style->add_class(GTK_STYLE_CLASS_NOTEBOOK); + //style->add_class(GTK_STYLE_CLASS_FLAT); + signal_event().connect( sigc::mem_fun(*this, &MyDiagonalCurve::handleEvents) ); curve.type = DCT_Spline; @@ -219,23 +224,22 @@ void MyDiagonalCurve::draw (int handle) // re-calculate curve if dimensions changed int currPointSize = point.getUpperBound(); - if (curveIsDirty || /*prevGraphW != graphW || prevGraphH != graphH ||*/ (currPointSize == 200 && (graphW - 3 > 200)) || (currPointSize > 200 && (graphW - 2 <= 200 || graphW - 3 != currPointSize))) { + if (curveIsDirty || /*prevGraphW != graphW || prevGraphH != graphH ||*/ (currPointSize == GRAPH_SIZE && (graphW - 3 > GRAPH_SIZE)) || (currPointSize > GRAPH_SIZE && (graphW - 2 <= GRAPH_SIZE || graphW - 3 != currPointSize))) { interpolate (); } currPointSize = point.getUpperBound(); - Gtk::StateType state = !is_sensitive() ? Gtk::STATE_INSENSITIVE : Gtk::STATE_NORMAL; + Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; - Glib::RefPtr style = get_style (); + Glib::RefPtr style = get_style_context(); Cairo::RefPtr cr = getContext(); cr->set_line_cap(Cairo::LINE_CAP_SQUARE); // clear background - Gdk::Color c = style->get_bg (Gtk::STATE_NORMAL); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->rectangle (0., 0., double(getWidth()), double(getHeight())); - cr->fill (); + style->render_background(cr, 0., 0., double(getWidth()), double(getHeight())); + + Gdk::RGBA c; // histogram in the background if (bghistvalid) { @@ -251,8 +255,8 @@ void MyDiagonalCurve::draw (int handle) cr->set_line_width (1.0); double stepSize = (graphW - 3) / 255.0; cr->move_to ( double(graphX + 1), double(graphY - 1) ); - c = style->get_fg (Gtk::STATE_INSENSITIVE); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_background_color(Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); for (int i = 0; i < 256; i++) { double val = double(bghist[i]) * double(graphH - 2) / double(valMax); @@ -271,8 +275,8 @@ void MyDiagonalCurve::draw (int handle) // draw the grid lines: cr->set_line_width (1.0); - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_antialias (Cairo::ANTIALIAS_NONE); for (int i = 0; i <= 10; i++) { @@ -290,7 +294,7 @@ void MyDiagonalCurve::draw (int handle) if (snapToElmt == -2) { cr->set_source_rgb (1.0, 0.0, 0.0); } else { - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); } std::valarray ds (1); @@ -310,7 +314,7 @@ void MyDiagonalCurve::draw (int handle) float graphY_ = float(graphY) - 1.5; if (curve.type == DCT_Parametric && activeParam > 0 && lpoint.getUpperBound() > 1 && upoint.getUpperBound() > 1) { - cr->set_source_rgba (0.0, 0.0, 0.0, 0.15); + cr->set_source_rgba (1.0, 1.0, 1.0, 0.1); cr->move_to (graphX_, getVal(upoint, 0) * -graphH_ + graphY_); for (int i = 1; i < graphW - 2; ++i) { @@ -365,8 +369,8 @@ void MyDiagonalCurve::draw (int handle) if (pipetteVal > -1.f) { cr->set_line_width (2.); - c = style->get_fg (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_color (state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->move_to (double(graphX) + 1.5 + double(graphW - 3)*pipetteVal, double(graphY) - 1.5); cr->rel_line_to (0, double(-graphH + 3)); cr->stroke (); @@ -374,7 +378,7 @@ void MyDiagonalCurve::draw (int handle) } } - c = style->get_fg (state); + c = style->get_color (state); // draw the cage of the NURBS curve if (curve.type == DCT_NURBS) { @@ -383,7 +387,7 @@ void MyDiagonalCurve::draw (int handle) ch_ds[0] = 2; cr->set_dash (ch_ds, 0); cr->set_line_width (0.75); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); std::vector points = getPoints(); nbPoints = ((int)points.size() - 1) / 2; @@ -399,7 +403,7 @@ void MyDiagonalCurve::draw (int handle) if (curve.x.size() == nbPoints && snapToElmt >= 1000 && ((i == (snapToElmt - 1000)) || (i == (snapToElmt - 999)))) { cr->set_source_rgb (1.0, 0.0, 0.0); } else { - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); } cr->move_to (x1, y1); @@ -412,7 +416,7 @@ void MyDiagonalCurve::draw (int handle) } // draw curve - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->move_to (graphX_, getVal(point, 0) * -graphH_ + graphY_); for (int i = 1; i < graphW - 2; ++i) { @@ -430,8 +434,8 @@ void MyDiagonalCurve::draw (int handle) leftBar->expose(bb); // now the border - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle(0.5, graphY - graphH + 0.5, bWidth - 1, graphH - 1); cr->stroke(); } @@ -445,15 +449,15 @@ void MyDiagonalCurve::draw (int handle) bottomBar->expose(bb); // now the border - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color (state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle(graphX + 0.5, graphY + CBAR_MARGIN + 0.5, graphW - 1, bWidth - 1 ); cr->stroke(); } // draw bullets if (curve.type != DCT_Parametric) { - c = style->get_fg (state); + c = style->get_color (state); for (int i = 0; i < (int)curve.x.size(); ++i) { if (curve.x.at(i) == -1) { @@ -466,13 +470,13 @@ void MyDiagonalCurve::draw (int handle) if (i >= (pt - 1) && i <= (pt + 1)) { cr->set_source_rgb(1.0, 0.0, 0.0); } else { - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); } } else { if (i == handle || i == snapToElmt || i == edited_point) { cr->set_source_rgb (1.0, 0.0, 0.0); } else { - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); } } @@ -496,6 +500,27 @@ void MyDiagonalCurve::draw (int handle) queue_draw(); } +bool MyDiagonalCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) +{ + Glib::RefPtr win = get_window(); + Gtk::Allocation allocation = get_allocation(); + allocation.set_x(0); + allocation.set_y(0); + + // setDrawRectangle will allocate the backbuffer Surface + if (setDrawRectangle(win, allocation)) { + setDirty(true); + + if (prevGraphW > GRAPH_SIZE || graphW > GRAPH_SIZE) { + curveIsDirty = true; + } + } + + draw (lit_point); + copySurface(cr); + return false; +} + /*void MyDiagonalCurve::graphSizeRequest (Gtk::Requisition* req) { req->width = getGraphMinSize(); // The real height request should take care of the presence of the vertical @@ -522,43 +547,6 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) double minDistanceY = double(MIN_DISTANCE) / double(graphH - 1); switch (event->type) { - case Gdk::CONFIGURE: { - // Happen when the the window is resized - if (sized & (RS_Pending | RS_Force)) { - set_size_request(-1, calcDimensions()); - sized = RS_Done; - } - - retval = true; - break; - } - - case Gdk::EXPOSE: { - Glib::RefPtr win = get_window(); - - if (sized & (RS_Pending | RS_Force)) { - set_size_request(-1, calcDimensions()); - } - - sized = RS_Pending; - - // setDrawRectangle will allocate the backbuffer Surface - if (setDrawRectangle(win, 0, 0, get_allocation().get_width(), get_allocation().get_height())) { - setDirty(true); - - if (prevGraphW > 200 || graphW > 200) { - curveIsDirty = true; - } - } - - draw (lit_point); - GdkRectangle *rectangle = &(event->expose.area); - copySurface(win, rectangle); - - retval = true; - break; - } - case Gdk::BUTTON_PRESS: snapToElmt = -100; @@ -972,7 +960,7 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) if (new_type != cursor_type) { cursor_type = new_type; - cursorManager.setCursor(cursor_type); + CursorManager::setCursorOfMainWindow(get_window(), cursor_type); } return retval; @@ -1544,7 +1532,7 @@ void MyDiagonalCurve::updateBackgroundHistogram (LUTu & hist) } mcih->pending++; - // Can be done outside of the GUI thread + // Can be done outside of the GUI thread, so we're using g_idle_add instead of add_idle g_idle_add (diagonalmchistupdateUI, mcih); } diff --git a/rtgui/mydiagonalcurve.h b/rtgui/mydiagonalcurve.h index 033ba9f95..51c4358f7 100644 --- a/rtgui/mydiagonalcurve.h +++ b/rtgui/mydiagonalcurve.h @@ -84,6 +84,7 @@ public: std::vector getPoints (); void setPoints (const std::vector& p); void setType (DiagonalCurveType t); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool handleEvents (GdkEvent* event); void setActiveParam (int ac); void reset (const std::vector &resetCurve, double identityValue = 0.5); diff --git a/rtgui/myflatcurve.cc b/rtgui/myflatcurve.cc index 474756834..e602647ab 100644 --- a/rtgui/myflatcurve.cc +++ b/rtgui/myflatcurve.cc @@ -41,6 +41,11 @@ MyFlatCurve::MyFlatCurve () editedPos.resize(4); editedPos.at(0) = editedPos.at(1) = editedPos.at(2) = editedPos.at(3) = 0.0; + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_FRAME); + //style->add_class(GTK_STYLE_CLASS_NOTEBOOK); + //style->add_class(GTK_STYLE_CLASS_FLAT); + signal_event().connect( sigc::mem_fun(*this, &MyFlatCurve::handleEvents) ); // By default, we create a curve with 8 control points @@ -126,30 +131,29 @@ void MyFlatCurve::draw () // re-calculate curve if dimensions changed int currPointSize = point.getUpperBound(); - if (curveIsDirty || /*prevGraphW != graphW || prevGraphH != graphH ||*/ (currPointSize == 200 && (graphW - 3 > 200)) || (currPointSize > 200 && (graphW - 2 <= 200 || graphW - 3 != currPointSize))) { + if (curveIsDirty || /*prevGraphW != graphW || prevGraphH != graphH ||*/ (currPointSize == GRAPH_SIZE && (graphW - 3 > GRAPH_SIZE)) || (currPointSize > GRAPH_SIZE && (graphW - 2 <= GRAPH_SIZE || graphW - 3 != currPointSize))) { interpolate (); } double innerW = double(graphW - 2); double innerH = double(graphH - 2); - Gtk::StateType state = !is_sensitive() ? Gtk::STATE_INSENSITIVE : Gtk::STATE_NORMAL; + Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; - Glib::RefPtr style = get_style (); + Glib::RefPtr style = get_style_context(); Cairo::RefPtr cr = getContext(); cr->set_line_cap(Cairo::LINE_CAP_SQUARE); // clear background - Gdk::Color c = style->get_bg (Gtk::STATE_NORMAL); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->rectangle (0, 0, double(getWidth()), double(getHeight())); - cr->fill (); + style->render_background(cr, 0., 0., double(getWidth()), double(getHeight())); + + Gdk::RGBA c; cr->set_line_width (1.0); // draw f(x)=0.5 line - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); std::valarray ds (1); ds[0] = 4; cr->set_dash (ds, 0); @@ -172,8 +176,8 @@ void MyFlatCurve::draw () leftBar->expose(bb); // now the border - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle(0.5, graphY - graphH + 0.5, bWidth - 1, graphH - 1); cr->stroke(); } @@ -187,8 +191,8 @@ void MyFlatCurve::draw () bottomBar->expose(bb); // now the border - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle(graphX + 0.5, graphY + CBAR_MARGIN + 0.5, graphW - 1, bWidth - 1 ); cr->stroke(); } @@ -198,7 +202,7 @@ void MyFlatCurve::draw () // draw the pipette values if (pipetteR > -1.f || pipetteG > -1.f || pipetteB > -1.f) { cr->set_line_width (0.75); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); int n = 0; if (pipetteR > -1.f) { @@ -238,8 +242,8 @@ void MyFlatCurve::draw () if (pipetteVal > -1.f) { cr->set_line_width (2.); - c = style->get_fg (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_color (state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->move_to (double(graphX) + 1.5 + double(graphW - 3)*pipetteVal, double(graphY) - 1.5); cr->rel_line_to (0, double(-graphH + 3)); cr->stroke (); @@ -330,8 +334,8 @@ void MyFlatCurve::draw () cr->set_line_cap(Cairo::LINE_CAP_SQUARE); // draw the graph's borders: - c = style->get_dark (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle(double(graphX) + 0.5, double(graphY) - 0.5, double(graphW - 1), double(-graphH + 1)); cr->stroke (); @@ -418,8 +422,8 @@ void MyFlatCurve::draw () } // draw curve - c = style->get_fg (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); float graphH_ = float(graphH - 3); float graphX_ = float(graphX) + 1.5; float graphY_ = float(graphY) - 1.5; @@ -449,7 +453,7 @@ void MyFlatCurve::draw () } else if (curve.y.at(i) == 0.5) { cr->set_source_rgb (0.0, 0.5, 0.0); } else { - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); } double x = double(graphX + 1) + innerW * curve.x.at(i); // project (curve.x.at(i), 0, 1, graphW); @@ -501,6 +505,28 @@ void MyFlatCurve::draw () queue_draw(); } +bool MyFlatCurve::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) +{ + Glib::RefPtr win = get_window(); + Gtk::Allocation allocation = get_allocation(); + allocation.set_x(0); + allocation.set_y(0); + + // setDrawRectangle will allocate the backbuffer Surface + if (setDrawRectangle(win, allocation)) { + setDirty(true); + + if (prevGraphW > GRAPH_SIZE || graphW > GRAPH_SIZE) { + curveIsDirty = true; + } + } + + draw (); + copySurface(cr); + return false; +} + + /* * Return the X1, X2, Y position of the tangential handles. */ @@ -572,42 +598,6 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) minDistanceY = double(MIN_DISTANCE) / double(graphH - 1); switch (event->type) { - case Gdk::CONFIGURE: { - // Happen when the the window is resized - if (sized & (RS_Pending | RS_Force)) { - set_size_request(-1, calcDimensions()); - sized = RS_Done; - } - - retval = true; - break; - } - - case Gdk::EXPOSE: { - Glib::RefPtr win = get_window(); - - if (sized & (RS_Pending | RS_Force)) { - set_size_request(-1, calcDimensions()); - } - - sized = RS_Pending; - - // setDrawRectangle will allocate the backbuffer Surface - if (setDrawRectangle(win, 0, 0, get_allocation().get_width(), get_allocation().get_height())) { - setDirty(true); - - if (prevGraphW > 200 || graphW > 200) { - curveIsDirty = true; - } - } - - draw (); - GdkRectangle *rectangle = &(event->expose.area); - copySurface(win, rectangle); - - retval = true; - break; - } case Gdk::BUTTON_PRESS: if (edited_point == -1) { //curve.type!=FCT_Parametric) { @@ -1196,7 +1186,7 @@ bool MyFlatCurve::handleEvents (GdkEvent* event) if (new_type != cursor_type) { cursor_type = new_type; - cursorManager.setCursor(cursor_type); + CursorManager::setCursorOfMainWindow(get_window(), cursor_type); } return retval; @@ -1308,7 +1298,7 @@ void MyFlatCurve::pipetteButton1Pressed(EditDataProvider *provider, int modifier switch (area) { case (FCT_Area_Insertion): { - rtengine::FlatCurve rtCurve(getPoints(), 200); + rtengine::FlatCurve rtCurve(getPoints(), GRAPH_SIZE); std::vector::iterator itx, ity, itlt, itrt; int num = (int)curve.x.size(); diff --git a/rtgui/myflatcurve.h b/rtgui/myflatcurve.h index cd08edf89..587e700de 100644 --- a/rtgui/myflatcurve.h +++ b/rtgui/myflatcurve.h @@ -125,6 +125,7 @@ public: }; void setPoints (const std::vector& p); void setType (FlatCurveType t); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool handleEvents (GdkEvent* event); void reset (const std::vector &resetCurve, double identityValue = 0.5); //void updateBackgroundHistogram (unsigned int* hist); diff --git a/rtgui/navigator.cc b/rtgui/navigator.cc index 4f7e638f2..c2e6dffd7 100644 --- a/rtgui/navigator.cc +++ b/rtgui/navigator.cc @@ -50,15 +50,15 @@ Navigator::Navigator () lLAB_L = Gtk::manage (new Gtk::Label (M("NAVIGATOR_LAB_L"))); // left-align labels - lR->set_alignment(Gtk::ALIGN_LEFT); - lG->set_alignment(Gtk::ALIGN_LEFT); - lB->set_alignment(Gtk::ALIGN_LEFT); - lH->set_alignment(Gtk::ALIGN_LEFT); - lS->set_alignment(Gtk::ALIGN_LEFT); - lV->set_alignment(Gtk::ALIGN_LEFT); - lLAB_A->set_alignment(Gtk::ALIGN_LEFT); - lLAB_B->set_alignment(Gtk::ALIGN_LEFT); - lLAB_L->set_alignment(Gtk::ALIGN_LEFT); + lR->set_alignment(Gtk::ALIGN_START); + lG->set_alignment(Gtk::ALIGN_START); + lB->set_alignment(Gtk::ALIGN_START); + lH->set_alignment(Gtk::ALIGN_START); + lS->set_alignment(Gtk::ALIGN_START); + lV->set_alignment(Gtk::ALIGN_START); + lLAB_A->set_alignment(Gtk::ALIGN_START); + lLAB_B->set_alignment(Gtk::ALIGN_START); + lLAB_L->set_alignment(Gtk::ALIGN_START); //values R = Gtk::manage (new Gtk::Label ()); @@ -72,15 +72,15 @@ Navigator::Navigator () LAB_L = Gtk::manage (new Gtk::Label ()); // right-align values - R->set_alignment(Gtk::ALIGN_RIGHT); - G->set_alignment(Gtk::ALIGN_RIGHT); - B->set_alignment(Gtk::ALIGN_RIGHT); - H->set_alignment(Gtk::ALIGN_RIGHT); - S->set_alignment(Gtk::ALIGN_RIGHT); - V->set_alignment(Gtk::ALIGN_RIGHT); - LAB_A->set_alignment(Gtk::ALIGN_RIGHT); - LAB_B->set_alignment(Gtk::ALIGN_RIGHT); - LAB_L->set_alignment(Gtk::ALIGN_RIGHT); + R->set_alignment(Gtk::ALIGN_END); + G->set_alignment(Gtk::ALIGN_END); + B->set_alignment(Gtk::ALIGN_END); + H->set_alignment(Gtk::ALIGN_END); + S->set_alignment(Gtk::ALIGN_END); + V->set_alignment(Gtk::ALIGN_END); + LAB_A->set_alignment(Gtk::ALIGN_END); + LAB_B->set_alignment(Gtk::ALIGN_END); + LAB_L->set_alignment(Gtk::ALIGN_END); // set font family and size Glib::ustring fontname; @@ -97,28 +97,33 @@ Navigator::Navigator () fontname = "Menlo"; #endif - if (fontname != "") { - R->modify_font(Pango::FontDescription(fontname)); - G->modify_font(Pango::FontDescription(fontname)); - B->modify_font(Pango::FontDescription(fontname)); - H->modify_font(Pango::FontDescription(fontname)); - S->modify_font(Pango::FontDescription(fontname)); - V->modify_font(Pango::FontDescription(fontname)); - LAB_A->modify_font(Pango::FontDescription(fontname)); - LAB_B->modify_font(Pango::FontDescription(fontname)); - LAB_L->modify_font(Pango::FontDescription(fontname)); + if (0) { // (fontname!=""){ + Glib::RefPtr cssProvider = Gtk::CssProvider::create(); - lR->modify_font(Pango::FontDescription(fontname)); - lG->modify_font(Pango::FontDescription(fontname)); - lB->modify_font(Pango::FontDescription(fontname)); - lH->modify_font(Pango::FontDescription(fontname)); - lS->modify_font(Pango::FontDescription(fontname)); - lV->modify_font(Pango::FontDescription(fontname)); - lLAB_A->modify_font(Pango::FontDescription(fontname)); - lLAB_B->modify_font(Pango::FontDescription(fontname)); - lLAB_L->modify_font(Pango::FontDescription(fontname)); + if (cssProvider) { + cssProvider->load_from_data("Label { font-name: " + fontname + " }"); + R->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + G->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + B->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + H->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + S->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + V->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + LAB_A->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + LAB_B->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + LAB_L->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); - position->modify_font(Pango::FontDescription(fontname)); + lR->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lG->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lB->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lH->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lS->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lV->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lLAB_A->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lLAB_B->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + lLAB_L->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + + position->get_style_context()->add_provider(cssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER); + } } // setup the tables diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d1f5124b1..a22956b58 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -587,7 +587,6 @@ public: bool bluemed; bool greenhigh; bool bluehigh; - bool enacont; bool expcontrast; bool expchroma; bool expedge; diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 4fbfe2d93..55da5f1b0 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -255,7 +255,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) vbtop->pack_start (*everything, Gtk::PACK_SHRINK, 2); vbtop->set_border_width (8); - Gtk::Dialog::get_vbox()->pack_start (*vbtop, Gtk::PACK_SHRINK, 2); // TODO replace with get_content_area() with GTK upgrade + Gtk::Dialog::get_content_area()->pack_start (*vbtop, Gtk::PACK_SHRINK, 2); // TODO replace with get_content_area() with GTK upgrade Gtk::HBox* hbmain = Gtk::manage (new Gtk::HBox ()); hbmain->pack_start (*vbCol1); @@ -265,7 +265,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) hbmain->pack_start (*vbCol3); scrolledwindow = Gtk::manage ( new Gtk::ScrolledWindow() ); - scrolledwindow->set_flags(Gtk::CAN_FOCUS); + scrolledwindow->set_can_focus(true); scrolledwindow->set_border_width(2); scrolledwindow->set_shadow_type(Gtk::SHADOW_NONE); scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); @@ -273,7 +273,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) scrolledwindow->add(*hbmain); - Gtk::Dialog::get_vbox()->pack_start (*scrolledwindow, Gtk::PACK_EXPAND_WIDGET, 2);// TODO replace with get_content_area() with GTK upgrade + Gtk::Dialog::get_content_area()->pack_start (*scrolledwindow, Gtk::PACK_EXPAND_WIDGET, 2);// TODO replace with get_content_area() with GTK upgrade hbmain->show(); scrolledwindow->show (); @@ -359,8 +359,8 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) ff_BlurTypeConn = ff_BlurType->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true)); ff_ClipControlConn = ff_ClipControl->signal_toggled().connect (sigc::bind (sigc::mem_fun(*raw, &Gtk::CheckButton::set_inconsistent), true)); - add_button (Gtk::StockID("gtk-ok"), Gtk::RESPONSE_OK); - add_button (Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); + add_button (M("GENERAL_OK"), Gtk::RESPONSE_OK); + add_button (M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); set_response_sensitive (Gtk::RESPONSE_OK); set_default_response (Gtk::RESPONSE_OK); show_all_children (); diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 6edb3b471..d811cef96 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -30,18 +30,28 @@ PlacesBrowser::PlacesBrowser () : listener (NULL) scrollw->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); pack_start (*scrollw); - add = Gtk::manage (new Gtk::Button (M("MAIN_FRAME_PLACES_ADD"))); - del = Gtk::manage (new Gtk::Button (M("MAIN_FRAME_PLACES_DEL"))); - add->set_image (*Gtk::manage (new RTImage ("gtk-add.png"))); + // Since Gtk3, we can't have image+text buttons natively. We'll comply to the Gtk guidelines and choose one of them (icons here) + add = Gtk::manage (new Gtk::Button ()); + add->set_tooltip_text(M("MAIN_FRAME_PLACES_ADD")); + 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 ("list-add.png"))); + 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 ("list-remove.png"))); - Gtk::HBox* buttonBox = Gtk::manage (new Gtk::HBox ()); - buttonBox->pack_start (*add); - buttonBox->pack_start (*del); + Gtk::Grid* buttonBox = Gtk::manage (new Gtk::Grid ()); + buttonBox->set_orientation(Gtk::ORIENTATION_HORIZONTAL); + buttonBox->attach_next_to(*add, Gtk::POS_LEFT, 1, 1); + buttonBox->attach_next_to(*del, *add, Gtk::POS_RIGHT, 1, 1); pack_start (*buttonBox, Gtk::PACK_SHRINK, 2); treeView = Gtk::manage (new Gtk::TreeView ()); - treeView->unset_flags (Gtk::CAN_FOCUS); + treeView->set_can_focus(false); scrollw->add (*treeView); placesModel = Gtk::ListStore::create (placesColumns); diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index 881994589..cac443c5c 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -23,24 +23,27 @@ #include "popupcommon.h" #include "../rtengine/safegtk.h" #include "rtimage.h" +#include "guiutils.h" PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label) { button = thisButton; hasMenu = false; - imageContainer = Gtk::manage( new Gtk::HBox(false, 0)); + imageContainer = Gtk::manage( new Gtk::Grid()); + setExpandAlignProperties(imageContainer, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); button->set_relief (Gtk::RELIEF_NORMAL); - button->set_border_width (0); button->add(*imageContainer); - if (label.size()) { + if (!label.empty()) { Gtk::Label* buttonLabel = Gtk::manage ( new Gtk::Label(label + " ") ); - imageContainer->pack_start(*buttonLabel, Gtk::PACK_SHRINK, 0); + setExpandAlignProperties(buttonLabel, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); + imageContainer->attach(*buttonLabel, 0, 0, 1, 1); } // Create the global container and put the button in it - buttonGroup = Gtk::manage( new Gtk::HBox(false, 0)); - buttonGroup->pack_start(*button, Gtk::PACK_EXPAND_WIDGET, 0); + buttonGroup = Gtk::manage( new Gtk::Grid()); + setExpandAlignProperties(buttonGroup, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + buttonGroup->attach(*button, 0, 0, 1, 1); // Create the list entry imageFilenames.clear(); images.clear(); @@ -54,11 +57,7 @@ PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label) PopUpCommon::~PopUpCommon () { - for (std::vector::iterator i = images.begin(); i != images.end(); ++i) { - delete *i; - } - - for (std::vector::iterator i = items.begin(); i != items.end(); ++i) { + for (std::vector::iterator i = items.begin(); i != items.end(); ++i) { delete *i; } @@ -85,12 +84,10 @@ bool PopUpCommon::addEntry (Glib::ustring fileName, Glib::ustring label) if ( label.size() ) { imageFilenames.push_back(fileName); sItems.push_back(label); - // Create the image - RTImage* newImage = new RTImage(fileName); - images.push_back(newImage); - int currPos = (int)images.size(); // Create the menu item - Gtk::ImageMenuItem* newItem = new Gtk::ImageMenuItem (*newImage, label); + MyImageMenuItem* newItem = new MyImageMenuItem (label, fileName); + images.push_back(newItem->getImage()); + int currPos = (int)images.size(); items.push_back(newItem); if (selected == -1) { @@ -98,8 +95,9 @@ bool PopUpCommon::addEntry (Glib::ustring fileName, Glib::ustring label) menu = new Gtk::Menu (); // Create the image for the button buttonImage = new RTImage(fileName); + setExpandAlignProperties(buttonImage, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); // Use the first image by default - imageContainer->pack_start(*buttonImage, Gtk::PACK_EXPAND_WIDGET); + imageContainer->attach_next_to(*buttonImage, Gtk::POS_RIGHT, 1, 1); selected = 0; } @@ -107,11 +105,12 @@ bool PopUpCommon::addEntry (Glib::ustring fileName, Glib::ustring label) if (images.size() == 1) { Gtk::Button* arrowButton = Gtk::manage( new Gtk::Button() ); RTImage* arrowImage = Gtk::manage( new RTImage("popuparrow.png") ); + setExpandAlignProperties(arrowButton, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_FILL); arrowButton->add(*arrowImage); //menuSymbol); - arrowButton->set_relief (Gtk::RELIEF_NONE); - arrowButton->set_border_width (0); - buttonGroup->pack_start(*arrowButton, Gtk::PACK_SHRINK, 0); + buttonGroup->attach_next_to(*arrowButton, *button, Gtk::POS_RIGHT, 1, 1); arrowButton->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &PopUpCommon::showMenu) ); + button->get_style_context()->add_class("Left"); + arrowButton->get_style_context()->add_class("Right"); hasMenu = true; } diff --git a/rtgui/popupcommon.h b/rtgui/popupcommon.h index 872beb434..952f76fd9 100644 --- a/rtgui/popupcommon.h +++ b/rtgui/popupcommon.h @@ -25,6 +25,7 @@ #include #include #include "rtimage.h" +#include "guiutils.h" class PopUpCommon @@ -33,7 +34,7 @@ class PopUpCommon public: typedef sigc::signal type_signal_changed; type_signal_changed signal_changed(); - Gtk::HBox* buttonGroup; // this is the widget to be packed + Gtk::Grid* buttonGroup; // this is the widget to be packed PopUpCommon (Gtk::Button* button, const Glib::ustring& label = ""); virtual ~PopUpCommon (); @@ -56,11 +57,11 @@ private: */ std::vector sItems; std::vector imageFilenames; - std::vector images; - std::vector items; + std::vector images; + std::vector items; Glib::ustring buttonHint; RTImage* buttonImage; - Gtk::HBox* imageContainer; + Gtk::Grid* imageContainer; Gtk::Menu* menu; Gtk::Button* button; int selected; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 9c0918189..2e377c974 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -33,6 +33,9 @@ extern Options options; extern Glib::ustring argv0; +extern Glib::RefPtr css; +extern Glib::RefPtr cssSlim; +extern Glib::RefPtr cssForced; Preferences::Preferences (RTWindow *rtwindow) : rprofiles(NULL), iprofiles(NULL), parent(rtwindow) { @@ -54,26 +57,21 @@ Preferences::Preferences (RTWindow *rtwindow) : rprofiles(NULL), iprofiles(NULL set_default_size (options.preferencesWidth, options.preferencesHeight); set_border_width(4); - Gtk::VBox* mainvb = get_vbox (); - mainvb->set_spacing(8); - set_has_separator (false); + Gtk::Box* mainBox = get_content_area (); + mainBox->set_spacing(8); + //set_has_separator (false); Gtk::Notebook* nb = Gtk::manage (new Gtk::Notebook ()); - mainvb->pack_start (*nb); + mainBox->pack_start (*nb); Gtk::HBox* buttonpanel = Gtk::manage (new Gtk::HBox ()); buttonpanel->set_spacing(8); - mainvb->pack_start (*buttonpanel, Gtk::PACK_SHRINK, 0); + mainBox->pack_start (*buttonpanel, Gtk::PACK_SHRINK, 0); Gtk::Button* about = Gtk::manage (new Gtk::Button (M("GENERAL_ABOUT"))); Gtk::Button* ok = Gtk::manage (new Gtk::Button (M("GENERAL_OK"))); Gtk::Button* cancel = Gtk::manage (new Gtk::Button (M("GENERAL_CANCEL"))); - about->set_image (*Gtk::manage(new RTImage ("rt-logo.png"))); - ok->set_image (*Gtk::manage(new RTImage ("gtk-apply.png"))); - cancel->set_image (*Gtk::manage(new RTImage ("gtk-cancel.png"))); - - about->signal_clicked().connect( sigc::mem_fun(*this, &Preferences::aboutPressed) ); ok->signal_clicked().connect( sigc::mem_fun(*this, &Preferences::okPressed) ); cancel->signal_clicked().connect( sigc::mem_fun(*this, &Preferences::cancelPressed) ); @@ -136,8 +134,8 @@ Gtk::Widget* Preferences::getBatchProcPanel () behTreeView->append_column_editable (M("PREFERENCES_ADD"), behavColumns.badd); behTreeView->append_column_editable (M("PREFERENCES_SET"), behavColumns.bset); - Gtk::CellRendererToggle* cr_add = static_cast (behTreeView->get_column (1)->get_first_cell_renderer()); - Gtk::CellRendererToggle* cr_set = static_cast (behTreeView->get_column (2)->get_first_cell_renderer()); + Gtk::CellRendererToggle* cr_add = static_cast (behTreeView->get_column (1)->get_first_cell()); + Gtk::CellRendererToggle* cr_set = static_cast (behTreeView->get_column (2)->get_first_cell()); cr_add->set_radio (true); cr_add->set_property("xalign", 0.0f); @@ -408,11 +406,11 @@ Gtk::Widget* Preferences::getProcParamsPanel () Gtk::Frame* fpp = Gtk::manage (new Gtk::Frame (M("PREFERENCES_IMPROCPARAMS"))); Gtk::VBox* vbpp = Gtk::manage (new Gtk::VBox ()); vbpp->set_border_width(4); - Gtk::Label* drlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORRAW") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* drlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORRAW") + ":", Gtk::ALIGN_START)); rprofiles = Gtk::manage (new ProfileStoreComboBox ()); rprofiles->set_size_request(50, -1); rpconn = rprofiles->signal_changed().connect( sigc::mem_fun(*this, &Preferences::forRAWComboChanged) ); - Gtk::Label* drimg = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORIMAGE") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* drimg = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORIMAGE") + ":", Gtk::ALIGN_START)); iprofiles = Gtk::manage (new ProfileStoreComboBox ()); iprofiles->set_size_request(50, -1); ipconn = iprofiles->signal_changed().connect( sigc::mem_fun(*this, &Preferences::forImageComboChanged) ); @@ -430,14 +428,14 @@ Gtk::Widget* Preferences::getProcParamsPanel () // Custom profile builder box Gtk::Frame* cpfrm = Gtk::manage( new Gtk::Frame (M("PREFERENCES_CUSTPROFBUILD")) ); - Gtk::Label* cplab = Gtk::manage( new Gtk::Label (M("PREFERENCES_CUSTPROFBUILDPATH") + ":", Gtk::ALIGN_LEFT) ); + Gtk::Label* cplab = Gtk::manage( new Gtk::Label (M("PREFERENCES_CUSTPROFBUILDPATH") + ":", Gtk::ALIGN_START) ); txtCustProfBuilderPath = Gtk::manage( new Gtk::Entry () ); txtCustProfBuilderPath->set_tooltip_markup (M("PREFERENCES_CUSTPROFBUILDHINT")); - Gtk::Label* cpltypelab = Gtk::manage( new Gtk::Label (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT") + ":", Gtk::ALIGN_LEFT) ); + Gtk::Label* cpltypelab = Gtk::manage( new Gtk::Label (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT") + ":", Gtk::ALIGN_START) ); custProfBuilderLabelType = Gtk::manage (new Gtk::ComboBoxText ()); - custProfBuilderLabelType->append_text (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_TID")); - custProfBuilderLabelType->append_text (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_NAME")); - custProfBuilderLabelType->append_text (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_TID") + "_" + M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_NAME")); + custProfBuilderLabelType->append (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_TID")); + custProfBuilderLabelType->append (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_NAME")); + custProfBuilderLabelType->append (M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_TID") + "_" + M("PREFERENCES_CUSTPROFBUILDKEYFORMAT_NAME")); Gtk::Table* cpbt = Gtk::manage (new Gtk::Table (2, 2)); cpbt->set_border_width(4); cpbt->attach (*cplab, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2); @@ -456,8 +454,8 @@ Gtk::Widget* Preferences::getProcParamsPanel () vbdp->pack_start (*saveParamsCache, Gtk::PACK_SHRINK, 4); Gtk::Label* lplab = Gtk::manage (new Gtk::Label (M("PREFERENCES_PROFILELOADPR") + ":")); loadParamsPreference = Gtk::manage (new Gtk::ComboBoxText ()); - loadParamsPreference->append_text (M("PREFERENCES_PROFILEPRCACHE")); - loadParamsPreference->append_text (M("PREFERENCES_PROFILEPRFILE")); + loadParamsPreference->append (M("PREFERENCES_PROFILEPRCACHE")); + loadParamsPreference->append (M("PREFERENCES_PROFILEPRFILE")); Gtk::HBox* hb41 = Gtk::manage (new Gtk::HBox ()); hb41->pack_start (*lplab, Gtk::PACK_SHRINK, 0); hb41->pack_start (*loadParamsPreference, Gtk::PACK_EXPAND_WIDGET, 0); @@ -534,8 +532,8 @@ Gtk::Widget* Preferences::getPerformancePanel () Gtk::HBox* hbprevdemo = Gtk::manage (new Gtk::HBox (false, 4)); Gtk::Label* lprevdemo = Gtk::manage (new Gtk::Label (M("PREFERENCES_PREVDEMO_LABEL"))); cprevdemo = Gtk::manage (new Gtk::ComboBoxText ()); - cprevdemo->append_text (M("PREFERENCES_PREVDEMO_FAST")); - cprevdemo->append_text (M("PREFERENCES_PREVDEMO_SIDECAR")); + cprevdemo->append (M("PREFERENCES_PREVDEMO_FAST")); + cprevdemo->append (M("PREFERENCES_PREVDEMO_SIDECAR")); cprevdemo->set_active (1); hbprevdemo->pack_start (*lprevdemo, Gtk::PACK_SHRINK); hbprevdemo->pack_start (*cprevdemo); @@ -556,7 +554,7 @@ Gtk::Widget* Preferences::getPerformancePanel () Gtk::HBox* clutCacheSizeHB = Gtk::manage( new Gtk::HBox () ); clutCacheSizeHB->set_border_width(4); clutCacheSizeHB->set_spacing(4); - Gtk::Label* CLUTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_CLUTSCACHE_LABEL") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* CLUTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_CLUTSCACHE_LABEL") + ":", Gtk::ALIGN_START)); clutCacheSizeSB = Gtk::manage( new Gtk::SpinButton () ); clutCacheSizeSB->set_digits (0); clutCacheSizeSB->set_increments (1, 5); @@ -576,7 +574,7 @@ Gtk::Widget* Preferences::getPerformancePanel () maxIBuffersHB->set_border_width(4); maxIBuffersHB->set_spacing(4); maxIBuffersHB->set_tooltip_text(M("PREFERENCES_INSPECT_MAXBUFFERS_TOOLTIP")); - Gtk::Label* maxIBufferLbl = Gtk::manage( new Gtk::Label (M("PREFERENCES_INSPECT_MAXBUFFERS_LABEL") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* maxIBufferLbl = Gtk::manage( new Gtk::Label (M("PREFERENCES_INSPECT_MAXBUFFERS_LABEL") + ":", Gtk::ALIGN_START)); maxInspectorBuffersSB = Gtk::manage( new Gtk::SpinButton () ); maxInspectorBuffersSB->set_digits (0); maxInspectorBuffersSB->set_increments (1, 5); @@ -591,10 +589,10 @@ Gtk::Widget* Preferences::getPerformancePanel () Gtk::VBox* vbdenoise = Gtk::manage( new Gtk::VBox (Gtk::PACK_SHRINK, 4) ); vbdenoise->set_border_width (4); - Gtk::Label* lreloadneeded2 = Gtk::manage (new Gtk::Label (M("PREFERENCES_IMG_RELOAD_NEEDED"), Gtk::ALIGN_LEFT)); + Gtk::Label* lreloadneeded2 = Gtk::manage (new Gtk::Label (M("PREFERENCES_IMG_RELOAD_NEEDED"), Gtk::ALIGN_START)); Gtk::HBox* threadLimitHB = Gtk::manage (new Gtk::HBox (Gtk::PACK_SHRINK, 4)); threadLimitHB->set_tooltip_text(M("PREFERENCES_RGBDTL_TOOLTIP")); - Gtk::Label* RGBDTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_RGBDTL_LABEL") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* RGBDTLl = Gtk::manage( new Gtk::Label (M("PREFERENCES_RGBDTL_LABEL") + ":", Gtk::ALIGN_START)); rgbDenoiseTreadLimitSB = Gtk::manage( new Gtk::SpinButton () ); rgbDenoiseTreadLimitSB->set_digits (0); rgbDenoiseTreadLimitSB->set_increments (1, 5); @@ -607,40 +605,40 @@ Gtk::Widget* Preferences::getPerformancePanel () threadLimitHB->pack_start (*RGBDTLl, Gtk::PACK_SHRINK, 2); threadLimitHB->pack_end (*rgbDenoiseTreadLimitSB, Gtk::PACK_SHRINK, 2); - Gtk::Label* dnlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_LEVDN") + ":", Gtk::ALIGN_LEFT)); - Gtk::Label* dnautlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_LEVAUTDN") + ":", Gtk::ALIGN_LEFT)); - Gtk::Label* dnautsimpllab = Gtk::manage (new Gtk::Label (M("PREFERENCES_SIMPLAUT") + ":", Gtk::ALIGN_LEFT)); - Gtk::Label* dntilab = Gtk::manage (new Gtk::Label (M("PREFERENCES_TINB") + ":", Gtk::ALIGN_LEFT)); - Gtk::Label* dnwavlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_WAVLEV") + ":", Gtk::ALIGN_LEFT)); - Gtk::Label* dnlisslab = Gtk::manage (new Gtk::Label (M("PREFERENCES_LISS") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* dnlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_LEVDN") + ":", Gtk::ALIGN_START)); + Gtk::Label* dnautlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_LEVAUTDN") + ":", Gtk::ALIGN_START)); + Gtk::Label* dnautsimpllab = Gtk::manage (new Gtk::Label (M("PREFERENCES_SIMPLAUT") + ":", Gtk::ALIGN_START)); + Gtk::Label* dntilab = Gtk::manage (new Gtk::Label (M("PREFERENCES_TINB") + ":", Gtk::ALIGN_START)); + Gtk::Label* dnwavlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_WAVLEV") + ":", Gtk::ALIGN_START)); + Gtk::Label* dnlisslab = Gtk::manage (new Gtk::Label (M("PREFERENCES_LISS") + ":", Gtk::ALIGN_START)); dnv = Gtk::manage (new Gtk::ComboBoxText ()); - dnv->append_text (M("PREFERENCES_MIN")); - dnv->append_text (M("PREFERENCES_SMA")); - dnv->append_text (M("PREFERENCES_MED")); - dnv->append_text (M("PREFERENCES_MAX")); + dnv->append (M("PREFERENCES_MIN")); + dnv->append (M("PREFERENCES_SMA")); + dnv->append (M("PREFERENCES_MED")); + dnv->append (M("PREFERENCES_MAX")); dnaut = Gtk::manage (new Gtk::ComboBoxText ()); - dnaut->append_text (M("PREFERENCES_AUTLOW")); - dnaut->append_text (M("PREFERENCES_AUTSTD")); + dnaut->append (M("PREFERENCES_AUTLOW")); + dnaut->append (M("PREFERENCES_AUTSTD")); dnautsimpl = Gtk::manage (new Gtk::ComboBoxText ()); - dnautsimpl->append_text (M("PREFERENCES_STDAUT")); - dnautsimpl->append_text (M("PREFERENCES_EXPAUT")); + dnautsimpl->append (M("PREFERENCES_STDAUT")); + dnautsimpl->append (M("PREFERENCES_EXPAUT")); dnliss = Gtk::manage (new Gtk::ComboBoxText ()); - dnliss->append_text (M("PREFERENCES_AUTLISVLOW"));//very low - dnliss->append_text (M("PREFERENCES_AUTLISLOW"));//low - dnliss->append_text (M("PREFERENCES_AUTLISSTD"));//med - dnliss->append_text (M("PREFERENCES_AUTLISMAX"));//max + dnliss->append (M("PREFERENCES_AUTLISVLOW"));//very low + dnliss->append (M("PREFERENCES_AUTLISLOW"));//low + dnliss->append (M("PREFERENCES_AUTLISSTD"));//med + dnliss->append (M("PREFERENCES_AUTLISMAX"));//max dnti = Gtk::manage (new Gtk::ComboBoxText ()); - dnti->append_text (M("PREFERENCES_TISTD")); - dnti->append_text (M("PREFERENCES_TIMAX")); + dnti->append (M("PREFERENCES_TISTD")); + dnti->append (M("PREFERENCES_TIMAX")); dnwavlev = Gtk::manage (new Gtk::ComboBoxText ()); - dnwavlev->append_text (M("PREFERENCES_WLZER")); - dnwavlev->append_text (M("PREFERENCES_WLONE")); - dnwavlev->append_text (M("PREFERENCES_WLTWO")); + dnwavlev->append (M("PREFERENCES_WLZER")); + dnwavlev->append (M("PREFERENCES_WLONE")); + dnwavlev->append (M("PREFERENCES_WLTWO")); Gtk::Table* colon = Gtk::manage (new Gtk::Table (6, 2)); colon->attach (*dnlab, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2); @@ -660,7 +658,7 @@ Gtk::Widget* Preferences::getPerformancePanel () vbdenoise->pack_start (*colon, Gtk::PACK_SHRINK); vbdenoise->pack_start(*threadLimitHB, Gtk::PACK_SHRINK); // <--- To be hard-coded and removed once tested - cbdaubech = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_DAUB_LABEL"), Gtk::ALIGN_LEFT)); + cbdaubech = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_DAUB_LABEL"), Gtk::ALIGN_START)); cbdaubech->set_tooltip_markup (M("PREFERENCES_DAUB_TOOLTIP")); // vbdenoise->pack_start (*cbdaubech, Gtk::PACK_SHRINK); // ---> @@ -677,31 +675,31 @@ Gtk::Widget* Preferences::getColorManagementPanel () mvbcm->set_border_width (4); /* - Gtk::Label* intlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_CMETRICINTENT")+":", Gtk::ALIGN_LEFT)); + Gtk::Label* intlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_CMETRICINTENT")+":", Gtk::ALIGN_START)); intent = Gtk::manage (new Gtk::ComboBoxText ()); - intent->append_text (M("PREFERENCES_INTENT_PERCEPTUAL")); - intent->append_text (M("PREFERENCES_INTENT_RELATIVE")); - intent->append_text (M("PREFERENCES_INTENT_SATURATION")); - intent->append_text (M("PREFERENCES_INTENT_ABSOLUTE")); + intent->append (M("PREFERENCES_INTENT_PERCEPTUAL")); + intent->append (M("PREFERENCES_INTENT_RELATIVE")); + intent->append (M("PREFERENCES_INTENT_SATURATION")); + intent->append (M("PREFERENCES_INTENT_ABSOLUTE")); */ iccDir = Gtk::manage (new Gtk::FileChooserButton (M("PREFERENCES_ICCDIR"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER)); - Gtk::Label* pdlabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_ICCDIR") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* pdlabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_ICCDIR") + ":", Gtk::ALIGN_START)); - Gtk::FileFilter monProfileFilter_colprof; - monProfileFilter_colprof.set_name(M("FILECHOOSER_FILTER_COLPROF")); - monProfileFilter_colprof.add_pattern("*.icc"); - monProfileFilter_colprof.add_pattern("*.ICC"); - monProfileFilter_colprof.add_pattern("*.icm"); - monProfileFilter_colprof.add_pattern("*.ICM"); - Gtk::FileFilter monProfileFilter_any; - monProfileFilter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - monProfileFilter_any.add_pattern("*"); + Glib::RefPtr monProfileFilter_colprof = Gtk::FileFilter::create(); + monProfileFilter_colprof->set_name(M("FILECHOOSER_FILTER_COLPROF")); + monProfileFilter_colprof->add_pattern("*.icc"); + monProfileFilter_colprof->add_pattern("*.ICC"); + monProfileFilter_colprof->add_pattern("*.icm"); + monProfileFilter_colprof->add_pattern("*.ICM"); + const Glib::RefPtr monProfileFilter_any = Gtk::FileFilter::create(); + monProfileFilter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + monProfileFilter_any->add_pattern("*"); monProfile = Gtk::manage (new Gtk::FileChooserButton (M("PREFERENCES_MONITORICC"), Gtk::FILE_CHOOSER_ACTION_OPEN)); monProfile->add_filter (monProfileFilter_colprof); monProfile->add_filter (monProfileFilter_any); - Gtk::Label* mplabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_MONITORICC") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* mplabel = Gtk::manage (new Gtk::Label (M("PREFERENCES_MONITORICC") + ":", Gtk::ALIGN_START)); #if defined(WIN32) // Auto-detection not implemented for Linux, see issue 851 cbAutoMonProfile = Gtk::manage (new Gtk::CheckButton (M("PREFERENCES_AUTOMONPROFILE"))); @@ -728,38 +726,38 @@ Gtk::Widget* Preferences::getColorManagementPanel () Gtk::VBox* vbdp = Gtk::manage (new Gtk::VBox ()); vbdp->set_border_width (4); - Gtk::Label* viewlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_VIEW") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* viewlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_VIEW") + ":", Gtk::ALIGN_START)); view = Gtk::manage (new Gtk::ComboBoxText ()); - view->append_text (M("PREFERENCES_D50")); - view->append_text (M("PREFERENCES_D55")); - view->append_text (M("PREFERENCES_D60")); - view->append_text (M("PREFERENCES_D65")); - view->append_text (M("PREFERENCES_BLACKBODY")); - view->append_text (M("PREFERENCES_FLUOF2")); - view->append_text (M("PREFERENCES_FLUOF7")); - view->append_text (M("PREFERENCES_FLUOF11")); + view->append (M("PREFERENCES_D50")); + view->append (M("PREFERENCES_D55")); + view->append (M("PREFERENCES_D60")); + view->append (M("PREFERENCES_D65")); + view->append (M("PREFERENCES_BLACKBODY")); + view->append (M("PREFERENCES_FLUOF2")); + view->append (M("PREFERENCES_FLUOF7")); + view->append (M("PREFERENCES_FLUOF11")); - Gtk::Label* greylab = Gtk::manage (new Gtk::Label (M("PREFERENCES_GREY") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* greylab = Gtk::manage (new Gtk::Label (M("PREFERENCES_GREY") + ":", Gtk::ALIGN_START)); grey = Gtk::manage (new Gtk::ComboBoxText ()); - grey->append_text (M("PREFERENCES_GREY05")); - grey->append_text (M("PREFERENCES_GREY10")); - grey->append_text (M("PREFERENCES_GREY15")); - grey->append_text (M("PREFERENCES_GREY18")); - grey->append_text (M("PREFERENCES_GREY23")); - grey->append_text (M("PREFERENCES_GREY30")); - grey->append_text (M("PREFERENCES_GREY40")); + grey->append (M("PREFERENCES_GREY05")); + grey->append (M("PREFERENCES_GREY10")); + grey->append (M("PREFERENCES_GREY15")); + grey->append (M("PREFERENCES_GREY18")); + grey->append (M("PREFERENCES_GREY23")); + grey->append (M("PREFERENCES_GREY30")); + grey->append (M("PREFERENCES_GREY40")); - Gtk::Label* greySclab = Gtk::manage (new Gtk::Label (M("PREFERENCES_GREYSC") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* greySclab = Gtk::manage (new Gtk::Label (M("PREFERENCES_GREYSC") + ":", Gtk::ALIGN_START)); greySc = Gtk::manage (new Gtk::ComboBoxText ()); - greySc->append_text (M("PREFERENCES_GREYSCA")); - greySc->append_text (M("PREFERENCES_GREYSC18")); + greySc->append (M("PREFERENCES_GREYSCA")); + greySc->append (M("PREFERENCES_GREYSC18")); Gtk::Frame* fcielab = Gtk::manage( new Gtk::Frame (M("PREFERENCES_CIEART_FRAME")) ); Gtk::VBox* vbcielab = Gtk::manage( new Gtk::VBox () ); vbcielab->set_border_width (4); - Gtk::Label* lreloadneeded1 = Gtk::manage (new Gtk::Label (M("PREFERENCES_IMG_RELOAD_NEEDED"), Gtk::ALIGN_LEFT)); + Gtk::Label* lreloadneeded1 = Gtk::manage (new Gtk::Label (M("PREFERENCES_IMG_RELOAD_NEEDED"), Gtk::ALIGN_START)); Gtk::Table* colo = Gtk::manage (new Gtk::Table (4, 2)); colo->attach (*viewlab, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 2); colo->attach (*view, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL | Gtk::SHRINK, Gtk::SHRINK, 2, 2); @@ -791,10 +789,10 @@ Gtk::Widget* Preferences::getGeneralPanel () Gtk::HBox* hbworkflow = Gtk::manage (new Gtk::HBox (false, 4)); Gtk::Label* flayoutlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_EDITORLAYOUT") + ":")); editorLayout = Gtk::manage (new Gtk::ComboBoxText ()); - editorLayout->append_text (M("PREFERENCES_SINGLETAB")); - editorLayout->append_text (M("PREFERENCES_SINGLETABVERTAB")); - editorLayout->append_text (M("PREFERENCES_MULTITAB")); - editorLayout->append_text (M("PREFERENCES_MULTITABDUALMON")); + editorLayout->append (M("PREFERENCES_SINGLETAB")); + editorLayout->append (M("PREFERENCES_SINGLETABVERTAB")); + editorLayout->append (M("PREFERENCES_MULTITAB")); + editorLayout->append (M("PREFERENCES_MULTITABDUALMON")); editorLayout->set_active (2); editorLayout->signal_changed().connect (sigc::mem_fun(*this, &Preferences::layoutComboChanged)); layoutComboChanged(); // update the tooltip @@ -808,10 +806,10 @@ Gtk::Widget* Preferences::getGeneralPanel () Gtk::Label* curveBBoxPosL = Gtk::manage (new Gtk::Label (M("PREFERENCES_CURVEBBOXPOS") + ":")); Gtk::Label* curveBBoxPosRestartL = Gtk::manage (new Gtk::Label (Glib::ustring("(") + M("PREFERENCES_APPLNEXTSTARTUP") + ")")); curveBBoxPosC = Gtk::manage (new Gtk::ComboBoxText ()); - curveBBoxPosC->append_text (M("PREFERENCES_CURVEBBOXPOS_ABOVE")); - curveBBoxPosC->append_text (M("PREFERENCES_CURVEBBOXPOS_RIGHT")); - curveBBoxPosC->append_text (M("PREFERENCES_CURVEBBOXPOS_BELOW")); - curveBBoxPosC->append_text (M("PREFERENCES_CURVEBBOXPOS_LEFT")); + curveBBoxPosC->append (M("PREFERENCES_CURVEBBOXPOS_ABOVE")); + curveBBoxPosC->append (M("PREFERENCES_CURVEBBOXPOS_RIGHT")); + curveBBoxPosC->append (M("PREFERENCES_CURVEBBOXPOS_BELOW")); + curveBBoxPosC->append (M("PREFERENCES_CURVEBBOXPOS_LEFT")); curveBBoxPosC->set_active (1); curveBBoxPosHB->pack_start (*curveBBoxPosL, Gtk::PACK_SHRINK); curveBBoxPosHB->pack_start (*curveBBoxPosC); @@ -859,7 +857,7 @@ Gtk::Widget* Preferences::getGeneralPanel () for (size_t i = 0; i < langs.size(); i++) { if ("default" != langs[i] && "README" != langs[i] && "LICENSE" != langs[i]) { - languages->append_text (langs[i]); + languages->append (langs[i]); } } @@ -907,7 +905,7 @@ Gtk::Widget* Preferences::getGeneralPanel () parseDir (argv0 + "/themes", themes, ".gtkrc"); for (size_t i = 0; i < themes.size(); i++) { - theme->append_text (themes[i]); + theme->append (themes[i]); } Gtk::Label* fontlab = Gtk::manage( new Gtk::Label (M("PREFERENCES_SELECTFONT") + ":") ); @@ -979,7 +977,7 @@ Gtk::Widget* Preferences::getGeneralPanel () navigationVBox->set_border_width(4); Gtk::HBox* panFactorHBox = Gtk::manage( new Gtk::HBox () ); - Gtk::Label* panFactorLabel = Gtk::manage( new Gtk::Label (M("PREFERENCES_PANFACTORLABEL") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* panFactorLabel = Gtk::manage( new Gtk::Label (M("PREFERENCES_PANFACTORLABEL") + ":", Gtk::ALIGN_START)); panFactor = Gtk::manage( new Gtk::SpinButton () ); panFactor->set_digits (0); panFactor->set_increments (1, 5); @@ -1077,7 +1075,7 @@ Gtk::Widget* Preferences::getFileBrowserPanel () sdother = Gtk::manage( new Gtk::RadioButton (M("PREFERENCES_DIROTHER") + ": ") ); startupdir = Gtk::manage( new Gtk::Entry () ); - Gtk::Button* sdselect = Gtk::manage( new Gtk::Button ("") ); + Gtk::Button* sdselect = Gtk::manage( new Gtk::Button () ); sdselect->set_image (*Gtk::manage(new RTImage ("gtk-open.png"))); Gtk::RadioButton::Group opts = sdcurrent->get_group(); @@ -1119,7 +1117,7 @@ Gtk::Widget* Preferences::getFileBrowserPanel () vbro->set_border_width (4); vbro->pack_start (*showDateTime, Gtk::PACK_SHRINK, 0); - Gtk::Label* dflab = Gtk::manage( new Gtk::Label (M("PREFERENCES_DATEFORMAT") + ":", Gtk::ALIGN_LEFT)); + Gtk::Label* dflab = Gtk::manage( new Gtk::Label (M("PREFERENCES_DATEFORMAT") + ":", Gtk::ALIGN_START)); dateformat = Gtk::manage( new Gtk::Entry () ); dateformat->set_tooltip_markup (M("PREFERENCES_DATEFORMATHINT")); dflab->set_tooltip_markup (M("PREFERENCES_DATEFORMATHINT")); @@ -1174,6 +1172,7 @@ Gtk::Widget* Preferences::getFileBrowserPanel () hb0->pack_start (*elab, Gtk::PACK_SHRINK, 4); extension = Gtk::manage( new Gtk::Entry () ); extension->set_width_chars(5); + extension->set_max_width_chars(5); hb0->pack_start (*extension); addExt = Gtk::manage( new Gtk::Button () ); delExt = Gtk::manage( new Gtk::Button () ); @@ -1379,16 +1378,16 @@ void Preferences::storePreferences () moptions.slimUI = slimUI->get_active (); moptions.useSystemTheme = chUseSystemTheme->get_active (); - Gdk::Color cropCol = butCropCol->get_color(); - moptions.cutOverlayBrush[0] = cropCol.get_red_p(); - moptions.cutOverlayBrush[1] = cropCol.get_green_p(); - moptions.cutOverlayBrush[2] = cropCol.get_blue_p(); + Gdk::RGBA cropCol = butCropCol->get_rgba(); + moptions.cutOverlayBrush[0] = cropCol.get_red(); + moptions.cutOverlayBrush[1] = cropCol.get_green(); + moptions.cutOverlayBrush[2] = cropCol.get_blue(); moptions.cutOverlayBrush[3] = butCropCol->get_alpha() / 65535.0; - Gdk::Color NavGuideCol = butNavGuideCol->get_color(); - moptions.navGuideBrush[0] = NavGuideCol.get_red_p(); - moptions.navGuideBrush[1] = NavGuideCol.get_green_p(); - moptions.navGuideBrush[2] = NavGuideCol.get_blue_p(); + Gdk::RGBA NavGuideCol = butNavGuideCol->get_rgba(); + moptions.navGuideBrush[0] = NavGuideCol.get_red(); + moptions.navGuideBrush[1] = NavGuideCol.get_green(); + moptions.navGuideBrush[2] = NavGuideCol.get_blue(); moptions.navGuideBrush[3] = butNavGuideCol->get_alpha() / 65535.0; moptions.font = fontbutton->get_font_name(); @@ -1578,14 +1577,14 @@ void Preferences::fillPreferences () slimUI->set_active(moptions.slimUI); chUseSystemTheme->set_active(moptions.useSystemTheme); - Gdk::Color cropCol; - cropCol.set_rgb_p(moptions.cutOverlayBrush[0], moptions.cutOverlayBrush[1], moptions.cutOverlayBrush[2]); - butCropCol->set_color(cropCol); + Gdk::RGBA cropCol; + cropCol.set_rgba(moptions.cutOverlayBrush[0], moptions.cutOverlayBrush[1], moptions.cutOverlayBrush[2]); + butCropCol->set_rgba(cropCol); butCropCol->set_alpha ( (unsigned short)(moptions.cutOverlayBrush[3] * 65535.0)); - Gdk::Color NavGuideCol; - NavGuideCol.set_rgb_p(moptions.navGuideBrush[0], moptions.navGuideBrush[1], moptions.navGuideBrush[2]); - butNavGuideCol->set_color(NavGuideCol); + Gdk::RGBA NavGuideCol; + NavGuideCol.set_rgba(moptions.navGuideBrush[0], moptions.navGuideBrush[1], moptions.navGuideBrush[2]); + butNavGuideCol->set_rgba(NavGuideCol); butNavGuideCol->set_alpha ( (unsigned short)(moptions.navGuideBrush[3] * 65535.0)); fontbutton->set_font_name(moptions.font); @@ -1809,8 +1808,8 @@ void Preferences::selectStartupDir () // dialog.set_transient_for(*this); //Add response buttons the the dialog: - dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::StockID("gtk-open"), Gtk::RESPONSE_OK); + dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + dialog.add_button(M("GENERAL_OPEN"), Gtk::RESPONSE_OK); int result = dialog.run(); @@ -1954,33 +1953,44 @@ void Preferences::fontChanged () void Preferences::switchThemeTo(Glib::ustring newTheme, bool slimInterface) { - std::vector files; - files.push_back (argv0 + "/themes/" + newTheme + ".gtkrc"); + Glib::ustring filename(argv0 + "/themes/" + options.theme + ".css"); + + if (!css) { + css = Gtk::CssProvider::create(); + } + + try { + css->load_from_path (filename); + } catch (Glib::Error &err) { + printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str()); + } catch (...) { + printf("Error: Can't load css file \"%s\"\n", filename.c_str()); + } options.slimUI = slimInterface; if (slimInterface) { - files.push_back (argv0 + "/themes/slim"); - } + if (!cssSlim) { + cssSlim = Gtk::CssProvider::create(); + } - Gtk::RC::set_default_files (files); + filename = argv0 + "/themes/slim.css"; -#ifndef WIN32 - // For an unknown reason, gtkmm 2.22 don't know the gtk-button-images property, while it exists in the documentation... - // Anyway, the problem was Linux only - static Glib::RefPtr settings = Gtk::Settings::get_default(); - - if (settings) { - settings->property_gtk_button_images().set_value(true); + try { + cssSlim->load_from_path (filename); + } catch (Glib::Error &err) { + printf("Error: Can't load css file \"%s\"\nMessage: %s\n", filename.c_str(), err.what().c_str()); + } catch (...) { + printf("Error: Can't load css file \"%s\"\n", filename.c_str()); + } } else { - printf("Error: no default settings to update!\n"); + if (cssSlim) { + // remove the slim CSS provider + Glib::RefPtr screen = Gdk::Screen::get_default(); + Gtk::StyleContext::remove_provider_for_screen(screen, cssSlim); + cssSlim.reset(); + } } - -#endif - - Gtk::RC::reparse_all (Gtk::Settings::get_default()); - GdkEventClient event = { GDK_CLIENT_EVENT, NULL, TRUE, gdk_atom_intern("_GTK_READ_RCFILES", FALSE), 8 }; - gdk_event_send_clientmessage_toall ((GdkEvent*)&event); } void Preferences::workflowUpdate () @@ -1992,7 +2002,7 @@ void Preferences::workflowUpdate () parent->SetMainCurrent(); if(moptions.tabbedUI) { - parent->epanel->hide_all(); + parent->epanel->hide(); parent->set_title_decorated(""); } else { parent->epanel->show_all(); @@ -2030,11 +2040,26 @@ void Preferences::workflowUpdate () void Preferences::switchFontTo(Glib::ustring newFont) { - Gtk::RC::parse_string (Glib::ustring::compose( - "style \"clearlooks-default\" { font_name = \"%1\" }", newFont)); - Gtk::RC::reparse_all (Gtk::Settings::get_default()); - GdkEventClient event = { GDK_CLIENT_EVENT, NULL, TRUE, gdk_atom_intern("_GTK_READ_RCFILES", FALSE), 8 }; - gdk_event_send_clientmessage_toall ((GdkEvent*)&event); + if (newFont != "default") { + if (!cssForced) { + cssForced = Gtk::CssProvider::create(); + } + + try { + cssForced->load_from_data (Glib::ustring::compose("* { font: %1; }", newFont)); + } catch (Glib::Error &err) { + printf("Error: \"%s\"\n", err.what().c_str()); + } catch (...) { + printf("Error: Can't find the font named \"%s\"\n", newFont.c_str()); + } + } else { + if (cssForced) { + // remove the slim CSS provider + Glib::RefPtr screen = Gdk::Screen::get_default(); + Gtk::StyleContext::remove_provider_for_screen(screen, cssForced); + cssForced.reset(); + } + } } void Preferences::useThemeChanged() diff --git a/rtgui/previewloader.cc b/rtgui/previewloader.cc index 3fe1897ba..b0916824e 100644 --- a/rtgui/previewloader.cc +++ b/rtgui/previewloader.cc @@ -129,6 +129,7 @@ public: } if ( tmb ) { + DEBUG("Preview Ready\n"); j.listener_->previewReady(j.dir_id_, new FileBrowserEntry(tmb, j.dir_entry_)); // Issue 2406 fdn = new FileBrowserEntry(tmb,j.dir_entry_); } diff --git a/rtgui/previewwindow.cc b/rtgui/previewwindow.cc index be932df5f..e014ff19c 100644 --- a/rtgui/previewwindow.cc +++ b/rtgui/previewwindow.cc @@ -21,9 +21,12 @@ #include "imagearea.h" #include "cursormanager.h" -PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL), imageArea(NULL), imgX(0), imgY(0), imgW(0), imgH(0), zoom(0.0), isMoving(false), needsUpdate(false) +PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL), imageArea(NULL), imgX(0), imgY(0), imgW(0), imgH(0), + zoom(0.0), isMoving(false), needsUpdate(false), cursor_type(CSUndefined) { - + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_BACKGROUND); + style->add_class(GTK_STYLE_CLASS_FLAT); rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &PreviewWindow::on_resized) ); } @@ -31,7 +34,7 @@ void PreviewWindow::on_realize () { Gtk::DrawingArea::on_realize (); - add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK); + add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK); } void PreviewWindow::getObservedFrameArea (int& x, int& y, int& w, int& h) @@ -59,8 +62,14 @@ void PreviewWindow::updatePreviewImage () return; } - backBuffer = Gdk::Pixmap::create (wind, W, H, -1); - backBuffer->draw_rectangle (get_style()->get_base_gc(Gtk::STATE_NORMAL), true, 0, 0, W, H); + backBuffer = Cairo::RefPtr ( new BackBuffer(W, H, wind) ); + Cairo::RefPtr surface = backBuffer->getSurface(); + Glib::RefPtr style = get_style_context(); + Cairo::RefPtr cc = Cairo::Context::create(surface); + style->render_background(cc, 0, 0, W, H); + Gdk::RGBA c = style->get_background_color(Gtk::STATE_FLAG_NORMAL); + cc->set_antialias(Cairo::ANTIALIAS_NONE); + cc->set_line_join(Cairo::LINE_JOIN_MITER); if (previewHandler) { Glib::RefPtr resPixbuf = previewHandler->getRoughImage (W, H, zoom); @@ -70,11 +79,12 @@ void PreviewWindow::updatePreviewImage () imgH = resPixbuf->get_height(); imgX = (W - imgW) / 2; imgY = (H - imgH) / 2; - backBuffer->draw_pixbuf (get_style()->get_base_gc(Gtk::STATE_NORMAL), resPixbuf, 0, 0, imgX, imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0); - Cairo::RefPtr cr = backBuffer->create_cairo_context(); + Gdk::Cairo::set_source_pixbuf(cc, resPixbuf, imgX, imgY); + cc->rectangle(imgX, imgY, imgW, imgH); + cc->fill(); if (previewHandler->getCropParams().enabled) { - drawCrop (cr, imgX, imgY, imgW, imgH, 0, 0, zoom, previewHandler->getCropParams(), true, false); + drawCrop (cc, imgX, imgY, imgW, imgH, 0, 0, zoom, previewHandler->getCropParams(), true, false); } } } @@ -97,14 +107,13 @@ void PreviewWindow::on_resized (Gtk::Allocation& req) queue_draw (); } -bool PreviewWindow::on_expose_event (GdkEventExpose* event) +bool PreviewWindow::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { if (backBuffer) { - Glib::RefPtr window = get_window(); - int bufferW, bufferH; - backBuffer->get_size (bufferW, bufferH); + bufferW = backBuffer->getWidth(); + bufferH = backBuffer->getHeight(); if (!mainCropWin && imageArea) { mainCropWin = imageArea->getMainCropWindow (); @@ -119,11 +128,10 @@ bool PreviewWindow::on_expose_event (GdkEventExpose* event) updatePreviewImage (); } - window->draw_drawable (get_style()->get_base_gc(Gtk::STATE_NORMAL), backBuffer, 0, 0, 0, 0, -1, -1); + backBuffer->copySurface(cr, NULL); if (mainCropWin && zoom > 0.0) { if(mainCropWin->getZoom() > mainCropWin->cropHandler.getFitZoom()) { - Cairo::RefPtr cr = get_window()->create_cairo_context(); int x, y, w, h; getObservedFrameArea (x, y, w, h); double rectX = x + 0.5; @@ -133,7 +141,8 @@ bool PreviewWindow::on_expose_event (GdkEventExpose* event) // draw a black "shadow" line cr->set_source_rgba (0.0, 0.0, 0.0, 0.65); - cr->set_line_width (1); + cr->set_line_width (1.); + cr->set_line_join(Cairo::LINE_JOIN_MITER); cr->rectangle (rectX + 1., rectY + 1, rectW, rectH); cr->stroke (); @@ -191,18 +200,26 @@ bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event) return true; } + if(mainCropWin->getZoom() > mainCropWin->cropHandler.getFitZoom()) { int x, y, w, h; getObservedFrameArea (x, y, w, h); bool inside = event->x > x - 6 && event->x < x + w - 1 + 6 && event->y > y - 6 && event->y < y + h - 1 + 6; bool moreInside = event->x > x + 6 && event->x < x + w - 1 - 6 && event->y > y + 6 && event->y < y + h - 1 - 6; + CursorShape newType = cursor_type; + if (isMoving) { mainCropWin->remoteMove ((event->x - press_x) / zoom, (event->y - press_y) / zoom); } else if (inside && !moreInside) { - cursorManager.setCursor (get_window(), CSClosedHand); + newType = CSClosedHand; } else { - cursorManager.setCursor (get_window(), CSArrow); + newType = CSArrow; + } + + if (newType != cursor_type) { + cursor_type = newType; + CursorManager::setWidgetCursor(get_window(), cursor_type); } } @@ -234,7 +251,10 @@ bool PreviewWindow::on_button_press_event (GdkEventButton* event) press_y = event->y; } - cursorManager.setCursor (get_window(), CSClosedHand); + if (cursor_type != CSClosedHand) { + cursor_type = CSClosedHand; + CursorManager::setWidgetCursor(get_window(), cursor_type); + } } } @@ -250,7 +270,12 @@ bool PreviewWindow::on_button_release_event (GdkEventButton* event) if (isMoving) { isMoving = false; - cursorManager.setCursor (get_window(), CSArrow); + + if (cursor_type != CSArrow) { + cursor_type = CSArrow; + CursorManager::setWidgetCursor(get_window(), cursor_type); + } + mainCropWin->remoteMoveReady (); } diff --git a/rtgui/previewwindow.h b/rtgui/previewwindow.h index 275f4bbe3..c1849e87c 100644 --- a/rtgui/previewwindow.h +++ b/rtgui/previewwindow.h @@ -22,12 +22,14 @@ #include #include "previewhandler.h" #include "cropwindow.h" +#include "guiutils.h" +#include "cursormanager.h" class PreviewWindow : public Gtk::DrawingArea, public PreviewListener, public CropWindowListener { private: - Glib::RefPtr backBuffer; + Cairo::RefPtr backBuffer; PreviewHandler* previewHandler; sigc::connection rconn; CropWindow* mainCropWin; @@ -37,6 +39,7 @@ private: int press_x, press_y; bool isMoving; bool needsUpdate; + CursorShape cursor_type; void updatePreviewImage (); void getObservedFrameArea (int& x, int& y, int& w, int& h); @@ -49,7 +52,7 @@ public: void on_realize (); void on_resized (Gtk::Allocation& req); - bool on_expose_event (GdkEventExpose* event); + bool on_draw (const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_motion_notify_event (GdkEventMotion* event); bool on_button_press_event (GdkEventButton* event); bool on_button_release_event(GdkEventButton* event); diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index eb655f424..2fcab9cff 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -40,7 +40,7 @@ void ProfilePanel::cleanup () delete partialProfileDlg; } -ProfilePanel::ProfilePanel (bool readOnly) : storedPProfile(NULL), lastFilename(""), imagePath("") +ProfilePanel::ProfilePanel () : storedPProfile(NULL), lastFilename(""), imagePath("") { tpc = NULL; @@ -52,62 +52,45 @@ ProfilePanel::ProfilePanel (bool readOnly) : storedPProfile(NULL), lastFilename( fillMode->add( options.filledProfile ? *profileFillModeOnImage : *profileFillModeOffImage ); fillMode->signal_toggled().connect ( sigc::mem_fun(*this, &ProfilePanel::profileFillModeToggled) ); fillMode->set_tooltip_text(M("PROFILEPANEL_MODE_TIP")); + setExpandAlignProperties(fillMode, false, true, Gtk::ALIGN_START, Gtk::ALIGN_FILL); // Create the Combobox profiles = Gtk::manage (new ProfileStoreComboBox ()); + setExpandAlignProperties(profiles, true, true, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL); - Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox ()); - hbox->show (); -// pack_start (*profiles, Gtk::PACK_SHRINK, 4); + Gtk::Grid* hgrid = Gtk::manage (new Gtk::Grid ()); + hgrid->show (); + setExpandAlignProperties(hgrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); - pack_start (*hbox, Gtk::PACK_SHRINK, 4); + pack_start (*hgrid, Gtk::PACK_SHRINK, 4); load = Gtk::manage (new Gtk::Button ()); load->add (*Gtk::manage (new RTImage ("gtk-open.png"))); - - if (!readOnly) { - save = Gtk::manage (new Gtk::Button ()); - } - - if (!readOnly) { - save->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); - } - - if (!readOnly) { - copy = Gtk::manage (new Gtk::Button ()); - } - - if (!readOnly) { - copy->add (*Gtk::manage (new RTImage ("edit-copy.png"))); - } - + load->get_style_context()->add_class("Left"); + setExpandAlignProperties(load, false, true, Gtk::ALIGN_END, Gtk::ALIGN_FILL); + save = Gtk::manage (new Gtk::Button ()); + save->add (*Gtk::manage (new RTImage ("gtk-save-large.png"))); + save->get_style_context()->add_class("MiddleH"); + setExpandAlignProperties(save, false, true, Gtk::ALIGN_END, Gtk::ALIGN_FILL); + copy = Gtk::manage (new Gtk::Button ()); + copy->add (*Gtk::manage (new RTImage ("edit-copy.png"))); + copy->get_style_context()->add_class("MiddleH"); + setExpandAlignProperties(copy, false, true, Gtk::ALIGN_END, Gtk::ALIGN_FILL); paste = Gtk::manage (new Gtk::Button ()); paste->add (*Gtk::manage (new RTImage ("edit-paste.png"))); + paste->get_style_context()->add_class("Right"); + setExpandAlignProperties(paste, false, true, Gtk::ALIGN_END, Gtk::ALIGN_FILL); - hbox->pack_start (*fillMode, Gtk::PACK_SHRINK, 1); - hbox->pack_start (*profiles); - hbox->pack_start (*load, Gtk::PACK_SHRINK, 1); - - if (!readOnly) { - hbox->pack_start (*save, Gtk::PACK_SHRINK, 1); - } - - hbox->pack_start (*copy, Gtk::PACK_SHRINK, 1); - - if (!readOnly) { - hbox->pack_start (*paste, Gtk::PACK_SHRINK, 1); - } + hgrid->attach (*fillMode, 0, 0, 1, 1); + hgrid->attach (*profiles, 1, 0, 1, 1); + hgrid->attach (*load, 2, 0, 1, 1); + hgrid->attach (*save, 3, 0, 1, 1); + hgrid->attach (*copy, 4, 0, 1, 1); + hgrid->attach (*paste, 5, 0, 1, 1); load->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &ProfilePanel::load_clicked) ); - - if (!readOnly) { - save->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &ProfilePanel::save_clicked) ); - } - - if (!readOnly) { - copy->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &ProfilePanel::copy_clicked) ); - } - + save->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &ProfilePanel::save_clicked) ); + copy->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &ProfilePanel::copy_clicked) ); paste->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &ProfilePanel::paste_clicked) ); custom = NULL; @@ -119,15 +102,8 @@ ProfilePanel::ProfilePanel (bool readOnly) : storedPProfile(NULL), lastFilename( changeconn = profiles->signal_changed().connect( sigc::mem_fun(*this, &ProfilePanel::selection_changed) ); load->set_tooltip_markup (M("PROFILEPANEL_TOOLTIPLOAD")); - - if (!readOnly) { - save->set_tooltip_markup (M("PROFILEPANEL_TOOLTIPSAVE")); - } - - if (!readOnly) { - copy->set_tooltip_markup (M("PROFILEPANEL_TOOLTIPCOPY")); - } - + save->set_tooltip_markup (M("PROFILEPANEL_TOOLTIPSAVE")); + copy->set_tooltip_markup (M("PROFILEPANEL_TOOLTIPCOPY")); paste->set_tooltip_markup (M("PROFILEPANEL_TOOLTIPPASTE")); show_all_children (); @@ -313,19 +289,19 @@ void ProfilePanel::save_clicked (GdkEventButton* event) } catch (Glib::Error &err) {} //Add response buttons the the dialog: - dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::StockID("gtk-save"), Gtk::RESPONSE_OK); + dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + dialog.add_button(M("GENERAL_SAVE"), Gtk::RESPONSE_OK); //Add filters, so that only certain file types can be selected: - Gtk::FileFilter filter_pp; - filter_pp.set_name(M("FILECHOOSER_FILTER_PP")); - filter_pp.add_pattern("*" + paramFileExtension); + Glib::RefPtr filter_pp = Gtk::FileFilter::create(); + filter_pp->set_name(M("FILECHOOSER_FILTER_PP")); + filter_pp->add_pattern("*" + paramFileExtension); dialog.add_filter(filter_pp); - Gtk::FileFilter filter_any; - filter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - filter_any.add_pattern("*"); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); + filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + filter_any->add_pattern("*"); dialog.add_filter(filter_any); // dialog.set_do_overwrite_confirmation (true); @@ -488,19 +464,19 @@ void ProfilePanel::load_clicked (GdkEventButton* event) } catch (Glib::Error &err) {} //Add response buttons the the dialog: - dialog.add_button(Gtk::StockID("gtk-cancel"), Gtk::RESPONSE_CANCEL); - dialog.add_button(Gtk::StockID("gtk-open"), Gtk::RESPONSE_OK); + dialog.add_button(M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); + dialog.add_button(M("GENERAL_OPEN"), Gtk::RESPONSE_OK); //Add filters, so that only certain file types can be selected: - Gtk::FileFilter filter_pp; - filter_pp.set_name(M("FILECHOOSER_FILTER_PP")); - filter_pp.add_pattern("*" + paramFileExtension); + Glib::RefPtr filter_pp = Gtk::FileFilter::create(); + filter_pp->set_name(M("FILECHOOSER_FILTER_PP")); + filter_pp->add_pattern("*" + paramFileExtension); dialog.add_filter(filter_pp); - Gtk::FileFilter filter_any; - filter_any.set_name(M("FILECHOOSER_FILTER_ANY")); - filter_any.add_pattern("*"); + Glib::RefPtr filter_any = Gtk::FileFilter::create(); + filter_any->set_name(M("FILECHOOSER_FILTER_ANY")); + filter_any->add_pattern("*"); dialog.add_filter(filter_any); int result = dialog.run(); diff --git a/rtgui/profilepanel.h b/rtgui/profilepanel.h index 9bcc79196..fb9054014 100644 --- a/rtgui/profilepanel.h +++ b/rtgui/profilepanel.h @@ -69,7 +69,7 @@ protected: public: - ProfilePanel (bool readOnly = false); + ProfilePanel (); virtual ~ProfilePanel (); void setProfileChangeListener (ProfileChangeListener* ppl) diff --git a/rtgui/prsharpening.cc b/rtgui/prsharpening.cc index 22a70e8a4..061f41431 100644 --- a/rtgui/prsharpening.cc +++ b/rtgui/prsharpening.cc @@ -38,8 +38,8 @@ PrSharpening::PrSharpening () : FoldableToolPanel(this, "prsharpening", M("TP_PR Gtk::Label* ml = Gtk::manage (new Gtk::Label (M("TP_SHARPENING_METHOD") + ":")); ml->show (); method = Gtk::manage (new MyComboBoxText ()); - method->append_text (M("TP_SHARPENING_USM")); - method->append_text (M("TP_SHARPENING_RLD")); + method->append (M("TP_SHARPENING_USM")); + method->append (M("TP_SHARPENING_RLD")); method->show (); hb->pack_start(*ml, Gtk::PACK_SHRINK, 4); hb->pack_start(*method); @@ -466,7 +466,7 @@ void PrSharpening::setBatchMode (bool batchMode) damount->showEditedCB (); ddamping->showEditedCB (); diter->showEditedCB (); - method->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); } void PrSharpening::setAdjusterBehavior (bool amountadd) diff --git a/rtgui/recentbrowser.cc b/rtgui/recentbrowser.cc index 80d56de4d..04efadccd 100644 --- a/rtgui/recentbrowser.cc +++ b/rtgui/recentbrowser.cc @@ -31,7 +31,7 @@ RecentBrowser::RecentBrowser () : listener (NULL) frame->add (*recentDirs); for(size_t i = 0; i < options.recentFolders.size(); i++) { - recentDirs->append_text (options.recentFolders[i]); + recentDirs->append (options.recentFolders[i]); } pack_start (*frame, Gtk::PACK_SHRINK, 4); @@ -55,11 +55,10 @@ void RecentBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustri { size_t numFolders = options.recentFolders.size(); + size_t i; if(numFolders > 0) { // search entry and move to top if it exists - size_t i; - - for(i = 0; i < numFolders; i++) { + for(i = 0; i < numFolders; ++i) { if(options.recentFolders[i] == dirname) { break; } @@ -78,10 +77,12 @@ void RecentBrowser::dirSelected (const Glib::ustring& dirname, const Glib::ustri conn.block (true); - recentDirs->remove_text (dirname); - recentDirs->prepend_text (dirname); + if (i > 0) { + recentDirs->remove_text (i); + } + + recentDirs->prepend (dirname); recentDirs->set_active_text (dirname); conn.block (false); } - diff --git a/rtgui/renamedlg.cc b/rtgui/renamedlg.cc index a33011f09..b3753b1f1 100644 --- a/rtgui/renamedlg.cc +++ b/rtgui/renamedlg.cc @@ -22,7 +22,7 @@ #include "rtimage.h" RenameDialog::RenameDialog (Gtk::Window* parent) - : Gtk::Dialog (M("FILEBROWSER_RENAMEDLGLABEL"), *parent, true, true), p(parent), imageData(NULL) + : Gtk::Dialog (M("FILEBROWSER_RENAMEDLGLABEL"), *parent, true), p(parent), imageData(NULL) { Gtk::Table* names = Gtk::manage (new Gtk::Table (2, 2)); @@ -36,7 +36,7 @@ RenameDialog::RenameDialog (Gtk::Window* parent) names->attach (*nnlab, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2); names->attach (*newName, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); - get_vbox()->pack_start (*names, Gtk::PACK_SHRINK, 4); + get_content_area()->pack_start (*names, Gtk::PACK_SHRINK, 4); // Issue 316 // Gtk::HBox* tbox = Gtk::manage (new Gtk::HBox()); @@ -49,7 +49,7 @@ RenameDialog::RenameDialog (Gtk::Window* parent) // tbox->pack_start (*useTmpl, Gtk::PACK_SHRINK, 4); // tbox->pack_start (*templates); -// get_vbox()->pack_start (*tbox, Gtk::PACK_SHRINK, 4); +// get_content_area()->pack_start (*tbox, Gtk::PACK_SHRINK, 4); add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); @@ -168,12 +168,12 @@ void RenameDialog::tmplSelectionChanged () } RenameTemplateEditor::RenameTemplateEditor (Gtk::Window* parent) - : Gtk::Dialog ("Edit rename templates", *parent, true, true) + : Gtk::Dialog ("Edit rename templates", *parent, true) { list = Gtk::manage (new Gtk::ListViewText (1, false, Gtk::SELECTION_MULTIPLE)); list->set_headers_visible (false); - get_vbox ()->pack_start (*list); + get_content_area ()->pack_start (*list); Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ()); templ = Gtk::manage (new Gtk::Entry ()); @@ -185,7 +185,7 @@ RenameTemplateEditor::RenameTemplateEditor (Gtk::Window* parent) hb->pack_start (*add, Gtk::PACK_SHRINK, 2); hb->pack_start (*del, Gtk::PACK_SHRINK, 2); - get_vbox ()->pack_start (*hb, Gtk::PACK_SHRINK, 4); + get_content_area ()->pack_start (*hb, Gtk::PACK_SHRINK, 4); add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); @@ -202,10 +202,10 @@ RenameTemplateEditor::RenameTemplateEditor (Gtk::Window* parent) void RenameTemplateEditor::refreshTemplateList () { - list->clear_items (); + list->remove_all_columns(); for (size_t i = 0; i < options.renameTemplates.size(); i++) { - list->append_text (options.renameTemplates[i]); + list->append (options.renameTemplates[i]); } } diff --git a/rtgui/resize.cc b/rtgui/resize.cc index 231f84659..25dd85850 100644 --- a/rtgui/resize.cc +++ b/rtgui/resize.cc @@ -32,8 +32,8 @@ Resize::Resize () : FoldableToolPanel(this, "resize", M("TP_RESIZE_LABEL"), fals Gtk::Label *label = NULL; appliesTo = Gtk::manage (new MyComboBoxText ()); - appliesTo->append_text (M("TP_RESIZE_CROPPEDAREA")); - appliesTo->append_text (M("TP_RESIZE_FULLIMAGE")); + appliesTo->append (M("TP_RESIZE_CROPPEDAREA")); + appliesTo->append (M("TP_RESIZE_FULLIMAGE")); appliesTo->set_active (0); label = Gtk::manage (new Gtk::Label (M("TP_RESIZE_APPLIESTO"))); @@ -43,8 +43,8 @@ Resize::Resize () : FoldableToolPanel(this, "resize", M("TP_RESIZE_LABEL"), fals // See Resize::methodChanged() when adding a new method. method = Gtk::manage (new MyComboBoxText ()); - method->append_text (M("TP_RESIZE_LANCZOS")); - method->append_text (M("TP_RESIZE_NEAREST")); + method->append (M("TP_RESIZE_LANCZOS")); + method->append (M("TP_RESIZE_NEAREST")); method->set_active (0); label = Gtk::manage (new Gtk::Label (M("TP_RESIZE_METHOD"))); @@ -53,10 +53,10 @@ Resize::Resize () : FoldableToolPanel(this, "resize", M("TP_RESIZE_LABEL"), fals combos->attach (*method, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); spec = Gtk::manage (new MyComboBoxText ()); - spec->append_text (M("TP_RESIZE_SCALE")); - spec->append_text (M("TP_RESIZE_WIDTH")); - spec->append_text (M("TP_RESIZE_HEIGHT")); - spec->append_text (M("TP_RESIZE_FITBOX")); + spec->append (M("TP_RESIZE_SCALE")); + spec->append (M("TP_RESIZE_WIDTH")); + spec->append (M("TP_RESIZE_HEIGHT")); + spec->append (M("TP_RESIZE_FITBOX")); spec->set_active (0); label = Gtk::manage (new Gtk::Label (M("TP_RESIZE_SPECIFY"))); @@ -593,8 +593,8 @@ void Resize::notifyBBox() void Resize::setBatchMode (bool batchMode) { - method->append_text (M("GENERAL_UNCHANGED")); - spec->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); + spec->append (M("GENERAL_UNCHANGED")); ToolPanel::setBatchMode (batchMode); scale->showEditedCB (); } diff --git a/rtgui/rotate.cc b/rtgui/rotate.cc index e688dba62..b80f29faf 100644 --- a/rtgui/rotate.cc +++ b/rtgui/rotate.cc @@ -37,7 +37,8 @@ Rotate::Rotate () : FoldableToolPanel(this, "rotate", M("TP_ROTATE_LABEL")) degree->setAdjusterListener (this); pack_start (*degree); - selectStraight = Gtk::manage (new Gtk::Button (M("TP_ROTATE_SELECTLINE"))); + selectStraight = Gtk::manage (new Gtk::Button ()); + selectStraight->set_tooltip_text(M("TP_ROTATE_SELECTLINE")); Gtk::Image* selimg = Gtk::manage (new RTImage ("straighten-small.png")); selectStraight->set_image (*selimg); pack_start (*selectStraight, Gtk::PACK_SHRINK, 2); diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index 6472467e6..6bff33c48 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -139,7 +139,7 @@ void RTImage::setPaths(Options &opt) Glib::ustring iSet; if (keyFile.has_key ("General", "Iconset")) { - iSet = keyFile.get_string ("General", "Iconset"); + iSet = "Dark"; //keyFile.get_string ("General", "Iconset"); } if (iSet.length()) { diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index e3428dea7..53a89bec2 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -17,6 +17,7 @@ * along with RawTherapee. If not, see . */ +#include #include "rtwindow.h" #include "options.h" #include "preferences.h" @@ -133,10 +134,8 @@ RTWindow::RTWindow () } set_title_decorated(""); - property_allow_shrink() = true; set_default_size(options.windowWidth, options.windowHeight); set_modal(false); - set_resizable(true); if (options.windowMaximized) { maximize(); @@ -176,28 +175,25 @@ RTWindow::RTWindow () fpanel->setParent (this); // decorate tab + Gtk::Grid* fpanelLabelGrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(fpanelLabelGrid, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + Gtk::Label* fpl = Gtk::manage (new Gtk::Label( Glib::ustring(" ") + M("MAIN_FRAME_EDITOR") )); + if (options.mainNBVertical) { mainNB->set_tab_pos (Gtk::POS_LEFT); - - Gtk::VBox* vbf = Gtk::manage (new Gtk::VBox ()); - vbf->pack_start (*Gtk::manage (new Gtk::Image (Gtk::Stock::DIRECTORY, Gtk::ICON_SIZE_MENU))); - Gtk::Label* l = Gtk::manage(new Gtk::Label (Glib::ustring(" ") + M("MAIN_FRAME_FILEBROWSER"))); - l->set_angle (90); - vbf->pack_start (*l); - vbf->set_spacing (2); - vbf->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP")); - vbf->show_all (); - mainNB->append_page (*fpanel, *vbf); + fpl->set_angle (90); + fpanelLabelGrid->attach_next_to(*fpl, Gtk::POS_BOTTOM, 1, 1); + fpanelLabelGrid->attach_next_to(*Gtk::manage (new RTImage ("gtk-directory.png")), *fpl, Gtk::POS_TOP, 1, 1); } else { - Gtk::HBox* hbf = Gtk::manage (new Gtk::HBox ()); - hbf->pack_start (*Gtk::manage (new Gtk::Image (Gtk::Stock::DIRECTORY, Gtk::ICON_SIZE_MENU))); - hbf->pack_start (*Gtk::manage (new Gtk::Label (M("MAIN_FRAME_FILEBROWSER")))); - hbf->set_spacing (2); - hbf->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP")); - hbf->show_all (); - mainNB->append_page (*fpanel, *hbf); + fpanelLabelGrid->attach_next_to(*fpl, Gtk::POS_LEFT, 1, 1); + fpanelLabelGrid->attach_next_to(*Gtk::manage (new RTImage ("gtk-directory.png")), *fpl, Gtk::POS_RIGHT, 1, 1); } + fpanelLabelGrid->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP")); + fpanelLabelGrid->show_all (); + mainNB->append_page (*fpanel, *fpanelLabelGrid); + + bpanel = Gtk::manage ( new BatchQueuePanel (fpanel->fileCatalog) ); bpanel->setParent (this); @@ -215,90 +211,86 @@ RTWindow::RTWindow () epanel->setParent (this); // decorate tab + Gtk::Grid* editorLabelGrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(editorLabelGrid, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + Gtk::Label* el = Gtk::manage (new Gtk::Label( Glib::ustring(" ") + M("MAIN_FRAME_EDITOR") )); + if (options.mainNBVertical) { - Gtk::VBox* vbe = Gtk::manage (new Gtk::VBox ()); - vbe->pack_start (*Gtk::manage (new RTImage ("rt-logo.png"))); - Gtk::Label* l = Gtk::manage (new Gtk::Label( Glib::ustring(" ") + M("MAIN_FRAME_EDITOR") )); - //l->set_markup(Glib::ustring("Editor")); Bold difficult to read - l->set_angle (90); - vbe->pack_start (*l); - vbe->set_spacing (2); - vbe->set_tooltip_markup (M("MAIN_FRAME_EDITOR_TOOLTIP")); - vbe->show_all (); - epanel->tbTopPanel_1_visible(true); //show the toggle Top Panel button - mainNB->append_page (*epanel, *vbe); + el->set_angle (90); + editorLabelGrid->attach_next_to(*el, Gtk::POS_BOTTOM, 1, 1); + editorLabelGrid->attach_next_to(*Gtk::manage (new RTImage ("rt-logo.png")), *el, Gtk::POS_TOP, 1, 1); } else { - Gtk::HBox* hbe = Gtk::manage (new Gtk::HBox ()); - hbe->pack_start (*Gtk::manage (new RTImage ("rt-logo.png"))); - hbe->pack_start (*Gtk::manage (new Gtk::Label( Glib::ustring(" ") + M("MAIN_FRAME_EDITOR") ))); - hbe->set_spacing (2); - hbe->set_tooltip_markup (M("MAIN_FRAME_EDITOR_TOOLTIP")); - hbe->show_all (); - epanel->tbTopPanel_1_visible(true); //show the toggle Top Panel button - mainNB->append_page (*epanel, *hbe); + editorLabelGrid->attach_next_to(*el, Gtk::POS_LEFT, 1, 1); + editorLabelGrid->attach_next_to(*Gtk::manage (new RTImage ("rt-logo.png")), *el, Gtk::POS_RIGHT, 1, 1); } + editorLabelGrid->set_tooltip_markup (M("MAIN_FRAME_EDITOR_TOOLTIP")); + editorLabelGrid->show_all (); + epanel->tbTopPanel_1_visible(true); //show the toggle Top Panel button + mainNB->append_page (*epanel, *editorLabelGrid); + mainNB->set_current_page (mainNB->page_num (*fpanel)); - Gtk::VBox* mainBox = Gtk::manage (new Gtk::VBox ()); - mainBox->pack_start (*mainNB); + //Gtk::VBox* mainBox = Gtk::manage (new Gtk::VBox ()); + //mainBox->pack_start (*mainNB); // filling bottom box iFullscreen = new RTImage ("fullscreen.png"); iFullscreen_exit = new RTImage ("fullscreen-exit.png"); - Gtk::LinkButton* rtWeb = Gtk::manage (new Gtk::LinkButton ("http://rawtherapee.com")); + //Gtk::LinkButton* rtWeb = Gtk::manage (new Gtk::LinkButton ("http://rawtherapee.com")); // unused... but fail to be linked anyway !? //Gtk::Button* preferences = Gtk::manage (new Gtk::Button (M("MAIN_BUTTON_PREFERENCES")+"...")); Gtk::Button* preferences = Gtk::manage (new Gtk::Button ()); + preferences->set_hexpand(false); + preferences->set_vexpand(false); + preferences->set_halign(Gtk::ALIGN_CENTER); + preferences->set_valign(Gtk::ALIGN_CENTER); preferences->set_image (*Gtk::manage(new RTImage ("gtk-preferences.png"))); preferences->set_tooltip_markup (M("MAIN_BUTTON_PREFERENCES")); preferences->signal_clicked().connect( sigc::mem_fun(*this, &RTWindow::showPreferences) ); //btn_fullscreen = Gtk::manage( new Gtk::Button(M("MAIN_BUTTON_FULLSCREEN"))); btn_fullscreen = Gtk::manage( new Gtk::Button()); + btn_fullscreen->set_hexpand(false); + btn_fullscreen->set_vexpand(false); + btn_fullscreen->set_halign(Gtk::ALIGN_CENTER); + btn_fullscreen->set_valign(Gtk::ALIGN_CENTER); btn_fullscreen->set_tooltip_markup (M("MAIN_BUTTON_FULLSCREEN")); btn_fullscreen->set_image (*iFullscreen); btn_fullscreen->signal_clicked().connect( sigc::mem_fun(*this, &RTWindow::toggle_fullscreen) ); -#if GTKMM_MINOR_VERSION >= 20 + setExpandAlignProperties(&prProgBar, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + prProgBar.set_show_text(true); + + Gtk::Grid* actionGrid = Gtk::manage (new Gtk::Grid ()); + setExpandAlignProperties(actionGrid, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); if (options.mainNBVertical) { - Gtk::VBox* bottomVBox = Gtk::manage (new Gtk::VBox ()); - bottomVBox->pack_start (prProgBar, Gtk::PACK_SHRINK, 1); - bottomVBox->pack_end (*preferences, Gtk::PACK_SHRINK, 0); - bottomVBox->pack_end (*btn_fullscreen, Gtk::PACK_EXPAND_WIDGET, 1); - prProgBar.set_orientation(Gtk::PROGRESS_BOTTOM_TO_TOP); - mainNB->set_action_widget( bottomVBox, Gtk::PACK_END); - bottomVBox->show_all(); + actionGrid->attach_next_to(*btn_fullscreen, Gtk::POS_BOTTOM, 1, 1); + actionGrid->attach_next_to(*preferences, *btn_fullscreen, Gtk::POS_TOP, 1, 1); + actionGrid->attach_next_to(prProgBar, *preferences, Gtk::POS_TOP, 1, 1); + prProgBar.set_orientation(Gtk::ORIENTATION_VERTICAL); + //prProgBar.set_halign(Gtk::ALIGN_FILL); prProgBar.set_valign(Gtk::ALIGN_FILL); + mainNB->set_action_widget(actionGrid, Gtk::PACK_END); } else { - Gtk::HBox* bottomHBox = Gtk::manage (new Gtk::HBox ()); - bottomHBox->pack_end (*btn_fullscreen, Gtk::PACK_SHRINK, 1); - bottomHBox->pack_end (*preferences, Gtk::PACK_SHRINK, 0); - bottomHBox->pack_start (prProgBar, Gtk::PACK_EXPAND_WIDGET, 1); - mainNB->set_action_widget( bottomHBox, Gtk::PACK_END); - bottomHBox->show_all(); + actionGrid->attach_next_to(*btn_fullscreen, Gtk::POS_RIGHT, 1, 1); + actionGrid->attach_next_to(*preferences, *btn_fullscreen, Gtk::POS_LEFT, 1, 1); + actionGrid->attach_next_to(prProgBar, *preferences, Gtk::POS_LEFT, 1, 1); + prProgBar.set_orientation(Gtk::ORIENTATION_HORIZONTAL); + //prProgBar.set_halign(Gtk::ALIGN_FILL); prProgBar.set_valign(Gtk::ALIGN_FILL); + mainNB->set_action_widget(actionGrid, Gtk::PACK_END); } -#else - Gtk::HBox* bottomBox = Gtk::manage (new Gtk::HBox ()); - bottomBox->pack_end (*btn_fullscreen, Gtk::PACK_SHRINK, 1); - bottomBox->pack_end (*preferences, Gtk::PACK_SHRINK, 0); - bottomBox->pack_start (prProgBar, Gtk::PACK_EXPAND_WIDGET, 1); - mainBox->pack_start (*bottomBox, Gtk::PACK_SHRINK, 1); -#endif + actionGrid->show_all(); pldBridge = new PLDBridge(static_cast(this)); - Glib::RefPtr style = Gtk::RcStyle::create (); - style->set_xthickness (0); - style->set_ythickness (0); - rtWeb->modify_style (style); - - add (*mainBox); + //add (*mainBox); + add (*mainNB); show_all (); } if (!isSingleTabMode() && !simpleEditor) { - epanel->hide_all(); + epanel->hide(); } } @@ -350,7 +342,7 @@ void RTWindow::on_realize () fpanel->setAspect(); } - cursorManager.init (get_window()); + mainWindowCursorManager.init(get_window()); // Check if first run of this version, then display the Release Notes text if (options.version != versionString) { @@ -404,7 +396,7 @@ bool RTWindow::on_window_state_event(GdkEventWindowState* event) return true; } -void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) +void RTWindow::on_mainNB_switch_page(Gtk::Widget* widget, guint page_num) { if(!on_delete_has_run) { if(isEditorPanel(page_num)) { @@ -454,11 +446,8 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) closeb->set_relief (Gtk::RELIEF_NONE); closeb->set_focus_on_click (false); // make the button as small as possible - Glib::RefPtr style = Gtk::RcStyle::create (); - style->set_xthickness (0); - style->set_ythickness (0); + printf("TODO: make #tabClose as smalla s possible through css\n"); - closeb->modify_style (style); closeb->signal_clicked().connect( sigc::bind (sigc::mem_fun(*this, &RTWindow::remEditorPanel) , ep)); hb->pack_end (*closeb); hb->set_spacing (2); @@ -544,13 +533,13 @@ bool RTWindow::keyPressed (GdkEventKey* event) #if defined(__APPLE__) bool apple_cmd = event->state & GDK_MOD2_MASK; - if (event->keyval == GDK_q && apple_cmd) { + if (event->keyval == GDK_KEY_q && apple_cmd) { try_quit = true; } #else - if (event->keyval == GDK_q && ctrl) { + if (event->keyval == GDK_KEY_q && ctrl) { try_quit = true; } @@ -562,7 +551,7 @@ bool RTWindow::keyPressed (GdkEventKey* event) } } - if(event->keyval == GDK_F11) { + if(event->keyval == GDK_KEY_F11) { toggle_fullscreen(); } @@ -574,22 +563,22 @@ bool RTWindow::keyPressed (GdkEventKey* event) if (ctrl) { switch(event->keyval) { - case GDK_F2: // file browser panel + case GDK_KEY_F2: // file browser panel mainNB->set_current_page (mainNB->page_num (*fpanel)); return true; - case GDK_F3: // batch queue panel + case GDK_KEY_F3: // batch queue panel mainNB->set_current_page (mainNB->page_num (*bpanel)); return true; - case GDK_F4: //single tab mode, editor panel + case GDK_KEY_F4: //single tab mode, editor panel if (isSingleTabMode() && epanel) { mainNB->set_current_page (mainNB->page_num (*epanel)); } return true; - case GDK_w: //multi-tab mode, close editor panel + case GDK_KEY_w: //multi-tab mode, close editor panel if (!isSingleTabMode() && mainNB->get_current_page() != mainNB->page_num(*fpanel) && mainNB->get_current_page() != mainNB->page_num(*bpanel)) { diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 70e80de4d..5ea7a7946 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -82,7 +82,7 @@ public: bool keyPressed (GdkEventKey* event); bool on_delete_event(GdkEventAny* event); bool on_window_state_event(GdkEventWindowState* event); - void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num); + void on_mainNB_switch_page(Gtk::Widget* widget, guint page_num); void showPreferences (); void on_realize (); diff --git a/rtgui/saveasdlg.cc b/rtgui/saveasdlg.cc index 47957bc80..d2c079933 100644 --- a/rtgui/saveasdlg.cc +++ b/rtgui/saveasdlg.cc @@ -28,36 +28,39 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) set_title(M("GENERAL_SAVE")); - Gtk::VBox* vbox = get_vbox (); + Gtk::Box* box = get_content_area (); fchooser = Gtk::manage( new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE) ); fchooser->set_current_folder (initialDir); fchooser->signal_file_activated().connect(sigc::mem_fun(*this, &SaveAsDialog::okPressed)); - filter_jpg.set_name(M("SAVEDLG_JPGFILTER")); - filter_jpg.add_pattern("*.jpg"); - filter_jpg.add_pattern("*.JPG"); - filter_jpg.add_pattern("*.jpeg"); - filter_jpg.add_pattern("*.JPEG"); - filter_jpg.add_pattern("*.jpe"); - filter_jpg.add_pattern("*.JPE"); + filter_jpg = Gtk::FileFilter::create(); + filter_jpg->set_name(M("SAVEDLG_JPGFILTER")); + filter_jpg->add_pattern("*.jpg"); + filter_jpg->add_pattern("*.JPG"); + filter_jpg->add_pattern("*.jpeg"); + filter_jpg->add_pattern("*.JPEG"); + filter_jpg->add_pattern("*.jpe"); + filter_jpg->add_pattern("*.JPE"); - filter_tif.set_name(M("SAVEDLG_JPGFILTER")); - filter_tif.add_pattern("*.tif"); - filter_tif.add_pattern("*.TIF"); - filter_tif.add_pattern("*.tiff"); - filter_tif.add_pattern("*.TIFF"); + filter_tif = Gtk::FileFilter::create(); + filter_tif->set_name(M("SAVEDLG_JPGFILTER")); + filter_tif->add_pattern("*.tif"); + filter_tif->add_pattern("*.TIF"); + filter_tif->add_pattern("*.tiff"); + filter_tif->add_pattern("*.TIFF"); - filter_png.set_name(M("SAVEDLG_JPGFILTER")); - filter_png.add_pattern("*.png"); - filter_png.add_pattern("*.PNG"); + filter_png = Gtk::FileFilter::create(); + filter_png->set_name(M("SAVEDLG_JPGFILTER")); + filter_png->add_pattern("*.png"); + filter_png->add_pattern("*.PNG"); formatChanged (options.saveFormat.format); // Output Options // ~~~~~~~~~~~~~~ formatOpts = Gtk::manage( new SaveFormatPanel () ); - formatOpts->init (options.saveFormat); + setExpandAlignProperties(formatOpts, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); formatOpts->setListener (this); // queue/immediate @@ -97,9 +100,6 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) Gtk::Button* ok = Gtk::manage( new Gtk::Button (M("GENERAL_OK")) ); Gtk::Button* cancel = Gtk::manage( new Gtk::Button (M("GENERAL_CANCEL")) ); - ok->set_image (*Gtk::manage(new RTImage ("gtk-apply.png"))); - cancel->set_image (*Gtk::manage(new RTImage ("gtk-cancel.png"))); - ok->set_tooltip_markup (M("TP_SAVEDIALOG_OK_TIP")); ok->signal_clicked().connect( sigc::mem_fun(*this, &SaveAsDialog::okPressed) ); @@ -125,8 +125,8 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) hbox_bottom->pack_start (*Gtk::manage(new Gtk::VSeparator ()), Gtk::PACK_SHRINK, 2); hbox_bottom->pack_start (*vbox_bottomRight, Gtk::PACK_SHRINK, 2); - vbox->pack_start (*fchooser); - vbox->pack_start (*hbox_bottom, Gtk::PACK_SHRINK, 2); + box->pack_start (*fchooser); + box->pack_start (*hbox_bottom, Gtk::PACK_SHRINK, 2); get_action_area()->pack_end (*ok, Gtk::PACK_SHRINK, 4); get_action_area()->pack_end (*cancel, Gtk::PACK_SHRINK, 4); @@ -134,6 +134,8 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) set_border_width (4); show_all_children (); + formatOpts->init (options.saveFormat); + signal_key_press_event().connect( sigc::mem_fun(*this, &SaveAsDialog::keyPressed) ); } @@ -310,8 +312,8 @@ bool SaveAsDialog::keyPressed (GdkEventKey* event) if (ctrl) { switch(event->keyval) { - case GDK_Return: // Ctrl-Enter equivalent to pressing OK button - case GDK_KP_Enter: + case GDK_KEY_Return: // Ctrl-Enter equivalent to pressing OK button + case GDK_KEY_KP_Enter: SaveAsDialog::okPressed(); return true; } diff --git a/rtgui/saveasdlg.h b/rtgui/saveasdlg.h index db307e4b8..c669a62e7 100644 --- a/rtgui/saveasdlg.h +++ b/rtgui/saveasdlg.h @@ -33,9 +33,9 @@ protected: Gtk::CheckButton* forceFormatOpts; SaveFormatPanel* formatOpts; Glib::ustring fname; - Gtk::FileFilter filter_jpg; - Gtk::FileFilter filter_tif; - Gtk::FileFilter filter_png; + Glib::RefPtr filter_jpg; + Glib::RefPtr filter_tif; + Glib::RefPtr filter_png; Gtk::RadioButton* saveMethod[3]; /* 0 -> immediately * 1 -> putToQueueHead * 2 -> putToQueueTail diff --git a/rtgui/saveformatpanel.cc b/rtgui/saveformatpanel.cc index 2159f6623..b84c2424f 100644 --- a/rtgui/saveformatpanel.cc +++ b/rtgui/saveformatpanel.cc @@ -23,61 +23,102 @@ SaveFormatPanel::SaveFormatPanel () : listener (NULL) { - jpegqual = new Adjuster (M("SAVEDLG_JPEGQUAL"), 0, 100, 1, 100); - jpegqual->setAdjusterListener (this); - jpegqual->show (); - jpegSubSampBox = Gtk::manage (new Gtk::HBox ()); + // --------------------- FILE FORMAT SELECTOR - jpegSubSampHead = Gtk::manage (new Gtk::Label (M("SAVEDLG_SUBSAMP") + Glib::ustring(":")) ); - jpegSubSampHead->show (); - jpegSubSampBox->pack_start (*jpegSubSampHead, Gtk::PACK_SHRINK, 4); + + Gtk::Grid* hb1 = Gtk::manage (new Gtk::Grid ()); + hb1->set_column_spacing(5); + hb1->set_row_spacing(5); + setExpandAlignProperties(hb1, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + Gtk::Label* flab = Gtk::manage (new Gtk::Label (M("SAVEDLG_FILEFORMAT") + ":")); + setExpandAlignProperties(flab, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); + format = Gtk::manage (new MyComboBoxText ()); + setExpandAlignProperties(format, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + format->append ("JPEG (8 bit)"); + format->append ("TIFF (8 bit)"); + format->append ("TIFF (16 bit)"); + format->append ("PNG (8 bit)"); + format->append ("PNG (16 bit)"); + format->set_active (0); + format->signal_changed().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged) ); + + hb1->attach (*flab, 0, 0, 1, 1); + hb1->attach (*format, 1, 0, 1, 1); + + + // --------------------- JPEG OPTIONS + + + jpegOpts = Gtk::manage (new Gtk::Grid ()); + jpegOpts->set_column_spacing(15); + jpegOpts->set_row_spacing(5); + setExpandAlignProperties(jpegOpts, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + + jpegQual = new Adjuster (M("SAVEDLG_JPEGQUAL"), 0, 100, 1, 100); + setExpandAlignProperties(jpegQual, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + jpegQual->setAdjusterListener (this); + jpegQual->show (); + + jpegSubSampLabel = Gtk::manage (new Gtk::Label (M("SAVEDLG_SUBSAMP") + Glib::ustring(":")) ); + setExpandAlignProperties(jpegSubSampLabel, true, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); + jpegSubSampLabel->show (); jpegSubSamp = Gtk::manage (new MyComboBoxText ()); - jpegSubSamp->append_text (M("SAVEDLG_SUBSAMP_1")); - jpegSubSamp->append_text (M("SAVEDLG_SUBSAMP_2")); - jpegSubSamp->append_text (M("SAVEDLG_SUBSAMP_3")); + setExpandAlignProperties(jpegSubSamp, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + jpegSubSamp->append (M("SAVEDLG_SUBSAMP_1")); + jpegSubSamp->append (M("SAVEDLG_SUBSAMP_2")); + jpegSubSamp->append (M("SAVEDLG_SUBSAMP_3")); jpegSubSamp->set_tooltip_text (M("SAVEDLG_SUBSAMP_TOOLTIP")); jpegSubSamp->set_active (2); jpegSubSamp->signal_changed().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged) ); jpegSubSamp->show (); - jpegSubSampBox->pack_end (*jpegSubSamp); - jpegSubSampBox->show (); + jpegOpts->attach(*jpegQual, 0, 0, 1, 2); + jpegOpts->attach(*jpegSubSampLabel, 1, 0, 1, 1); + jpegOpts->attach(*jpegSubSamp, 1, 1, 1, 1); - pngcompr = new Adjuster (M("SAVEDLG_PNGCOMPR"), 0, 6, 1, 6); - pngcompr->setAdjusterListener (this); - pngcompr->show (); - tiffuncompressed = new Gtk::CheckButton (M("SAVEDLG_TIFFUNCOMPRESSED")); - tiffuncompressed->signal_toggled().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged)); - tiffuncompressed->show(); + jpegOpts->show (); - Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ()); - Gtk::Label* flab = Gtk::manage (new Gtk::Label (M("SAVEDLG_FILEFORMAT") + ":")); - hb1->pack_start (*flab, Gtk::PACK_SHRINK, 4); - format = Gtk::manage (new MyComboBoxText ()); - format->append_text ("JPEG (8 bit)"); - format->append_text ("TIFF (8 bit)"); - format->append_text ("TIFF (16 bit)"); - format->append_text ("PNG (8 bit)"); - format->append_text ("PNG (16 bit)"); - format->set_active (0); - oformat = 0; - format->signal_changed().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged) ); - hb1->pack_start (*format); - pack_start (*hb1, Gtk::PACK_SHRINK, 4); - formatopts = Gtk::manage (new Gtk::VBox ()); - formatopts->pack_start (*jpegqual, Gtk::PACK_SHRINK, 4); - formatopts->pack_start (*jpegSubSampBox, Gtk::PACK_SHRINK, 4); - pack_start (*formatopts, Gtk::PACK_SHRINK, 4); + // --------------------- PNG OPTIONS - savespp = Gtk::manage (new Gtk::CheckButton (M("SAVEDLG_SAVESPP"))); - savespp->signal_toggled().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged)); - pack_start (*savespp, Gtk::PACK_SHRINK, 4); - show_all (); - set_border_width (4); + pngCompr = new Adjuster (M("SAVEDLG_PNGCOMPR"), 0, 6, 1, 6); + setExpandAlignProperties(pngCompr, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + pngCompr->setAdjusterListener (this); + pngCompr->show (); + + + // --------------------- TIFF OPTIONS + + + tiffUncompressed = new Gtk::CheckButton (M("SAVEDLG_TIFFUNCOMPRESSED")); + setExpandAlignProperties(tiffUncompressed, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); + tiffUncompressed->signal_toggled().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged)); + tiffUncompressed->show(); + + + // --------------------- MAIN BOX + + + savesPP = Gtk::manage (new Gtk::CheckButton (M("SAVEDLG_SAVESPP"))); + savesPP->signal_toggled().connect( sigc::mem_fun(*this, &SaveFormatPanel::formatChanged)); + + set_column_spacing(5); + set_row_spacing(5); + + attach (*hb1, 0, 0, 1, 1); + attach (*jpegOpts, 0, 1, 1, 1); + attach (*tiffUncompressed, 0, 2, 1, 1); + attach (*pngCompr, 0, 3, 1, 1); + attach (*savesPP, 0, 4, 1, 2); + + hb1->show_all(); + savesPP->show_all(); + jpegOpts->show_all(); + tiffUncompressed->hide(); + pngCompr->hide(); fstr[0] = "jpg"; fstr[1] = "tif"; @@ -87,9 +128,9 @@ SaveFormatPanel::SaveFormatPanel () : listener (NULL) } SaveFormatPanel::~SaveFormatPanel () { - delete jpegqual; - delete pngcompr; - delete tiffuncompressed; + delete jpegQual; + delete pngCompr; + delete tiffUncompressed; } void SaveFormatPanel::init (SaveFormat &sf) @@ -112,10 +153,10 @@ void SaveFormatPanel::init (SaveFormat &sf) jpegSubSamp->set_active (sf.jpegSubSamp - 1); - pngcompr->setValue (sf.pngCompression); - jpegqual->setValue (sf.jpegQuality); - savespp->set_active (sf.saveParams); - tiffuncompressed->set_active (sf.tiffUncompressed); + pngCompr->setValue (sf.pngCompression); + jpegQual->setValue (sf.jpegQuality); + savesPP->set_active (sf.saveParams); + tiffUncompressed->set_active (sf.tiffUncompressed); listener = tmp; } @@ -139,26 +180,17 @@ SaveFormat SaveFormatPanel::getFormat () sf.tiffBits = 8; } - sf.pngCompression = (int) pngcompr->getValue (); - sf.jpegQuality = (int) jpegqual->getValue (); + sf.pngCompression = (int) pngCompr->getValue (); + sf.jpegQuality = (int) jpegQual->getValue (); sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1; - sf.tiffUncompressed = tiffuncompressed->get_active(); - sf.saveParams = savespp->get_active (); + sf.tiffUncompressed = tiffUncompressed->get_active(); + sf.saveParams = savesPP->get_active (); return sf; } void SaveFormatPanel::formatChanged () { - if (oformat == 0) { - removeIfThere (formatopts, jpegqual); - removeIfThere (formatopts, jpegSubSampBox); - } else if (oformat == 3 || oformat == 4) { - removeIfThere (formatopts, pngcompr); - } else if (oformat == 1 || oformat == 2) { - removeIfThere (formatopts, tiffuncompressed); - } - int act = format->get_active_row_number(); if (act < 0 || act > 4) { @@ -168,16 +200,19 @@ void SaveFormatPanel::formatChanged () Glib::ustring fr = fstr[act]; if (fr == "jpg") { - formatopts->pack_start (*jpegqual, Gtk::PACK_SHRINK, 4); - formatopts->pack_start (*jpegSubSampBox, Gtk::PACK_SHRINK, 4); + jpegOpts->show_all(); + tiffUncompressed->hide(); + pngCompr->hide(); } else if (fr == "png") { - formatopts->pack_start (*pngcompr, Gtk::PACK_SHRINK, 4); + jpegOpts->hide(); + tiffUncompressed->hide(); + pngCompr->show_all(); } else if (fr == "tif") { - formatopts->pack_start (*tiffuncompressed, Gtk::PACK_SHRINK, 4); + jpegOpts->hide(); + tiffUncompressed->show_all(); + pngCompr->hide(); } - oformat = act; - if (listener) { listener->formatChanged (fr); } diff --git a/rtgui/saveformatpanel.h b/rtgui/saveformatpanel.h index e4b4b1b7d..c71759399 100644 --- a/rtgui/saveformatpanel.h +++ b/rtgui/saveformatpanel.h @@ -28,26 +28,25 @@ class FormatChangeListener { public: + virtual ~FormatChangeListener () {} virtual void formatChanged (Glib::ustring f) {} - }; -class SaveFormatPanel : public Gtk::VBox, public AdjusterListener +class SaveFormatPanel : public Gtk::Grid, public AdjusterListener { protected: - Adjuster* jpegqual; - Adjuster* pngcompr; - Gtk::CheckButton* tiffuncompressed; + Adjuster* jpegQual; + Adjuster* pngCompr; + Gtk::CheckButton* tiffUncompressed; MyComboBoxText* format; MyComboBoxText* jpegSubSamp; - Gtk::VBox* formatopts; - Gtk::HBox* jpegSubSampBox; - Gtk::Label* jpegSubSampHead; - int oformat; + Gtk::Grid* formatOpts; + Gtk::Grid* jpegOpts; + Gtk::Label* jpegSubSampLabel; FormatChangeListener* listener; Glib::ustring fstr[5]; - Gtk::CheckButton* savespp; + Gtk::CheckButton* savesPP; public: diff --git a/rtgui/sharpening.cc b/rtgui/sharpening.cc index b312f18b5..4bd95876e 100644 --- a/rtgui/sharpening.cc +++ b/rtgui/sharpening.cc @@ -37,8 +37,8 @@ Sharpening::Sharpening () : FoldableToolPanel(this, "sharpening", M("TP_SHARPENI Gtk::Label* ml = Gtk::manage (new Gtk::Label (M("TP_SHARPENING_METHOD") + ":")); ml->show (); method = Gtk::manage (new MyComboBoxText ()); - method->append_text (M("TP_SHARPENING_USM")); - method->append_text (M("TP_SHARPENING_RLD")); + method->append (M("TP_SHARPENING_USM")); + method->append (M("TP_SHARPENING_RLD")); method->show (); hb->pack_start(*ml, Gtk::PACK_SHRINK, 4); hb->pack_start(*method); @@ -466,7 +466,7 @@ void Sharpening::setBatchMode (bool batchMode) damount->showEditedCB (); ddamping->showEditedCB (); diter->showEditedCB (); - method->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); } void Sharpening::setAdjusterBehavior (bool amountadd) diff --git a/rtgui/shcselector.cc b/rtgui/shcselector.cc index 461eb118f..c66e48534 100644 --- a/rtgui/shcselector.cc +++ b/rtgui/shcselector.cc @@ -30,13 +30,46 @@ SHCSelector::SHCSelector() : ColoredBar(RTO_Left2Right), movingPosition(-1), cl( leftMargin = RADIUS; rightMargin = RADIUS; + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_DEFAULT); + style->add_class(GTK_STYLE_CLASS_SCALE); + style->add_class(GTK_STYLE_CLASS_SLIDER); + // TODO: This is a hack :) ; change this name to a specific one and create a new entry in all gtkrc theme files set_name("ThresholdSelector"); set_can_focus(false); - set_size_request (-1, 12); set_tooltip_text(M("SHCSELECTOR_TOOLTIP")); } +Gtk::SizeRequestMode SHCSelector::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; +} + +void SHCSelector::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + int minimumWidth = 0; + int naturalWidth = 0; + get_preferred_width_vfunc (minimumWidth, naturalWidth); + get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height); +} + +void SHCSelector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 100; + natural_width = 150; +} + +void SHCSelector::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + natural_height = minimum_height = 14; +} + +void SHCSelector::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + void SHCSelector::setMargins(int left, int right) { leftMargin = left; @@ -73,14 +106,13 @@ void SHCSelector::on_realize() Gtk::DrawingArea::on_realize(); - add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); + add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); } -bool SHCSelector::on_expose_event(GdkEventExpose* event) +bool SHCSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { - Gdk::Color c; - Cairo::RefPtr cr = get_window()->create_cairo_context(); + Gdk::RGBA c; int w = get_width () - leftMargin - rightMargin; int h = get_height (); @@ -88,8 +120,17 @@ bool SHCSelector::on_expose_event(GdkEventExpose* event) wslider = std::max(int(h / 5), 10); double hwslider = double(wslider) / 2.; - Gtk::StateType state = !is_sensitive() ? Gtk::STATE_INSENSITIVE : Gtk::STATE_NORMAL; - Glib::RefPtr style = get_style(); + Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; + Glib::RefPtr style = get_style_context(); + + + + + //style->render_background(cr, leftMargin, 0, w, h); + //return true; + + + // clear bg @@ -103,61 +144,93 @@ bool SHCSelector::on_expose_event(GdkEventExpose* event) // this will eventually create/update the off-screen pixmap setDrawRectangle(win, leftMargin + 1, 1, w - 2, int(float(h) * 5.5f / 7.f + 0.5f)); // that we're displaying here - ColoredBar::expose(win); - } else { - // solid background - c = style->get_bg (state); - - if (state == Gtk::STATE_INSENSITIVE) { - cr->set_source_rgb (c.get_red_p() * 0.96, c.get_green_p() * 0.96, c.get_blue_p() * 0.96); - } else { - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); - } - - // draw the box's background - cr->rectangle (leftMargin + 1, 1, w - 2, int(float(h) * 5.5f / 7.f + 0.5f)); - cr->fill(); + ColoredBar::expose(cr); } + /* useless + else { + // solid background + // draw the box's background + style->render_background(cr, leftMargin+1, 1, w-2, int(float(h)*5.5f/7.f+0.5f)); + } + */ + // draw the box's borders cr->set_line_width (1.); + c = style->get_border_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->rectangle (leftMargin + 0.5, 0.5, w - 1, int(float(h) * 5.5f / 7.f + 0.5f) + 1); - c = style->get_bg (state); - - if (state == Gtk::STATE_INSENSITIVE) { - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); - } else { - cr->set_source_rgb (c.get_red_p() * 0.7, c.get_green_p() * 0.7, c.get_blue_p() * 0.7); - } - cr->stroke (); // draw sliders - //cr->set_line_width (1.0); + //cr->set_line_width (1.); for (int i = 0; i < 3; i++) { - cr->move_to (leftMargin + 0.5 + (w - 1)*positions[i] + hwslider, double(h) - 0.5); - cr->rel_line_to (0., double(-h / 3)); - cr->rel_line_to (-hwslider, double(-h / 3)); - cr->rel_line_to (-hwslider, double(h / 3)); - cr->rel_line_to (0., double(h / 3)); - cr->close_path(); - // normal - c = style->get_bg (is_sensitive() ? Gtk::STATE_ACTIVE : Gtk::STATE_INSENSITIVE); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->fill_preserve (); - c = style->get_bg (state); - - if (state == Gtk::STATE_INSENSITIVE) { - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); + if (i == movingPosition) { + style->set_state(Gtk::STATE_FLAG_ACTIVE); + } + /* + else if (i==litCursor) + style->set_state(Gtk::STATE_FLAG_PRELIGHT); + */ + else if (!is_sensitive()) { + style->set_state(Gtk::STATE_FLAG_INSENSITIVE); } else { - cr->set_source_rgb (c.get_red_p() * 0.7, c.get_green_p() * 0.7, c.get_blue_p() * 0.7); + style->set_state(Gtk::STATE_FLAG_NORMAL); } - cr->stroke (); + style->render_slider(cr, leftMargin + 0.5 + (w - 1)*positions[i] - hwslider, vb, wslider, h - vb, Gtk::ORIENTATION_HORIZONTAL); + style->set_state(Gtk::STATE_FLAG_NORMAL); } + /* + for (int i=0; i<3; i++) { + double posX = leftMargin+0.5+(w-1)*positions[i]; + double arrowY = h-(h*3.5/7.-0.5)-vb; + double baseY = h-0.5-vb; + double centerY = (arrowY+baseY)/2.; + cr->move_to (posX, arrowY); + cr->line_to (posX+hwslider, centerY); + cr->line_to (posX+hwslider, baseY); + cr->line_to (posX-hwslider, baseY); + cr->line_to (posX-hwslider, centerY); + cr->close_path(); + if (i==movingPosition) { + // moved (selected) + c = style->get_background_color(Gtk::STATE_FLAG_SELECTED); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (Gtk::STATE_FLAG_SELECTED); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } + */ + + /* + else if (i==litCursor) { + // prelight + c = style->get_background_color(Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } + */ + + /* + else { + // normal + c = style->get_background_color(is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } + } + */ + // draw text for the slider that is being moved - Glib::RefPtr context = get_pango_context () ; cr->set_line_width (0.5); if (movingPosition >= 0) { @@ -167,8 +240,8 @@ bool SHCSelector::on_expose_event(GdkEventExpose* event) Glib::RefPtr layout = create_pango_layout(Glib::ustring::format(std::setprecision(2), positions[i])); layout->get_pixel_size(layout_width, layout_height); offset = positions[i] > 0.5 ? -layout_width - 1 - hwslider : 1 + hwslider; - c = style->get_bg (state); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_background_color(state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->set_line_width(3.); cr->set_line_join(Cairo::LINE_JOIN_ROUND); @@ -177,8 +250,8 @@ bool SHCSelector::on_expose_event(GdkEventExpose* event) cr->move_to (leftMargin + w * positions[i] + offset, 0.); layout->add_to_cairo_context (cr); cr->stroke_preserve(); - c = style->get_fg (Gtk::STATE_PRELIGHT); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_color(Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->fill (); } diff --git a/rtgui/shcselector.h b/rtgui/shcselector.h index b71044f0f..7f0368720 100644 --- a/rtgui/shcselector.h +++ b/rtgui/shcselector.h @@ -51,6 +51,17 @@ protected: SHCListener* cl; + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const; + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void on_realize(); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); + bool on_button_press_event (GdkEventButton* event); + bool on_button_release_event (GdkEventButton* event); + bool on_motion_notify_event (GdkEventMotion* event); + public: SHCSelector(); @@ -64,11 +75,6 @@ public: void setDefaults (double spos, double cpos, double hpos); void setPositions (double spos, double cpos, double hpos); void getPositions (double& spos, double& cpos, double& hpos); - void on_realize(); - bool on_expose_event(GdkEventExpose* event); - bool on_button_press_event (GdkEventButton* event); - bool on_button_release_event (GdkEventButton* event); - bool on_motion_notify_event (GdkEventMotion* event); void styleChanged (const Glib::RefPtr& style); bool reset (); void refresh(); diff --git a/rtgui/splash.cc b/rtgui/splash.cc index b385ca460..35a80e6d6 100644 --- a/rtgui/splash.cc +++ b/rtgui/splash.cc @@ -21,7 +21,6 @@ #include #include "../rtengine/safegtk.h" -extern Glib::ustring argv0; extern Glib::ustring creditsPath; extern Glib::ustring licensePath; extern Glib::ustring versionString; @@ -34,25 +33,13 @@ SplashImage::SplashImage () set_size_request (pixbuf->get_width(), pixbuf->get_height()); } -void SplashImage::on_realize () -{ - - Gtk::DrawingArea::on_realize(); - add_events(Gdk::EXPOSURE_MASK); - - gc_ = Gdk::GC::create (get_window()); - Glib::RefPtr colormap = get_default_colormap(); - Gdk::Color fontc = Gdk::Color ("white"); - colormap->alloc_color (fontc); - gc_->set_foreground (fontc); - -} - -bool SplashImage::on_expose_event (GdkEventExpose* event) +bool SplashImage::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { Glib::RefPtr window = get_window(); - pixbuf->render_to_drawable (window, gc_, 0, 0, 0, 0, pixbuf->get_width(), pixbuf->get_height(), Gdk::RGB_DITHER_NONE, 0, 0); + Gdk::Cairo::set_source_pixbuf(cr, pixbuf); + cr->rectangle(0, 0, pixbuf->get_width(), pixbuf->get_height()); + cr->fill(); Cairo::FontOptions cfo; cfo.set_antialias (Cairo::ANTIALIAS_SUBPIXEL); @@ -62,9 +49,6 @@ bool SplashImage::on_expose_event (GdkEventExpose* event) fontd.set_weight (Pango::WEIGHT_LIGHT); fontd.set_absolute_size (12 * Pango::SCALE); context->set_font_description (fontd); - Gdk::Color *textColor = new Gdk::Color(); - textColor->set_rgb(0, 0, 0); - gc_->set_foreground(*textColor); int w, h; Glib::ustring versionStr(versionString); @@ -74,9 +58,18 @@ bool SplashImage::on_expose_event (GdkEventExpose* event) } version = create_pango_layout (versionStr); - version->set_markup("" + versionStr + ""); + version->set_text(versionStr); version->get_pixel_size (w, h); - window->draw_layout(gc_, pixbuf->get_width() - w - 32, pixbuf->get_height() - h - 20, version); + cr->set_source_rgb (0., 0., 0.); + cr->set_line_width(3.); + cr->set_line_join(Cairo::LINE_JOIN_ROUND); + cr->move_to (pixbuf->get_width() - w - 32, pixbuf->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; } @@ -89,14 +82,17 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t releaseNotesSW = NULL; nb = Gtk::manage (new Gtk::Notebook ()); - get_vbox()->pack_start (*nb); + get_content_area()->pack_start (*nb); // Add close button to bottom of the notebook Gtk::Button* closeButton = Gtk::manage (new Gtk::Button (M("GENERAL_CLOSE"))); closeButton->signal_clicked().connect( sigc::mem_fun(*this, &Splash::closePressed) ); Gtk::HBox* bottomHBox = Gtk::manage (new Gtk::HBox ()); bottomHBox->pack_end (*closeButton, Gtk::PACK_SHRINK, 0); - get_vbox()->pack_start (*bottomHBox, Gtk::PACK_SHRINK, 0); + get_content_area()->pack_start (*bottomHBox, Gtk::PACK_SHRINK, 0); + + Glib::RefPtr localCSS = Gtk::CssProvider::create(); + localCSS->load_from_data ("GtkTextView { font: monospace 8; }"); // Tab 1: the image splashImage = Gtk::manage(new SplashImage ()); @@ -125,6 +121,7 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t Gtk::ScrolledWindow *buildSW = Gtk::manage (new Gtk::ScrolledWindow()); Gtk::TextView *buildTV = Gtk::manage (new Gtk::TextView (textBuffer)); + buildTV->get_style_context()->add_provider(localCSS, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); buildTV->set_editable(false); buildTV->set_left_margin (10); buildTV->set_right_margin (5); @@ -155,6 +152,7 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t Gtk::ScrolledWindow *creditsSW = Gtk::manage (new Gtk::ScrolledWindow()); Gtk::TextView *creditsTV = Gtk::manage (new Gtk::TextView (textBuffer)); + //creditsTV->get_style_context()->add_provider(localCSS, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); creditsTV->set_left_margin (10); creditsTV->set_right_margin (5); creditsTV->set_wrap_mode(Gtk::WRAP_WORD); @@ -186,13 +184,9 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t Gtk::ScrolledWindow *licenseSW = Gtk::manage (new Gtk::ScrolledWindow()); Gtk::TextView *licenseTV = Gtk::manage (new Gtk::TextView (textBuffer)); + //licenseTV->get_style_context()->add_provider(localCSS, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); // set monospace font to enhance readability of formatted text - Pango::FontDescription fdescLicense; - fdescLicense.set_family("monospace"); - fdescLicense.set_absolute_size (11 * Pango::SCALE); - licenseTV->modify_font(fdescLicense); - licenseTV->set_left_margin (10); licenseTV->set_right_margin (5); licenseTV->set_editable(false); @@ -223,14 +217,9 @@ Splash::Splash (Gtk::Window& parent) : Gtk::Dialog(M("GENERAL_ABOUT"), parent, t releaseNotesSW = Gtk::manage (new Gtk::ScrolledWindow()); Gtk::TextView *releaseNotesTV = Gtk::manage (new Gtk::TextView (textBuffer)); + releaseNotesTV->get_style_context()->add_provider(localCSS, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); // set monospace font to enhance readability of formatted text - Pango::FontDescription fdescReleaseNotes; - fdescReleaseNotes.set_family("monospace"); - fdescReleaseNotes.set_absolute_size (11 * Pango::SCALE); - releaseNotesTV->modify_font(fdescReleaseNotes); - - releaseNotesTV->set_left_margin (10); releaseNotesTV->set_right_margin (3); releaseNotesTV->set_editable(false); @@ -255,8 +244,7 @@ Splash::Splash (Gtk::Window& parent, int maxtime) : Gtk::Dialog(M("GENERAL_ABOUT { splashImage = Gtk::manage(new SplashImage ()); -// add (*splashImage); - get_vbox()->pack_start (*splashImage); + get_content_area()->pack_start (*splashImage); splashImage->show (); if (maxtime > 0) { diff --git a/rtgui/splash.h b/rtgui/splash.h index 5e3d5e1b4..5eb48ee07 100644 --- a/rtgui/splash.h +++ b/rtgui/splash.h @@ -25,14 +25,12 @@ class SplashImage : public Gtk::DrawingArea { private: - Glib::RefPtr gc_; Glib::RefPtr pixbuf; Glib::RefPtr version; public: SplashImage (); - void on_realize (); - bool on_expose_event (GdkEventExpose* event); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); }; //class Splash : public Gtk::Window { diff --git a/rtgui/threadutils.h b/rtgui/threadutils.h index 2ee654c4e..aa899cb46 100644 --- a/rtgui/threadutils.h +++ b/rtgui/threadutils.h @@ -44,29 +44,19 @@ //#define PROTECT_VECTORS 1 //#undef TRACE_MYRWMUTEX //#define TRACE_MYRWMUTEX 1 -//#undef STRICT_MUTEX -//#define STRICT_MUTEX 1 /** * @brief Custom Mutex to replace Glib::Threads::Mutex, which behave differently on windows (recursive) and linux (non-recursive), by a recursive and "debugable" one * - * This implementation will behave like a Glib::Threads::RecMutex (STRICT_MUTEX=0) or a Glib::Threads::Mutex (STRICT_MUTEX=1), but in this case, the application will - * crash instead of freezing. + * This implementation will behave like a Glib::Threads::Mutex, but the application will crash instead of freezing. * * In Debug builds, a printf will let you know that the MyMutex was already locked - * - * The default and recommended mode is STRICT_MUTEX=1 */ -#ifdef WIN32 -class MyMutex : public Glib::RecMutex -{ -#else class MyMutex : public Glib::Threads::RecMutex { -#endif -#if STRICT_MUTEX || !defined(NDEBUG) +#ifndef NDEBUG private: bool alreadyLocked; #endif @@ -74,7 +64,7 @@ private: public: class MyLock; -#if STRICT_MUTEX || !defined(NDEBUG) +#ifndef NDEBUG MyMutex() : alreadyLocked(false) {} #else MyMutex() {} @@ -82,18 +72,13 @@ public: void lock() { -#ifdef WIN32 - Glib::RecMutex::lock(); -#else Glib::Threads::RecMutex::lock(); -#endif -#if STRICT_MUTEX || !defined(NDEBUG) +#ifndef NDEBUG if (alreadyLocked) { #ifndef NDEBUG std::cout << "Warning: MyMutex already locked!" << std::endl; // breakpoint #endif -#if STRICT_MUTEX #ifndef NDEBUG #ifdef WIN32 DebugBreak(); @@ -102,7 +87,6 @@ public: #endif #else raise(SIGINT); -#endif #endif } @@ -112,20 +96,13 @@ public: bool trylock() { -#ifdef WIN32 - - if (Glib::RecMutex::trylock()) -#else - if (Glib::Threads::RecMutex::trylock()) -#endif - { -#if STRICT_MUTEX || !defined(NDEBUG) + if (Glib::Threads::RecMutex::trylock()) { +#ifndef NDEBUG if (alreadyLocked) { #ifndef NDEBUG std::cout << "Warning: MyMutex already locked!" << std::endl; // breakpoint #endif -#if STRICT_MUTEX #ifndef NDEBUG #ifdef WIN32 DebugBreak(); @@ -134,7 +111,6 @@ public: #endif #else raise(SIGINT); -#endif #endif } @@ -149,14 +125,10 @@ public: // Warning: the base class of MyMutex is RecMutex, but the mutex is said "unlocked" on first occurrence of "unlock", to avoid overhead. void unlock() { -#if STRICT_MUTEX || !defined(NDEBUG) +#ifndef NDEBUG alreadyLocked = false; #endif -#ifdef WIN32 - Glib::RecMutex::unlock(); -#else Glib::Threads::RecMutex::unlock(); -#endif } }; @@ -221,13 +193,8 @@ private: class MyRWMutex { public: -#ifdef WIN32 - Glib::Mutex handlerMutex; // Having a recursive or non-recursive mutex is not important here, so we can use Glib::Mutex - Glib::Cond access; -#else Glib::Threads::Mutex handlerMutex; // Having a recursive or non-recursive mutex is not important here, so we can use Glib::Threads::Mutex Glib::Threads::Cond access; -#endif size_t writerCount; size_t readerCount; #if TRACE_MYRWMUTEX diff --git a/rtgui/thresholdadjuster.cc b/rtgui/thresholdadjuster.cc index 6f699eed8..b3ed37605 100644 --- a/rtgui/thresholdadjuster.cc +++ b/rtgui/thresholdadjuster.cc @@ -84,7 +84,7 @@ void ThresholdAdjuster::initObject (Glib::ustring label, bool editedcb) hbox = Gtk::manage (new Gtk::HBox ()); - this->label = Gtk::manage (new Gtk::Label (label, Gtk::ALIGN_LEFT)); + this->label = Gtk::manage (new Gtk::Label (label, Gtk::ALIGN_START)); if (editedcb) { editedCheckBox = Gtk::manage (new Gtk::CheckButton ()); @@ -320,7 +320,7 @@ void ThresholdAdjuster::showEditedCB () void ThresholdAdjuster::refreshLabelStyle () { - /* Glib::RefPtr style = label->get_style (); + /* Glib::RefPtr style = label->get_style_context (); Pango::FontDescription fd = style->get_font (); fd.set_weight (editedState==Edited ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL); style->set_font (fd); diff --git a/rtgui/thresholdadjuster.h b/rtgui/thresholdadjuster.h index 99e4efd44..f022735ff 100644 --- a/rtgui/thresholdadjuster.h +++ b/rtgui/thresholdadjuster.h @@ -33,6 +33,7 @@ class ThresholdAdjusterListener { public: + virtual ~ThresholdAdjusterListener() {} // to be used by listener that has created a ThresholdAdjuster with with single threshold and precision > 0 virtual void adjusterChanged (ThresholdAdjuster* a, double newBottom, double newTop) {} // to be used by listener that has created a ThresholdAdjuster with with double threshold and precision > 0 diff --git a/rtgui/thresholdselector.cc b/rtgui/thresholdselector.cc index 80a961292..6141528e0 100644 --- a/rtgui/thresholdselector.cc +++ b/rtgui/thresholdselector.cc @@ -140,8 +140,12 @@ void ThresholdSelector::initValues () oldLitCursor = litCursor = TS_UNDEFINED; movedCursor = TS_UNDEFINED; secondaryMovedCursor = TS_UNDEFINED; - set_size_request (-1, 30); - add_events(Gdk::LEAVE_NOTIFY_MASK); + Glib::RefPtr style = get_style_context(); + + style->add_class(GTK_STYLE_CLASS_DEFAULT); + style->add_class(GTK_STYLE_CLASS_SCALE); + style->add_class(GTK_STYLE_CLASS_SLIDER); + set_name("ThresholdSelector"); set_can_focus(false); set_app_paintable(true); @@ -149,6 +153,36 @@ void ThresholdSelector::initValues () updateTooltip(); } +Gtk::SizeRequestMode ThresholdSelector::get_request_mode_vfunc () const +{ + return Gtk::SIZE_REQUEST_HEIGHT_FOR_WIDTH; +} + +void ThresholdSelector::get_preferred_height_vfunc (int &minimum_height, int &natural_height) const +{ + int minimumWidth = 0; + int naturalWidth = 0; + get_preferred_width_vfunc (minimumWidth, naturalWidth); + get_preferred_height_for_width_vfunc (minimumWidth, minimum_height, natural_height); +} + +void ThresholdSelector::get_preferred_width_vfunc (int &minimum_width, int &natural_width) const +{ + minimum_width = 100; + natural_width = 150; +} + +void ThresholdSelector::get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const +{ + natural_height = minimum_height = 23; +} + +void ThresholdSelector::get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const +{ + get_preferred_width_vfunc (minimum_width, natural_width); +} + + /* * Set the position of the sliders without telling it to the listener */ @@ -209,21 +243,18 @@ void ThresholdSelector::on_realize() Gtk::DrawingArea::on_realize(); - add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK); + add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::LEAVE_NOTIFY_MASK); } -bool ThresholdSelector::on_expose_event(GdkEventExpose* event) +bool ThresholdSelector::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { - Gdk::Color c; - Glib::RefPtr win = get_window(); - Cairo::RefPtr cr = win->create_cairo_context(); - + Gdk::RGBA c; double positions01[4]; int w = get_width (); int h = get_height (); - wslider = std::max(int(h / 5), 10); + int wslider = 10; int hwslider = wslider / 2; int iw = w - wslider - 2 * hb; // inner width (excluding padding for sliders) @@ -232,8 +263,8 @@ bool ThresholdSelector::on_expose_event(GdkEventExpose* event) positions01[TS_BOTTOMRIGHT] = to01(TS_BOTTOMRIGHT); positions01[TS_TOPRIGHT] = to01(TS_TOPRIGHT); - Gtk::StateType state = !is_sensitive() ? Gtk::STATE_INSENSITIVE : Gtk::STATE_NORMAL; - Glib::RefPtr style = get_style(); + Gtk::StateFlags state = !is_sensitive() ? Gtk::STATE_FLAG_INSENSITIVE : Gtk::STATE_FLAG_NORMAL; + Glib::RefPtr style = get_style_context(); // set the box's colors cr->set_line_width (1.0); @@ -242,24 +273,31 @@ bool ThresholdSelector::on_expose_event(GdkEventExpose* event) if (is_sensitive() && canGetColors()) { // gradient background Glib::RefPtr win = get_window(); - // this will eventually create/update the off-screen Surface + // this will eventually create/update the off-screen Surface for the gradient area only ! setDrawRectangle(win, hb + hwslider, int(float(h) * 1.5f / 7.f + 0.5f), iw + 1, int(float(h) * 4.f / 7.f + 0.5f)); // that we're displaying here - ColoredBar::expose(win); - } else { - // solid background - c = style->get_bg (state); + ColoredBar::expose(cr); + } - if (state == Gtk::STATE_INSENSITIVE) { - cr->set_source_rgb (c.get_red_p() * 0.96, c.get_green_p() * 0.96, c.get_blue_p() * 0.96); - } else { - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); - } + /* useless + else { + // solid background // draw the box's background - cr->rectangle (hb + hwslider - 0.5, double(int(float(h) * 1.5f / 7.f)) + 0.5, iw + 1, double(int(float(h) * 4.f / 7.f))); - cr->fill(); + style->render_background(cr, hb+hwslider-0.5, double(int(float(h)*1.5f/7.f))+0.5, iw+1, double(int(float(h)*4.f/7.f))); } + */ + + // draw the box's borders + cr->set_line_width (1.); + cr->set_antialias(Cairo::ANTIALIAS_NONE); + c = style->get_border_color (state); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->rectangle (hb + hwslider - 0.5, double(int(float(h) * 1.5f / 7.f)) + 0.5, iw + 1, double(int(float(h) * 4.f / 7.f))); + cr->stroke (); + + cr->set_line_width (1.); + cr->set_antialias(Cairo::ANTIALIAS_NONE); // draw curve @@ -335,89 +373,94 @@ bool ThresholdSelector::on_expose_event(GdkEventExpose* event) } } + cr->set_antialias(Cairo::ANTIALIAS_SUBPIXEL); + if (is_sensitive() && bgGradient.size() > 1) { // draw surrounding curve - c = style->get_bg (state); - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); + c = style->get_background_color(state); + cr->set_source_rgb (c.get_red() * 0.85, c.get_green() * 0.85, c.get_blue() * 0.85); cr->set_line_width (5.0); cr->stroke_preserve(); } // draw curve if (is_sensitive()) { - c = style->get_fg (movedCursor != TS_UNDEFINED || litCursor != TS_UNDEFINED ? Gtk::STATE_PRELIGHT : Gtk::STATE_ACTIVE); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + c = style->get_color(movedCursor != TS_UNDEFINED || litCursor != TS_UNDEFINED ? Gtk::STATE_FLAG_PRELIGHT : Gtk::STATE_FLAG_NORMAL); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); } else { - c = style->get_bg (Gtk::STATE_INSENSITIVE); - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); + c = style->get_background_color(Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red() * 0.85, c.get_green() * 0.85, c.get_blue() * 0.85); } cr->set_line_width (1.5); cr->stroke (); - // draw the box's borders - cr->set_line_width (1.); - cr->rectangle (hb + hwslider - 0.5, double(int(float(h) * 1.5f / 7.f)) + 0.5, iw + 1, double(int(float(h) * 4.f / 7.f))); - c = style->get_bg (state); - - if (state == Gtk::STATE_INSENSITIVE) { - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); - } else { - cr->set_source_rgb (c.get_red_p() * 0.7, c.get_green_p() * 0.7, c.get_blue_p() * 0.7); - } - - cr->stroke (); - // draw sliders //if (!(litCursor == TS_UNDEFINED && movedCursor == TS_UNDEFINED)) { - //cr->set_line_width (1.); - for (int i = 0; i < (doubleThresh ? 4 : 2); i++) { - double posX = hb + hwslider + iw * positions01[i] + 0.5; - double arrowY = i == 0 || i == 2 ? h - (h * 2.5 / 7. - 0.5) - vb : h * 2.5 / 7. - 0.5 + vb; - double baseY = i == 0 || i == 2 ? h - 0.5 - vb : 0.5 + vb; - double centerY = (arrowY + baseY) / 2.; - cr->move_to (posX, arrowY); - cr->line_to (posX + hwslider, centerY); - cr->line_to (posX + hwslider, baseY); - cr->line_to (posX - hwslider, baseY); - cr->line_to (posX - hwslider, centerY); - cr->close_path(); + Gtk::StateFlags currState = style->get_state(); - if (i == movedCursor) { - // moved (selected) - c = style->get_bg (Gtk::STATE_SELECTED); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->fill_preserve (); - //c = style->get_dark (Gtk::STATE_SELECTED); - //cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - c = style->get_bg (state); - cr->set_source_rgb (c.get_red_p() * 0.55, c.get_green_p() * 0.55, c.get_blue_p() * 0.55); - cr->stroke (); - } else if (i == secondaryMovedCursor || (movedCursor == TS_UNDEFINED && i == litCursor)) { - // prelight - c = style->get_bg (Gtk::STATE_PRELIGHT); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); - cr->fill_preserve (); - c = style->get_bg (state); - cr->set_source_rgb (c.get_red_p() * 0.55, c.get_green_p() * 0.55, c.get_blue_p() * 0.55); - cr->stroke (); + for (int i = 0; i < (doubleThresh ? 4 : 2); ++i) { + if (!is_sensitive()) { + style->set_state(Gtk::STATE_FLAG_INSENSITIVE); + } else if (i == movedCursor) { + style->set_state(Gtk::STATE_FLAG_ACTIVE); + } else if (i == litCursor) { + style->set_state(Gtk::STATE_FLAG_PRELIGHT); } else { - // normal - c = style->get_bg (is_sensitive() ? Gtk::STATE_ACTIVE : Gtk::STATE_INSENSITIVE); - cr->set_source_rgb (c.get_red_p(), c.get_green_p(), c.get_blue_p()); + style->set_state(Gtk::STATE_FLAG_NORMAL); + } + + double posX = hb + iw * positions01[i] + 0.5; + double arrowY = i == 0 || i == 2 ? h - (h * 3. / 7. - 0.5) - vb : h * 3. / 7. - 0.5 + vb; + double baseY = i == 0 || i == 2 ? h - 0.5 - vb : 0.5 + vb; + + style->render_slider(cr, posX, i == 0 || i == 2 ? arrowY : baseY, wslider, i == 0 || i == 2 ? baseY - arrowY : arrowY - baseY, Gtk::ORIENTATION_HORIZONTAL); + } + + style->set_state(currState); + + /* + cr->set_line_width (1.); + for (int i=0; i<(doubleThresh?4:2); i++) { + double posX = hb+hwslider+iw*positions01[i]+0.5; + double arrowY = i==0 || i==2 ? h-(h*2.5/7.-0.5)-vb : h*2.5/7.-0.5+vb; + double baseY = i==0 || i==2 ? h-0.5-vb : 0.5+vb; + double centerY = (arrowY+baseY)/2.; + cr->move_to (posX, arrowY); + cr->line_to (posX+hwslider, centerY); + cr->line_to (posX+hwslider, baseY); + cr->line_to (posX-hwslider, baseY); + cr->line_to (posX-hwslider, centerY); + cr->close_path(); + if (i==movedCursor) { + // moved (selected) + c = style->get_background_color(Gtk::STATE_FLAG_SELECTED); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->fill_preserve (); - c = style->get_bg (state); - - if (state == Gtk::STATE_INSENSITIVE) { - cr->set_source_rgb (c.get_red_p() * 0.85, c.get_green_p() * 0.85, c.get_blue_p() * 0.85); - } else { - cr->set_source_rgb (c.get_red_p() * 0.7, c.get_green_p() * 0.7, c.get_blue_p() * 0.7); - } - + c = style->get_border_color (Gtk::STATE_FLAG_SELECTED); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } + else if (i==secondaryMovedCursor || (movedCursor==TS_UNDEFINED && i==litCursor)) { + // prelight + c = style->get_background_color(Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (Gtk::STATE_FLAG_PRELIGHT); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->stroke (); + } + else { + // normal + c = style->get_background_color(is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); + cr->fill_preserve (); + c = style->get_border_color (is_sensitive() ? Gtk::STATE_FLAG_ACTIVE : Gtk::STATE_FLAG_INSENSITIVE); + cr->set_source_rgb (c.get_red(), c.get_green(), c.get_blue()); cr->stroke (); } } - + */ //} return true; diff --git a/rtgui/thresholdselector.h b/rtgui/thresholdselector.h index fabbfb9db..03b6bf554 100644 --- a/rtgui/thresholdselector.h +++ b/rtgui/thresholdselector.h @@ -56,8 +56,8 @@ public: * on the graph. E.g. the "bottomLeft" value is related to the bottom left cursor. * * It is also possible to have a threshold with 2 totally independent cursors, each one having his own range, - * man/max/default values and precision. This let developers create their own threshold curve, that they will - * have to provide through the + * min/max/default values and precision. This let developers create their own threshold curve, that they will + * have to provide through the ThresholdCurveProvider interface * */ class ThresholdSelector : public Gtk::DrawingArea, public ColoredBar @@ -98,11 +98,10 @@ protected: double minValBottom, maxValBottom; double defPos[4]; double positions[4]; - unsigned short wslider; eUpdatePolicy updatePolicy; const static int hb = 3; // horizontal border - const static int vb = 2; // vertical border + const static int vb = 0; // vertical border void initValues (); void findLitCursor(int posX, int posY); @@ -111,6 +110,18 @@ protected: double to01(ThreshCursorId cursorId); void updateTooltip(); + Gtk::SizeRequestMode get_request_mode_vfunc () const; + void get_preferred_height_vfunc (int& minimum_height, int& natural_height) const; + void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; + void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; + void get_preferred_width_for_height_vfunc (int width, int &minimum_width, int &natural_width) const; + void on_realize (); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); + bool on_button_press_event (GdkEventButton* event); + bool on_button_release_event (GdkEventButton* event); + bool on_motion_notify_event (GdkEventMotion* event); + bool on_leave_notify_event (GdkEventCrossing* event); + public: sigc::signal signal_value_changed(); @@ -201,12 +212,6 @@ public: { return doubleThresh; } - void on_realize (); - bool on_expose_event(GdkEventExpose* event); - bool on_button_press_event (GdkEventButton* event); - bool on_button_release_event (GdkEventButton* event); - bool on_motion_notify_event (GdkEventMotion* event); - bool on_leave_notify_event (GdkEventCrossing* event); void styleChanged (const Glib::RefPtr& style); unsigned int getPrecision () { diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index c2ed480f2..398682dbb 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -25,7 +25,7 @@ using namespace std; ThumbBrowserBase::ThumbBrowserBase () - : lastClicked(NULL), previewHeight(options.thumbSize), numOfCols(1), inspector(NULL), isInspectorActive(false) + : inspector(NULL), isInspectorActive(false), lastClicked(NULL), previewHeight(options.thumbSize), numOfCols(1) { location = THLOC_FILEBROWSER; inW = -1; @@ -49,9 +49,6 @@ ThumbBrowserBase::ThumbBrowserBase () show_all (); - hscroll.set_update_policy (Gtk::UPDATE_CONTINUOUS); - vscroll.set_update_policy (Gtk::UPDATE_CONTINUOUS); - vscroll.signal_value_changed().connect( sigc::mem_fun(*this, &ThumbBrowserBase::scrollChanged) ); hscroll.signal_value_changed().connect( sigc::mem_fun(*this, &ThumbBrowserBase::scrollChanged) ); @@ -638,9 +635,9 @@ void ThumbBrowserBase::Internal::on_realize() Gtk::DrawingArea::on_realize(); Glib::RefPtr window = get_window(); - set_flags (Gtk::CAN_FOCUS); + set_can_focus(true); add_events(Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK | Gdk::KEY_PRESS_MASK); - gc_ = Gdk::GC::create(window); + //cc = window->create_cairo_context(); set_has_tooltip (true); signal_query_tooltip().connect( sigc::mem_fun(*this, &ThumbBrowserBase::Internal::on_query_tooltip) ); } @@ -670,7 +667,7 @@ bool ThumbBrowserBase::Internal::on_query_tooltip (int x, int y, bool keyboard_t } } -void ThumbBrowserBase::on_style_changed (const Glib::RefPtr& style) +void ThumbBrowserBase::on_style_updated () { // GUI will be acquired by refreshThumbImages refreshThumbImages (); @@ -678,6 +675,9 @@ void ThumbBrowserBase::on_style_changed (const Glib::RefPtr& style) ThumbBrowserBase::Internal::Internal () : ofsX(0), ofsY(0), parent(NULL), dirty(true) { + Glib::RefPtr style = get_style_context(); + style->add_class(GTK_STYLE_CLASS_BACKGROUND); + style->add_class(GTK_STYLE_CLASS_FLAT); } void ThumbBrowserBase::Internal::setParent (ThumbBrowserBase* p) @@ -710,7 +710,8 @@ bool ThumbBrowserBase::Internal::on_button_press_event (GdkEventButton* event) GdkRectangle rect; rect.x = 0; rect.y = 0; - window->get_size (rect.width, rect.height); + rect.width = window->get_width(); + rect.height = window->get_height(); gdk_window_invalidate_rect (window->gobj(), &rect, true); gdk_window_process_updates (window->gobj(), true); @@ -871,7 +872,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ } -bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) +bool ThumbBrowserBase::Internal::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) { // Gtk signals automatically acquire the GUI (i.e. this method is enclosed by gdk_thread_enter and gdk_thread_leave) @@ -882,10 +883,13 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) int w = get_width(); int h = get_height(); - window->clear(); // draw thumbnails + Glib::RefPtr style = get_style_context (); + cr->set_antialias(Cairo::ANTIALIAS_NONE); + cr->set_line_join(Cairo::LINE_JOIN_MITER); + style->render_background(cr, 0., 0., w, h); Glib::RefPtr context = get_pango_context (); - context->set_font_description (get_style()->get_font()); + context->set_font_description (style->get_font()); { #if PROTECT_VECTORS diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index bd410292d..86e438275 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -34,8 +34,7 @@ class ThumbBrowserBase : public Gtk::VBox class Internal : public Gtk::DrawingArea { - - Glib::RefPtr gc_; + //Cairo::RefPtr cc; int ofsX, ofsY; ThumbBrowserBase* parent; bool dirty; @@ -43,7 +42,7 @@ class ThumbBrowserBase : public Gtk::VBox Internal (); void setParent (ThumbBrowserBase* p); void on_realize(); - bool on_expose_event(GdkEventExpose* event); + bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); bool on_button_release_event (GdkEventButton* event); bool on_motion_notify_event (GdkEventMotion* event); @@ -162,7 +161,7 @@ public: { return fd; } - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); void redraw (); // arrange files and draw area void refreshThumbImages (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw void refreshQuickThumbImages (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw diff --git a/rtgui/thumbbrowserentrybase.cc b/rtgui/thumbbrowserentrybase.cc index f9f8f9f1e..913ee120f 100644 --- a/rtgui/thumbbrowserentrybase.cc +++ b/rtgui/thumbbrowserentrybase.cc @@ -26,7 +26,7 @@ ThumbBrowserEntryBase::ThumbBrowserEntryBase (const Glib::ustring& fname) prex(0), prey(0), upperMargin(6), borderWidth(1), textGap(6), sideMargin(8), lowerMargin(8), preview(NULL), dispname(Glib::path_get_basename (fname)), buttonSet(NULL), width(0), height(0), exp_width(0), exp_height(0), startx(0), starty(0), ofsX(0), ofsY(0), redrawRequests(0), - parent(NULL), bbSelected(false), bbFramed(false), bbPreview(NULL), + parent(NULL), bbSelected(false), bbFramed(false), bbPreview(NULL), cursor_type(CSUndefined), thumbnail(NULL), filename(fname), shortname(dispname), exifline(""), datetimeline(""), selected(false), drawable(false), filtered(false), framed(false), processing(false), italicstyle(false), edited(false), recentlysaved(false), updatepriority(false), withFilename(WFNAME_NONE) {} @@ -64,34 +64,44 @@ void ThumbBrowserEntryBase::updateBackBuffer () return; } - backBuffer = Gdk::Pixmap::create (win, exp_width, exp_height); - - // If thumbnail is hidden by a filter drawing to it will crash - int backbuffer_w = 0, backbuffer_h = 0; - backBuffer->get_size(backbuffer_w, backbuffer_h); + backBuffer = Glib::RefPtr ( new BackBuffer (exp_width, exp_height, win) ); + // If thumbnail is hidden by a filter, drawing to it will crash // if either with or height is zero then return early - if (backbuffer_w * backbuffer_h == 0) { + if (!backBuffer->getWidth() || !backBuffer->getHeight()) { return; } + Cairo::RefPtr surface = backBuffer->getSurface(); + bbSelected = selected; bbFramed = framed; bbPreview = preview; - Glib::RefPtr gc_ = Gdk::GC::create (backBuffer); + Cairo::RefPtr cc = Cairo::Context::create(surface); - Gdk::Color textn = w->get_style()->get_text(Gtk::STATE_NORMAL); - Gdk::Color texts = w->get_style()->get_text(Gtk::STATE_SELECTED); - Gdk::Color bgn = w->get_style()->get_bg(Gtk::STATE_NORMAL); - Gdk::Color bgs = w->get_style()->get_bg(Gtk::STATE_SELECTED); + Glib::RefPtr style = w->get_style_context(); + Gdk::RGBA txtn; + style->lookup_color("text", txtn); + Gdk::RGBA textn = style->get_color(Gtk::STATE_FLAG_NORMAL); + Gdk::RGBA texts = style->get_color(Gtk::STATE_FLAG_SELECTED); + Gdk::RGBA bgn = style->get_background_color(Gtk::STATE_FLAG_NORMAL); + Gdk::RGBA bgs = style->get_background_color(Gtk::STATE_FLAG_SELECTED); // clear area, draw frames and background - gc_->set_foreground (bgn); - gc_->set_background (bgn); - backBuffer->draw_rectangle (gc_, true, 0, 0, exp_width, exp_height); - Cairo::RefPtr cr = backBuffer->create_cairo_context(); - drawFrame (cr, bgs, bgn); + style->render_background(cc, 0., 0., exp_width, exp_height); + /* + cc->set_line_width(0.); + cc->set_line_cap(Cairo::LINE_CAP_BUTT); + cc->set_antialias(Cairo::ANTIALIAS_NONE); + cc->set_source_rgb(bgn.get_red(), bgn.get_green(), bgn.get_blue()); + cc->rectangle(0., 0., exp_width, exp_height); + cc->fill(); + */ + + cc->set_antialias(Cairo::ANTIALIAS_SUBPIXEL); + + drawFrame (cc, bgs, bgn); // calculate height of button set int bsHeight = 0; @@ -102,15 +112,15 @@ void ThumbBrowserEntryBase::updateBackBuffer () } // draw preview frame - //backBuffer->draw_rectangle (gc_, false, (exp_width-prew)/2, upperMargin+bsHeight, prew+1, preh+1); + //backBuffer->draw_rectangle (cc, false, (exp_width-prew)/2, upperMargin+bsHeight, prew+1, preh+1); // draw thumbnail image if (preview) { prex = borderWidth + (exp_width - prew) / 2; prey = upperMargin + bsHeight + borderWidth; - backBuffer->draw_rgb_image (gc_, prex, prey, prew, preh, Gdk::RGB_DITHER_NONE, preview, prew * 3); + backBuffer->copyRGBCharData(preview, 0, 0, prew, preh, prew * 3, prex, prey); } - customBackBufferUpdate (cr); + customBackBufferUpdate (cc); // draw icons onto the thumbnail area bbIcons = getIconsOnImageArea (); @@ -125,16 +135,16 @@ void ThumbBrowserEntryBase::updateBackBuffer () if ((parent->getLocation() != ThumbBrowserBase::THLOC_EDITOR && options.showFileNames && options.overlayedFileNames) || (parent->getLocation() == ThumbBrowserBase::THLOC_EDITOR && options.filmStripShowFileNames && options.filmStripOverlayedFileNames)) { - cr->begin_new_path (); - cr->rectangle (istartx, istarty, prew, fnlabh + dtlabh + exlabh + 2 * iofs_y); + cc->begin_new_path (); + cc->rectangle (istartx, istarty, prew, fnlabh + dtlabh + exlabh + 2 * iofs_y); - if ((texts.get_red_p() + texts.get_green_p() + texts.get_blue_p()) / 3 > 0.5) { - cr->set_source_rgba (0, 0, 0, 0.5); + if ((texts.get_red() + texts.get_green() + texts.get_blue()) / 3 > 0.5) { + cc->set_source_rgba (0, 0, 0, 0.5); } else { - cr->set_source_rgba (1, 1, 1, 0.5); + cc->set_source_rgba (1, 1, 1, 0.5); } - cr->fill (); + cc->fill (); } istartx += iofs_x; @@ -155,22 +165,25 @@ void ThumbBrowserEntryBase::updateBackBuffer () if ((parent->getLocation() != ThumbBrowserBase::THLOC_EDITOR && (!options.showFileNames || !options.overlayedFileNames)) || (parent->getLocation() == ThumbBrowserBase::THLOC_EDITOR && (!options.filmStripShowFileNames || !options.filmStripOverlayedFileNames))) { // Draw the transparent black background around icons - cr->begin_new_path (); - cr->move_to(istartx - igap, istarty); - cr->rel_line_to(igap, -igap); - cr->rel_line_to(iwidth, 0); - cr->rel_line_to(igap, igap); - cr->rel_line_to(0, iheight); - cr->rel_line_to(-igap, igap); - cr->rel_line_to(-iwidth, 0); - cr->rel_line_to(-igap, -igap); - cr->rel_line_to(0, -iheight); - cr->set_source_rgba (0, 0, 0, 0.6); - cr->fill (); + cc->begin_new_path (); + cc->move_to(istartx - igap, istarty); + cc->rel_line_to(igap, -igap); + cc->rel_line_to(iwidth, 0); + cc->rel_line_to(igap, igap); + cc->rel_line_to(0, iheight); + cc->rel_line_to(-igap, igap); + cc->rel_line_to(-iwidth, 0); + cc->rel_line_to(-igap, -igap); + cc->rel_line_to(0, -iheight); + cc->set_source_rgba (0, 0, 0, 0.6); + cc->fill (); } for (size_t i = 0; i < bbIcons.size(); i++) { - backBuffer->draw_pixbuf (gc_, bbIcons[i], 0, 0, istartx, istarty, bbIcons[i]->get_width(), bbIcons[i]->get_height(), Gdk::RGB_DITHER_NONE, 0, 0); + // Draw the image at 110, 90, except for the outermost 10 pixels. + 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; } } @@ -202,14 +215,19 @@ void ThumbBrowserEntryBase::updateBackBuffer () textposy = upperMargin + bsHeight + 2 * borderWidth + preh + borderWidth + textGap; textw = exp_width - 2 * textGap; - gc_->set_foreground (selected ? texts : textn); + + if (selected) { + cc->set_source_rgb(texts.get_red(), texts.get_green(), texts.get_blue()); + } else { + cc->set_source_rgb(textn.get_red(), textn.get_green(), textn.get_blue()); + } } else { textposx_fn = istartx; textposx_ex = istartx; textposx_dt = istartx; textposy = istarty; textw = prew - (istartx - prex); - gc_->set_foreground (texts); + cc->set_source_rgb(texts.get_red(), texts.get_green(), texts.get_blue()); } // draw file name @@ -227,7 +245,9 @@ void ThumbBrowserEntryBase::updateBackBuffer () Glib::RefPtr fn = w->create_pango_layout (dispname); fn->set_width (textw * Pango::SCALE); fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); - backBuffer->draw_layout(gc_, textposx_fn, textposy, fn); + cc->move_to(textposx_fn, textposy); + fn->add_to_cairo_context (cc); + cc->fill(); fontd.set_weight (Pango::WEIGHT_NORMAL); fontd.set_style (Pango::STYLE_NORMAL); @@ -241,7 +261,9 @@ void ThumbBrowserEntryBase::updateBackBuffer () fn = w->create_pango_layout (datetimeline); fn->set_width (textw * Pango::SCALE); fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); - backBuffer->draw_layout(gc_, textposx_dt, textposy + tpos, fn); + cc->move_to(textposx_dt, textposy + tpos); + fn->add_to_cairo_context (cc); + cc->fill(); tpos += dtlabh; } @@ -250,7 +272,9 @@ void ThumbBrowserEntryBase::updateBackBuffer () fn = w->create_pango_layout (exifline); fn->set_width (textw * Pango::SCALE); fn->set_ellipsize (Pango::ELLIPSIZE_MIDDLE); - backBuffer->draw_layout (gc_, textposx_ex, textposy + tpos, fn); + cc->move_to(textposx_ex, textposy + tpos); + fn->add_to_cairo_context (cc); + cc->fill(); tpos += exlabh; } } @@ -270,7 +294,8 @@ void ThumbBrowserEntryBase::getTextSizes (int& infow, int& infoh) dispname = shortname; Glib::RefPtr context = w->get_pango_context () ; - context->set_font_description (w->get_style()->get_font()); + context->set_font_description (w->get_style_context()->get_font()); + // filename: Pango::FontDescription fontd = context->get_font_description (); @@ -393,49 +418,46 @@ void ThumbBrowserEntryBase::resize (int h) delete [] preview; preview = NULL; refreshThumbnailImage (); - } else { - backBuffer.clear(); // This will force a backBuffer update on queue_draw + } else if (backBuffer) { + backBuffer->setDirty(true); // This will force a backBuffer update on queue_draw } drawable = true; } -void ThumbBrowserEntryBase::drawFrame (Cairo::RefPtr cr, const Gdk::Color& bg, const Gdk::Color& fg) +void ThumbBrowserEntryBase::drawFrame (Cairo::RefPtr cc, const Gdk::RGBA& bg, const Gdk::RGBA& fg) { - int radius = 8; + int radius = 4; if (selected || framed) { - cr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL); - cr->move_to (radius, 0); - cr->arc (exp_width - 1 - radius, radius, radius, -M_PI / 2, 0); - cr->arc (exp_width - 1 - radius, exp_height - 1 - radius, radius, 0, M_PI / 2); - cr->arc (radius, exp_height - 1 - radius, radius, M_PI / 2, M_PI); - cr->arc (radius, radius, radius, M_PI, -M_PI / 2); - cr->close_path (); + cc->move_to (radius, 0); + cc->arc (exp_width - 1 - radius, radius, radius, -M_PI / 2, 0); + cc->arc (exp_width - 1 - radius, exp_height - 1 - radius, radius, 0, M_PI / 2); + cc->arc (radius, exp_height - 1 - radius, radius, M_PI / 2, M_PI); + cc->arc (radius, radius, radius, M_PI, -M_PI / 2); + cc->close_path (); if (selected) { - cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p()); - cr->fill_preserve (); + cc->set_source_rgb (bg.get_red(), bg.get_green(), bg.get_blue()); + cc->fill_preserve (); } - cr->set_source_rgb (bg.get_red_p() * 2 / 3, bg.get_green_p() * 2 / 3, bg.get_blue_p() * 2 / 3); - cr->set_line_width (1.0); - cr->stroke (); - + cc->set_source_rgb (bg.get_red() * 2 / 3, bg.get_green() * 2 / 3, bg.get_blue() * 2 / 3); + cc->set_line_width (1.0); + cc->stroke (); } if (framed) { - cr->set_antialias (Cairo::ANTIALIAS_SUBPIXEL); - cr->move_to (+2 + 0.5 + radius, +2 + 0.5); - cr->arc (-2 + 0.5 + exp_width - 1 - radius, +2 + 0.5 + radius, radius, -M_PI / 2, 0); - cr->arc (-2 + 0.5 + exp_width - 1 - radius, -2 + 0.5 + exp_height - 1 - radius, radius, 0, M_PI / 2); - cr->arc (+2 + 0.5 + radius, -2 + exp_height - 1 - radius, radius, M_PI / 2, M_PI); - cr->arc (+2 + 0.5 + radius, +2 + radius, radius, M_PI, -M_PI / 2); - cr->close_path (); - cr->set_source_rgb (fg.get_red_p(), fg.get_green_p(), fg.get_blue_p()); - cr->set_line_width (2.0); - cr->stroke (); + cc->move_to (+2 + 0.5 + radius, +2 + 0.5); + cc->arc (-2 + 0.5 + exp_width - 1 - radius, +2 + 0.5 + radius, radius, -M_PI / 2, 0); + cc->arc (-2 + 0.5 + exp_width - 1 - radius, -2 + 0.5 + exp_height - 1 - radius, radius, 0, M_PI / 2); + cc->arc (+2 + 0.5 + radius, -2 + exp_height - 1 - radius, radius, M_PI / 2, M_PI); + cc->arc (+2 + 0.5 + radius, +2 + radius, radius, M_PI, -M_PI / 2); + cc->close_path (); + cc->set_source_rgb (fg.get_red(), fg.get_green(), fg.get_blue()); + cc->set_line_width (2.0); + cc->stroke (); } } @@ -453,33 +475,38 @@ void ThumbBrowserEntryBase::draw () int bbWidth, bbHeight; if (backBuffer) { - backBuffer->get_size (bbWidth, bbHeight); + bbWidth = backBuffer->getWidth(); + bbHeight = backBuffer->getHeight(); } if (!backBuffer || selected != bbSelected || framed != bbFramed || preview != bbPreview - || exp_width != bbWidth || exp_height != bbHeight || getIconsOnImageArea () != bbIcons) { + || exp_width != bbWidth || exp_height != bbHeight || getIconsOnImageArea () != bbIcons || backBuffer->isDirty()) { updateBackBuffer (); } Gtk::Widget* w = parent->getDrawingArea (); - Glib::RefPtr gc_ = Gdk::GC::create (w->get_window()); + Glib::RefPtr win = w->get_window(); + Cairo::RefPtr cc = win->create_cairo_context(); + Glib::RefPtr sc = w->get_style_context(); -// Gdk::Color textn = w->get_style()->get_text(Gtk::STATE_NORMAL); - // Gdk::Color texts = w->get_style()->get_text(Gtk::STATE_SELECTED); - Gdk::Color bgn = w->get_style()->get_bg(Gtk::STATE_NORMAL); - Gdk::Color bgs = w->get_style()->get_bg(Gtk::STATE_SELECTED); - - w->get_window()->draw_drawable (gc_, backBuffer, 0, 0, startx + ofsX, starty + ofsY); +// Gdk::RGBA textn = sc->get_color(Gtk::STATE_FLAG_NORMAL); +// Gdk::RGBA texts = sc->get_color(Gtk::STATE_FLAG_SELECTED); + Gdk::RGBA bgn = sc->get_background_color(Gtk::STATE_FLAG_NORMAL); + Gdk::RGBA bgs = sc->get_background_color(Gtk::STATE_FLAG_SELECTED); + int w_ = startx + ofsX; + int h_ = starty + ofsY; + cc->set_source(backBuffer->getSurface(), w_, h_); + cc->rectangle(w_, h_, backBuffer->getWidth(), backBuffer->getHeight()); + cc->fill(); // check icon set changes!!! -// drawProgressBar (window, gc_, selected ? texts : textn, selected ? bgs : bgn, ofsX+startx, exp_width, ofsY+starty + upperMargin+bsHeight+borderWidth+preh+borderWidth+textGap+tpos, fnlabh); +// drawProgressBar (window, cc, selected ? texts : textn, selected ? bgs : bgn, ofsX+startx, exp_width, ofsY+starty + upperMargin+bsHeight+borderWidth+preh+borderWidth+textGap+tpos, fnlabh); // redraw button set above the thumbnail if (buttonSet) { buttonSet->setColors (selected ? bgs : bgn, selected ? bgn : bgs); - Cairo::RefPtr cc = w->get_window()->create_cairo_context(); buttonSet->redraw (cc); } } diff --git a/rtgui/thumbbrowserentrybase.h b/rtgui/thumbbrowserentrybase.h index e910aedd0..53ea0a211 100644 --- a/rtgui/thumbbrowserentrybase.h +++ b/rtgui/thumbbrowserentrybase.h @@ -23,6 +23,8 @@ #include "lwbuttonset.h" #include "thumbnail.h" #include "threadutils.h" +#include "guiutils.h" +#include "cursormanager.h" class ThumbBrowserBase; class ThumbBrowserEntryBase @@ -73,12 +75,13 @@ protected: ThumbBrowserBase* parent; - Glib::RefPtr backBuffer; + Glib::RefPtr backBuffer; bool bbSelected, bbFramed; guint8* bbPreview; std::vector > bbIcons; + CursorShape cursor_type; - void drawFrame (Cairo::RefPtr cr, const Gdk::Color& bg, const Gdk::Color& fg); + void drawFrame (Cairo::RefPtr cr, const Gdk::RGBA& bg, const Gdk::RGBA& fg); void getTextSizes (int& w, int& h); // called during updateBackBuffer for custom overlays @@ -172,7 +175,7 @@ public: virtual void refreshQuickThumbnailImage () {} virtual void calcThumbnailSize () {} - virtual void drawProgressBar (Glib::RefPtr win, Glib::RefPtr gc, const Gdk::Color& foregr, const Gdk::Color& backgr, int x, int w, int y, int h) {} + 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 () { diff --git a/rtgui/thumbimageupdater.cc b/rtgui/thumbimageupdater.cc index 3f5861677..e9baf25f1 100644 --- a/rtgui/thumbimageupdater.cc +++ b/rtgui/thumbimageupdater.cc @@ -81,12 +81,8 @@ public: Glib::ThreadPool* threadPool_; // Need to be a Glib::Threads::Mutex because used in a Glib::Threads::Cond object... - // This is the only exceptions in RT so far, MyMutex is used everywhere else -#ifdef WIN32 - Glib::Mutex mutex_; -#else + // This is the only exceptions along with GThreadMutex (guiutils.cc), MyMutex is used everywhere else Glib::Threads::Mutex mutex_; -#endif JobList jobs_; @@ -94,11 +90,7 @@ public: bool inactive_waiting_; -#ifdef WIN32 - Glib::Cond inactive_; -#else Glib::Threads::Cond inactive_; -#endif void processNextJob() @@ -106,11 +98,7 @@ public: Job j; { -#ifdef WIN32 - Glib::Mutex::Lock lock(mutex_); -#else Glib::Threads::Mutex::Lock lock(mutex_); -#endif // nothing to do; could be jobs have been removed if ( jobs_.empty() ) { @@ -173,12 +161,7 @@ public: } { -#ifdef WIN32 - Glib::Mutex::Lock lock(mutex_); -#else Glib::Threads::Mutex::Lock lock(mutex_); -#endif - if ( --active_ == 0 && inactive_waiting_ ) { @@ -215,11 +198,7 @@ ThumbImageUpdater::add(ThumbBrowserEntryBase* tbe, bool* priority, bool upgrade, return; } -#ifdef WIN32 - Glib::Mutex::Lock lock(impl_->mutex_); -#else Glib::Threads::Mutex::Lock lock(impl_->mutex_); -#endif // look up if an older version is in the queue Impl::JobList::iterator i(impl_->jobs_.begin()); @@ -251,11 +230,7 @@ ThumbImageUpdater::removeJobs(ThumbImageUpdateListener* listener) { DEBUG("removeJobs(%p)", listener); -#ifdef WIN32 - Glib::Mutex::Lock lock(impl_->mutex_); -#else Glib::Threads::Mutex::Lock lock(impl_->mutex_); -#endif for( Impl::JobList::iterator i(impl_->jobs_.begin()); i != impl_->jobs_.end(); ) { if (i->listener_ == listener) { @@ -282,11 +257,7 @@ ThumbImageUpdater::removeAllJobs(void) { DEBUG("stop"); -#ifdef WIN32 - Glib::Mutex::Lock lock(impl_->mutex_); -#else Glib::Threads::Mutex::Lock lock(impl_->mutex_); -#endif impl_->jobs_.clear(); diff --git a/rtgui/thumbimageupdater.h b/rtgui/thumbimageupdater.h index ea9cff6d7..ecf45fb15 100644 --- a/rtgui/thumbimageupdater.h +++ b/rtgui/thumbimageupdater.h @@ -29,6 +29,7 @@ class ThumbImageUpdateListener public: + virtual ~ThumbImageUpdateListener() {} /** * @brief Called when thumbnail image is update * diff --git a/rtgui/thumbnailbrowser.h b/rtgui/thumbnailbrowser.h index c237c2194..0c2d6ebab 100644 --- a/rtgui/thumbnailbrowser.h +++ b/rtgui/thumbnailbrowser.h @@ -62,11 +62,10 @@ class ThumbBrowser : public Gtk::DrawingArea protected: int dx, dy, w, h; - Glib::RefPtr gc_; - Gdk::Color black; - Gdk::Color white; - Gdk::Color blue; - Gdk::Color bluew; + Gdk::RGBA black; + Gdk::RGBA white; + Gdk::RGBA blue; + Gdk::RGBA bluew; std::vector fd; std::vector selected; @@ -89,7 +88,7 @@ public: } virtual void on_realize(); - virtual bool on_expose_event(GdkEventExpose* event); + virtual bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); virtual bool on_button_press_event (GdkEventButton* event); virtual bool on_button_release_event (GdkEventButton* event); virtual void previewReady (FileDescr* fdn); diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 770652430..cdec7c0e1 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -52,6 +52,8 @@ ToneCurve::ToneCurve () : FoldableToolPanel(this, "tonecurve", M("TP_EXPOSURE_LA sclip->set_increments (0.01, 0.10); sclip->set_value (0.02); sclip->set_digits (2); + sclip->set_width_chars(4); + sclip->set_max_width_chars(4); sclip->signal_value_changed().connect( sigc::mem_fun(*this, &ToneCurve::clip_changed) ); neutral = Gtk::manage (new Gtk::Button (M("TP_NEUTRAL"))); @@ -75,10 +77,10 @@ ToneCurve::ToneCurve () : FoldableToolPanel(this, "tonecurve", M("TP_EXPOSURE_LA pack_start (*hrenabled); method = Gtk::manage (new MyComboBoxText ()); - method->append_text (M("TP_HLREC_LUMINANCE")); - method->append_text (M("TP_HLREC_CIELAB")); - method->append_text (M("TP_HLREC_COLOR")); - method->append_text (M("TP_HLREC_BLEND")); + method->append (M("TP_HLREC_LUMINANCE")); + method->append (M("TP_HLREC_CIELAB")); + method->append (M("TP_HLREC_COLOR")); + method->append (M("TP_HLREC_BLEND")); method->set_active (0); hlrbox = Gtk::manage (new Gtk::HBox ()); @@ -122,12 +124,12 @@ ToneCurve::ToneCurve () : FoldableToolPanel(this, "tonecurve", M("TP_EXPOSURE_LA pack_start (*Gtk::manage (new Gtk::HSeparator())); toneCurveMode = Gtk::manage (new MyComboBoxText ()); - toneCurveMode->append_text (M("TP_EXPOSURE_TCMODE_STANDARD")); - toneCurveMode->append_text (M("TP_EXPOSURE_TCMODE_WEIGHTEDSTD")); - toneCurveMode->append_text (M("TP_EXPOSURE_TCMODE_FILMLIKE")); - toneCurveMode->append_text (M("TP_EXPOSURE_TCMODE_SATANDVALBLENDING")); - toneCurveMode->append_text (M("TP_EXPOSURE_TCMODE_LUMINANCE")); - toneCurveMode->append_text (M("TP_EXPOSURE_TCMODE_PERCEPTUAL")); + toneCurveMode->append (M("TP_EXPOSURE_TCMODE_STANDARD")); + toneCurveMode->append (M("TP_EXPOSURE_TCMODE_WEIGHTEDSTD")); + toneCurveMode->append (M("TP_EXPOSURE_TCMODE_FILMLIKE")); + toneCurveMode->append (M("TP_EXPOSURE_TCMODE_SATANDVALBLENDING")); + toneCurveMode->append (M("TP_EXPOSURE_TCMODE_LUMINANCE")); + toneCurveMode->append (M("TP_EXPOSURE_TCMODE_PERCEPTUAL")); toneCurveMode->set_active (0); toneCurveMode->set_tooltip_text(M("TP_EXPOSURE_TCMODE_LABEL1")); @@ -149,12 +151,12 @@ ToneCurve::ToneCurve () : FoldableToolPanel(this, "tonecurve", M("TP_EXPOSURE_LA //----------- Curve 2 ------------------------------ toneCurveMode2 = Gtk::manage (new MyComboBoxText ()); - toneCurveMode2->append_text (M("TP_EXPOSURE_TCMODE_STANDARD")); - toneCurveMode2->append_text (M("TP_EXPOSURE_TCMODE_WEIGHTEDSTD")); - toneCurveMode2->append_text (M("TP_EXPOSURE_TCMODE_FILMLIKE")); - toneCurveMode2->append_text (M("TP_EXPOSURE_TCMODE_SATANDVALBLENDING")); - toneCurveMode2->append_text (M("TP_EXPOSURE_TCMODE_LUMINANCE")); - toneCurveMode2->append_text (M("TP_EXPOSURE_TCMODE_PERCEPTUAL")); + toneCurveMode2->append (M("TP_EXPOSURE_TCMODE_STANDARD")); + toneCurveMode2->append (M("TP_EXPOSURE_TCMODE_WEIGHTEDSTD")); + toneCurveMode2->append (M("TP_EXPOSURE_TCMODE_FILMLIKE")); + toneCurveMode2->append (M("TP_EXPOSURE_TCMODE_SATANDVALBLENDING")); + toneCurveMode2->append (M("TP_EXPOSURE_TCMODE_LUMINANCE")); + toneCurveMode2->append (M("TP_EXPOSURE_TCMODE_PERCEPTUAL")); toneCurveMode2->set_active (0); toneCurveMode2->set_tooltip_text(M("TP_EXPOSURE_TCMODE_LABEL2")); @@ -236,6 +238,7 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) clipDirty = pedited->toneCurve.clip; shape->setUnChanged (!pedited->toneCurve.curve); shape2->setUnChanged (!pedited->toneCurve.curve2); + hrenabled->set_inconsistent (!pedited->toneCurve.hrenabled); if (!pedited->toneCurve.curveMode) { toneCurveMode->set_active(6); @@ -246,10 +249,6 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) } } - if (pedited) { - hrenabled->set_inconsistent (!pedited->toneCurve.hrenabled); - } - enaconn.block (true); hrenabled->set_active (pp->toneCurve.hrenabled); enaconn.block (false); @@ -358,9 +357,6 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->toneCurve.curve2 = !shape2->isUnChanged (); pedited->toneCurve.curveMode = toneCurveMode->get_active_row_number() != 6; pedited->toneCurve.curveMode2 = toneCurveMode2->get_active_row_number() != 6; - } - - if (pedited) { pedited->toneCurve.method = method->get_active_row_number() != 4; pedited->toneCurve.hrenabled = !hrenabled->get_inconsistent(); } @@ -805,7 +801,7 @@ bool ToneCurve::autoExpComputed_ () void ToneCurve::setBatchMode (bool batchMode) { ToolPanel::setBatchMode (batchMode); - method->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); removeIfThere (abox, autolevels, false); autolevels = Gtk::manage (new Gtk::CheckButton (M("TP_EXPOSURE_AUTOLEVELS"))); @@ -823,8 +819,8 @@ void ToneCurve::setBatchMode (bool batchMode) contrast->showEditedCB (); saturation->showEditedCB (); - toneCurveMode->append_text (M("GENERAL_UNCHANGED")); - toneCurveMode2->append_text (M("GENERAL_UNCHANGED")); + toneCurveMode->append (M("GENERAL_UNCHANGED")); + toneCurveMode2->append (M("GENERAL_UNCHANGED")); curveEditorG->setBatchMode (batchMode); curveEditorG2->setBatchMode (batchMode); diff --git a/rtgui/toolbar.cc b/rtgui/toolbar.cc index 7a7222299..9490a2057 100644 --- a/rtgui/toolbar.cc +++ b/rtgui/toolbar.cc @@ -339,8 +339,8 @@ bool ToolBar::handleShortcutKey (GdkEventKey* event) if (!ctrl && !alt) { switch(event->keyval) { - case GDK_w: - case GDK_W: + case GDK_KEY_w: + case GDK_KEY_W: if(wbTool) { wb_pressed (); return true; @@ -348,18 +348,18 @@ bool ToolBar::handleShortcutKey (GdkEventKey* event) return false; - case GDK_c: - case GDK_C: + case GDK_KEY_c: + case GDK_KEY_C: crop_pressed (); return true; - case GDK_s: - case GDK_S: + case GDK_KEY_s: + case GDK_KEY_S: stra_pressed (); return true; - case GDK_h: - case GDK_H: + case GDK_KEY_h: + case GDK_KEY_H: hand_pressed (); return true; } diff --git a/rtgui/toolpanel.cc b/rtgui/toolpanel.cc index fdee3fa79..4a863604f 100644 --- a/rtgui/toolpanel.cc +++ b/rtgui/toolpanel.cc @@ -39,7 +39,7 @@ void ToolVBox::updateStyle() } } -void ToolVBox::on_style_changed (const Glib::RefPtr& style) +void ToolVBox::on_style_updated () { updateStyle(); } @@ -60,7 +60,7 @@ void ToolParamBlock::updateStyle() } } -void ToolParamBlock::on_style_changed (const Glib::RefPtr& style) +void ToolParamBlock::on_style_updated () { updateStyle(); } @@ -78,7 +78,7 @@ FoldableToolPanel::FoldableToolPanel(Gtk::Box* content, Glib::ustring toolName, Gtk::Label *label = Gtk::manage(new Gtk::Label()); label->set_markup(Glib::ustring("") + escapeHtmlChars(UILabel) + Glib::ustring("")); - label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + label->set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_CENTER); titleHBox->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0); RTImage *image = Gtk::manage (new RTImage("zoom-100-identifier.png")); @@ -136,6 +136,13 @@ void FoldableToolPanel::set_inconsistent(bool isInconsistent) exp->set_inconsistent(isInconsistent); } +void FoldableToolPanel::setLevel (int level) +{ + if (exp) { + exp->setLevel(level); + } +} + bool FoldableToolPanel::getEnabled() { return exp->getEnabled(); diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index 69a8d18ac..28afb2b15 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -48,7 +48,7 @@ private: public: ToolVBox(); - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); }; /// @brief This class control the space around a tool's block of parameter. */ @@ -59,7 +59,7 @@ private: public: ToolParamBlock(); - void on_style_changed (const Glib::RefPtr& style); + void on_style_updated (); }; class ToolPanel @@ -202,6 +202,8 @@ public: bool get_inconsistent(); // related to the enabled/disabled state void set_inconsistent(bool isInconsistent); // related to the enabled/disabled state + void setLevel (int level); + // Functions that want to receive an enabled/disabled event from this class // will have to receive it from MyExpander directly, we do not create // a relaying event diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index c77a9cdb5..8e7c0f96d 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -147,39 +147,39 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) toolPanels.push_back (crop); addPanel (transformPanel, resize); toolPanels.push_back (resize); - addPanel (resize->getPackBox(), prsharpening); + addPanel (resize->getPackBox(), prsharpening, 2); toolPanels.push_back (prsharpening); addPanel (transformPanel, lensgeom); toolPanels.push_back (lensgeom); - addPanel (lensgeom->getPackBox(), rotate); + addPanel (lensgeom->getPackBox(), rotate, 2); toolPanels.push_back (rotate); - addPanel (lensgeom->getPackBox(), perspective); + addPanel (lensgeom->getPackBox(), perspective, 2); toolPanels.push_back (perspective); - addPanel (lensgeom->getPackBox(), lensProf); + addPanel (lensgeom->getPackBox(), lensProf, 2); toolPanels.push_back (lensProf); - addPanel (lensgeom->getPackBox(), distortion); + addPanel (lensgeom->getPackBox(), distortion, 2); toolPanels.push_back (distortion); - addPanel (lensgeom->getPackBox(), cacorrection); + addPanel (lensgeom->getPackBox(), cacorrection, 2); toolPanels.push_back (cacorrection); - addPanel (lensgeom->getPackBox(), vignetting); + addPanel (lensgeom->getPackBox(), vignetting, 2); toolPanels.push_back (vignetting); addPanel (colorPanel, icm); toolPanels.push_back (icm); addPanel (rawPanel, sensorbayer); toolPanels.push_back (sensorbayer); - addPanel (sensorbayer->getPackBox(), bayerprocess); + addPanel (sensorbayer->getPackBox(), bayerprocess, 2); toolPanels.push_back (bayerprocess); - addPanel (sensorbayer->getPackBox(), bayerrawexposure); + addPanel (sensorbayer->getPackBox(), bayerrawexposure, 2); toolPanels.push_back (bayerrawexposure); - addPanel (sensorbayer->getPackBox(), bayerpreprocess); + addPanel (sensorbayer->getPackBox(), bayerpreprocess, 2); toolPanels.push_back (bayerpreprocess); - addPanel (sensorbayer->getPackBox(), rawcacorrection); + addPanel (sensorbayer->getPackBox(), rawcacorrection, 2); toolPanels.push_back (rawcacorrection); addPanel (rawPanel, sensorxtrans); toolPanels.push_back (sensorxtrans); - addPanel (sensorxtrans->getPackBox(), xtransprocess); + addPanel (sensorxtrans->getPackBox(), xtransprocess, 2); toolPanels.push_back (xtransprocess); - addPanel (sensorxtrans->getPackBox(), xtransrawexposure); + addPanel (sensorxtrans->getPackBox(), xtransrawexposure, 2); toolPanels.push_back (xtransrawexposure); addPanel (rawPanel, rawexposure); toolPanels.push_back (rawexposure); @@ -284,17 +284,11 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) toolBar->setToolBarListener(this); } -void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel) +void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel, int level) { - // no more separator! - /*if (where->children().size()) { - Gtk::HSeparator *hsep = Gtk::manage (new Gtk::HSeparator()); - where->pack_start(*hsep, Gtk::PACK_SHRINK, 0); - hsep->show(); - }*/ - panel->setParent(where); + panel->setLevel(level); expList.push_back (panel->getExpander()); where->pack_start(*panel->getExpander(), false, false); @@ -766,31 +760,31 @@ bool ToolPanelCoordinator::handleShortcutKey (GdkEventKey* event) if (alt) { switch(event->keyval) { - case GDK_e: + case GDK_KEY_e: toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*exposurePanelSW)); return true; - case GDK_d: + case GDK_KEY_d: toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*detailsPanelSW)); return true; - case GDK_c: + case GDK_KEY_c: toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*colorPanelSW)); return true; - case GDK_t: + case GDK_KEY_t: toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*transformPanelSW)); return true; - case GDK_r: + case GDK_KEY_r: toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*rawPanelSW)); return true; - case GDK_w: + case GDK_KEY_w: toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*waveletPanelSW)); return true; - case GDK_m: + case GDK_KEY_m: if (metadataPanel) { toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*metadataPanel)); return true; diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 8362a3f37..0649bf60e 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -196,7 +196,7 @@ protected: bool hasChanged; - void addPanel (Gtk::Box* where, FoldableToolPanel* panel); + void addPanel (Gtk::Box* where, FoldableToolPanel* panel, int level = 1); void foldThemAll (GdkEventButton* event); void updateVScrollbars (bool hide); void updateTabsHeader (bool useIcons); diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 4bebb10ad..4b8c384e6 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -120,9 +120,9 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), tilesizeLabel = Gtk::manage (new Gtk::Label (M("TP_WAVELET_TILESIZE") + ":")); //tilesizeLabel->set_alignment(Gtk::ALIGN_START); Tilesmethod = Gtk::manage (new MyComboBoxText ()); - Tilesmethod->append_text (M("TP_WAVELET_TILESFULL")); - Tilesmethod->append_text (M("TP_WAVELET_TILESBIG")); - Tilesmethod->append_text (M("TP_WAVELET_TILESLIT")); + Tilesmethod->append (M("TP_WAVELET_TILESFULL")); + Tilesmethod->append (M("TP_WAVELET_TILESBIG")); + Tilesmethod->append (M("TP_WAVELET_TILESLIT")); Tilesmethodconn = Tilesmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::TilesmethodChanged) ); Tilesmethod->set_tooltip_text (M("TP_WAVELET_TILES_TOOLTIP")); tilesizeHBox->pack_start(*tilesizeLabel, Gtk::PACK_SHRINK, 4); @@ -132,11 +132,11 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), daubcoeffLabel = Gtk::manage (new Gtk::Label (M("TP_WAVELET_DAUB") + ":")); daubcoeffmethod = Gtk::manage (new MyComboBoxText ()); daubcoeffmethod->set_sensitive(true); - daubcoeffmethod->append_text (M("TP_WAVELET_DAUB2")); - daubcoeffmethod->append_text (M("TP_WAVELET_DAUB4")); - daubcoeffmethod->append_text (M("TP_WAVELET_DAUB6")); - daubcoeffmethod->append_text (M("TP_WAVELET_DAUB10")); - daubcoeffmethod->append_text (M("TP_WAVELET_DAUB14")); + daubcoeffmethod->append (M("TP_WAVELET_DAUB2")); + daubcoeffmethod->append (M("TP_WAVELET_DAUB4")); + daubcoeffmethod->append (M("TP_WAVELET_DAUB6")); + daubcoeffmethod->append (M("TP_WAVELET_DAUB10")); + daubcoeffmethod->append (M("TP_WAVELET_DAUB14")); daubcoeffmethodconn = daubcoeffmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::daubcoeffmethodChanged) ); daubcoeffmethod->set_tooltip_text (M("TP_WAVELET_DAUB_TOOLTIP")); daubcoeffHBox->pack_start(*daubcoeffLabel, Gtk::PACK_SHRINK, 4); @@ -144,9 +144,9 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), backgroundHBox = Gtk::manage (new Gtk::HBox()); Backmethod = Gtk::manage (new MyComboBoxText ()); - Backmethod->append_text (M("TP_WAVELET_B0")); - Backmethod->append_text (M("TP_WAVELET_B1")); - Backmethod->append_text (M("TP_WAVELET_B2")); + Backmethod->append (M("TP_WAVELET_B0")); + Backmethod->append (M("TP_WAVELET_B1")); + Backmethod->append (M("TP_WAVELET_B2")); Backmethodconn = Backmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::BackmethodChanged) ); backgroundLabel = Gtk::manage (new Gtk::Label (M("TP_WAVELET_BACKGROUND") + ":")); backgroundHBox->pack_start(*backgroundLabel, Gtk::PACK_SHRINK, 4); @@ -154,10 +154,10 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), levdirMainHBox = Gtk::manage (new Gtk::HBox()); CLmethod = Gtk::manage (new MyComboBoxText ()); - CLmethod->append_text (M("TP_WAVELET_LEVDIR_ONE")); - CLmethod->append_text (M("TP_WAVELET_LEVDIR_INF")); - CLmethod->append_text (M("TP_WAVELET_LEVDIR_SUP")); - CLmethod->append_text (M("TP_WAVELET_LEVDIR_ALL")); + CLmethod->append (M("TP_WAVELET_LEVDIR_ONE")); + CLmethod->append (M("TP_WAVELET_LEVDIR_INF")); + CLmethod->append (M("TP_WAVELET_LEVDIR_SUP")); + CLmethod->append (M("TP_WAVELET_LEVDIR_ALL")); CLmethodconn = CLmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::CLmethodChanged) ); levdirMainLabel = Gtk::manage (new Gtk::Label (M("TP_WAVELET_PROC") + ":")); levdirMainHBox->pack_start(*levdirMainLabel, Gtk::PACK_SHRINK, 4); @@ -167,24 +167,24 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), Lmethod = Gtk::manage (new MyComboBoxText ()); Lmethod->set_sensitive(false); Lmethod->set_sensitive(false); - Lmethod->append_text (M("TP_WAVELET_1")); - Lmethod->append_text (M("TP_WAVELET_2")); - Lmethod->append_text (M("TP_WAVELET_3")); - Lmethod->append_text (M("TP_WAVELET_4")); - Lmethod->append_text (M("TP_WAVELET_5")); - Lmethod->append_text (M("TP_WAVELET_6")); - Lmethod->append_text (M("TP_WAVELET_7")); - Lmethod->append_text (M("TP_WAVELET_8")); - Lmethod->append_text (M("TP_WAVELET_9")); - Lmethod->append_text (M("TP_WAVELET_SUPE")); - Lmethod->append_text (M("TP_WAVELET_RESID")); + Lmethod->append (M("TP_WAVELET_1")); + Lmethod->append (M("TP_WAVELET_2")); + Lmethod->append (M("TP_WAVELET_3")); + Lmethod->append (M("TP_WAVELET_4")); + Lmethod->append (M("TP_WAVELET_5")); + Lmethod->append (M("TP_WAVELET_6")); + Lmethod->append (M("TP_WAVELET_7")); + Lmethod->append (M("TP_WAVELET_8")); + Lmethod->append (M("TP_WAVELET_9")); + Lmethod->append (M("TP_WAVELET_SUPE")); + Lmethod->append (M("TP_WAVELET_RESID")); Lmethod->set_active(0); Dirmethod = Gtk::manage (new MyComboBoxText ()); Dirmethod->set_sensitive(false); - Dirmethod->append_text (M("TP_WAVELET_DONE")); - Dirmethod->append_text (M("TP_WAVELET_DTWO")); - Dirmethod->append_text (M("TP_WAVELET_DTHR")); - Dirmethod->append_text (M("TP_WAVELET_DALL")); + Dirmethod->append (M("TP_WAVELET_DONE")); + Dirmethod->append (M("TP_WAVELET_DTWO")); + Dirmethod->append (M("TP_WAVELET_DTHR")); + Dirmethod->append (M("TP_WAVELET_DALL")); Lmethodconn = Lmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::LmethodChanged) ); Dirmethodconn = Dirmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::DirmethodChanged) ); levdirSubHBox->pack_start(*Lmethod); @@ -255,8 +255,8 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), contrastSHVBox->set_spacing(2); HSmethod = Gtk::manage (new MyComboBoxText ()); - HSmethod->append_text (M("TP_WAVELET_HS1")); - HSmethod->append_text (M("TP_WAVELET_HS2")); + HSmethod->append (M("TP_WAVELET_HS1")); + HSmethod->append (M("TP_WAVELET_HS2")); HSmethodconn = HSmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::HSmethodChanged) ); hllev = Gtk::manage (new ThresholdAdjuster (M("TP_WAVELET_HIGHLIGHT"), 0., 100., 50., 75., 100., 98., 0, false)); @@ -293,9 +293,9 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), ctboxch->pack_start (*labmch, Gtk::PACK_SHRINK, 1); CHmethod = Gtk::manage (new MyComboBoxText ()); - CHmethod->append_text (M("TP_WAVELET_CH1")); - CHmethod->append_text (M("TP_WAVELET_CH2")); - CHmethod->append_text (M("TP_WAVELET_CH3")); + CHmethod->append (M("TP_WAVELET_CH1")); + CHmethod->append (M("TP_WAVELET_CH2")); + CHmethod->append (M("TP_WAVELET_CH3")); CHmethodconn = CHmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::CHmethodChanged) ); ctboxch->pack_start(*CHmethod); chBox->pack_start(*ctboxch); @@ -305,8 +305,8 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), ctboxCH->pack_start (*labmC, Gtk::PACK_SHRINK, 1); CHSLmethod = Gtk::manage (new MyComboBoxText ()); - CHSLmethod->append_text (M("TP_WAVELET_CHSL")); - CHSLmethod->append_text (M("TP_WAVELET_CHCU")); + CHSLmethod->append (M("TP_WAVELET_CHSL")); + CHSLmethod->append (M("TP_WAVELET_CHCU")); CHSLmethodconn = CHSLmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::CHSLmethodChanged) ); ctboxCH->pack_start(*CHSLmethod); @@ -450,9 +450,9 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), edbox->pack_start (*labmedgr, Gtk::PACK_SHRINK, 1); Medgreinf = Gtk::manage (new MyComboBoxText ()); - Medgreinf->append_text (M("TP_WAVELET_RE1")); - Medgreinf->append_text (M("TP_WAVELET_RE2")); - Medgreinf->append_text (M("TP_WAVELET_RE3")); + Medgreinf->append (M("TP_WAVELET_RE1")); + Medgreinf->append (M("TP_WAVELET_RE2")); + Medgreinf->append (M("TP_WAVELET_RE3")); MedgreinfConn = Medgreinf->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::MedgreinfChanged) ); Medgreinf->set_tooltip_markup (M("TP_WAVELET_EDGREINF_TOOLTIP")); edbox->pack_start(*Medgreinf); @@ -466,8 +466,8 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), ctboxED->pack_start (*labmED, Gtk::PACK_SHRINK, 1); EDmethod = Gtk::manage (new MyComboBoxText ()); - EDmethod->append_text (M("TP_WAVELET_EDSL")); - EDmethod->append_text (M("TP_WAVELET_EDCU")); + EDmethod->append (M("TP_WAVELET_EDSL")); + EDmethod->append (M("TP_WAVELET_EDCU")); EDmethodconn = EDmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::EDmethodChanged) ); ctboxED->pack_start(*EDmethod); edgBox->pack_start (*ctboxED); @@ -559,9 +559,9 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), ctboxNP->pack_start (*labmNP, Gtk::PACK_SHRINK, 1); NPmethod = Gtk::manage (new MyComboBoxText ()); - NPmethod->append_text (M("TP_WAVELET_NPNONE")); - NPmethod->append_text (M("TP_WAVELET_NPLOW")); - NPmethod->append_text (M("TP_WAVELET_NPHIGH")); + NPmethod->append (M("TP_WAVELET_NPNONE")); + NPmethod->append (M("TP_WAVELET_NPLOW")); + NPmethod->append (M("TP_WAVELET_NPHIGH")); NPmethodconn = NPmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::NPmethodChanged) ); NPmethod->set_tooltip_text (M("TP_WAVELET_NPTYPE_TOOLTIP")); @@ -647,8 +647,8 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), resBox->pack_start(*separatorR0, Gtk::PACK_SHRINK, 2); TMmethod = Gtk::manage (new MyComboBoxText ()); - TMmethod->append_text (M("TP_WAVELET_COMPCONT")); - TMmethod->append_text (M("TP_WAVELET_COMPTM")); + TMmethod->append (M("TP_WAVELET_COMPCONT")); + TMmethod->append (M("TP_WAVELET_COMPTM")); TMmethodconn = TMmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::TMmethodChanged) ); ctboxTM->pack_start(*TMmethod); resBox->pack_start (*ctboxTM); @@ -793,9 +793,9 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), ctboxFI->pack_start (*labmBA, Gtk::PACK_SHRINK, 1); BAmethod = Gtk::manage (new MyComboBoxText ()); - BAmethod->append_text (M("TP_WAVELET_BANONE")); - BAmethod->append_text (M("TP_WAVELET_BASLI")); - BAmethod->append_text (M("TP_WAVELET_BACUR")); + BAmethod->append (M("TP_WAVELET_BANONE")); + BAmethod->append (M("TP_WAVELET_BASLI")); + BAmethod->append (M("TP_WAVELET_BACUR")); BAmethodconn = BAmethod->signal_changed().connect ( sigc::mem_fun(*this, &Wavelet::BAmethodChanged) ); ctboxFI->pack_start(*BAmethod); ctboxBA->pack_start(*ctboxFI); @@ -880,30 +880,39 @@ Wavelet::Wavelet () : FoldableToolPanel(this, "wavelet", M("TP_WAVELET_LABEL"), //----------------------------- expsettings->add(*settingsVBox); + expsettings->setLevel(2); pack_start (*expsettings); expcontrast->add(*levBox); + expcontrast->setLevel(2); pack_start (*expcontrast); expchroma->add(*chBox); + expchroma->setLevel(2); pack_start (*expchroma); exptoning->add(*tonBox); + exptoning->setLevel(2); pack_start (*exptoning); expnoise->add(*noiseBox); + expnoise->setLevel(2); pack_start (*expnoise); expedge->add(*edgBox); + expedge->setLevel(2); pack_start (*expedge); expgamut->add(*conBox); + expgamut->setLevel(2); pack_start (*expgamut); expresid->add(*resBox); + expresid->setLevel(2); pack_start(*expresid); expfinal->add(*finalBox); + expfinal->setLevel(2); pack_start(*expfinal); } @@ -2331,20 +2340,20 @@ void Wavelet::LmethodChanged() void Wavelet::setBatchMode (bool batchMode) { - Lmethod->append_text (M("GENERAL_UNCHANGED")); - CLmethod->append_text (M("GENERAL_UNCHANGED")); - Backmethod->append_text (M("GENERAL_UNCHANGED")); - Tilesmethod->append_text (M("GENERAL_UNCHANGED")); - daubcoeffmethod->append_text (M("GENERAL_UNCHANGED")); - CHmethod->append_text (M("GENERAL_UNCHANGED")); - Medgreinf->append_text (M("GENERAL_UNCHANGED")); - CHSLmethod->append_text (M("GENERAL_UNCHANGED")); - EDmethod->append_text (M("GENERAL_UNCHANGED")); - NPmethod->append_text (M("GENERAL_UNCHANGED")); - BAmethod->append_text (M("GENERAL_UNCHANGED")); - TMmethod->append_text (M("GENERAL_UNCHANGED")); - HSmethod->append_text (M("GENERAL_UNCHANGED")); - Dirmethod->append_text (M("GENERAL_UNCHANGED")); + Lmethod->append (M("GENERAL_UNCHANGED")); + CLmethod->append (M("GENERAL_UNCHANGED")); + Backmethod->append (M("GENERAL_UNCHANGED")); + Tilesmethod->append (M("GENERAL_UNCHANGED")); + daubcoeffmethod->append (M("GENERAL_UNCHANGED")); + CHmethod->append (M("GENERAL_UNCHANGED")); + Medgreinf->append (M("GENERAL_UNCHANGED")); + CHSLmethod->append (M("GENERAL_UNCHANGED")); + EDmethod->append (M("GENERAL_UNCHANGED")); + NPmethod->append (M("GENERAL_UNCHANGED")); + BAmethod->append (M("GENERAL_UNCHANGED")); + TMmethod->append (M("GENERAL_UNCHANGED")); + HSmethod->append (M("GENERAL_UNCHANGED")); + Dirmethod->append (M("GENERAL_UNCHANGED")); CCWcurveEditorG->setBatchMode (batchMode); opaCurveEditorG->setBatchMode (batchMode); opacityCurveEditorG->setBatchMode (batchMode); diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index 914c59956..4af9de9d0 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -248,7 +248,8 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB Gtk::HBox* spotbox = Gtk::manage (new Gtk::HBox ()); spotbox->show (); - spotbutton = Gtk::manage (new Gtk::Button (M("TP_WBALANCE_SPOTWB"))); + spotbutton = Gtk::manage (new Gtk::Button ()); + spotbutton->set_tooltip_text(M("TP_WBALANCE_SPOTWB")); Gtk::Image* spotimg = Gtk::manage (new RTImage ("gtk-color-picker-small.png")); spotimg->show (); spotbutton->set_image (*spotimg); @@ -261,31 +262,31 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB spotsize = Gtk::manage (new MyComboBoxText ()); spotsize->show (); - spotsize->append_text ("2"); + spotsize->append ("2"); if (options.whiteBalanceSpotSize == 2) { spotsize->set_active(0); } - spotsize->append_text ("4"); + spotsize->append ("4"); if (options.whiteBalanceSpotSize == 4) { spotsize->set_active(1); } - spotsize->append_text ("8"); + spotsize->append ("8"); if (options.whiteBalanceSpotSize == 8) { spotsize->set_active(2); } - spotsize->append_text ("16"); + spotsize->append ("16"); if (options.whiteBalanceSpotSize == 16) { spotsize->set_active(3); } - spotsize->append_text ("32"); + spotsize->append ("32"); if (options.whiteBalanceSpotSize == 32) { spotsize->set_active(4); diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index f6c82a55a..de608491d 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -29,7 +29,7 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP method = Gtk::manage (new MyComboBoxText ()); for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) { - method->append_text(procparams::RAWParams::XTransSensor::methodstring[i]); + method->append(procparams::RAWParams::XTransSensor::methodstring[i]); } method->set_active(0); @@ -100,7 +100,7 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p void XTransProcess::setBatchMode(bool batchMode) { - method->append_text (M("GENERAL_UNCHANGED")); + method->append (M("GENERAL_UNCHANGED")); method->set_active(procparams::RAWParams::XTransSensor::numMethods); // No name ToolPanel::setBatchMode (batchMode); ccSteps->showEditedCB ();