Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.81k stars 316 forks source link

Favorites panel #5016

Closed heckflosse closed 5 years ago

heckflosse commented 5 years ago

Technically it's easy to make a panel with the most used tools. Here's an example. Currently it's hardcoded. It's just to show how easy it is:

diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc
index bf155b1d6..01e24b433 100644
--- a/rtgui/toolpanelcoord.cc
+++ b/rtgui/toolpanelcoord.cc
@@ -31,6 +31,7 @@ using namespace rtengine::procparams;
 ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChanged (false), editDataProvider (nullptr)
 {

+    userPanel   = Gtk::manage (new ToolVBox ());
     exposurePanel   = Gtk::manage (new ToolVBox ());
     detailsPanel    = Gtk::manage (new ToolVBox ());
     colorPanel      = Gtk::manage (new ToolVBox ());
@@ -102,15 +103,15 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     //     Medium -> High ISO

     addPanel (colorPanel, whitebalance);
-    addPanel (exposurePanel, toneCurve);
+    addPanel (userPanel, toneCurve);
     addPanel (colorPanel, vibrance);
     addPanel (colorPanel, chmixer);
     addPanel (colorPanel, blackwhite);
-    addPanel (exposurePanel, shadowshighlights);
-    addPanel (detailsPanel, sharpening);
-    addPanel (detailsPanel, localContrast);
+    addPanel (userPanel, shadowshighlights);
+    addPanel (userPanel, sharpening);
+    addPanel (userPanel, localContrast);
     addPanel (detailsPanel, sharpenEdge);
-    addPanel (detailsPanel, sharpenMicro);
+    addPanel (userPanel, sharpenMicro);
     addPanel (colorPanel, hsvequalizer);
     addPanel (colorPanel, filmSimulation);
     addPanel (colorPanel, softlight);
@@ -123,14 +124,14 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     addPanel (exposurePanel, gradient);
     addPanel (exposurePanel, lcurve);
     addPanel (advancedPanel, colorappearance);
-    addPanel (detailsPanel, impulsedenoise);
-    addPanel (detailsPanel, dirpyrdenoise);
+    addPanel (userPanel, impulsedenoise);
+    addPanel (userPanel, dirpyrdenoise);
     addPanel (detailsPanel, defringe);
     addPanel (detailsPanel, dirpyrequalizer);
     addPanel (detailsPanel, dehaze);
     addPanel (advancedPanel, wavelet);
     addPanel (transformPanel, crop);
-    addPanel (transformPanel, resize);
+    addPanel (userPanel, resize);
     addPanel (resize->getPackBox(), prsharpening, 2);
     addPanel (transformPanel, lensgeom);
     addPanel (lensgeom->getPackBox(), rotate, 2);
@@ -160,6 +161,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     toolPanelNotebook->set_name ("ToolPanelNotebook");

+    userPanelSW        = Gtk::manage (new MyScrolledWindow ());
     exposurePanelSW    = Gtk::manage (new MyScrolledWindow ());
     detailsPanelSW     = Gtk::manage (new MyScrolledWindow ());
     colorPanelSW       = Gtk::manage (new MyScrolledWindow ());
@@ -169,7 +171,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     updateVScrollbars (options.hideTPVScrollbar);

     // load panel endings
-    for (int i = 0; i < 6; i++) {
+    for (int i = 0; i < 7; i++) {
         vbPanelEnd[i] = Gtk::manage (new Gtk::VBox ());
         imgPanelEnd[i] = Gtk::manage (new RTImage ("ornament1.png"));
         imgPanelEnd[i]->show ();
@@ -177,30 +179,35 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
         vbPanelEnd[i]->show_all();
     }

+    userPanelSW->add  (*userPanel);
+    userPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
+    userPanel->pack_start (*vbPanelEnd[0], Gtk::PACK_SHRINK, 4);
+
     exposurePanelSW->add  (*exposurePanel);
     exposurePanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    exposurePanel->pack_start (*vbPanelEnd[0], Gtk::PACK_SHRINK, 4);
+    exposurePanel->pack_start (*vbPanelEnd[1], Gtk::PACK_SHRINK, 4);

     detailsPanelSW->add   (*detailsPanel);
     detailsPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    detailsPanel->pack_start (*vbPanelEnd[1], Gtk::PACK_SHRINK, 4);
+    detailsPanel->pack_start (*vbPanelEnd[2], Gtk::PACK_SHRINK, 4);

     colorPanelSW->add     (*colorPanel);
     colorPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    colorPanel->pack_start (*vbPanelEnd[2], Gtk::PACK_SHRINK, 4);
+    colorPanel->pack_start (*vbPanelEnd[3], Gtk::PACK_SHRINK, 4);

     advancedPanelSW->add       (*advancedPanel);
     advancedPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    advancedPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);
+    advancedPanel->pack_start (*vbPanelEnd[6], Gtk::PACK_SHRINK, 0);

     transformPanelSW->add (*transformPanel);
     transformPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    transformPanel->pack_start (*vbPanelEnd[3], Gtk::PACK_SHRINK, 4);
+    transformPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 4);

     rawPanelSW->add       (*rawPanel);
     rawPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    rawPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 0);
+    rawPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);

+    toiU = Gtk::manage (new TextOrIcon ("wb-sun.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP")));
     toiE = Gtk::manage (new TextOrIcon ("exposure.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP")));
     toiD = Gtk::manage (new TextOrIcon ("detail.png", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP")));
     toiC = Gtk::manage (new TextOrIcon ("color-circles.png", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP")));
@@ -209,6 +216,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     toiR = Gtk::manage (new TextOrIcon ("bayer.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP")));
     toiM = Gtk::manage (new TextOrIcon ("metadata.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP")));

+    toolPanelNotebook->append_page (*userPanelSW,  *toiU);
     toolPanelNotebook->append_page (*exposurePanelSW,  *toiE);
     toolPanelNotebook->append_page (*detailsPanelSW,   *toiD);
     toolPanelNotebook->append_page (*colorPanelSW,     *toiC);
@@ -893,6 +901,7 @@ void ToolPanelCoordinator::updateVScrollbars (bool hide)
 {
     GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
     Gtk::PolicyType policy = hide ? Gtk::POLICY_NEVER : Gtk::POLICY_AUTOMATIC;
+    userPanelSW->set_policy     (Gtk::POLICY_AUTOMATIC, policy);
     exposurePanelSW->set_policy     (Gtk::POLICY_AUTOMATIC, policy);
     detailsPanelSW->set_policy      (Gtk::POLICY_AUTOMATIC, policy);
     colorPanelSW->set_policy        (Gtk::POLICY_AUTOMATIC, policy);
diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h
index 437e4055a..b12a11be7 100644
--- a/rtgui/toolpanelcoord.h
+++ b/rtgui/toolpanelcoord.h
@@ -158,6 +158,7 @@ protected:
     rtengine::StagedImageProcessor* ipc;

     std::vector<ToolPanel*> toolPanels;
+    ToolVBox* userPanel;
     ToolVBox* exposurePanel;
     ToolVBox* detailsPanel;
     ToolVBox* colorPanel;
@@ -166,6 +167,7 @@ protected:
     ToolVBox* advancedPanel;
     ToolBar* toolBar;

+    TextOrIcon* toiU;
     TextOrIcon* toiE;
     TextOrIcon* toiD;
     TextOrIcon* toiC;
@@ -174,9 +176,10 @@ protected:
     TextOrIcon* toiM;
     TextOrIcon* toiW;

-    Gtk::Image* imgPanelEnd[6];
-    Gtk::VBox* vbPanelEnd[6];
+    Gtk::Image* imgPanelEnd[7];
+    Gtk::VBox* vbPanelEnd[7];

+    Gtk::ScrolledWindow* userPanelSW;
     Gtk::ScrolledWindow* exposurePanelSW;
     Gtk::ScrolledWindow* detailsPanelSW;
     Gtk::ScrolledWindow* colorPanelSW;

grafik

heckflosse commented 5 years ago

Here's a first quick and dirty patch (replaces first patch) which allows definition of user defined tools in options file:

diff --git a/rtdata/languages/default b/rtdata/languages/default
index d3e40cb19..5e0a5e0cb 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -900,6 +900,8 @@ MAIN_TAB_ADVANCED;Advanced
 MAIN_TAB_ADVANCED_TOOLTIP;Shortcut: <b>Alt-w</b>
 MAIN_TAB_COLOR;Color
 MAIN_TAB_COLOR_TOOLTIP;Shortcut: <b>Alt-c</b>
+MAIN_TAB_CUSTOM;Custom
+MAIN_TAB_CUSTOM_TOOLTIP;Shortcut: none
 MAIN_TAB_DETAIL;Detail
 MAIN_TAB_DETAIL_TOOLTIP;Shortcut: <b>Alt-d</b>
 MAIN_TAB_DEVELOP; Batch Edit 
diff --git a/rtgui/options.cc b/rtgui/options.cc
index c1494a085..a388ccb3e 100644
--- a/rtgui/options.cc
+++ b/rtgui/options.cc
@@ -399,6 +399,7 @@ void Options::setDefaults()
     autoSaveTpOpen = true;
     //crvOpen.clear ();
     parseExtensions.clear();
+    userTools.clear();
     parseExtensionsEnabled.clear();
     parsedExtensions.clear();
     renameUseTemplates = false;
@@ -1069,6 +1070,10 @@ void Options::readFromFile(Glib::ustring fname)
             }

             if (keyFile.has_group("GUI")) {
+                if (keyFile.has_key("GUI", "UserTools")) {
+                    userTools = keyFile.get_string_list("GUI", "UserTools");
+                }
+
                 if (keyFile.has_key("GUI", "WindowWidth")) {
                     windowWidth = keyFile.get_integer("GUI", "WindowWidth");
                 }
@@ -1967,6 +1972,8 @@ void Options::saveToFile(Glib::ustring fname)
         keyFile.set_string("Profiles", "CustomProfileBuilderPath", CPBPath);
         keyFile.set_integer("Profiles", "CustomProfileBuilderKeys", CPBKeys);

+        Glib::ArrayHandle<Glib::ustring> pusert = userTools;
+        keyFile.set_string_list("GUI", "UserTools", pusert);
         keyFile.set_integer("GUI", "WindowWidth", windowWidth);
         keyFile.set_integer("GUI", "WindowHeight", windowHeight);
         keyFile.set_integer("GUI", "WindowX", windowX);
diff --git a/rtgui/options.h b/rtgui/options.h
index 47ced982d..a97c1f165 100644
--- a/rtgui/options.h
+++ b/rtgui/options.h
@@ -375,6 +375,7 @@ public:
     int           fastexport_resize_height;
     bool fastexport_use_fast_pipeline;

+    std::vector<Glib::ustring> userTools;
     // Dialog settings
     Glib::ustring lastIccDir;
     Glib::ustring lastDarkframeDir;
diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h
index 39abd03fa..fbe87f5f0 100644
--- a/rtgui/toolpanel.h
+++ b/rtgui/toolpanel.h
@@ -131,6 +131,9 @@ public:
         this->batchMode = batchMode;
     }

+    virtual Glib::ustring getToolName () {
+        return toolName;
+    }
 };

 class FoldableToolPanel : public ToolPanel
diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc
index bf155b1d6..1b6b47016 100644
--- a/rtgui/toolpanelcoord.cc
+++ b/rtgui/toolpanelcoord.cc
@@ -31,6 +31,7 @@ using namespace rtengine::procparams;
 ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChanged (false), editDataProvider (nullptr)
 {

+    userPanel   = Gtk::manage (new ToolVBox ());
     exposurePanel   = Gtk::manage (new ToolVBox ());
     detailsPanel    = Gtk::manage (new ToolVBox ());
     colorPanel      = Gtk::manage (new ToolVBox ());
@@ -100,66 +101,70 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     // Valeurs par dfaut:
     //     Best -> low ISO
     //     Medium -> High ISO
-
-    addPanel (colorPanel, whitebalance);
-    addPanel (exposurePanel, toneCurve);
-    addPanel (colorPanel, vibrance);
-    addPanel (colorPanel, chmixer);
-    addPanel (colorPanel, blackwhite);
-    addPanel (exposurePanel, shadowshighlights);
-    addPanel (detailsPanel, sharpening);
-    addPanel (detailsPanel, localContrast);
-    addPanel (detailsPanel, sharpenEdge);
-    addPanel (detailsPanel, sharpenMicro);
-    addPanel (colorPanel, hsvequalizer);
-    addPanel (colorPanel, filmSimulation);
-    addPanel (colorPanel, softlight);
-    addPanel (colorPanel, rgbcurves);
-    addPanel (colorPanel, colortoning);
-    addPanel (exposurePanel, epd);
-    addPanel (exposurePanel, fattal);
-    addPanel (advancedPanel, retinex);
-    addPanel (exposurePanel, pcvignette);
-    addPanel (exposurePanel, gradient);
-    addPanel (exposurePanel, lcurve);
-    addPanel (advancedPanel, colorappearance);
-    addPanel (detailsPanel, impulsedenoise);
-    addPanel (detailsPanel, dirpyrdenoise);
-    addPanel (detailsPanel, defringe);
-    addPanel (detailsPanel, dirpyrequalizer);
-    addPanel (detailsPanel, dehaze);
-    addPanel (advancedPanel, wavelet);
-    addPanel (transformPanel, crop);
-    addPanel (transformPanel, resize);
+    userTools.resize(options.userTools.size());
+
+    addUserPanel (colorPanel, whitebalance);
+    addUserPanel (exposurePanel, toneCurve);
+    addUserPanel (colorPanel, vibrance);
+    addUserPanel (colorPanel, chmixer);
+    addUserPanel (colorPanel, blackwhite);
+    addUserPanel (exposurePanel, shadowshighlights);
+    addUserPanel (detailsPanel, sharpening);
+    addUserPanel (detailsPanel, localContrast);
+    addUserPanel (detailsPanel, sharpenEdge);
+    addUserPanel (detailsPanel, sharpenMicro);
+    addUserPanel (colorPanel, hsvequalizer);
+    addUserPanel (colorPanel, filmSimulation);
+    addUserPanel (colorPanel, softlight);
+    addUserPanel (colorPanel, rgbcurves);
+    addUserPanel (colorPanel, colortoning);
+    addUserPanel (exposurePanel, epd);
+    addUserPanel (exposurePanel, fattal);
+    addUserPanel (advancedPanel, retinex);
+    addUserPanel (exposurePanel, pcvignette);
+    addUserPanel (exposurePanel, gradient);
+    addUserPanel (exposurePanel, lcurve);
+    addUserPanel (advancedPanel, colorappearance);
+    addUserPanel (detailsPanel, impulsedenoise);
+    addUserPanel (detailsPanel, dirpyrdenoise);
+    addUserPanel (detailsPanel, defringe);
+    addUserPanel (detailsPanel, dirpyrequalizer);
+    addUserPanel (detailsPanel, dehaze);
+    addUserPanel (advancedPanel, wavelet);
+    addUserPanel (transformPanel, crop);
+    addUserPanel (transformPanel, resize);
     addPanel (resize->getPackBox(), prsharpening, 2);
-    addPanel (transformPanel, lensgeom);
+    addUserPanel (transformPanel, lensgeom);
     addPanel (lensgeom->getPackBox(), rotate, 2);
     addPanel (lensgeom->getPackBox(), perspective, 2);
     addPanel (lensgeom->getPackBox(), lensProf, 2);
     addPanel (lensgeom->getPackBox(), distortion, 2);
     addPanel (lensgeom->getPackBox(), cacorrection, 2);
     addPanel (lensgeom->getPackBox(), vignetting, 2);
-    addPanel (colorPanel, icm);
-    addPanel (rawPanel, sensorbayer);
+    addUserPanel (colorPanel, icm);
+    addUserPanel (rawPanel, sensorbayer);
     addPanel (sensorbayer->getPackBox(), bayerprocess, 2);
     addPanel (sensorbayer->getPackBox(), bayerrawexposure, 2);
     addPanel (sensorbayer->getPackBox(), bayerpreprocess, 2);
     addPanel (sensorbayer->getPackBox(), rawcacorrection, 2);
-    addPanel (rawPanel, sensorxtrans);
+    addUserPanel (rawPanel, sensorxtrans);
     addPanel (sensorxtrans->getPackBox(), xtransprocess, 2);
     addPanel (sensorxtrans->getPackBox(), xtransrawexposure, 2);
-    addPanel (rawPanel, rawexposure);
-    addPanel (rawPanel, preprocess);
-    addPanel (rawPanel, darkframe);
-    addPanel (rawPanel, flatfield);
+    addUserPanel (rawPanel, rawexposure);
+    addUserPanel (rawPanel, preprocess);
+    addUserPanel (rawPanel, darkframe);
+    addUserPanel (rawPanel, flatfield);

+    for(auto it = userTools.begin(); it != userTools.end(); ++it) {
+        addPanel(userPanel, *it);
+    }
     toolPanels.push_back (coarse);
     toolPanels.push_back(metadata);

     toolPanelNotebook = new Gtk::Notebook ();
     toolPanelNotebook->set_name ("ToolPanelNotebook");

-
+    userPanelSW        = Gtk::manage (new MyScrolledWindow ());
     exposurePanelSW    = Gtk::manage (new MyScrolledWindow ());
     detailsPanelSW     = Gtk::manage (new MyScrolledWindow ());
     colorPanelSW       = Gtk::manage (new MyScrolledWindow ());
@@ -169,7 +174,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     updateVScrollbars (options.hideTPVScrollbar);

     // load panel endings
-    for (int i = 0; i < 6; i++) {
+    for (int i = 0; i < 7; i++) {
         vbPanelEnd[i] = Gtk::manage (new Gtk::VBox ());
         imgPanelEnd[i] = Gtk::manage (new RTImage ("ornament1.png"));
         imgPanelEnd[i]->show ();
@@ -177,30 +182,35 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
         vbPanelEnd[i]->show_all();
     }

+    userPanelSW->add  (*userPanel);
+    userPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
+    userPanel->pack_start (*vbPanelEnd[0], Gtk::PACK_SHRINK, 4);
+
     exposurePanelSW->add  (*exposurePanel);
     exposurePanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    exposurePanel->pack_start (*vbPanelEnd[0], Gtk::PACK_SHRINK, 4);
+    exposurePanel->pack_start (*vbPanelEnd[1], Gtk::PACK_SHRINK, 4);

     detailsPanelSW->add   (*detailsPanel);
     detailsPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    detailsPanel->pack_start (*vbPanelEnd[1], Gtk::PACK_SHRINK, 4);
+    detailsPanel->pack_start (*vbPanelEnd[2], Gtk::PACK_SHRINK, 4);

     colorPanelSW->add     (*colorPanel);
     colorPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    colorPanel->pack_start (*vbPanelEnd[2], Gtk::PACK_SHRINK, 4);
+    colorPanel->pack_start (*vbPanelEnd[3], Gtk::PACK_SHRINK, 4);

     advancedPanelSW->add       (*advancedPanel);
     advancedPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    advancedPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);
+    advancedPanel->pack_start (*vbPanelEnd[6], Gtk::PACK_SHRINK, 0);

     transformPanelSW->add (*transformPanel);
     transformPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    transformPanel->pack_start (*vbPanelEnd[3], Gtk::PACK_SHRINK, 4);
+    transformPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 4);

     rawPanelSW->add       (*rawPanel);
     rawPanel->pack_start (*Gtk::manage (new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
-    rawPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 0);
+    rawPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);

+    toiU = Gtk::manage (new TextOrIcon ("wb-sun.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP")));
     toiE = Gtk::manage (new TextOrIcon ("exposure.png", M ("MAIN_TAB_EXPOSURE"), M ("MAIN_TAB_EXPOSURE_TOOLTIP")));
     toiD = Gtk::manage (new TextOrIcon ("detail.png", M ("MAIN_TAB_DETAIL"), M ("MAIN_TAB_DETAIL_TOOLTIP")));
     toiC = Gtk::manage (new TextOrIcon ("color-circles.png", M ("MAIN_TAB_COLOR"), M ("MAIN_TAB_COLOR_TOOLTIP")));
@@ -209,6 +219,7 @@ ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChan
     toiR = Gtk::manage (new TextOrIcon ("bayer.png", M ("MAIN_TAB_RAW"), M ("MAIN_TAB_RAW_TOOLTIP")));
     toiM = Gtk::manage (new TextOrIcon ("metadata.png", M ("MAIN_TAB_METADATA"), M ("MAIN_TAB_METADATA_TOOLTIP")));

+    toolPanelNotebook->append_page (*userPanelSW,  *toiU);
     toolPanelNotebook->append_page (*exposurePanelSW,  *toiE);
     toolPanelNotebook->append_page (*detailsPanelSW,   *toiD);
     toolPanelNotebook->append_page (*colorPanelSW,     *toiC);
@@ -251,6 +262,18 @@ void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel,
     toolPanels.push_back (panel);
 }

+void ToolPanelCoordinator::addUserPanel (Gtk::Box* where, FoldableToolPanel* panel)
+{
+    auto name = panel->getToolName();
+    auto it = std::find(options.userTools.begin(), options.userTools.end(), name);
+    if (it != options.userTools.end()) {
+        int index = std::distance(options.userTools.begin(), it);
+        userTools[index] = panel;
+    } else {
+        addPanel(where, panel);
+    }
+}
+
 ToolPanelCoordinator::~ToolPanelCoordinator ()
 {
     idle_register.destroy();
@@ -893,6 +916,7 @@ void ToolPanelCoordinator::updateVScrollbars (bool hide)
 {
     GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
     Gtk::PolicyType policy = hide ? Gtk::POLICY_NEVER : Gtk::POLICY_AUTOMATIC;
+    userPanelSW->set_policy     (Gtk::POLICY_AUTOMATIC, policy);
     exposurePanelSW->set_policy     (Gtk::POLICY_AUTOMATIC, policy);
     detailsPanelSW->set_policy      (Gtk::POLICY_AUTOMATIC, policy);
     colorPanelSW->set_policy        (Gtk::POLICY_AUTOMATIC, policy);
diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h
index 437e4055a..76a3cdd1c 100644
--- a/rtgui/toolpanelcoord.h
+++ b/rtgui/toolpanelcoord.h
@@ -158,6 +158,8 @@ protected:
     rtengine::StagedImageProcessor* ipc;

     std::vector<ToolPanel*> toolPanels;
+    std::vector<FoldableToolPanel*> userTools;
+    ToolVBox* userPanel;
     ToolVBox* exposurePanel;
     ToolVBox* detailsPanel;
     ToolVBox* colorPanel;
@@ -166,6 +168,7 @@ protected:
     ToolVBox* advancedPanel;
     ToolBar* toolBar;

+    TextOrIcon* toiU;
     TextOrIcon* toiE;
     TextOrIcon* toiD;
     TextOrIcon* toiC;
@@ -174,9 +177,10 @@ protected:
     TextOrIcon* toiM;
     TextOrIcon* toiW;

-    Gtk::Image* imgPanelEnd[6];
-    Gtk::VBox* vbPanelEnd[6];
+    Gtk::Image* imgPanelEnd[7];
+    Gtk::VBox* vbPanelEnd[7];

+    Gtk::ScrolledWindow* userPanelSW;
     Gtk::ScrolledWindow* exposurePanelSW;
     Gtk::ScrolledWindow* detailsPanelSW;
     Gtk::ScrolledWindow* colorPanelSW;
@@ -191,6 +195,7 @@ protected:
     void addPanel (Gtk::Box* where, FoldableToolPanel* panel, int level = 1);
     void foldThemAll (GdkEventButton* event);
     void updateVScrollbars (bool hide);
+    void addUserPanel (Gtk::Box* where, FoldableToolPanel* panel);

 private:
     EditDataProvider *editDataProvider;

Example:

Add this to [GUI] section of options file:

UserTools=tonecurve;sharpening;

Result: grafik

heckflosse commented 5 years ago

I will create a branch...

Edit: Branch custom-tool-panel created

Thanatomanic commented 5 years ago

Great idea and indeed a simple execution. Can you start calling these Favourites? "User-defined panels" sounds technically true but less close than the actual thing it will implement. Or did you have something else in mind?

heckflosse commented 5 years ago

@Thanatomanic I'm open for any suggestion. Favourites sounds good :+1:

There still are some todos:

1) hide empty panels (for example in case someone moves all tools of a panel to Favourites) 2) it should be possible to define the favourites in preferences instead of manually editing the options file 3) we need an icon. I used the sun just because the sun is shining here atm

Floessie commented 5 years ago

@heckflosse That's just marvelous. I'm having intense RT sessions currently for our next calendar and realized, I only need a few tools regularly. Your proposal would be a great speedup.

One other minor thing missing is a hotkey for the sharpening contrast mask.

heckflosse commented 5 years ago

@Floessie #5018

Thanatomanic commented 5 years ago

@heckflosse to choose your favorites from preferences may be a bit cumbersome to code and maintain, because you would have to list them all manually, right? A way to mark a tool as favorite from the tool itself might clutter the interface a bit there, but may be easier to code.

heckflosse commented 5 years ago

@Thanatomanic :+1: for your suggestion. But that's nothing I am able to code...

heckflosse commented 5 years ago

Any suggestions for a hotkey? Unfortunately Alt-f is already used...

ff2000 commented 5 years ago

What about drag'n'drop? Grab the tool on the title label and drop it on the favorites' icon. Downside is that this isn't a directly user visible action. But you can still show a tooltip for the icon and a label with help when the favorites are empty. Another option would be a lock mechanism. Add a toggle icon in a tool box. Unlocking the favorites will show a favorite icon in each tool's header which will move the tool to favorites. Locking the favorites will hide the icons again. As you likely won't change favorites that often this approach might be a good middle way.

Thanatomanic commented 5 years ago

@ff2000 while I like the idea of drag and drop, and movable GUI in general, it is also much harder to code. The lock idea could be worthwhile, with a "Select favorites" button.

agriggio commented 5 years ago

@heckflosse great idea!

heckflosse commented 5 years ago

with 0ae602b I use 'Favourites' as suggested by @Thanatomanic Means, you have to change the key in options file to Favourites manually I also allowed moving of subtools to favourites (for example you can move profiled lens correction without moving the whole Lens/Geometry stuff). Also added alt-u as hotkey (the alt-h in commit message is a typo)

grafik

Edit: Options string I used for the screenshot

Favourites=sensorbayer;whitebalance;tonecurve;shadowshighlights;localcontrast;lensprof;dirpyrdenoise;sharpening;resize;
Beep6581 commented 5 years ago

@heckflosse *Favorites

heckflosse commented 5 years ago

@Beep6581 damn american english

sguyader commented 5 years ago

Glad to see favo(u)rites coming around the corner. I often use tools across different tabs repeatedly, the favourites will be a great relief!

TooWaBoo commented 5 years ago

GUI example: Click on the star adds or removes a tool. Arrow up / down moves tool up or down. unbenannt unbenannt2

heckflosse commented 5 years ago

I merged custom-tool-panel (aka favorites) into dev and also dev into blur-flat-regions because I don't want to lose the favorites in options file each time I switch between this branches.

TooWaBoo commented 5 years ago

@heckflosse I get these messages on compiling dev.

[ 87%] Building CXX object rtgui/CMakeFiles/rth.dir/vignetting.cc.obj
In file included from C:/_RT_compile/RT_code_Beep6581/rtgui/toolpanelcoord.cc:20:
C:/_RT_compile/RT_code_Beep6581/rtgui/toolpanelcoord.h: In constructor 'ToolPanelCoordinator::ToolPanelCoordinator(bool)':
C:/_RT_compile/RT_code_Beep6581/rtgui/toolpanelcoord.h:201:23: warning: 'ToolPanelCoordinator::editDataProvider' will be initialized after [-Wreorder]
     EditDataProvider *editDataProvider;
                       ^~~~~~~~~~~~~~~~
C:/_RT_compile/RT_code_Beep6581/rtgui/toolpanelcoord.h:183:26: warning:   'Gtk::ScrolledWindow* ToolPanelCoordinator::favoritePanelSW' [-Wreorder]
     Gtk::ScrolledWindow* favoritePanelSW;
                          ^~~~~~~~~~~~~~~
C:/_RT_compile/RT_code_Beep6581/rtgui/toolpanelcoord.cc:31:1: warning:   when initialized here [-Wreorder]
 ToolPanelCoordinator::ToolPanelCoordinator (bool batch) : ipc (nullptr), hasChanged (false), editDataProvider (nullptr), favoritePanelSW(nullptr)
 ^~~~~~~~~~~~~~~~~~~~
RawConvert commented 5 years ago

@heckflosse , I tried Favorite again. Couldn't remember what fattal was so put just that in Options. (Noticed RT had moved this new line to be the first in the section) I got this when I ran RT - paulssd2@shovel2:~$ bash runrtdev16dec.sh (rawtherapee:4513): GLib-GObject-WARNING : instance of invalid non-instantiatable type '(null)' (rawtherapee:4513): GLib-GObject-CRITICAL : g_signal_handlers_destroy: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed runrtdev16dec.sh: line 2: 4513 Segmentation fault (core dumped) ./rawtherapee

When I reverted to Options prior to editing (with Gedit, which is what I used yesterday to put the new stuff in) RT was fine.

Modified Options file - [GUI] Favorites=fattal; WindowWidth=1200 WindowHeight=680 WindowX=0 etc.....

heckflosse commented 5 years ago

@RawConvert I tried, but could not reproduce

TooWaBoo commented 5 years ago

Neither do I.

Beep6581 commented 5 years ago

Neither can I.

@RawConvert sometimes (rarely) RT crashes. When something like that happens, make sure you try restarting it at least twice to rule out "random" crashes. And provide a stack backtrace.

RawConvert commented 5 years ago

Nor me!... Just repeated the test and it's ok now. So fattal = dynamic range compression. ?Might be better to use the actual tool names as the keywords? (epd = tone mapping) Cheers!

heckflosse commented 5 years ago

@RawConvert

Might be better to use the actual tool names as the keywords?

No, tool names are localized whereas keywords have to be constant. Tough I agree about using better (more meaningful keywords) without a doubt

RawConvert commented 5 years ago

I suppose theoretically the keywords could be defined for each language and since RT would know the locale, it could work out what was needed. But appreciate that's a load more development to do. Given the keywords are constant, and English basically, surely they could be made rather more intuitive for the ?majority of users?

TooWaBoo commented 5 years ago

@RawConvert Right now, we don't need to discuss the name of the tools because the final version will have a GUI to configure I guess.

Beep6581 commented 5 years ago

Favorites functionality is ready for 5.6: http://rawpedia.rawtherapee.com/Favorites_Tab GUI handled by #5256