From 60fea52af1d3080fc1f45d5d6acb147e50beb012 Mon Sep 17 00:00:00 2001 From: Andrey Skvortsov Date: Fri, 1 Oct 2010 22:10:07 -0700 Subject: [PATCH] tabular and single tab workflows reunited! option in preferences --- rtgui/editorpanel.cc | 41 ++++++++++++----------------------------- rtgui/editorpanel.h | 1 - rtgui/filepanel.cc | 20 ++++---------------- rtgui/filepanel.h | 5 ++--- rtgui/preferences.cc | 32 +++++++++++++++++++++++++++++--- rtgui/preferences.h | 7 +++++-- rtgui/rtwindow.cc | 32 +++++++++++++++++++++++++++++++- rtgui/rtwindow.h | 3 ++- 8 files changed, 85 insertions(+), 56 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index e49f7738e..ea4fac5de 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -247,19 +247,13 @@ EditorPanel::~EditorPanel () { history->setHistoryBeforeLineListener (NULL); // the order is important! delete iarea; + iarea = NULL; delete beforeIarea; + beforeIarea = NULL; - if (ipc) - ipc->setPreviewImageListener (NULL); - if (beforeIpc) - beforeIpc->setPreviewImageListener (NULL); - - delete previewHandler; - previewHandler = NULL; delete beforePreviewHandler; - - if (ipc) - close (); + + close (); if (epih->pending) epih->destroyed = true; @@ -350,8 +344,11 @@ void EditorPanel::close () { rtengine::StagedImageProcessor::destroy (ipc); ipc = NULL; - iarea->imageArea->setPreviewHandler (NULL); - iarea->imageArea->setImProcCoordinator (NULL); + if(iarea) + { + iarea->imageArea->setPreviewHandler (NULL); + iarea->imageArea->setImProcCoordinator (NULL); + } navigator->previewWindow->setPreviewHandler (NULL); // navigator->previewWindow->setImageArea (NULL); @@ -896,10 +893,9 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector *pc,rtengine::IImage16* void EditorPanel::saveOptions () { - //options.historyPanelWidth = hpanedl->get_position ();//older code + //options.historyPanelWidth = hpanedl->get_position ();//older code //options.toolPanelWidth = vboxright->get_width ();//older code - if (options.startupDir==STARTUPDIR_LAST && fPanel->fileCatalog->lastSelectedDir ()!="") - options.startupPath = fPanel->fileCatalog->lastSelectedDir (); + //options.toolPanelWidth = hpanedr->get_position ();//Hombre's change which screws up OSX build } @@ -975,17 +971,4 @@ void EditorPanel::histogramChanged (unsigned int* rh, unsigned int* gh, unsigned histogramPanel->histogramChanged (rh, gh, bh, lh); tpc->updateCurveBackgroundHistogram (bcrgb, bcl); -} - -bool EditorPanel::on_expose_event(GdkEventExpose* event) -{ - - if(!options.tabbedUI && catalogPane->get_children().size() ==0 ){ - FileCatalog *fCatalog = fPanel->fileCatalog; - fPanel->dirpaned->remove(*fCatalog); - catalogPane->add(*fCatalog); - fCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Horizontal); - fCatalog->redrawAll(); - } - return Gtk::VBox::on_expose_event(event); -} +} \ No newline at end of file diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index 04db12c41..27c5e4484 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -145,7 +145,6 @@ class EditorPanel : public Gtk::VBox, void saveOptions (); Gtk::Paned *catalogPane; - bool on_expose_event(GdkEventExpose* event); }; #endif diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 1dfd767ab..50d2f1664 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -52,7 +52,9 @@ FilePanel::FilePanel () : parent(NULL) { tpc = new BatchToolPanelCoordinator (this); fileCatalog = new FileCatalog (tpc->coarse, tpc->getToolBar()); - dirpaned->pack2 (*fileCatalog, true, true); + ribbonPane = new Gtk::Paned(); + ribbonPane->add(*fileCatalog); + dirpaned->pack2 (*ribbonPane, true, true); placesBrowser->setDirBrowserRemoteInterface (dirBrowser); recentBrowser->setDirBrowserRemoteInterface (dirBrowser); @@ -225,18 +227,4 @@ bool FilePanel::handleShortcutKey (GdkEventKey* event) { return true; return false; -} - -bool FilePanel::on_expose_event(GdkEventExpose* event) -{ - - if(!options.tabbedUI && dirpaned->get_children().size() ==1 ){ - - parent->epanel->catalogPane->remove(*fileCatalog); - fileCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Vertical); - dirpaned->pack2(*fileCatalog,true,true); - fileCatalog->redrawAll(); - } - return Gtk::HPaned::on_expose_event(event); -} - +} \ No newline at end of file diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index 321f78138..3d416ad6d 100644 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -39,7 +39,7 @@ class FilePanel : public Gtk::HPaned, protected: Gtk::Paned* placespaned; - + Gtk::HPaned* dirpaned; //DirBrowser* dirBrowser; PlacesBrowser* placesBrowser; RecentBrowser* recentBrowser; @@ -59,7 +59,7 @@ class FilePanel : public Gtk::HPaned, DirBrowser* dirBrowser; FilterPanel* filterPanel; FileCatalog* fileCatalog; - Gtk::HPaned* dirpaned; + Gtk::Paned *ribbonPane; void setParent (RTWindow* p) { parent = p; } void init (); // dont call it directly, the constructor calls it as idle source @@ -77,7 +77,6 @@ class FilePanel : public Gtk::HPaned, bool imageLoaded( Thumbnail* thm, ProgressConnector * ); bool handleShortcutKey (GdkEventKey* event); - bool on_expose_event(GdkEventExpose* event); }; #endif diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 25abae13a..3ef9802eb 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -26,7 +26,7 @@ extern Options options; extern Glib::ustring argv0; -Preferences::Preferences (int initialPage) { +Preferences::Preferences (RTWindow *rtwindow):parent(rtwindow) { set_title (M("MAIN_BUTTON_PREFERENCES")); @@ -77,7 +77,7 @@ Preferences::Preferences (int initialPage) { nb->append_page (*getFileBrowserPanel(), M("PREFERENCES_TAB_BROWSER")); nb->append_page (*getColorManagementPanel(),M("PREFERENCES_TAB_COLORMGR")); nb->append_page (*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING")); - nb->set_current_page (initialPage); + nb->set_current_page (0); fillPreferences (); @@ -395,6 +395,21 @@ Gtk::Widget* Preferences::getGeneralPanel () { Gtk::VBox* mvbsd = new Gtk::VBox (); + Gtk::Frame* fworklflow = new Gtk::Frame (M("PREFERENCES_WORKFLOW")); + Gtk::HBox* hbworkflow = new Gtk::HBox (); + hbworkflow->set_border_width (4); + Gtk::Label* flayoutlab = new Gtk::Label (M("PREFERENCES_EDITORLAYOUT")+":"); + editorLayout = new Gtk::ComboBoxText (); + + editorLayout->append_text (M("PREFERENCES_SINGLETAB")); + editorLayout->append_text (M("PREFERENCES_MULTITAB")); + editorLayout->set_active (1); + + hbworkflow->pack_start (*flayoutlab, Gtk::PACK_SHRINK, 4); + hbworkflow->pack_start (*editorLayout); + fworklflow->add (*hbworkflow); + mvbsd->pack_start (*fworklflow, Gtk::PACK_SHRINK, 4); + Gtk::Frame* flang = new Gtk::Frame (M("PREFERENCES_DEFAULTLANG")); Gtk::HBox* hblang = new Gtk::HBox (); hblang->set_border_width (4); @@ -540,7 +555,7 @@ Gtk::Widget* Preferences::getGeneralPanel () { mvbsd->set_border_width (4); tconn = theme->signal_changed().connect( sigc::mem_fun(*this, &Preferences::themeChanged) ); - + return mvbsd; } @@ -833,6 +848,8 @@ void Preferences::storePreferences () { for (Gtk::TreeIter sections=behModel->children().begin(); sections!=behModel->children().end(); sections++) for (Gtk::TreeIter adjs=sections->children().begin(); adjs!=sections->children().end(); adjs++) moptions.baBehav[adjs->get_value (behavColumns.addsetid)] = adjs->get_value (behavColumns.badd); + + moptions.tabbedUI = (bool)editorLayout->get_active_row_number(); } void Preferences::fillPreferences () { @@ -987,6 +1004,7 @@ void Preferences::okPressed () { storePreferences (); options.copyFrom (&moptions); + workflowUpdate(); hide (); } @@ -1067,6 +1085,14 @@ void Preferences::themeChanged () { gdk_event_send_clientmessage_toall ((GdkEvent*)&event); } +void Preferences::workflowUpdate (){ + + if(moptions.tabbedUI) + parent->epanel->hide_all(); + else + parent->epanel->show_all(); +} + void Preferences::addExtPressed () { Gtk::TreeNodeChildren c = extensionModel->children (); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 8098a5d76..7541c44ba 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -23,6 +23,7 @@ #include #include #include +#include "rtwindow.h" class Preferences : public Gtk::Dialog { @@ -109,6 +110,8 @@ class Preferences : public Gtk::Dialog { Gtk::CheckButton* saveParamsFile; Gtk::CheckButton* saveParamsCache; Gtk::ComboBoxText* loadParamsPreference; + Gtk::ComboBoxText* editorLayout; + RTWindow* parent; Options moptions; sigc::connection dmconn, dmconnBatch, tconn, addc, setc; @@ -118,7 +121,7 @@ class Preferences : public Gtk::Dialog { void parseDir (Glib::ustring dirname, std::vector& items, Glib::ustring ext); void dmethodChanged (); void dmethodBatchChanged (); - + void workflowUpdate(); void themeChanged (); void appendBehavList (Gtk::TreeModel::iterator& parent, Glib::ustring label, int id, bool set); @@ -130,7 +133,7 @@ class Preferences : public Gtk::Dialog { Gtk::Widget* getBatchProcPanel (); public: - Preferences (int initialPage=0); + Preferences (RTWindow *rtwindow); void savePressed (); void loadPressed (); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 45731ff50..7eb907a7e 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -59,6 +59,7 @@ RTWindow::RTWindow () { hbf->set_spacing (2); hbf->show_all (); mainNB->append_page (*fpanel, *hbf); + fpanel->signal_expose_event().connect( sigc::mem_fun(*this, &RTWindow::on_expose_event_fpanel) ); bpanel = new BatchQueuePanel (); bpanel->setParent (this); @@ -82,6 +83,7 @@ RTWindow::RTWindow () { hbe->show_all (); mainNB->append_page (*epanel, *hbe); mainNB->set_current_page (mainNB->page_num (*fpanel)); + epanel->signal_expose_event().connect( sigc::mem_fun(*this, &RTWindow::on_expose_event_epanel) ); signal_key_press_event().connect( sigc::mem_fun(*this, &RTWindow::keyPressed) ); @@ -257,7 +259,7 @@ bool RTWindow::on_delete_event(GdkEventAny* event) { void RTWindow::showPreferences () { - Preferences *pref = new Preferences (); + Preferences *pref = new Preferences (this); pref->run (); delete pref; @@ -295,3 +297,31 @@ void RTWindow::toggle_fullscreen () { void RTWindow::error (Glib::ustring descr){ prLabel.set_text ( descr ); } + +bool RTWindow::on_expose_event_epanel(GdkEventExpose* event) +{ + + if(!options.tabbedUI && epanel->catalogPane->get_children().size() ==0 ){ + FileCatalog *fCatalog = fpanel->fileCatalog; + fpanel->ribbonPane->remove(*fCatalog); + epanel->catalogPane->add(*fCatalog); + fCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Horizontal); + fCatalog->redrawAll(); + } + return false; // Gtk::VBox::on_expose_event(event); +} + + +bool RTWindow::on_expose_event_fpanel(GdkEventExpose* event) +{ + + if(!options.tabbedUI && fpanel->ribbonPane->get_children().size() ==0 ){ + FileCatalog *fCatalog = fpanel->fileCatalog; + epanel->catalogPane->remove(*fCatalog); + //dirpaned->pack2(*fileCatalog,true,true); + fpanel->ribbonPane->add(*fCatalog); + fCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Vertical); + fCatalog->redrawAll(); + } + return false; // Gtk::HPaned::on_expose_event(event); +} \ No newline at end of file diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 00051b502..a615b252f 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -41,7 +41,8 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ bool is_fullscreen; Gtk::Button * btn_fullscreen; - + bool on_expose_event_epanel(GdkEventExpose* event); + bool on_expose_event_fpanel(GdkEventExpose* event); public: RTWindow ();