From abc288587956ef89c9322820a317c3d3ff6ec1ca Mon Sep 17 00:00:00 2001 From: natureh Date: Mon, 23 Jul 2012 23:02:10 +0200 Subject: [PATCH] Solving issue 1410: "Save Current Profile does not save some values" + shortcut keys are now also usable in single editor mode (when a filename is specified in the command line) --- rtdata/languages/Francais | 2 +- rtdata/languages/default | 2 +- rtengine/procevents.h | 2 +- rtengine/refreshmap.cc | 2 +- rtgui/editorpanel.cc | 65 +++++++++++++++++++++++++++------------ rtgui/editorpanel.h | 2 -- rtgui/editwindow.cc | 2 +- rtgui/rtwindow.cc | 35 ++++++++++++--------- rtgui/tonecurve.cc | 44 ++++++++++++++++---------- 9 files changed, 100 insertions(+), 56 deletions(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 916f701d6..a95e2af45 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -257,7 +257,7 @@ HISTORY_MSG_33;Déconvolution - Itérations HISTORY_MSG_34;Éviter l'écrêtage couleur HISTORY_MSG_35;Limiteur de saturation HISTORY_MSG_36;Limite de saturation -HISTORY_MSG_37;Rehaussement couleur +HISTORY_MSG_37;Exposition auto HISTORY_MSG_38;Méthode de balance des blancs HISTORY_MSG_39;Température de couleur HISTORY_MSG_40;Teinte de balance des blancs diff --git a/rtdata/languages/default b/rtdata/languages/default index ff89b70bf..a61773f7d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -258,7 +258,7 @@ HISTORY_MSG_33;Deconvolution Iterations HISTORY_MSG_34;LCP use disortion HISTORY_MSG_35;LCP use vignette HISTORY_MSG_36;LCP use CA -HISTORY_MSG_37;Color Boost +HISTORY_MSG_37;Auto Exposure HISTORY_MSG_38;White Balance Method HISTORY_MSG_39;Color Temperature HISTORY_MSG_40;White Balance Tint diff --git a/rtengine/procevents.h b/rtengine/procevents.h index fc2908d61..412d4b075 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -58,7 +58,7 @@ enum ProcEvent { EvLCPUseDist=33, EvLCPUseVign=34, EvLCPUseCA=35, - EvCBBoost=36, // obsolete + EvFixedExp=36, EvWBMethod=37, EvWBTemp=38, EvWBGreen=39, diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index b04686dff..22301a6c2 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -56,7 +56,7 @@ SHARPENING, // EvShrDIterations, TRANSFORM, // EvLCPUseDist, DARKFRAME, // EvLCPUseVign, TRANSFORM, // EvLCPUseCA, -0, // EvCBBoost: obsolete +M_VOID, // EvFixedExp WHITEBALANCE, // EvWBMethod, WHITEBALANCE, // EvWBTemp, WHITEBALANCE, // EvWBGreen, diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 512d990cb..eaa497040 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -90,7 +90,6 @@ EditorPanel::EditorPanel (FilePanel* filePanel) Gtk::VSeparator* vsepz = Gtk::manage (new Gtk::VSeparator ()); Gtk::VSeparator* vsepi = Gtk::manage (new Gtk::VSeparator ()); Gtk::VSeparator* vseph = Gtk::manage (new Gtk::VSeparator ()); - Gtk::VSeparator* vsep1 = Gtk::manage (new Gtk::VSeparator ()); hidehp = Gtk::manage (new Gtk::ToggleButton ()); @@ -107,13 +106,16 @@ EditorPanel::EditorPanel (FilePanel* filePanel) hidehp->set_image (*iHistoryShow); } - tbTopPanel_1 = new Gtk::ToggleButton (); - iTopPanel_1_Show = new RTImage ("panel-to-bottom.png"); - iTopPanel_1_Hide = new RTImage ("panel-to-top.png"); - tbTopPanel_1->set_relief(Gtk::RELIEF_NONE); - tbTopPanel_1->set_active (true); - tbTopPanel_1->set_tooltip_markup (M("MAIN_TOOLTIP_SHOWHIDETP1")); - tbTopPanel_1->set_image (*iTopPanel_1_Hide); + tbTopPanel_1 = NULL; + if (!simpleEditor && filePanel) { + tbTopPanel_1 = new Gtk::ToggleButton (); + iTopPanel_1_Show = new RTImage ("panel-to-bottom.png"); + iTopPanel_1_Hide = new RTImage ("panel-to-top.png"); + tbTopPanel_1->set_relief(Gtk::RELIEF_NONE); + tbTopPanel_1->set_active (true); + tbTopPanel_1->set_tooltip_markup (M("MAIN_TOOLTIP_SHOWHIDETP1")); + tbTopPanel_1->set_image (*iTopPanel_1_Hide); + } tbRightPanel_1 = new Gtk::ToggleButton (); iRightPanel_1_Show = new RTImage ("panel-to-left.png"); @@ -139,8 +141,11 @@ EditorPanel::EditorPanel (FilePanel* filePanel) toolBarPanel->pack_start (*tpc->getToolBar(), Gtk::PACK_SHRINK, 1); toolBarPanel->pack_start (*vsept, Gtk::PACK_SHRINK, 2); - toolBarPanel->pack_end (*tbTopPanel_1, Gtk::PACK_SHRINK, 1); - toolBarPanel->pack_end (*vsep1, Gtk::PACK_SHRINK, 2); + if (tbTopPanel_1) { + toolBarPanel->pack_end (*tbTopPanel_1, Gtk::PACK_SHRINK, 1); + Gtk::VSeparator* vsep1 = Gtk::manage (new Gtk::VSeparator ()); + toolBarPanel->pack_end (*vsep1, Gtk::PACK_SHRINK, 2); + } toolBarPanel->pack_end (*tpc->coarse, Gtk::PACK_SHRINK, 2); toolBarPanel->pack_end (*vsepcl, Gtk::PACK_SHRINK, 2); toolBarPanel->pack_end (*iareapanel->imageArea->indClippedPanel, Gtk::PACK_SHRINK, 0); @@ -286,12 +291,13 @@ EditorPanel::EditorPanel (FilePanel* filePanel) info->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::info_toggled) ); beforeAfter->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::beforeAfterToggled) ); hidehp->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::hideHistoryActivated) ); - tbTopPanel_1->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::tbTopPanel_1_toggled) ); tbRightPanel_1->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::tbRightPanel_1_toggled) ); saveimgas->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::saveAsPressed) ); queueimg->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::queueImgPressed) ); sendtogimp->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::sendToGimpPressed) ); ShowHideSidePanelsconn = tbShowHideSidePanels->signal_toggled().connect ( sigc::mem_fun(*this, &EditorPanel::toggleSidePanels), true); + if (tbTopPanel_1) + tbTopPanel_1->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::tbTopPanel_1_toggled) ); } EditorPanel::~EditorPanel () { @@ -332,6 +338,10 @@ EditorPanel::~EditorPanel () { //delete saveAsDialog; if(catalogPane) delete catalogPane; + + if (!iTopPanel_1_Show) delete iTopPanel_1_Show; + if (!iTopPanel_1_Hide) delete iTopPanel_1_Hide; + } void EditorPanel::leftPaneButtonReleased(GdkEventButton *event) { @@ -751,6 +761,9 @@ void EditorPanel::tbRightPanel_1_toggled () { } void EditorPanel::tbTopPanel_1_visible (bool visible){ + if (!tbTopPanel_1) + return; + if (visible) tbTopPanel_1->show(); else @@ -760,9 +773,8 @@ void EditorPanel::tbTopPanel_1_visible (bool visible){ void EditorPanel::tbTopPanel_1_toggled () { if (catalogPane){ // catalogPane does not exist in multitab mode - tbTopPanel_1_Active = tbTopPanel_1->get_active(); - if (tbTopPanel_1_Active){ + if (tbTopPanel_1->get_active()){ catalogPane->show(); tbTopPanel_1->set_image (*iTopPanel_1_Hide); } @@ -775,6 +787,10 @@ void EditorPanel::tbTopPanel_1_toggled () { } } +/* + * WARNING: Take care of the simpleEditor value when adding or modifying shortcut keys, + * since handleShortcutKey is now also triggered in simple editor mode + */ bool EditorPanel::handleShortcutKey (GdkEventKey* event) { bool ctrl = event->state & GDK_CONTROL_MASK; @@ -785,10 +801,12 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) { // Editor Layout switch(event->keyval) { case GDK_L: - tbTopPanel_1->set_active (!tbTopPanel_1->get_active()); // toggle top panel + if (tbTopPanel_1) + tbTopPanel_1->set_active (!tbTopPanel_1->get_active()); // toggle top panel if (ctrl) hidehp->set_active (!hidehp->get_active()); // toggle History (left panel) if (alt) tbRightPanel_1->set_active (!tbRightPanel_1->get_active()); // toggle right panel return true; + break; case GDK_l: if (!shift && !alt /*&& !ctrl*/){ hidehp->set_active (!hidehp->get_active()); // toggle History (left panel) @@ -803,16 +821,19 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) { tbRightPanel_1->set_active (!tbRightPanel_1->get_active()); return true; } + break; case GDK_m: // Maximize preview panel: hide top AND right AND history panels if (!ctrl && !alt) { toggleSidePanels(); return true; } + break; case GDK_M: // Maximize preview panel: hide top AND right AND history panels AND (fit image preview) if (!ctrl && !alt) { toggleSidePanelsZoomFit(); return true; } + break; } if (!alt){ @@ -897,7 +918,8 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) { saveAsPressed(); return true; case GDK_q: - queueImgPressed(); + if (!simpleEditor) + queueImgPressed(); return true; case GDK_e: sendToGimpPressed(); @@ -1362,10 +1384,14 @@ void EditorPanel::histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & his } bool EditorPanel::CheckSidePanelsVisibility() { - if(tbTopPanel_1->get_active()==false && tbRightPanel_1->get_active()==false && hidehp->get_active()==false) - return false; - else + if (tbTopPanel_1) { + if(tbTopPanel_1->get_active()==false && tbRightPanel_1->get_active()==false && hidehp->get_active()==false) + return false; return true; + } + if(tbRightPanel_1->get_active()==false && hidehp->get_active()==false) + return false; + return true; } void EditorPanel::toggleSidePanels(){ // Maximize preview panel: @@ -1374,7 +1400,8 @@ void EditorPanel::toggleSidePanels(){ bool bAllSidePanelsVisible; bAllSidePanelsVisible= CheckSidePanelsVisibility(); - tbTopPanel_1->set_active (!bAllSidePanelsVisible); + if (tbTopPanel_1) + tbTopPanel_1->set_active (!bAllSidePanelsVisible); tbRightPanel_1->set_active (!bAllSidePanelsVisible); hidehp->set_active (!bAllSidePanelsVisible); if (bAllSidePanelsVisible == false) diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index 2d5316aac..46d8dc557 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -61,8 +61,6 @@ class EditorPanel : public Gtk::VBox, Gtk::ToggleButton* tbTopPanel_1; Gtk::ToggleButton* tbRightPanel_1; Gtk::ToggleButton* tbBeforeLock; - bool tbTopPanel_1_Active; - bool tbRightPanel_1_Active; //bool bAllSidePanelsVisible; Gtk::ToggleButton* beforeAfter; Gtk::HPaned* hpanedl; diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index 57b3fe695..6b0bb2f08 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -175,7 +175,7 @@ bool EditWindow::keyPressed (GdkEventKey* event) { toggleFullscreen(); return true; } else { - EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); + EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); return ep->handleShortcutKey (event); } } diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index e6e9e6708..f5816f080 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -30,6 +30,7 @@ RTWindow::RTWindow () ,splash(NULL) ,epanel(NULL) ,fpanel(NULL) +,btn_fullscreen(NULL) { cacheMgr->init (); @@ -61,6 +62,7 @@ RTWindow::RTWindow () is_fullscreen = false; property_destroy_with_parent().set_value(false); signal_window_state_event().connect( sigc::mem_fun(*this, &RTWindow::on_window_state_event) ); + signal_key_press_event().connect( sigc::mem_fun(*this, &RTWindow::keyPressed) ); if(simpleEditor) { @@ -83,7 +85,7 @@ RTWindow::RTWindow () mainNB->set_scrollable (true); mainNB->signal_switch_page().connect_notify( sigc::mem_fun(*this, &RTWindow::on_mainNB_switch_page) ); - fpanel = new FilePanel () ; + fpanel = new FilePanel () ; fpanel->setParent (this); // decorate tab @@ -147,8 +149,6 @@ RTWindow::RTWindow () mainNB->set_current_page (mainNB->page_num (*fpanel)); - signal_key_press_event().connect( sigc::mem_fun(*this, &RTWindow::keyPressed) ); - Gtk::VBox* mainBox = Gtk::manage (new Gtk::VBox ()); mainBox->pack_start (*mainNB); @@ -383,6 +383,13 @@ bool RTWindow::keyPressed (GdkEventKey* event) { bool ctrl = event->state & GDK_CONTROL_MASK; //bool shift = event->state & GDK_SHIFT_MASK; + if(event->keyval == GDK_F11) + toggle_fullscreen(); + + if (simpleEditor) + // in simpleEditor mode, there's no other tab that can handle pressed keys, so we can send the event to editor panel then return + return epanel->handleShortcutKey (event);; + if (ctrl) { switch(event->keyval) { case GDK_F2: // file browser panel @@ -399,10 +406,6 @@ bool RTWindow::keyPressed (GdkEventKey* event) { } } - if(event->keyval == GDK_F11) { - toggle_fullscreen(); - } - if (mainNB->get_current_page() == mainNB->page_num(*fpanel)) { return fpanel->handleShortcutKey (event); } @@ -410,7 +413,7 @@ bool RTWindow::keyPressed (GdkEventKey* event) { return false; } else { - EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); + EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); return ep->handleShortcutKey (event); } return false; @@ -500,15 +503,19 @@ void RTWindow::toggle_fullscreen () { if (is_fullscreen) { unfullscreen(); is_fullscreen = false; - //btn_fullscreen->set_label(M("MAIN_BUTTON_FULLSCREEN")); - btn_fullscreen->set_tooltip_markup(M("MAIN_BUTTON_FULLSCREEN")); - btn_fullscreen->set_image (*iFullscreen); + if (btn_fullscreen) { + //btn_fullscreen->set_label(M("MAIN_BUTTON_FULLSCREEN")); + btn_fullscreen->set_tooltip_markup(M("MAIN_BUTTON_FULLSCREEN")); + btn_fullscreen->set_image (*iFullscreen); + } } else { fullscreen(); is_fullscreen = true; - //btn_fullscreen->set_label(M("MAIN_BUTTON_UNFULLSCREEN")); - btn_fullscreen->set_tooltip_markup(M("MAIN_BUTTON_UNFULLSCREEN")); - btn_fullscreen->set_image (*iFullscreen_exit); + if (btn_fullscreen) { + //btn_fullscreen->set_label(M("MAIN_BUTTON_UNFULLSCREEN")); + btn_fullscreen->set_tooltip_markup(M("MAIN_BUTTON_UNFULLSCREEN")); + btn_fullscreen->set_image (*iFullscreen_exit); + } } } diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index b8f55ab09..2d54650e1 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -226,7 +226,9 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) { // Switch off auto exposure if user changes sliders manually if (autolevels->get_active() && (a==expcomp || a==brightness || a==contrast || a==black || a==hlcompr || a==hlcomprthresh)) { + autoconn.block(true); autolevels->set_active (false); + autoconn.block(false); autolevels->set_inconsistent (false); } @@ -301,35 +303,45 @@ void ToneCurve::autolevels_toggled () { autolevels->set_inconsistent (true); lastAuto = autolevels->get_active (); - } - if (!batchMode && autolevels->get_active() && listener) { - listener->panelChanged (EvAutoExp, M("GENERAL_ENABLED")); - waitForAutoExp (); - if (!black->getAddMode()) shcompr->set_sensitive(!((int)black->getValue ()==0)); //at black=0 shcompr value has no effect - } - - if (batchMode) { expcomp->setEditedState (UnEdited); - brightness->setEditedState (UnEdited); - contrast->setEditedState (UnEdited); + brightness->setEditedState (UnEdited); + contrast->setEditedState (UnEdited); black->setEditedState (UnEdited); hlcompr->setEditedState (UnEdited); hlcomprthresh->setEditedState (UnEdited); if (expcomp->getAddMode()) expcomp->setValue (0); - if (brightness->getAddMode()) + if (brightness->getAddMode()) brightness->setValue (0); - if (contrast->getAddMode()) + if (contrast->getAddMode()) contrast->setValue (0); - if (black->getAddMode()) + if (black->getAddMode()) black->setValue (0); if (hlcompr->getAddMode()) - hlcompr->setValue (0); + hlcompr->setValue (0); if (hlcomprthresh->getAddMode()) - hlcomprthresh->setValue (0); - listener->panelChanged (EvAutoExp, M("GENERAL_ENABLED")); + hlcomprthresh->setValue (0); + if (listener) { + if (!autolevels->get_inconsistent()) { + if (autolevels->get_active ()) + listener->panelChanged (EvAutoExp, M("GENERAL_ENABLED")); + else + listener->panelChanged (EvFixedExp, M("GENERAL_DISABLED")); + } + } } + else if (/* !batchMode && */ listener) { + if (autolevels->get_active()) { + listener->panelChanged (EvAutoExp, M("GENERAL_ENABLED")); + waitForAutoExp (); + if (!black->getAddMode()) shcompr->set_sensitive(!((int)black->getValue ()==0)); //at black=0 shcompr value has no effect + } + else { + listener->panelChanged (EvFixedExp, M("GENERAL_DISABLED")); + } + } + } void ToneCurve::clip_changed () {