13
0

fix save/restore of preferences torn-off-window state

This commit is contained in:
Paul Davis 2016-07-13 16:38:08 -04:00
parent 7a1084d349
commit dc43189c7e
6 changed files with 52 additions and 5 deletions

View File

@ -3574,6 +3574,11 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name,
new_session->add_instant_xml (*n, false); new_session->add_instant_xml (*n, false);
} }
n = Config->instant_xml (X_("Preferences"));
if (n) {
new_session->add_instant_xml (*n, false);
}
/* Put the playhead at 0 and scroll fully left */ /* Put the playhead at 0 and scroll fully left */
n = new_session->instant_xml (X_("Editor")); n = new_session->instant_xml (X_("Editor"));
if (n) { if (n) {
@ -4544,6 +4549,24 @@ ARDOUR_UI::export_video (bool range)
export_video_dialog->hide (); export_video_dialog->hide ();
} }
XMLNode*
ARDOUR_UI::preferences_settings () const
{
XMLNode* node = 0;
if (_session) {
node = _session->instant_xml(X_("Preferences"));
} else {
node = Config->instant_xml(X_("Preferences"));
}
if (!node) {
node = new XMLNode (X_("Preferences"));
}
return node;
}
XMLNode* XMLNode*
ARDOUR_UI::mixer_settings () const ARDOUR_UI::mixer_settings () const
{ {

View File

@ -232,6 +232,7 @@ public:
XMLNode* main_window_settings() const; XMLNode* main_window_settings() const;
XMLNode* editor_settings() const; XMLNode* editor_settings() const;
XMLNode* preferences_settings() const;
XMLNode* mixer_settings () const; XMLNode* mixer_settings () const;
XMLNode* keyboard_settings () const; XMLNode* keyboard_settings () const;
XMLNode* tearoff_settings (const char*) const; XMLNode* tearoff_settings (const char*) const;

View File

@ -733,6 +733,7 @@ ARDOUR_UI::save_ardour_state ()
XMLNode& enode (editor->get_state()); XMLNode& enode (editor->get_state());
XMLNode& mnode (mixer->get_state()); XMLNode& mnode (mixer->get_state());
XMLNode& bnode (meterbridge->get_state()); XMLNode& bnode (meterbridge->get_state());
XMLNode& pnode (rc_option_editor->get_state());
Config->add_extra_xml (*window_node); Config->add_extra_xml (*window_node);
Config->add_extra_xml (audio_midi_setup->get_state()); Config->add_extra_xml (audio_midi_setup->get_state());
@ -745,6 +746,7 @@ ARDOUR_UI::save_ardour_state ()
_session->add_instant_xml (main_window_node); _session->add_instant_xml (main_window_node);
_session->add_instant_xml (enode); _session->add_instant_xml (enode);
_session->add_instant_xml (mnode); _session->add_instant_xml (mnode);
_session->add_instant_xml (pnode);
_session->add_instant_xml (bnode); _session->add_instant_xml (bnode);
if (location_ui) { if (location_ui) {
_session->add_instant_xml (location_ui->ui().get_state ()); _session->add_instant_xml (location_ui->ui().get_state ());
@ -753,12 +755,17 @@ ARDOUR_UI::save_ardour_state ()
Config->add_instant_xml (main_window_node); Config->add_instant_xml (main_window_node);
Config->add_instant_xml (enode); Config->add_instant_xml (enode);
Config->add_instant_xml (mnode); Config->add_instant_xml (mnode);
Config->add_instant_xml (pnode);
Config->add_instant_xml (bnode); Config->add_instant_xml (bnode);
if (location_ui) { if (location_ui) {
Config->add_instant_xml (location_ui->ui().get_state ()); Config->add_instant_xml (location_ui->ui().get_state ());
} }
} }
delete &enode; delete &enode;
delete &mnode;
delete &bnode;
delete &pnode;
Keyboard::save_keybindings (); Keyboard::save_keybindings ();
} }

View File

@ -1362,7 +1362,7 @@ public:
edit_box->set_spacing(3); edit_box->set_spacing(3);
_box->pack_start (*edit_box, false, false); _box->pack_start (*edit_box, false, false);
edit_box->show (); edit_box->show ();
Label* label = manage (new Label); Label* label = manage (new Label);
label->set_text (_("Click to edit the settings for selected protocol ( it must be ENABLED first ):")); label->set_text (_("Click to edit the settings for selected protocol ( it must be ENABLED first ):"));
edit_box->pack_start (*label, false, false); edit_box->pack_start (*label, false, false);
@ -1432,7 +1432,7 @@ private:
else else
edit_button->set_sensitive (false); edit_button->set_sensitive (false);
} }
void view_changed (TreeModel::Path const &, TreeModel::iterator const & i) void view_changed (TreeModel::Path const &, TreeModel::iterator const & i)
{ {
TreeModel::Row r = *i; TreeModel::Row r = *i;
@ -1854,6 +1854,13 @@ RCOptionEditor::RCOptionEditor ()
, _rc_config (Config) , _rc_config (Config)
, _mixer_strip_visibility ("mixer-element-visibility") , _mixer_strip_visibility ("mixer-element-visibility")
{ {
XMLNode* node = ARDOUR_UI::instance()->preferences_settings();
if (node) {
/* gcc4 complains about ambiguity with Gtk::Widget::set_state
(Gtk::StateType) here !!!
*/
Tabbable::set_state (*node, Stateful::loading_state_version);
}
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &RCOptionEditor::parameter_changed)); UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &RCOptionEditor::parameter_changed));
@ -2337,7 +2344,7 @@ if (!Profile->get_mixbus()) {
rsas->add(ExistingNewlyCreatedBoth, _("existing selection and newly-created regions")); rsas->add(ExistingNewlyCreatedBoth, _("existing selection and newly-created regions"));
add_option (_("Editor"), rsas); add_option (_("Editor"), rsas);
add_option (_("Editor/Waveforms"), new OptionEditorHeading (_("Waveforms"))); add_option (_("Editor/Waveforms"), new OptionEditorHeading (_("Waveforms")));
if (!Profile->get_mixbus()) { if (!Profile->get_mixbus()) {
@ -3482,3 +3489,11 @@ RCOptionEditor::use_own_window (bool and_fill_it)
return win; return win;
} }
XMLNode&
RCOptionEditor::get_state ()
{
XMLNode* node = new XMLNode (X_("Preferences"));
node->add_child_nocopy (Tabbable::get_state());
return *node;
}

View File

@ -42,6 +42,7 @@ public:
void populate_sync_options (); void populate_sync_options ();
Gtk::Window* use_own_window (bool and_fill_it); Gtk::Window* use_own_window (bool and_fill_it);
XMLNode& get_state ();
private: private:
void parameter_changed (std::string const &); void parameter_changed (std::string const &);

View File

@ -68,7 +68,7 @@ Manager::register_window (ProxyBase* info)
if (!window_actions) { if (!window_actions) {
window_actions = ARDOUR_UI::instance()->global_actions.create_action_group (X_("Window")); window_actions = ARDOUR_UI::instance()->global_actions.create_action_group (X_("Window"));
} }
info->set_action (ARDOUR_UI::instance()->global_actions.register_toggle_action (window_actions, info->set_action (ARDOUR_UI::instance()->global_actions.register_toggle_action (window_actions,
info->action_name().c_str(), info->menu_name().c_str(), info->action_name().c_str(), info->menu_name().c_str(),
sigc::bind (sigc::mem_fun (*this, &Manager::toggle_window), info))); sigc::bind (sigc::mem_fun (*this, &Manager::toggle_window), info)));
@ -159,7 +159,7 @@ Manager::show_visible() const
* ::signal_response(). This means we need to * ::signal_response(). This means we need to
* destroy the window as well, so that the code * destroy the window as well, so that the code
* which checks if it should be created will * which checks if it should be created will
* find that it is missing and will create it * find that it is missing and will create it
* and connect to any necessary signals. * and connect to any necessary signals.
*/ */
(*i)->drop_window (); (*i)->drop_window ();