Custom tool panel, first step

This commit is contained in:
heckflosse
2018-11-23 14:36:16 +01:00
parent 52ddc63f54
commit d604abec39
6 changed files with 90 additions and 48 deletions

View File

@@ -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
userTools.resize(options.userTools.size());
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);
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_CUSTOM"), M ("MAIN_TAB_CUSTOM_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);