Show filename of currently opened image in titlebar (issue 2450)

Thanks for help, Ingo!
This commit is contained in:
michael
2014-08-08 08:56:36 -04:00
parent 8ea5c6dbb1
commit 878e0865a7
7 changed files with 81 additions and 16 deletions

View File

@@ -32,7 +32,7 @@
using namespace rtengine::procparams; using namespace rtengine::procparams;
EditorPanel::EditorPanel (FilePanel* filePanel) 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 = new EditorPanelIdleHelper;
epih->epanel = this; epih->epanel = this;
@@ -549,13 +549,13 @@ void EditorPanel::saveProfile () {
} }
Glib::ustring EditorPanel::getShortName () { Glib::ustring EditorPanel::getShortName () {
if (openThm) return Glib::path_get_basename (openThm->getFileName ());
return Glib::path_get_basename (openThm->getFileName ()); else return "";
} }
Glib::ustring EditorPanel::getFileName () { Glib::ustring EditorPanel::getFileName () {
if (openThm) return openThm->getFileName ();
return openThm->getFileName (); else return "";
} }
// TODO!!! // TODO!!!

View File

@@ -73,8 +73,7 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) {
set_default_icon_from_file (fullPath, error); set_default_icon_from_file (fullPath, error);
} }
#endif //GLIBMM_EXCEPTIONS_ENABLED #endif //GLIBMM_EXCEPTIONS_ENABLED
set_title_decorated("");
set_title("RawTherapee "+ M("EDITWINDOW_TITLE"));
property_allow_shrink() = true; property_allow_shrink() = true;
set_modal(false); set_modal(false);
set_resizable(true); 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) { void EditWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) {
if (page_num > 1) { //if (page_num > 1) {
EditorPanel *ep = static_cast<EditorPanel*>(mainNB->get_nth_page(page_num)); EditorPanel *ep = static_cast<EditorPanel*>(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) { 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_current_page (mainNB->page_num (*ep));
mainNB->set_tab_reorderable (*ep, true); mainNB->set_tab_reorderable (*ep, true);
set_title_decorated(name);
epanels[ name ] = ep; epanels[ name ] = ep;
filesEdited.insert ( name ); filesEdited.insert ( name );
parent->fpanel->refreshEditedState (filesEdited); parent->fpanel->refreshEditedState (filesEdited);
@@ -159,6 +164,11 @@ void EditWindow::remEditorPanel (EditorPanel* ep) {
parent->fpanel->refreshEditedState (filesEdited); parent->fpanel->refreshEditedState (filesEdited);
mainNB->remove_page (*ep); mainNB->remove_page (*ep);
if (mainNB->get_n_pages()>0){
EditorPanel* ep1 = static_cast<EditorPanel*>(mainNB->get_nth_page (mainNB->get_current_page()));
set_title_decorated(ep1->getFileName());
}
else set_title_decorated("");
// TODO: save options if wanted // TODO: save options if wanted
} }
@@ -167,6 +177,7 @@ bool EditWindow::selectEditorPanel(const std::string &name) {
if (iep!=epanels.end()) { if (iep!=epanels.end()) {
mainNB->set_current_page (mainNB->page_num (*iep->second)); mainNB->set_current_page (mainNB->page_num (*iep->second));
set_title_decorated(name);
return true; return true;
} }
return false; return false;
@@ -224,3 +235,8 @@ bool EditWindow::on_delete_event(GdkEventAny* event) {
return true; 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);
}

View File

@@ -51,6 +51,7 @@ class EditWindow : public Gtk::Window {
bool on_delete_event(GdkEventAny* event); bool on_delete_event(GdkEventAny* event);
bool on_window_state_event(GdkEventWindowState* event); bool on_window_state_event(GdkEventWindowState* event);
void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num); void on_mainNB_switch_page(GtkNotebookPage* page, guint page_num);
void set_title_decorated(Glib::ustring fname);
void on_realize (); void on_realize ();
}; };

View File

@@ -192,12 +192,15 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
parent->addEditorPanel (epanel,thm->getFileName()); parent->addEditorPanel (epanel,thm->getFileName());
} }
epanel->open(thm, pc->returnValue() ); epanel->open(thm, pc->returnValue() );
if (!EditWindow::isMultiDisplayEnabled())
parent->set_title_decorated(thm->getFileName());
} else { } else {
{ {
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
parent->SetEditorCurrent(); parent->SetEditorCurrent();
} }
parent->epanel->open(thm, pc->returnValue() ); parent->epanel->open(thm, pc->returnValue() );
parent->set_title_decorated(thm->getFileName());
} }
} else { } else {
Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_CANNOTLOAD") + " \"" + thm->getFileName() + "\" .\n</b>"; Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_CANNOTLOAD") + " \"" + thm->getFileName() + "\" .\n</b>";

View File

@@ -1644,11 +1644,16 @@ void Preferences::workflowUpdate (){
if(moptions.tabbedUI != options.tabbedUI) { if(moptions.tabbedUI != options.tabbedUI) {
parent->MoveFileBrowserToMain(); parent->MoveFileBrowserToMain();
parent->CloseOpenEditors();
parent->SetMainCurrent(); parent->SetMainCurrent();
if(moptions.tabbedUI) if(moptions.tabbedUI){
parent->epanel->hide_all(); parent->epanel->hide_all();
else parent->set_title_decorated("");
}
else{
parent->epanel->show_all(); parent->epanel->show_all();
parent->set_title_decorated(parent->epanel->getFileName());
}
} }
if(moptions.hideTPVScrollbar != options.hideTPVScrollbar) { if(moptions.hideTPVScrollbar != options.hideTPVScrollbar) {
// Update the tool panels // Update the tool panels

View File

@@ -113,10 +113,10 @@ RTWindow::RTWindow ()
gtkosx_application_ready (osxApp); gtkosx_application_ready (osxApp);
} }
#endif #endif
Glib::ustring versionStr("RawTherapee "+versionString); versionStr = "RawTherapee "+versionString;
if (!versionSuffixString.empty()) if (!versionSuffixString.empty())
versionStr += " "+versionSuffixString; versionStr += " "+versionSuffixString;
set_title(versionStr); set_title_decorated("");
property_allow_shrink() = true; property_allow_shrink() = true;
set_default_size(options.windowWidth, options.windowHeight); set_default_size(options.windowWidth, options.windowHeight);
set_modal(false); set_modal(false);
@@ -366,6 +366,13 @@ void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) {
EditorPanel *ep = static_cast<EditorPanel*>(mainNB->get_nth_page(page_num)); EditorPanel *ep = static_cast<EditorPanel*>(mainNB->get_nth_page(page_num));
ep->setAspect(); ep->setAspect();
if (!isSingleTabMode() && mainNB->get_current_page ()>2){
if (mainNB->get_n_pages()>2 && filesEdited.size()>0){
set_title_decorated(ep->getFileName());
}
}
} else { } else {
// in single tab mode with command line filename epanel does not exist yet // in single tab mode with command line filename epanel does not exist yet
if (isSingleTabMode() && epanel) { 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_current_page (mainNB->page_num (*ep));
mainNB->set_tab_reorderable (*ep, true); mainNB->set_tab_reorderable (*ep, true);
set_title_decorated(name);
epanels[ name ] = ep; epanels[ name ] = ep;
filesEdited.insert ( name ); filesEdited.insert ( name );
fpanel->refreshEditedState (filesEdited); fpanel->refreshEditedState (filesEdited);
@@ -432,8 +440,14 @@ void RTWindow::remEditorPanel (EditorPanel* ep) {
mainNB->remove_page (*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)); mainNB->set_current_page (mainNB->page_num (*fpanel));
set_title_decorated("");
}
else{
EditorPanel* ep = static_cast<EditorPanel*>(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 // 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) { bool RTWindow::selectEditorPanel(const std::string &name) {
if (EditWindow::isMultiDisplayEnabled()) { if (EditWindow::isMultiDisplayEnabled()) {
EditWindow * wndEdit = EditWindow::getInstance(this); EditWindow * wndEdit = EditWindow::getInstance(this);
if (wndEdit->selectEditorPanel(name)) return true; if (wndEdit->selectEditorPanel(name)) {
set_title_decorated(name);
return true;
}
} else { } else {
std::map<Glib::ustring, EditorPanel*>::iterator iep = epanels.find(name); std::map<Glib::ustring, EditorPanel*>::iterator iep = epanels.find(name);
if (iep!=epanels.end()) { if (iep!=epanels.end()) {
mainNB->set_current_page (mainNB->page_num (*iep->second)); mainNB->set_current_page (mainNB->page_num (*iep->second));
set_title_decorated(name);
return true; return true;
} }
else{
//set_title_decorated(name);
//printf("RTWindow::selectEditorPanel - plain set\n");
}
} }
return false; return false;
@@ -736,3 +758,18 @@ bool RTWindow::splashClosed(GdkEventAny* event) {
splash = NULL; splash = NULL;
return true; 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<Glib::ustring, EditorPanel*>::const_iterator itr;
itr = epanels.begin();
while(itr != epanels.end()) {
remEditorPanel((*itr).second);
itr = epanels.begin();
}
}

View File

@@ -53,6 +53,7 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
bool on_expose_event_epanel(GdkEventExpose* event); bool on_expose_event_epanel(GdkEventExpose* event);
bool on_expose_event_fpanel(GdkEventExpose* event); bool on_expose_event_fpanel(GdkEventExpose* event);
bool splashClosed(GdkEventAny* event); bool splashClosed(GdkEventAny* event);
Glib::ustring versionStr;
#if defined(__APPLE__) #if defined(__APPLE__)
GtkosxApplication *osxApp; GtkosxApplication *osxApp;
#endif #endif
@@ -99,6 +100,8 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
void updateTabsUsesIcons (bool useIcons); void updateTabsUsesIcons (bool useIcons);
void updateFBQueryTB (bool singleRow); void updateFBQueryTB (bool singleRow);
bool getIsFullscreen() { return is_fullscreen; } bool getIsFullscreen() { return is_fullscreen; }
void set_title_decorated(Glib::ustring fname);
void CloseOpenEditors();
}; };
#endif #endif