From 8c3c2f3e886d073a9cbfdb182f0087d0a43b230d Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 8 Aug 2017 22:40:46 +0200 Subject: [PATCH] show message dialog about the expected usage when running RT as GIMP plugin --- rtdata/languages/default | 2 ++ rtgui/main.cc | 16 ++++++++++++++++ rtgui/options.cc | 5 +++++ rtgui/options.h | 1 + 4 files changed, 24 insertions(+) diff --git a/rtdata/languages/default b/rtdata/languages/default index 5f1b4666c..0c065a91d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -2129,3 +2129,5 @@ ZOOMPANEL_ZOOMFITCROPSCREEN;Fit crop to screen\nShortcut: Alt-f ZOOMPANEL_ZOOMFITSCREEN;Fit whole image to screen\nShortcut: f ZOOMPANEL_ZOOMIN;Zoom In\nShortcut: + ZOOMPANEL_ZOOMOUT;Zoom Out\nShortcut: - +GIMP_PLUGIN_INFO;Welcome to the RawTherapee GIMP plugin!\nOnce you are done editing, simply close the main RawTherapee window and the image will be automatically imported in GIMP. +DONT_SHOW_AGAIN;Don't show this message again. diff --git a/rtgui/main.cc b/rtgui/main.cc index 10cbe72b1..455749fdd 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -416,6 +416,19 @@ private: RTWindow *rtWindow; }; +void show_gimp_plugin_info_dialog(Gtk::Window *parent) +{ + if (options.gimpPluginShowInfoDialog) { + Gtk::MessageDialog info(*parent, M("GIMP_PLUGIN_INFO"), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); + Gtk::Box *box = info.get_message_area(); + Gtk::CheckButton dontshowagain(M("DONT_SHOW_AGAIN")); + dontshowagain.show(); + box->pack_start(dontshowagain); + info.run(); + options.gimpPluginShowInfoDialog = !dontshowagain.get_active(); + } +} + } // namespace @@ -602,6 +615,9 @@ int main(int argc, char **argv) Gtk::Main m(&argc, &argv); gdk_threads_enter(); const std::unique_ptr rtWindow(create_rt_window()); + if (gimpPlugin) { + show_gimp_plugin_info_dialog(rtWindow.get()); + } m.run(*rtWindow); gdk_threads_leave(); diff --git a/rtgui/options.cc b/rtgui/options.cc index 07b0f81ad..5bc7ab684 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -724,6 +724,7 @@ void Options::setDefaults () lastProfilingReferenceDir = ""; lastBWCurvesDir = ""; lastLensProfileDir = ""; + gimpPluginShowInfoDialog = true; maxRecentFolders = 15; } @@ -1852,6 +1853,9 @@ int Options::readFromFile (Glib::ustring fname) safeDirGet (keyFile, "Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); safeDirGet (keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); safeDirGet (keyFile, "Dialogs", "LastLensProfileDir", lastLensProfileDir); + if (keyFile.has_key ("Dialogs", "GimpPluginShowInfoDialog")) { + gimpPluginShowInfoDialog = keyFile.get_boolean("Dialogs", "GimpPluginShowInfoDialog"); + } } // -------------------------------------------------------------------------------------------------------- @@ -2217,6 +2221,7 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Dialogs", "LastVibranceCurvesDir", lastVibranceCurvesDir); keyFile.set_string ("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); keyFile.set_string ("Dialogs", "LastLensProfileDir", lastLensProfileDir); + keyFile.set_boolean("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog); keyData = keyFile.to_data (); diff --git a/rtgui/options.h b/rtgui/options.h index 9253b7e2f..13025ee7c 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -315,6 +315,7 @@ public: Glib::ustring lastProfilingReferenceDir; Glib::ustring lastBWCurvesDir; Glib::ustring lastLensProfileDir; + bool gimpPluginShowInfoDialog; size_t maxRecentFolders; // max. number of recent folders stored in options file std::vector recentFolders; // List containing all recent folders