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);
}
n = Config->instant_xml (X_("Preferences"));
if (n) {
new_session->add_instant_xml (*n, false);
}
/* Put the playhead at 0 and scroll fully left */
n = new_session->instant_xml (X_("Editor"));
if (n) {
@ -4544,6 +4549,24 @@ ARDOUR_UI::export_video (bool range)
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*
ARDOUR_UI::mixer_settings () const
{

View File

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

View File

@ -733,6 +733,7 @@ ARDOUR_UI::save_ardour_state ()
XMLNode& enode (editor->get_state());
XMLNode& mnode (mixer->get_state());
XMLNode& bnode (meterbridge->get_state());
XMLNode& pnode (rc_option_editor->get_state());
Config->add_extra_xml (*window_node);
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 (enode);
_session->add_instant_xml (mnode);
_session->add_instant_xml (pnode);
_session->add_instant_xml (bnode);
if (location_ui) {
_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 (enode);
Config->add_instant_xml (mnode);
Config->add_instant_xml (pnode);
Config->add_instant_xml (bnode);
if (location_ui) {
Config->add_instant_xml (location_ui->ui().get_state ());
}
}
delete &enode;
delete &mnode;
delete &bnode;
delete &pnode;
Keyboard::save_keybindings ();
}

View File

@ -1854,6 +1854,13 @@ RCOptionEditor::RCOptionEditor ()
, _rc_config (Config)
, _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));
@ -3482,3 +3489,11 @@ RCOptionEditor::use_own_window (bool and_fill_it)
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 ();
Gtk::Window* use_own_window (bool and_fill_it);
XMLNode& get_state ();
private:
void parameter_changed (std::string const &);