From a5e66f8dfc072967cfd704d486a23190709753d4 Mon Sep 17 00:00:00 2001 From: Ingo Date: Mon, 3 Nov 2014 21:43:27 +0100 Subject: [PATCH] Bugfix for two crashes and some window title issues, see Issue 1493 for details --- rtgui/editorpanel.cc | 10 +++++-- rtgui/rtwindow.cc | 71 ++++++++++++++++++++++++-------------------- rtgui/rtwindow.h | 3 ++ 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index e149d35d6..6be0f7bf8 100755 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1098,7 +1098,8 @@ bool EditorPanel::idle_saveImage (ProgressConnector *pc, Gl msgd.run (); saveimgas->set_sensitive(true); - sendtogimp->set_sensitive(true); + sendtogimp->set_sensitive(true); + isProcessing = false; } rtengine::ImageSource* imgsrc = isrc->getImageSource (); @@ -1134,7 +1135,9 @@ bool EditorPanel::idle_imageSaved(ProgressConnector *pc,rtengine::IImage16* setProgressState(false); - delete pc; + delete pc; + SoundManager::playSoundAsync(options.sndBatchQueueDone); + isProcessing = false; return false; } @@ -1214,7 +1217,8 @@ void EditorPanel::saveAsPressed () { fnameOK = confirmOverwrite (*saveAsDialog, fnameOut); } - if (fnameOK) { + if (fnameOK) { + isProcessing = true; // save image rtengine::procparams::ProcParams pparams; ipc->getParams (&pparams); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index b30915c2a..da3a5a04f 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -361,29 +361,31 @@ bool RTWindow::on_window_state_event(GdkEventWindowState* event) { } void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) { - if (page_num > 1) { - if (isSingleTabMode()) MoveFileBrowserToEditor(); + if(!on_delete_has_run) { + if(isEditorPanel(page_num)) { + if (isSingleTabMode() && epanel) + MoveFileBrowserToEditor(); + + EditorPanel *ep = static_cast(mainNB->get_nth_page(page_num)); + ep->setAspect(); + + if (!isSingleTabMode()){ + if (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) { + // Save profile on leaving the editor panel + epanel->saveProfile(); - 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()); - } + // Moving the FileBrowser only if the user has switched to the FileBrowser tab + if (mainNB->get_nth_page(page_num)==fpanel) + MoveFileBrowserToMain(); + } } - - } else { - // in single tab mode with command line filename epanel does not exist yet - if (isSingleTabMode() && epanel) { - // Save profile on leaving the editor panel - epanel->saveProfile(); - - // Moving the FileBrowser only if the user has switched to the FileBrowser tab - if (page_num==0) - MoveFileBrowserToMain(); - } - } + } } void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) { @@ -440,11 +442,9 @@ void RTWindow::remEditorPanel (EditorPanel* ep) { mainNB->remove_page (*ep); - if (mainNB->get_current_page () == mainNB->page_num (*bpanel) || mainNB->get_current_page () == mainNB->page_num (*fpanel)){ - mainNB->set_current_page (mainNB->page_num (*fpanel)); + if (!isEditorPanel(mainNB->get_current_page())){ set_title_decorated(""); - } - else{ + } else { EditorPanel* ep = static_cast(mainNB->get_nth_page (mainNB->get_current_page())); set_title_decorated(ep->getFileName()); } @@ -569,15 +569,14 @@ bool RTWindow::on_delete_event(GdkEventAny* event) { else { int pageCount=mainNB->get_n_pages(); - // First and second are file browser and batch queue - if (pageCount>2) { - for (int i=2;i(mainNB->get_nth_page(i)))->getIsProcessing(); - } + for (int i=0;i(mainNB->get_nth_page(i)))->getIsProcessing(); + } } - if (isProcessing) return true; - + if (isProcessing) + return true; if( fpanel ) fpanel->saveOptions (); @@ -774,3 +773,11 @@ void RTWindow::CloseOpenEditors(){ itr = epanels.begin(); } } + +bool RTWindow::isEditorPanel(Widget* panel) { + return (panel != bpanel) && (panel != fpanel); +} + +bool RTWindow::isEditorPanel(guint pageNum) { + return isEditorPanel(mainNB->get_nth_page(pageNum)); +} \ No newline at end of file diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index 4022e9e34..05a1abe6d 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -53,6 +53,9 @@ 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); + bool isEditorPanel(Widget* panel); + bool isEditorPanel(guint pageNum); + Glib::ustring versionStr; #if defined(__APPLE__) GtkosxApplication *osxApp;