Also fix the missing parent window for the partial-paste and the save-as dialogs.

This commit is contained in:
Adam Reichold
2016-01-10 18:07:06 +01:00
parent 325d153bd4
commit 375ed172e0
11 changed files with 22 additions and 65 deletions

View File

@@ -1556,11 +1556,12 @@ void EditorPanel::saveAsPressed ()
Glib::ustring fnameOut; Glib::ustring fnameOut;
SaveAsDialog* saveAsDialog; SaveAsDialog* saveAsDialog;
auto toplevel = static_cast<Gtk::Window*> (get_toplevel ());
if (safe_file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) { if (safe_file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) {
saveAsDialog = new SaveAsDialog (options.lastSaveAsPath); saveAsDialog = new SaveAsDialog (options.lastSaveAsPath, toplevel);
} else { } 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); saveAsDialog->set_default_size (options.saveAsDialogWidth, options.saveAsDialogHeight);

View File

@@ -126,7 +126,7 @@ void findOriginalEntries (const std::vector<ThumbBrowserEntryBase*>& entries)
} }
FileBrowser::FileBrowser () FileBrowser::FileBrowser ()
: tbl(NULL), numFiltered(0), partialPasteDlg(M("PARTIALPASTE_DIALOGLABEL")) : tbl(NULL), numFiltered(0)
{ {
fbih = new FileBrowserIdleHelper; fbih = new FileBrowserIdleHelper;
@@ -1088,6 +1088,9 @@ void FileBrowser::partPasteProfile ()
return; return;
} }
auto toplevel = static_cast<Gtk::Window*> (get_toplevel ());
PartialPasteDlg partialPasteDlg (M("PARTIALPASTE_DIALOGLABEL"), toplevel);
int i = partialPasteDlg.run (); int i = partialPasteDlg.run ();
if (i == Gtk::RESPONSE_OK) { if (i == Gtk::RESPONSE_OK) {
@@ -1402,6 +1405,10 @@ void FileBrowser::applyPartialMenuItemActivated (ProfileStoreLabel *label)
const rtengine::procparams::PartialProfile* srcProfiles = profileStore.getProfile (label->entry); const rtengine::procparams::PartialProfile* srcProfiles = profileStore.getProfile (label->entry);
if (srcProfiles->pparams) { if (srcProfiles->pparams) {
auto toplevel = static_cast<Gtk::Window*> (get_toplevel ());
PartialPasteDlg partialPasteDlg (M("PARTIALPASTE_DIALOGLABEL"), toplevel);
if (partialPasteDlg.run() == Gtk::RESPONSE_OK) { if (partialPasteDlg.run() == Gtk::RESPONSE_OK) {
#if PROTECT_VECTORS #if PROTECT_VECTORS

View File

@@ -128,7 +128,6 @@ protected:
FileBrowserListener* tbl; FileBrowserListener* tbl;
BrowserFilter filter; BrowserFilter filter;
int numFiltered; int numFiltered;
PartialPasteDlg partialPasteDlg;
FileBrowserIdleHelper* fbih; FileBrowserIdleHelper* fbih;
void toTrashRequested (std::vector<FileBrowserEntry*> tbe); void toTrashRequested (std::vector<FileBrowserEntry*> tbe);

View File

@@ -1259,53 +1259,6 @@ void FileCatalog::renameRequested (std::vector<FileBrowserEntry*> tbe)
} }
delete renameDlg; 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; i<tbe.size(); i++) {
Glib::ustring ofname = tbe[i]->filename;
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("<big><b>") + Glib::ustring::compose (M("FILEBROWSER_RENAMEDLGMSG"), baseName) + Glib::ustring("</b></big>"));
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<FileBrowserEntry*> tbe, bool leavenotrace) void FileCatalog::clearFromCacheRequested (std::vector<FileBrowserEntry*> tbe, bool leavenotrace)

View File

@@ -20,11 +20,9 @@
#include "multilangmgr.h" #include "multilangmgr.h"
#include "paramsedited.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); set_default_size(700, 600);
everything = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EVERYTHING"))); everything = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EVERYTHING")));

View File

@@ -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 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: 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); void applyPaste (rtengine::procparams::ProcParams* dstPP, ParamsEdited* dstPE, const rtengine::procparams::ProcParams* srcPP, const ParamsEdited* srcPE = NULL);

View File

@@ -30,9 +30,9 @@ using namespace rtengine::procparams;
PartialPasteDlg* ProfilePanel::partialProfileDlg; 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 () void ProfilePanel::cleanup ()

View File

@@ -77,7 +77,7 @@ public:
tpc = ppl; tpc = ppl;
} }
static void init (); static void init (Gtk::Window* parent);
static void cleanup (); static void cleanup ();
void storeCurrentValue(); void storeCurrentValue();
void updateProfileList (); void updateProfileList ();

View File

@@ -90,7 +90,7 @@ RTWindow::RTWindow ()
cacheMgr->init (); cacheMgr->init ();
WhiteBalance::init(); WhiteBalance::init();
ProfilePanel::init(); ProfilePanel::init (this);
Glib::ustring fName = "rt-logo-small.png"; Glib::ustring fName = "rt-logo-small.png";
Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName); Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName);

View File

@@ -23,11 +23,10 @@
#include "rtimage.h" #include "rtimage.h"
extern Options options; 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 (); Gtk::Box* box = get_content_area ();
fchooser = Gtk::manage( new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE) ); fchooser = Gtk::manage( new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE) );

View File

@@ -45,7 +45,7 @@ protected:
void putToQueueClicked (); void putToQueueClicked ();
public: public:
SaveAsDialog (Glib::ustring initialDir); SaveAsDialog (const Glib::ustring& initialDir, Gtk::Window* parent);
Glib::ustring getFileName (); Glib::ustring getFileName ();
Glib::ustring getDirectory (); Glib::ustring getDirectory ();