+ XMLNode* tearoff_node = new XMLNode (X_("Tearoffs"));
+
+ if (transport_tearoff) {
+ XMLNode* t = new XMLNode (X_("transport"));
+ transport_tearoff->add_state (*t);
+ tearoff_node->add_child_nocopy (*t);
+ }
+
+ if (mixer && mixer->monitor_section()) {
+ XMLNode* t = new XMLNode (X_("monitor-section"));
+ mixer->monitor_section()->tearoff().add_state (*t);
+ tearoff_node->add_child_nocopy (*t);
+ }
+
+ if (editor && editor->mouse_mode_tearoff()) {
+ XMLNode* t = new XMLNode (X_("mouse-mode"));
+ editor->mouse_mode_tearoff ()->add_state (*t);
+ tearoff_node->add_child_nocopy (*t);
+ }
+
+ window_node->add_child_nocopy (*tearoff_node);
+
+ Config->add_extra_xml (*window_node);
+
+ if (_startup && _startup->engine_control() && _startup->engine_control()->was_used()) {
+ Config->add_extra_xml (_startup->engine_control()->get_state());
+ }
+ Config->save_state();
+ if (ui_config->dirty()) {
+ ui_config->save_state ();
+ }
+
+ XMLNode& enode (static_cast<Stateful*>(editor)->get_state());
+ XMLNode& mnode (mixer->get_state());
+
+ if (_session) {
+ _session->add_instant_xml (enode);
+ _session->add_instant_xml (mnode);
+ if (location_ui->get ()) {
+ _session->add_instant_xml (location_ui->get()->ui().get_state ());
+ }
+ } else {
+ Config->add_instant_xml (enode);
+ Config->add_instant_xml (mnode);
+ if (location_ui->get ()) {
+ Config->add_instant_xml (location_ui->get()->ui().get_state ());