diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index f2fa4770c..d71ab1c10 100755 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -32,7 +32,7 @@ using namespace rtengine::procparams; EditorPanel::EditorPanel (FilePanel* filePanel) - : beforePreviewHandler(NULL), beforeIarea(NULL), beforeBox(NULL), afterBox(NULL), afterHeaderBox(NULL), parent(NULL), ipc(NULL), beforeIpc(NULL), isProcessing(false), catalogPane(NULL), iHistoryShow(NULL), iHistoryHide(NULL), iBeforeLockON(NULL),iBeforeLockOFF(NULL), iRightPanel_1_Show(NULL), iRightPanel_1_Hide(NULL), iTopPanel_1_Show(NULL), iTopPanel_1_Hide(NULL) { + : beforePreviewHandler(NULL), beforeIarea(NULL), beforeBox(NULL), afterBox(NULL), afterHeaderBox(NULL), parent(NULL), ipc(NULL), beforeIpc(NULL), isProcessing(false), catalogPane(NULL), iHistoryShow(NULL), iHistoryHide(NULL), iBeforeLockON(NULL),iBeforeLockOFF(NULL), iRightPanel_1_Show(NULL), iRightPanel_1_Hide(NULL), iTopPanel_1_Show(NULL), iTopPanel_1_Hide(NULL), openThm(NULL) { epih = new EditorPanelIdleHelper; epih->epanel = this; @@ -549,13 +549,13 @@ void EditorPanel::saveProfile () { } Glib::ustring EditorPanel::getShortName () { - - return Glib::path_get_basename (openThm->getFileName ()); + if (openThm) return Glib::path_get_basename (openThm->getFileName ()); + else return ""; } Glib::ustring EditorPanel::getFileName () { - - return openThm->getFileName (); + if (openThm) return openThm->getFileName (); + else return ""; } // TODO!!! diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index c03bdad5f..f7adb964a 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -73,8 +73,7 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) { set_default_icon_from_file (fullPath, error); } #endif //GLIBMM_EXCEPTIONS_ENABLED - - set_title("RawTherapee "+ M("EDITWINDOW_TITLE")); + set_title_decorated(""); property_allow_shrink() = true; set_modal(false); set_resizable(true); @@ -114,10 +113,14 @@ bool EditWindow::on_window_state_event(GdkEventWindowState* event) { } void EditWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) { - if (page_num > 1) { + //if (page_num > 1) { EditorPanel *ep = static_cast(mainNB->get_nth_page(page_num)); - ep->setAspect(); - } + + if (mainNB->get_n_pages()>1 && page_num<=(filesEdited.size()-1)){ + set_title_decorated(ep->getFileName()); + } + ep->setAspect(); + //} } void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) { @@ -147,6 +150,8 @@ void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) { mainNB->set_current_page (mainNB->page_num (*ep)); mainNB->set_tab_reorderable (*ep, true); + set_title_decorated(name); + epanels[ name ] = ep; filesEdited.insert ( name ); parent->fpanel->refreshEditedState (filesEdited); @@ -159,6 +164,11 @@ void EditWindow::remEditorPanel (EditorPanel* ep) { parent->fpanel->refreshEditedState (filesEdited); mainNB->remove_page (*ep); + if (mainNB->get_n_pages()>0){ + EditorPanel* ep1 = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); + set_title_decorated(ep1->getFileName()); + } + else set_title_decorated(""); // TODO: save options if wanted } @@ -167,6 +177,7 @@ bool EditWindow::selectEditorPanel(const std::string &name) { if (iep!=epanels.end()) { mainNB->set_current_page (mainNB->page_num (*iep->second)); + set_title_decorated(name); return true; } return false; @@ -224,3 +235,8 @@ bool EditWindow::on_delete_event(GdkEventAny* event) { return true; } +void EditWindow::set_title_decorated(Glib::ustring fname){ + Glib::ustring subtitle; + if (!fname.empty()) subtitle= " - " + fname; + set_title("RawTherapee "+ M("EDITWINDOW_TITLE") + subtitle); +} diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index 6f57f5506..7b8fb08c7 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -51,6 +51,7 @@ class EditWindow : public Gtk::Window { bool on_delete_event(GdkEventAny* event); bool on_window_state_event(GdkEventWindowState* event); void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num); + void set_title_decorated(Glib::ustring fname); void on_realize (); }; diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 350883ec0..29bbaa4c9 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -192,12 +192,15 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnectoraddEditorPanel (epanel,thm->getFileName()); } epanel->open(thm, pc->returnValue() ); + if (!EditWindow::isMultiDisplayEnabled()) + parent->set_title_decorated(thm->getFileName()); } else { { GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm parent->SetEditorCurrent(); } parent->epanel->open(thm, pc->returnValue() ); + parent->set_title_decorated(thm->getFileName()); } } else { Glib::ustring msg_ = Glib::ustring("") + M("MAIN_MSG_CANNOTLOAD") + " \"" + thm->getFileName() + "\" .\n"; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 3782dc01d..19b48fb1e 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1644,11 +1644,16 @@ void Preferences::workflowUpdate (){ if(moptions.tabbedUI != options.tabbedUI) { parent->MoveFileBrowserToMain(); + parent->CloseOpenEditors(); parent->SetMainCurrent(); - if(moptions.tabbedUI) + if(moptions.tabbedUI){ parent->epanel->hide_all(); - else + parent->set_title_decorated(""); + } + else{ parent->epanel->show_all(); + parent->set_title_decorated(parent->epanel->getFileName()); + } } if(moptions.hideTPVScrollbar != options.hideTPVScrollbar) { // Update the tool panels diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 6f3e35bbc..d625f053a 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -113,10 +113,10 @@ RTWindow::RTWindow () gtkosx_application_ready (osxApp); } #endif - Glib::ustring versionStr("RawTherapee "+versionString); + versionStr = "RawTherapee "+versionString; if (!versionSuffixString.empty()) versionStr += " "+versionSuffixString; - set_title(versionStr); + set_title_decorated(""); property_allow_shrink() = true; set_default_size(options.windowWidth, options.windowHeight); set_modal(false); @@ -366,6 +366,13 @@ void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) { EditorPanel *ep = static_cast(mainNB->get_nth_page(page_num)); ep->setAspect(); + + if (!isSingleTabMode() && mainNB->get_current_page ()>2){ + if (mainNB->get_n_pages()>2 && filesEdited.size()>0){ + set_title_decorated(ep->getFileName()); + } + } + } else { // in single tab mode with command line filename epanel does not exist yet if (isSingleTabMode() && epanel) { @@ -412,6 +419,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) { mainNB->set_current_page (mainNB->page_num (*ep)); mainNB->set_tab_reorderable (*ep, true); + set_title_decorated(name); epanels[ name ] = ep; filesEdited.insert ( name ); fpanel->refreshEditedState (filesEdited); @@ -432,8 +440,14 @@ void RTWindow::remEditorPanel (EditorPanel* ep) { mainNB->remove_page (*ep); - if (mainNB->get_current_page () == mainNB->page_num (*bpanel)) + if (mainNB->get_current_page () == mainNB->page_num (*bpanel)){ mainNB->set_current_page (mainNB->page_num (*fpanel)); + set_title_decorated(""); + } + else{ + EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); + set_title_decorated(ep->getFileName()); + } // TODO: ask what to do: close & apply, close & apply selection, close & revert, cancel } } @@ -441,14 +455,22 @@ void RTWindow::remEditorPanel (EditorPanel* ep) { bool RTWindow::selectEditorPanel(const std::string &name) { if (EditWindow::isMultiDisplayEnabled()) { EditWindow * wndEdit = EditWindow::getInstance(this); - if (wndEdit->selectEditorPanel(name)) return true; + if (wndEdit->selectEditorPanel(name)) { + set_title_decorated(name); + return true; + } } else { std::map::iterator iep = epanels.find(name); if (iep!=epanels.end()) { mainNB->set_current_page (mainNB->page_num (*iep->second)); + set_title_decorated(name); return true; } + else{ + //set_title_decorated(name); + //printf("RTWindow::selectEditorPanel - plain set\n"); + } } return false; @@ -736,3 +758,18 @@ bool RTWindow::splashClosed(GdkEventAny* event) { splash = NULL; return true; } + +void RTWindow::set_title_decorated(Glib::ustring fname){ + Glib::ustring subtitle; + if (!fname.empty()) subtitle= " - " + fname; + set_title(versionStr + subtitle); +} + +void RTWindow::CloseOpenEditors(){ + std::map::const_iterator itr; + itr = epanels.begin(); + while(itr != epanels.end()) { + remEditorPanel((*itr).second); + itr = epanels.begin(); + } +} diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 54fbdedca..4022e9e34 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -53,6 +53,7 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ bool on_expose_event_epanel(GdkEventExpose* event); bool on_expose_event_fpanel(GdkEventExpose* event); bool splashClosed(GdkEventAny* event); + Glib::ustring versionStr; #if defined(__APPLE__) GtkosxApplication *osxApp; #endif @@ -99,6 +100,8 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{ void updateTabsUsesIcons (bool useIcons); void updateFBQueryTB (bool singleRow); bool getIsFullscreen() { return is_fullscreen; } + void set_title_decorated(Glib::ustring fname); + void CloseOpenEditors(); }; #endif