diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 7ee28d845..7bf81da3d 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1573,11 +1573,12 @@ void EditorPanel::saveAsPressed () Glib::ustring fnameOut; SaveAsDialog* saveAsDialog; + auto toplevel = static_cast (get_toplevel ()); if (safe_file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) { - saveAsDialog = new SaveAsDialog (options.lastSaveAsPath); + saveAsDialog = new SaveAsDialog (options.lastSaveAsPath, toplevel); } else { - saveAsDialog = new SaveAsDialog (safe_get_user_picture_dir()); + saveAsDialog = new SaveAsDialog (safe_get_user_picture_dir(), toplevel); } saveAsDialog->set_default_size (options.saveAsDialogWidth, options.saveAsDialogHeight); diff --git a/rtgui/filebrowser.cc b/rtgui/filebrowser.cc index 784b008f5..419dac35a 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -126,7 +126,7 @@ void findOriginalEntries (const std::vector& entries) } FileBrowser::FileBrowser () - : tbl(NULL), numFiltered(0), partialPasteDlg(M("PARTIALPASTE_DIALOGLABEL")) + : tbl(NULL), numFiltered(0) { fbih = new FileBrowserIdleHelper; @@ -1088,6 +1088,9 @@ void FileBrowser::partPasteProfile () return; } + auto toplevel = static_cast (get_toplevel ()); + PartialPasteDlg partialPasteDlg (M("PARTIALPASTE_DIALOGLABEL"), toplevel); + int i = partialPasteDlg.run (); if (i == Gtk::RESPONSE_OK) { @@ -1402,6 +1405,10 @@ void FileBrowser::applyPartialMenuItemActivated (ProfileStoreLabel *label) const rtengine::procparams::PartialProfile* srcProfiles = profileStore.getProfile (label->entry); if (srcProfiles->pparams) { + + auto toplevel = static_cast (get_toplevel ()); + PartialPasteDlg partialPasteDlg (M("PARTIALPASTE_DIALOGLABEL"), toplevel); + if (partialPasteDlg.run() == Gtk::RESPONSE_OK) { #if PROTECT_VECTORS diff --git a/rtgui/filebrowser.h b/rtgui/filebrowser.h index ab9443cad..cdb9b133f 100644 --- a/rtgui/filebrowser.h +++ b/rtgui/filebrowser.h @@ -128,7 +128,6 @@ protected: FileBrowserListener* tbl; BrowserFilter filter; int numFiltered; - PartialPasteDlg partialPasteDlg; FileBrowserIdleHelper* fbih; void toTrashRequested (std::vector tbe); diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 34cc868f2..b3b53f8c0 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -1258,53 +1258,6 @@ void FileCatalog::renameRequested (std::vector tbe) } delete renameDlg; - /* // ask for new file name - Gtk::Dialog dialog (M("FILEBROWSER_RENAMEDLGLABEL"), *((Gtk::Window*)get_toplevel()), true, true); - - dialog.add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK); - dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - - Gtk::Label l; - dialog.get_content_area()->pack_start (l, Gtk::PACK_SHRINK); - - Gtk::Entry nfentry; - - dialog.get_content_area()->pack_start (nfentry, Gtk::PACK_SHRINK); - dialog.get_content_area()->show_all (); - - nfentry.set_activates_default (true); - dialog.set_default_response (Gtk::RESPONSE_OK); - - for (int i=0; ifilename; - Glib::ustring dirName = Glib::path_get_dirname (tbe[i]->filename); - Glib::ustring baseName = Glib::path_get_basename (tbe[i]->filename); - - l.set_markup (Glib::ustring("") + Glib::ustring::compose (M("FILEBROWSER_RENAMEDLGMSG"), baseName) + Glib::ustring("")); - nfentry.set_text (baseName); - nfentry.select_region (0, baseName.size()); - - if (dialog.run ()== Gtk::RESPONSE_OK) { - Glib::ustring nBaseName = nfentry.get_text (); - // if path has directory components, exit - if (Glib::path_get_dirname (nBaseName) != ".") - continue; - // if no extension is given, concatenate the extension of the original file - if (nBaseName.find ('.')==nBaseName.npos) { - size_t lastdot = baseName.find_last_of ('.'); - nBaseName += "." + (lastdot!=Glib::ustring::npos ? baseName.substr (lastdot+1) : ""); - } - Glib::ustring nfname = Glib::build_filename (dirName, nBaseName); - if (!safe_g_rename (ofname, nfname)) { - cacheMgr->renameEntry (ofname, tbe[i]->thumbnail->getMD5(), nfname); - // the remaining part (removing old and adding new entry) is done by the directory monitor - reparseDirectory (); - // on_dir_changed (Gio::File::create_for_path (nfname), Gio::File::create_for_path (nfname), Gio::FILE_MONITOR_EVENT_CHANGED, true); - } - } - } - */ } void FileCatalog::clearFromCacheRequested (std::vector tbe, bool leavenotrace) diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index b806be4bd..a3b1e30ea 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -20,11 +20,9 @@ #include "multilangmgr.h" #include "paramsedited.h" -PartialPasteDlg::PartialPasteDlg (Glib::ustring title) +PartialPasteDlg::PartialPasteDlg (const Glib::ustring& title, Gtk::Window* parent) + : Gtk::Dialog (title, *parent, true) { - - set_modal (true); - set_title (title); set_default_size(700, 600); everything = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EVERYTHING"))); diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index 86f7fd1c2..879c65df3 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -134,7 +134,7 @@ public: sigc::connection raw_caredConn, raw_cablueConn, raw_ca_autocorrectConn, raw_hotpix_filtConn, raw_deadpix_filtConn, raw_linenoiseConn, raw_greenthreshConn, raw_ccStepsConn, raw_methodConn, raw_dcb_iterationsConn, raw_lmmse_iterationsConn, raw_dcb_enhanceConn, raw_exposConn, raw_preserConn, raw_blackConn; //,raw_all_enhanceConn public: - PartialPasteDlg (Glib::ustring title); + PartialPasteDlg (const Glib::ustring& title, Gtk::Window* parent); void applyPaste (rtengine::procparams::ProcParams* dstPP, ParamsEdited* dstPE, const rtengine::procparams::ProcParams* srcPP, const ParamsEdited* srcPE = NULL); diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 84625bdcf..124cd37a5 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -36,13 +36,13 @@ extern Glib::ustring argv0; extern Glib::RefPtr cssForced; Glib::RefPtr css; -Preferences::Preferences (RTWindow *rtwindow) : rprofiles(NULL), iprofiles(NULL), parent(rtwindow) +Preferences::Preferences (RTWindow *rtwindow) + : Gtk::Dialog (M("MAIN_BUTTON_PREFERENCES"), *rtwindow, true) + , rprofiles (nullptr) + , iprofiles (nullptr) + , parent (rtwindow) + , splash (nullptr) { - - splash = NULL; - - set_title (M("MAIN_BUTTON_PREFERENCES")); - moptions.copyFrom (&options); /* @@ -96,7 +96,6 @@ Preferences::Preferences (RTWindow *rtwindow) : rprofiles(NULL), iprofiles(NULL fillPreferences (); show_all_children (); - set_modal (true); } diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index e7eccb853..35db17587 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -30,9 +30,9 @@ using namespace rtengine::procparams; PartialPasteDlg* ProfilePanel::partialProfileDlg; -void ProfilePanel::init () +void ProfilePanel::init (Gtk::Window* parent) { - partialProfileDlg = new PartialPasteDlg("Foo"); + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); } void ProfilePanel::cleanup () diff --git a/rtgui/profilepanel.h b/rtgui/profilepanel.h index fb9054014..b02ff92e2 100644 --- a/rtgui/profilepanel.h +++ b/rtgui/profilepanel.h @@ -77,7 +77,7 @@ public: tpc = ppl; } - static void init (); + static void init (Gtk::Window* parent); static void cleanup (); void storeCurrentValue(); void updateProfileList (); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 4851b44e8..d90d6bfa1 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -90,7 +90,7 @@ RTWindow::RTWindow () cacheMgr->init (); WhiteBalance::init(); - ProfilePanel::init(); + ProfilePanel::init (this); Glib::ustring fName = "rt-logo-small.png"; Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName); diff --git a/rtgui/saveasdlg.cc b/rtgui/saveasdlg.cc index 3cd561ae0..3ecb18d54 100644 --- a/rtgui/saveasdlg.cc +++ b/rtgui/saveasdlg.cc @@ -23,11 +23,10 @@ #include "rtimage.h" extern Options options; -SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) + +SaveAsDialog::SaveAsDialog (const Glib::ustring& initialDir, Gtk::Window* parent) + : Gtk::Dialog (M("GENERAL_SAVE"), *parent) { - - set_title(M("GENERAL_SAVE")); - Gtk::Box* box = get_content_area (); fchooser = Gtk::manage( new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE) ); diff --git a/rtgui/saveasdlg.h b/rtgui/saveasdlg.h index c669a62e7..2538fe61e 100644 --- a/rtgui/saveasdlg.h +++ b/rtgui/saveasdlg.h @@ -45,7 +45,7 @@ protected: void putToQueueClicked (); public: - SaveAsDialog (Glib::ustring initialDir); + SaveAsDialog (const Glib::ustring& initialDir, Gtk::Window* parent); Glib::ustring getFileName (); Glib::ustring getDirectory ();