Create PartialProfileDlg (Partial Profile Dialog) on demand instead of in advance when starting rt (saves another few ms when starting rt). fixes #4151

This commit is contained in:
heckflosse
2017-10-19 20:37:03 +02:00
parent c2c213efac
commit 41cd29d201
2 changed files with 27 additions and 6 deletions

View File

@@ -26,12 +26,12 @@
using namespace rtengine; using namespace rtengine;
using namespace rtengine::procparams; using namespace rtengine::procparams;
PartialPasteDlg* ProfilePanel::partialProfileDlg; PartialPasteDlg* ProfilePanel::partialProfileDlg = nullptr;
Gtk::Window* ProfilePanel::parent;
void ProfilePanel::init (Gtk::Window* parentWindow)
void ProfilePanel::init (Gtk::Window* parent)
{ {
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent); parent = parentWindow;
} }
void ProfilePanel::cleanup () void ProfilePanel::cleanup ()
@@ -336,6 +336,9 @@ void ProfilePanel::save_clicked (GdkEventButton* event)
if (toSave) { if (toSave) {
if (event->state & Gdk::CONTROL_MASK) { if (event->state & Gdk::CONTROL_MASK) {
// opening the partial paste dialog window // opening the partial paste dialog window
if(!partialProfileDlg) {
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
}
partialProfileDlg->set_title(M("PROFILEPANEL_SAVEPPASTE")); partialProfileDlg->set_title(M("PROFILEPANEL_SAVEPPASTE"));
int i = partialProfileDlg->run(); int i = partialProfileDlg->run();
partialProfileDlg->hide(); partialProfileDlg->hide();
@@ -407,6 +410,9 @@ void ProfilePanel::copy_clicked (GdkEventButton* event)
if (toSave) { if (toSave) {
if (event->state & Gdk::CONTROL_MASK) { if (event->state & Gdk::CONTROL_MASK) {
// opening the partial paste dialog window // opening the partial paste dialog window
if(!partialProfileDlg) {
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
}
partialProfileDlg->set_title(M("PROFILEPANEL_COPYPPASTE")); partialProfileDlg->set_title(M("PROFILEPANEL_COPYPPASTE"));
int i = partialProfileDlg->run(); int i = partialProfileDlg->run();
partialProfileDlg->hide(); partialProfileDlg->hide();
@@ -475,6 +481,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event)
if (event->state & Gdk::CONTROL_MASK) { if (event->state & Gdk::CONTROL_MASK) {
// opening the partial paste dialog window // opening the partial paste dialog window
if(!partialProfileDlg) {
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
}
partialProfileDlg->set_title(M("PROFILEPANEL_LOADPPASTE")); partialProfileDlg->set_title(M("PROFILEPANEL_LOADPPASTE"));
int i = partialProfileDlg->run(); int i = partialProfileDlg->run();
partialProfileDlg->hide(); partialProfileDlg->hide();
@@ -514,6 +523,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event)
if (event->state & Gdk::CONTROL_MASK) if (event->state & Gdk::CONTROL_MASK)
// custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited & partialPaste.pedited ) // 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); partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active() ? custom->pedited : nullptr, &pp, &pe);
} else { } else {
// custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited ) // 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 (event->state & Gdk::CONTROL_MASK) {
if(!partialProfileDlg) {
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
}
partialProfileDlg->set_title(M("PROFILEPANEL_PASTEPPASTE")); partialProfileDlg->set_title(M("PROFILEPANEL_PASTEPPASTE"));
int i = partialProfileDlg->run(); int i = partialProfileDlg->run();
partialProfileDlg->hide(); partialProfileDlg->hide();
@@ -613,6 +628,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event)
if (event->state & Gdk::CONTROL_MASK) if (event->state & Gdk::CONTROL_MASK)
// custom.pparams = clipboard.pparams filtered by ( clipboard.pedited & partialPaste.pedited ) // 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); partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active() ? custom->pedited : nullptr, &pp, &pe);
} else { } else {
// custom.pparams = clipboard.pparams filtered by ( clipboard.pedited ) // custom.pparams = clipboard.pparams filtered by ( clipboard.pedited )
@@ -626,6 +644,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event)
if (event->state & Gdk::CONTROL_MASK) if (event->state & Gdk::CONTROL_MASK)
// custom.pparams = clipboard.pparams filtered by ( partialPaste.pedited ) // custom.pparams = clipboard.pparams filtered by ( partialPaste.pedited )
{ {
if(!partialProfileDlg) {
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
}
partialProfileDlg->applyPaste (custom->pparams, nullptr, &pp, nullptr); partialProfileDlg->applyPaste (custom->pparams, nullptr, &pp, nullptr);
} else { } else {
// custom.pparams = clipboard.pparams non filtered // custom.pparams = clipboard.pparams non filtered

View File

@@ -66,7 +66,7 @@ protected:
ProfileChangeListener* tpc; ProfileChangeListener* tpc;
bool dontupdate; bool dontupdate;
sigc::connection changeconn; sigc::connection changeconn;
static Gtk::Window* parent;
void changeTo (const rtengine::procparams::PartialProfile* newpp, Glib::ustring profname); void changeTo (const rtengine::procparams::PartialProfile* newpp, Glib::ustring profname);
public: public:
@@ -79,7 +79,7 @@ public:
tpc = ppl; tpc = ppl;
} }
static void init (Gtk::Window* parent); static void init (Gtk::Window* parentWindow);
static void cleanup (); static void cleanup ();
void storeCurrentValue(); void storeCurrentValue();
void updateProfileList (); void updateProfileList ();