=== modified file 'src/interface.cpp' --- src/interface.cpp 2011-10-03 03:44:17 +0000 +++ src/interface.cpp 2011-12-11 12:18:37 +0000 @@ -65,6 +65,7 @@ #include "event-context.h" #include "gradient-drag.h" #include "widgets/ege-paint-def.h" +#include "verbs.h" // Include Mac OS X menu synchronization on native OSX build #ifdef GDK_WINDOWING_QUARTZ @@ -1626,6 +1627,62 @@ } } +void +sp_ui_workspace_show_dialogs() +{ + SPDesktop *dt = SP_ACTIVE_DESKTOP; + if (dt == NULL) { + return; + } + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs == NULL) { + return; + } + + // Walk thru all the panel dialogs and restore visible state from preferences. + // Map dialog 'open' verb ids to dialog last visible state preference. + std::map mapVerbPreference; + std::map::const_iterator iter; + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_LAYERS, "/dialogs/layers") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_FILL_STROKE, "/dialogs/fillstroke") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_EXTENSIONEDITOR, "/dialogs/extensioneditor") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "/dialogs/align") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_METADATA, "/dialogs/documentmetadata") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_NAMEDVIEW, "/dialogs/documentoptions") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_FILTER_EFFECTS, "/dialogs/filtereffects") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_FIND, "/dialogs/find") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_GLYPHS, "/dialogs/glyphs") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_DEBUG, "/dialogs/messages") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_HELP_MEMORY, "/dialogs/memory") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_LIVE_PATH_EFFECT, "/dialogs/livepatheffect") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_UNDO_HISTORY, "/dialogs/undo-history") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_TRANSFORM, "/dialogs/transformation") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_SWATCHES, "/dialogs/swatches") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_VIEW_ICON_PREVIEW, "/dialogs/iconpreview") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_SVG_FONTS, "/dialogs/svgfonts") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_INPUT, "/dialogs/inputdevices") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_CONTEXT_SELECT_PREFS, "/dialogs/preferences") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_SELECTION_GRIDTILE, "/dialogs/gridtiler") ); + mapVerbPreference.insert(std::make_pair ((int)SP_VERB_SELECTION_TRACE, "/dialogs/trace") ); + //mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_TEXT, "/dialogs/textandfont") ); + //mapVerbPreference.insert(std::make_pair ((int)SP_VERB_FILE_EXPORT, "/dialogs/export") ); + + for (iter = mapVerbPreference.begin(); iter != mapVerbPreference.end(); iter++) { + int verbId = iter->first; + Glib::ustring pref = iter->second; + int visible = prefs->getInt(pref + "/visible", 0); + if (visible) { + Inkscape::Verb *verb = Inkscape::Verb::get(verbId); + if (verb) { + SPAction *action = verb->get_action(dt); + if (action) { + sp_action_perform(action, NULL); + } + } + } + } +} /* Local Variables: === modified file 'src/interface.h' --- src/interface.h 2011-10-05 07:06:08 +0000 +++ src/interface.h 2011-12-11 10:23:31 +0000 @@ -82,6 +82,11 @@ void sp_ui_error_dialog (const gchar * message); bool sp_ui_overwrite_file (const gchar * filename); +/** + * Show all previously open dialogs + */ +void sp_ui_workspace_show_dialogs(); + #endif // SEEN_SP_INTERFACE_H /* === modified file 'src/main.cpp' --- src/main.cpp 2011-10-27 04:55:51 +0000 +++ src/main.cpp 2011-12-11 10:23:06 +0000 @@ -974,6 +974,8 @@ sp_file_new_default(); } + sp_ui_workspace_show_dialogs(); + Glib::signal_idle().connect(sigc::ptr_fun(&Inkscape::CmdLineAction::idle)); main_instance.run(); === modified file 'src/ui/dialog/dialog.cpp' --- src/ui/dialog/dialog.cpp 2011-10-03 07:24:15 +0000 +++ src/ui/dialog/dialog.cpp 2011-12-11 15:05:59 +0000 @@ -196,6 +196,7 @@ Dialog::read_geometry() { _user_hidden = false; + save_visibility(1); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int x = prefs->getInt(_prefs_path + "/x", -1000); @@ -246,6 +247,14 @@ } void +Dialog::save_visibility(int v) +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs) + prefs->setInt(_prefs_path + "/visible", v); +} + +void Dialog::_handleResponse(int response_id) { switch (response_id) { @@ -342,6 +351,7 @@ if (event.window) g_object_unref(G_OBJECT(event.window)); + } void === modified file 'src/ui/dialog/dialog.h' --- src/ui/dialog/dialog.h 2010-11-17 02:12:56 +0000 +++ src/ui/dialog/dialog.h 2011-12-11 10:12:10 +0000 @@ -84,6 +84,8 @@ void read_geometry(); void save_geometry(); + void save_visibility(int v); // write to prefs if the dialog is visible or not, used to restore previously opened dialogs. + bool retransientize_suppress; // when true, do not retransientize (prevents races when switching new windows too fast) protected: === modified file 'src/ui/dialog/dock-behavior.cpp' --- src/ui/dialog/dock-behavior.cpp 2011-10-03 07:24:15 +0000 +++ src/ui/dialog/dock-behavior.cpp 2011-12-11 09:07:58 +0000 @@ -177,6 +177,7 @@ DockBehavior::_onHide() { _dialog.save_geometry(); + _dialog.save_visibility(0); _dialog._user_hidden = true; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt(_dialog._prefs_path + "/state", _dock_item.getPrevState());