add_option() after addings its choices so that it gets
[ardour.git] / gtk2_ardour / editor.cc
index c6164a707f85b19256f5e1cf78cf2ae1e9076918..791357d51777f6e6a55b81343776de52b361b372 100644 (file)
@@ -58,7 +58,6 @@
 #include "gtkmm2ext/choice.h"
 #include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
 
-#include "ardour/audio_diskstream.h"
 #include "ardour/audio_track.h"
 #include "ardour/audioplaylist.h"
 #include "ardour/audioregion.h"
@@ -871,6 +870,7 @@ Editor::show_window ()
 
                if (current_mixer_strip) {
                        current_mixer_strip->hide_things ();
+                       current_mixer_strip->parameter_changed ("mixer-strip-visibility");
                }
        }
 
@@ -1137,6 +1137,44 @@ Editor::set_session (Session *t)
 
        compute_fixed_ruler_scale ();
 
+       /* Make sure we have auto loop and auto punch ranges */
+
+       Location* loc = _session->locations()->auto_loop_location();
+       if (loc == 0) {
+               loc = new Location (*_session, 0, _session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
+
+               if (loc->start() == loc->end()) {
+                       loc->set_end (loc->start() + 1);
+               }
+
+               _session->locations()->add (loc, false);
+               _session->set_auto_loop_location (loc);
+       } else {
+               // force name
+               loc->set_name (_("Loop"));
+       }
+
+       loc = _session->locations()->auto_punch_location();
+
+       if (loc == 0) {
+               loc = new Location (*_session, 0, _session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
+
+               if (loc->start() == loc->end()) {
+                       loc->set_end (loc->start() + 1);
+               }
+
+               _session->locations()->add (loc, false);
+               _session->set_auto_punch_location (loc);
+       } else {
+               // force name
+               loc->set_name (_("Punch"));
+       }
+
+       refresh_location_display ();
+
+       /* This must happen after refresh_location_display(), as (amongst other things) we restore
+          the selected Marker; this needs the LocationMarker list to be available.
+       */
        XMLNode* node = ARDOUR_UI::instance()->editor_settings();
        set_state (*node, Stateful::loading_state_version);
 
@@ -1182,43 +1220,10 @@ Editor::set_session (Session *t)
 
        playhead_cursor->canvas_item.show ();
 
-       Location* loc = _session->locations()->auto_loop_location();
-       if (loc == 0) {
-               loc = new Location (*_session, 0, _session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
-
-               if (loc->start() == loc->end()) {
-                       loc->set_end (loc->start() + 1);
-               }
-
-               _session->locations()->add (loc, false);
-               _session->set_auto_loop_location (loc);
-       } else {
-               // force name
-               loc->set_name (_("Loop"));
-       }
-
-       loc = _session->locations()->auto_punch_location();
-
-       if (loc == 0) {
-               loc = new Location (*_session, 0, _session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
-
-               if (loc->start() == loc->end()) {
-                       loc->set_end (loc->start() + 1);
-               }
-
-               _session->locations()->add (loc, false);
-               _session->set_auto_punch_location (loc);
-       } else {
-               // force name
-               loc->set_name (_("Punch"));
-       }
-
        boost::function<void (string)> pc (boost::bind (&Editor::parameter_changed, this, _1));
        Config->map_parameters (pc);
        _session->config.map_parameters (pc);
 
-       refresh_location_display ();
-
        restore_ruler_visibility ();
        //tempo_map_changed (PropertyChange (0));
        _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
@@ -1244,7 +1249,7 @@ Editor::set_session (Session *t)
        }
 
        /* register for undo history */
-       _session->register_with_memento_command_factory(_id, this);
+       _session->register_with_memento_command_factory(id(), this);
 
        ActionManager::ui_manager->signal_pre_activate().connect (sigc::mem_fun (*this, &Editor::action_pre_activated));
 
@@ -1883,7 +1888,7 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items)
        edit_items.push_back (MenuElem (_("Consolidate Range With Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), true, true)));
        edit_items.push_back (MenuElem (_("Bounce Range to Region List"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, false)));
        edit_items.push_back (MenuElem (_("Bounce Range to Region List With Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, true)));
-       edit_items.push_back (MenuElem (_("Export Range"), sigc::mem_fun(*this, &Editor::export_selection)));
+       edit_items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_selection)));
 }
 
 
@@ -2160,9 +2165,7 @@ Editor::set_state (const XMLNode& node, int /*version*/)
        int x, y;
        Gdk::Geometry g;
 
-       if ((prop = node.property ("id")) != 0) {
-               _id = prop->value ();
-       }
+       set_id (node);
 
        g.base_width = default_width;
        g.base_height = default_height;
@@ -2374,7 +2377,7 @@ Editor::get_state ()
        XMLNode* node = new XMLNode ("Editor");
        char buf[32];
 
-       _id.print (buf, sizeof (buf));
+       id().print (buf, sizeof (buf));
        node->add_property ("id", buf);
 
        if (is_realized()) {