From 41cd29d201096b44035cd7f7942941a3c323cf8f Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 19 Oct 2017 20:37:03 +0200 Subject: [PATCH] Create PartialProfileDlg (Partial Profile Dialog) on demand instead of in advance when starting rt (saves another few ms when starting rt). fixes #4151 --- rtgui/profilepanel.cc | 29 +++++++++++++++++++++++++---- rtgui/profilepanel.h | 4 ++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index 6d317f5a4..57204f8b1 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -26,12 +26,12 @@ using namespace rtengine; using namespace rtengine::procparams; -PartialPasteDlg* ProfilePanel::partialProfileDlg; +PartialPasteDlg* ProfilePanel::partialProfileDlg = nullptr; +Gtk::Window* ProfilePanel::parent; - -void ProfilePanel::init (Gtk::Window* parent) +void ProfilePanel::init (Gtk::Window* parentWindow) { - partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + parent = parentWindow; } void ProfilePanel::cleanup () @@ -336,6 +336,9 @@ void ProfilePanel::save_clicked (GdkEventButton* event) if (toSave) { if (event->state & Gdk::CONTROL_MASK) { // opening the partial paste dialog window + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->set_title(M("PROFILEPANEL_SAVEPPASTE")); int i = partialProfileDlg->run(); partialProfileDlg->hide(); @@ -407,6 +410,9 @@ void ProfilePanel::copy_clicked (GdkEventButton* event) if (toSave) { if (event->state & Gdk::CONTROL_MASK) { // opening the partial paste dialog window + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->set_title(M("PROFILEPANEL_COPYPPASTE")); int i = partialProfileDlg->run(); partialProfileDlg->hide(); @@ -475,6 +481,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event) if (event->state & Gdk::CONTROL_MASK) { // opening the partial paste dialog window + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->set_title(M("PROFILEPANEL_LOADPPASTE")); int i = partialProfileDlg->run(); partialProfileDlg->hide(); @@ -514,6 +523,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event) if (event->state & Gdk::CONTROL_MASK) // custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited & partialPaste.pedited ) { + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active() ? custom->pedited : nullptr, &pp, &pe); } else { // custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited ) @@ -551,6 +563,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) } if (event->state & Gdk::CONTROL_MASK) { + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->set_title(M("PROFILEPANEL_PASTEPPASTE")); int i = partialProfileDlg->run(); partialProfileDlg->hide(); @@ -613,6 +628,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) if (event->state & Gdk::CONTROL_MASK) // custom.pparams = clipboard.pparams filtered by ( clipboard.pedited & partialPaste.pedited ) { + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active() ? custom->pedited : nullptr, &pp, &pe); } else { // custom.pparams = clipboard.pparams filtered by ( clipboard.pedited ) @@ -626,6 +644,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) if (event->state & Gdk::CONTROL_MASK) // custom.pparams = clipboard.pparams filtered by ( partialPaste.pedited ) { + if(!partialProfileDlg) { + partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); + } partialProfileDlg->applyPaste (custom->pparams, nullptr, &pp, nullptr); } else { // custom.pparams = clipboard.pparams non filtered diff --git a/rtgui/profilepanel.h b/rtgui/profilepanel.h index ddd7133ca..dc07e2006 100644 --- a/rtgui/profilepanel.h +++ b/rtgui/profilepanel.h @@ -66,7 +66,7 @@ protected: ProfileChangeListener* tpc; bool dontupdate; sigc::connection changeconn; - + static Gtk::Window* parent; void changeTo (const rtengine::procparams::PartialProfile* newpp, Glib::ustring profname); public: @@ -79,7 +79,7 @@ public: tpc = ppl; } - static void init (Gtk::Window* parent); + static void init (Gtk::Window* parentWindow); static void cleanup (); void storeCurrentValue(); void updateProfileList ();