From e679dd1a8fe8c369f8f0a0804072f3e33372ac5d Mon Sep 17 00:00:00 2001 From: askvortsov Date: Fri, 1 Oct 2010 16:43:08 -0700 Subject: [PATCH] add tabbedUI option, prepare infrastructure to support 2 workflows --- rtgui/editorpanel.cc | 45 ++++++++++++++++++++------------------------ rtgui/editorpanel.h | 5 ++--- rtgui/filecatalog.cc | 2 +- rtgui/filepanel.cc | 14 ++++++++++++-- rtgui/options.cc | 1 + rtgui/options.h | 1 + rtgui/rtwindow.cc | 7 +++++-- 7 files changed, 42 insertions(+), 33 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index a423aca92..e49f7738e 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -26,7 +26,7 @@ using namespace rtengine::procparams; -EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), beforeIarea(NULL), parent(NULL), beforeIpc(NULL) { +EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), beforeIarea(NULL), parent(NULL), beforeIpc(NULL), ipc(NULL), catalogPane(NULL) { epih = new EditorPanelIdleHelper; epih->epanel = this; @@ -186,24 +186,16 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be hpanedl->set_position (options.historyPanelWidth); } - ipc = NULL; -// btpCoordinator = new BatchToolPanelCoordinator (filePanel); -// fCatalog = new FileCatalog (btpCoordinator->coarse, btpCoordinator->getToolBar()); //, filePanel->fileCatalog->fileBrowser); -// filePanel->dirBrowser->addDirSelectionListener (fCatalog); -// // fCatalog->setFilterPanel (filePanel->filterPanel); -// fCatalog->setImageAreaToolListener (btpCoordinator); -// fCatalog->setFileSelectionListener (filePanel); -// fCatalog->setFileSelectionChangeListener (btpCoordinator); -// fCatalog->setEnabled(true); - - catalogPane = new Gtk::Paned(); - + Gtk::VPaned * viewpaned = Gtk::manage (new Gtk::VPaned()); - viewpaned->pack1(*catalogPane, false, true); + fPanel = filePanel; + if(filePanel) + { + catalogPane = new Gtk::Paned(); + viewpaned->pack1(*catalogPane, false, true); + } viewpaned->pack2(*editbox, true, true); - fPanel = filePanel; - fCatalog = filePanel->fileCatalog; Gtk::Frame* vbfr = Gtk::manage (new Gtk::Frame ()); vbfr->add (*viewpaned); @@ -263,6 +255,7 @@ EditorPanel::~EditorPanel () { beforeIpc->setPreviewImageListener (NULL); delete previewHandler; + previewHandler = NULL; delete beforePreviewHandler; if (ipc) @@ -278,9 +271,10 @@ EditorPanel::~EditorPanel () { delete red; delete green; delete leftbox; - delete vboxright; - delete catalogPane; + delete vboxright; delete saveAsDialog; + if(catalogPane) + delete catalogPane; } void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { @@ -514,8 +508,8 @@ void EditorPanel::info_toggled () { // M("QINFO_ISO"), idata->getISOSpeed(), // M("QINFO_FOCALLENGTH"), idata->getFocalLen()) // + Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens())); - infoString = Glib::ustring::compose ( - "%1 + %2\n%3s f/%4 %5%6 f=%7mm", +infoString = Glib::ustring::compose ( + "%1 + %2\n%3s f/%4 %5%6 f=%7mm", Glib::ustring(idata->getModel()), Glib::ustring(idata->getLens()), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())), @@ -904,8 +898,8 @@ void EditorPanel::saveOptions () { //options.historyPanelWidth = hpanedl->get_position ();//older code //options.toolPanelWidth = vboxright->get_width ();//older code - if (options.startupDir==STARTUPDIR_LAST && fCatalog->lastSelectedDir ()!="") - options.startupPath = fCatalog->lastSelectedDir (); + if (options.startupDir==STARTUPDIR_LAST && fPanel->fileCatalog->lastSelectedDir ()!="") + options.startupPath = fPanel->fileCatalog->lastSelectedDir (); } @@ -986,9 +980,10 @@ void EditorPanel::histogramChanged (unsigned int* rh, unsigned int* gh, unsigned bool EditorPanel::on_expose_event(GdkEventExpose* event) { - if(catalogPane->get_children().size() ==0 ){ - fPanel->dirpaned->remove(*fPanel->fileCatalog); - catalogPane->add(*fCatalog); + 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(); } diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index 24f8bef21..04db12c41 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -82,8 +82,7 @@ class EditorPanel : public Gtk::VBox, ToolPanelCoordinator* tpc; RTWindow* parent; SaveAsDialog* saveAsDialog; - BatchToolPanelCoordinator* btpCoordinator; - FileCatalog* fCatalog; + BatchToolPanelCoordinator* btpCoordinator; FilePanel* fPanel; @@ -105,7 +104,7 @@ class EditorPanel : public Gtk::VBox, int err; public: - EditorPanel (FilePanel* filePanel); + EditorPanel (FilePanel* filePanel = NULL); virtual ~EditorPanel (); void open (Thumbnail* tmb, rtengine::InitialImage* isrc); diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index defedde47..36cd269c2 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -51,7 +51,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb) : listener(NULL), fslist // construct and initialize thumbnail browsers fileBrowser = new FileBrowser(); fileBrowser->setFileBrowserListener (this); - fileBrowser->setArrangement (ThumbBrowserBase::TB_Horizontal); + fileBrowser->setArrangement (ThumbBrowserBase::TB_Vertical); fileBrowser->show (); set_size_request(0,250); diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 6c62b8289..1dfd767ab 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -148,7 +148,17 @@ bool FilePanel::fileSelected (Thumbnail* thm) { bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector *pc ){ if (pc->returnValue() && thm) { - parent->epanel->open(thm, pc->returnValue() ); + + if (options.tabbedUI) + { + EditorPanel* epanel = Gtk::manage (new EditorPanel ()); + parent->addEditorPanel (epanel,Glib::path_get_basename (thm->getFileName())); + epanel->open(thm, pc->returnValue() ); + } + else + parent->epanel->open(thm, pc->returnValue() ); + + }else { Glib::ustring msg_ = Glib::ustring("") + M("MAIN_MSG_CANNOTLOAD") + " \"" + thm->getFileName() + "\" .\n"; Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); @@ -220,7 +230,7 @@ bool FilePanel::handleShortcutKey (GdkEventKey* event) { bool FilePanel::on_expose_event(GdkEventExpose* event) { - if(dirpaned->get_children().size() ==1 ){ + if(!options.tabbedUI && dirpaned->get_children().size() ==1 ){ parent->epanel->catalogPane->remove(*fileCatalog); fileCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Vertical); diff --git a/rtgui/options.cc b/rtgui/options.cc index 957be5192..fd894bef1 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -116,6 +116,7 @@ void Options::setDefaults () { thumbnailZoomRatios.push_back (1.0); overlayedFileNames = true; showFileNames = true; + tabbedUI = false; int babehav[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0}; baBehav = std::vector (babehav, babehav+ADDSET_PARAM_NUM); diff --git a/rtgui/options.h b/rtgui/options.h index b0a929adc..0537bc859 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -124,6 +124,7 @@ class Options { std::vector thumbnailZoomRatios; bool overlayedFileNames; bool showFileNames; + bool tabbedUI; Options (); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 1a01e3b6b..45731ff50 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -81,7 +81,7 @@ RTWindow::RTWindow () { hbe->set_spacing (2); hbe->show_all (); mainNB->append_page (*epanel, *hbe); - mainNB->set_current_page (mainNB->page_num (*epanel)); + mainNB->set_current_page (mainNB->page_num (*fpanel)); signal_key_press_event().connect( sigc::mem_fun(*this, &RTWindow::keyPressed) ); @@ -116,6 +116,9 @@ RTWindow::RTWindow () { add (*mainBox); show_all (); + + if(options.tabbedUI) + epanel->hide_all(); } void RTWindow::on_realize () { @@ -153,7 +156,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) { epanels[ name ] = ep; filesEdited.insert ( name ); - fpanel->refreshEditedState (filesEdited); + fpanel->refreshEditedState (filesEdited); } void RTWindow::remEditorPanel (EditorPanel* ep) {