Fix double-display of VST preset names (#3576)
[ardour.git] / gtk2_ardour / editor.cc
index 7d4532cee88357428f0b9f9e623956e43d30c220..84cd70ee67b38dc6d037ebe6f272bc5663cce6e0 100644 (file)
@@ -19,7 +19,6 @@
 
 /* Note: public Editor methods are documented in public_editor.h */
 
-#define __STDC_LIMIT_MACROS 1
 #include <stdint.h>
 #include <unistd.h>
 #include <cstdlib>
 #include "editor_snapshots.h"
 #include "editor_summary.h"
 #include "region_layering_order_editor.h"
+#include "mouse_cursors.h"
+#include "editor_cursors.h"
 
 #include "i18n.h"
 
@@ -137,8 +138,6 @@ using Gtkmm2ext::Keyboard;
 
 const double Editor::timebar_height = 15.0;
 
-#include "editor_xpms"
-
 static const gchar *_snap_type_strings[] = {
        N_("CD Frames"),
        N_("Timecode Frames"),
@@ -208,32 +207,6 @@ static const gchar *_rb_opt_strings[] = {
 };
 #endif
 
-/* Soundfile  drag-n-drop */
-
-Gdk::Cursor* Editor::cross_hair_cursor = 0;
-Gdk::Cursor* Editor::selector_cursor = 0;
-Gdk::Cursor* Editor::trimmer_cursor = 0;
-Gdk::Cursor* Editor::left_side_trim_cursor = 0;
-Gdk::Cursor* Editor::right_side_trim_cursor = 0;
-Gdk::Cursor* Editor::fade_in_cursor = 0;
-Gdk::Cursor* Editor::fade_out_cursor = 0;
-Gdk::Cursor* Editor::grabber_cursor = 0;
-Gdk::Cursor* Editor::grabber_note_cursor = 0;
-Gdk::Cursor* Editor::grabber_edit_point_cursor = 0;
-Gdk::Cursor* Editor::zoom_in_cursor = 0;
-Gdk::Cursor* Editor::zoom_out_cursor = 0;
-Gdk::Cursor* Editor::time_fx_cursor = 0;
-Gdk::Cursor* Editor::fader_cursor = 0;
-Gdk::Cursor* Editor::speaker_cursor = 0;
-Gdk::Cursor* Editor::midi_pencil_cursor = 0;
-Gdk::Cursor* Editor::midi_select_cursor = 0;
-Gdk::Cursor* Editor::midi_resize_cursor = 0;
-Gdk::Cursor* Editor::midi_erase_cursor = 0;
-Gdk::Cursor* Editor::wait_cursor = 0;
-Gdk::Cursor* Editor::timebar_cursor = 0;
-Gdk::Cursor* Editor::transparent_cursor = 0;
-Gdk::Cursor* Editor::up_down_cursor = 0;
-
 void
 show_me_the_size (Requisition* r, const char* what)
 {
@@ -244,20 +217,20 @@ show_me_the_size (Requisition* r, const char* what)
 static void
 pane_size_watcher (Paned* pane)
 {
-       /* if the handle of a pane vanishes into (at least) the tabs of a notebook,
-          it is no longer accessible. so stop that. this doesn't happen on X11,
-          just the quartz backend.
+       /* if the handle of a pane vanishes into (at least) the tabs of a notebook,
+          it is no longer accessible. so stop that. this doesn't happen on X11,
+          just the quartz backend.
 
-          ugh.
-       */
+          ugh.
+       */
 
-       int max_width_of_lhs = GTK_WIDGET(pane->gobj())->allocation.width - 25;
+       int max_width_of_lhs = GTK_WIDGET(pane->gobj())->allocation.width - 25;
 
-       gint pos = pane->get_position ();
+       gint pos = pane->get_position ();
 
-       if (pos > max_width_of_lhs) {
-               pane->set_position (max_width_of_lhs);
-       }
+       if (pos > max_width_of_lhs) {
+               pane->set_position (max_width_of_lhs);
+       }
 }
 #endif
 
@@ -389,7 +362,7 @@ Editor::Editor ()
        _dragging_edit_point = false;
        select_new_marker = false;
        rhythm_ferret = 0;
-        layering_order_editor = 0;
+       layering_order_editor = 0;
        _bundle_manager = 0;
        no_save_visual = false;
        resize_idle_id = -1;
@@ -506,7 +479,7 @@ Editor::Editor ()
        controls_layout.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::edit_controls_button_release));
        controls_layout_size_request_connection = controls_layout.signal_size_request().connect (sigc::mem_fun (*this, &Editor::controls_layout_size_request));
 
-       build_cursors ();
+       _cursors = new MouseCursors;
 
        ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
        ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(),
@@ -636,8 +609,8 @@ Editor::Editor ()
 
        edit_pane.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
 #ifdef GTKOSX
-        Glib::PropertyProxy<int> proxy = edit_pane.property_position();
-        proxy.signal_changed().connect (bind (sigc::ptr_fun (pane_size_watcher), static_cast<Paned*> (&edit_pane)));
+       Glib::PropertyProxy<int> proxy = edit_pane.property_position();
+       proxy.signal_changed().connect (bind (sigc::ptr_fun (pane_size_watcher), static_cast<Paned*> (&edit_pane)));
 #endif
        top_hbox.pack_start (toolbar_frame, false, true);
 
@@ -740,6 +713,7 @@ Editor::Editor ()
        _popup_region_menu_item = 0;
 
        _show_marker_lines = false;
+       _over_region_trim_target = false;
 
        constructed = true;
        instant_save ();
@@ -1111,12 +1085,11 @@ Editor::set_session (Session *t)
           but use Gtkmm2ext::UI::instance()->call_slot();
        */
 
-        _session->StepEditStatusChange.connect (_session_connections, invalidator (*this), ui_bind(&Editor::step_edit_status_change, this, _1), gui_context());
+       _session->StepEditStatusChange.connect (_session_connections, invalidator (*this), ui_bind(&Editor::step_edit_status_change, this, _1), gui_context());
        _session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&Editor::map_transport_state, this), gui_context());
        _session->PositionChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::map_position_change, this, _1), gui_context());
        _session->RouteAdded.connect (_session_connections, invalidator (*this), ui_bind (&Editor::handle_new_route, this, _1), gui_context());
        _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_title, this), gui_context());
-       _session->TimecodeOffsetChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_just_timecode, this), gui_context());
        _session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::tempo_map_changed, this, _1), gui_context());
        _session->Located.connect (_session_connections, invalidator (*this), boost::bind (&Editor::located, this), gui_context());
        _session->config.ParameterChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::parameter_changed, this, _1), gui_context());
@@ -1132,7 +1105,7 @@ Editor::set_session (Session *t)
                bbt.bars = 0;
                bbt.beats = 0;
                bbt.ticks = 120;
-               nframes_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1);
+               framepos_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1);
                nudge_clock.set_mode(AudioClock::BBT);
                nudge_clock.set (pos, true, 0, AudioClock::BBT);
 
@@ -1223,104 +1196,6 @@ Editor::action_pre_activated (Glib::RefPtr<Action> const & a)
        }
 }
 
-void
-Editor::build_cursors ()
-{
-       using namespace Gdk;
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> zoom_in_cursor_pixbuf (::get_icon ("zoom_in_cursor"));
-               zoom_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), zoom_in_cursor_pixbuf, 5, 5);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> zoom_out_cursor_pixbuf (::get_icon ("zoom_out_cursor"));
-               zoom_out_cursor = new Gdk::Cursor (Gdk::Display::get_default(), zoom_out_cursor_pixbuf, 5, 5);
-       }
-       
-       Gdk::Color fbg ("#ffffff" );
-       Gdk::Color ffg  ("#000000" );
-
-       {
-               RefPtr<Bitmap> source, mask;
-
-               source = Bitmap::create (fader_cursor_bits, fader_cursor_width, fader_cursor_height);
-               mask = Bitmap::create (fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
-               fader_cursor = new Gdk::Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
-       }
-
-       {
-               RefPtr<Bitmap> source, mask;
-               source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
-               mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
-               speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
-       }
-
-       {
-               RefPtr<Bitmap> bits;
-               char pix[4] = { 0, 0, 0, 0 };
-               bits = Bitmap::create (pix, 2, 2);
-               Gdk::Color c;
-               transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
-       }
-
-       {
-               RefPtr<Bitmap> bits;
-               char pix[4] = { 0, 0, 0, 0 };
-               bits = Bitmap::create (pix, 2, 2);
-               Gdk::Color c;
-               transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> grabber_pixbuf (::get_icon ("grabber"));
-               grabber_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_pixbuf, 5, 0);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> grabber_note_pixbuf (::get_icon ("grabber_note"));
-               grabber_note_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_note_pixbuf, 5, 10);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> grabber_edit_point_pixbuf (::get_icon ("grabber_edit_point"));
-               grabber_edit_point_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_edit_point_pixbuf, 5, 17);
-       }
-
-       cross_hair_cursor = new Gdk::Cursor (CROSSHAIR);
-       trimmer_cursor =  new Gdk::Cursor (SB_H_DOUBLE_ARROW);
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_left_cursor"));
-               left_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 11);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("trim_right_cursor"));
-               right_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_in_cursor"));
-               fade_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 0, 40);
-       }
-
-       {
-               Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_out_cursor"));
-               fade_out_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 27, 40);
-       }
-
-       selector_cursor = new Gdk::Cursor (XTERM);
-       time_fx_cursor = new Gdk::Cursor (SIZING);
-       wait_cursor = new Gdk::Cursor  (WATCH);
-       timebar_cursor = new Gdk::Cursor(LEFT_PTR);
-       midi_pencil_cursor = new Gdk::Cursor (PENCIL);
-       midi_select_cursor = new Gdk::Cursor (CENTER_PTR);
-       midi_resize_cursor = new Gdk::Cursor (SIZING);
-       midi_erase_cursor = new Gdk::Cursor (DRAPED_BOX);
-       up_down_cursor = new Gdk::Cursor (Gdk::SB_V_DOUBLE_ARROW);
-}
-
 /** Pop up a context menu for when the user clicks on a fade in or fade out */
 void
 Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType item_type)
@@ -1479,10 +1354,10 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
 }
 
 void
-Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, bool with_selection, framepos_t frame)
+Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, bool with_selection)
 {
        using namespace Menu_Helpers;
-       Menu* (Editor::*build_menu_function)(framepos_t);
+       Menu* (Editor::*build_menu_function)();
        Menu *menu;
 
        switch (item_type) {
@@ -1523,7 +1398,7 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type,
                return;
        }
 
-       menu = (this->*build_menu_function)(frame);
+       menu = (this->*build_menu_function)();
        menu->set_name ("ArdourContextMenu");
 
        /* now handle specific situations */
@@ -1532,8 +1407,8 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type,
        case RegionItem:
        case RegionViewName:
        case RegionViewNameHighlight:
-        case LeftFrameHandle:
-        case RightFrameHandle:
+       case LeftFrameHandle:
+       case RightFrameHandle:
                if (!with_selection) {
                        if (region_edit_menu_split_item) {
                                if (clicked_regionview && clicked_regionview->region()->covers (get_preferred_edit_position())) {
@@ -1606,7 +1481,7 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type,
 }
 
 Menu*
-Editor::build_track_context_menu (framepos_t)
+Editor::build_track_context_menu ()
 {
        using namespace Menu_Helpers;
 
@@ -1618,7 +1493,7 @@ Editor::build_track_context_menu (framepos_t)
 }
 
 Menu*
-Editor::build_track_bus_context_menu (framepos_t)
+Editor::build_track_bus_context_menu ()
 {
        using namespace Menu_Helpers;
 
@@ -1630,7 +1505,7 @@ Editor::build_track_bus_context_menu (framepos_t)
 }
 
 Menu*
-Editor::build_track_region_context_menu (framepos_t frame)
+Editor::build_track_region_context_menu ()
 {
        using namespace Menu_Helpers;
        MenuList& edit_items  = track_region_context_menu.items();
@@ -1652,9 +1527,9 @@ Editor::build_track_region_context_menu (framepos_t frame)
                   mode and so offering region context is somewhat confusing.
                */
                if ((tr = rtv->track()) && ((pl = tr->playlist())) && !internal_editing()) {
-                        framepos_t framepos = (framepos_t) floor ((double)frame * tr->speed());
-                        uint32_t regions_at = pl->count_regions_at (framepos);
-                        add_region_context_items (edit_items, regions_at > 1);
+                       framepos_t const framepos = (framepos_t) floor ((double) get_preferred_edit_position() * tr->speed());
+                       uint32_t regions_at = pl->count_regions_at (framepos);
+                       add_region_context_items (edit_items, regions_at > 1);
                }
        }
 
@@ -1664,7 +1539,7 @@ Editor::build_track_region_context_menu (framepos_t frame)
 }
 
 Menu*
-Editor::build_track_crossfade_context_menu (framepos_t frame)
+Editor::build_track_crossfade_context_menu ()
 {
        using namespace Menu_Helpers;
        MenuList& edit_items  = track_crossfade_context_menu.items();
@@ -1681,7 +1556,7 @@ Editor::build_track_crossfade_context_menu (framepos_t frame)
 
                        AudioPlaylist::Crossfades xfades;
 
-                       apl->crossfades_at (frame, xfades);
+                       apl->crossfades_at (get_preferred_edit_position (), xfades);
 
                        bool many = xfades.size() > 1;
 
@@ -1689,9 +1564,9 @@ Editor::build_track_crossfade_context_menu (framepos_t frame)
                                add_crossfade_context_items (atv->audio_view(), (*i), edit_items, many);
                        }
 
-                       framepos_t framepos = (framepos_t) floor ((double)frame * tr->speed());
+                       framepos_t framepos = (framepos_t) floor ((double) get_preferred_edit_position() * tr->speed());
                        uint32_t regions_at = pl->count_regions_at (framepos);
-                        add_region_context_items (edit_items, regions_at > 1);
+                       add_region_context_items (edit_items, regions_at > 1);
                }
        }
 
@@ -1737,7 +1612,7 @@ Editor::analyze_range_selection()
 }
 
 Menu*
-Editor::build_track_selection_context_menu (framepos_t)
+Editor::build_track_selection_context_menu ()
 {
        using namespace Menu_Helpers;
        MenuList& edit_items  = track_selection_context_menu.items();
@@ -1843,7 +1718,7 @@ Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, bool multi
 
        edit_items.push_back (*_popup_region_menu_item);
        if (multiple_regions_at_position && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
-               edit_items.push_back (action_menu_item ("choose-top-region"));
+               edit_items.push_back (*manage (_region_actions->get_action ("choose-top-region")->create_menu_item ()));
        }
        edit_items.push_back (SeparatorElem());
 }
@@ -1869,7 +1744,7 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items)
        }
 
        edit_items.push_back (SeparatorElem());
-       edit_items.push_back (MenuElem (_("Convert to region in-place"), mem_fun(*this, &Editor::separate_region_from_selection)));
+       edit_items.push_back (MenuElem (_("Convert to Region In-Place"), mem_fun(*this, &Editor::separate_region_from_selection)));
        edit_items.push_back (MenuElem (_("Convert to Region in Region List"), sigc::mem_fun(*this, &Editor::new_region_from_selection)));
 
        edit_items.push_back (SeparatorElem());
@@ -2230,7 +2105,7 @@ Editor::set_state (const XMLNode& node, int /*version*/)
 
        if (_session && (prop = node.property ("playhead"))) {
                framepos_t pos;
-                sscanf (prop->value().c_str(), "%" PRIi64, &pos);
+               sscanf (prop->value().c_str(), "%" PRIi64, &pos);
                playhead_cursor->set_position (pos);
        } else {
                playhead_cursor->set_position (0);
@@ -2318,17 +2193,17 @@ Editor::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
-        if ((prop = node.property ("stationary-playhead"))) {
-                bool yn = (prop->value() == "yes");
-                set_stationary_playhead (yn);
-                RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
-                if (act) {
-                        RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
-                        if (tact->get_active() != yn) {
-                                tact->set_active (yn);
-                        }
-                }
-        }
+       if ((prop = node.property ("stationary-playhead"))) {
+               bool yn = (prop->value() == "yes");
+               set_stationary_playhead (yn);
+               RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
+               if (act) {
+                       RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+                       if (tact->get_active() != yn) {
+                               tact->set_active (yn);
+                       }
+               }
+       }
         
        if ((prop = node.property ("region-list-sort-type"))) {
                RegionListSortType st;
@@ -2453,7 +2328,7 @@ Editor::get_state ()
 
        node->add_property ("show-measures", _show_measures ? "yes" : "no");
        node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
-        node->add_property ("stationary-playhead", _stationary_playhead ? "yes" : "no");
+       node->add_property ("stationary-playhead", _stationary_playhead ? "yes" : "no");
        node->add_property ("xfades-visible", _xfade_visibility ? "yes" : "no");
        node->add_property ("region-list-sort-type", enum_2_string (_regions->sort_type ()));
        node->add_property ("mouse-mode", enum2str(mouse_mode));
@@ -2553,11 +2428,10 @@ Editor::timecode_snap_to_internal (framepos_t& start, int32_t direction, bool /*
                break;
 
        case SnapToTimecodeSeconds:
-               if (_session->timecode_offset_negative())
-               {
-                       start += _session->timecode_offset ();
+               if (_session->config.get_timecode_offset_negative()) {
+                       start += _session->config.get_timecode_offset ();
                } else {
-                       start -= _session->timecode_offset ();
+                       start -= _session->config.get_timecode_offset ();
                }
                if (((direction == 0) && (start % one_timecode_second > one_timecode_second / 2)) || direction > 0) {
                        start = (framepos_t) ceil ((double) start / one_timecode_second) * one_timecode_second;
@@ -2565,31 +2439,28 @@ Editor::timecode_snap_to_internal (framepos_t& start, int32_t direction, bool /*
                        start = (framepos_t) floor ((double) start / one_timecode_second) * one_timecode_second;
                }
 
-               if (_session->timecode_offset_negative())
-               {
-                       start -= _session->timecode_offset ();
+               if (_session->config.get_timecode_offset_negative()) {
+                       start -= _session->config.get_timecode_offset ();
                } else {
-                       start += _session->timecode_offset ();
+                       start += _session->config.get_timecode_offset ();
                }
                break;
 
        case SnapToTimecodeMinutes:
-               if (_session->timecode_offset_negative())
-               {
-                       start += _session->timecode_offset ();
+               if (_session->config.get_timecode_offset_negative()) {
+                       start += _session->config.get_timecode_offset ();
                } else {
-                       start -= _session->timecode_offset ();
+                       start -= _session->config.get_timecode_offset ();
                }
                if (((direction == 0) && (start % one_timecode_minute > one_timecode_minute / 2)) || direction > 0) {
                        start = (framepos_t) ceil ((double) start / one_timecode_minute) * one_timecode_minute;
                } else {
                        start = (framepos_t) floor ((double) start / one_timecode_minute) * one_timecode_minute;
                }
-               if (_session->timecode_offset_negative())
-               {
-                       start -= _session->timecode_offset ();
+               if (_session->config.get_timecode_offset_negative()) {
+                       start -= _session->config.get_timecode_offset ();
                } else {
-                       start += _session->timecode_offset ();
+                       start += _session->config.get_timecode_offset ();
                }
                break;
        default:
@@ -2835,13 +2706,13 @@ Editor::setup_toolbar ()
        }
 
        _mouse_mode_tearoff->Detach.connect (sigc::bind (sigc::mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
-                                                         &_mouse_mode_tearoff->tearoff_window()));
+                                                        &_mouse_mode_tearoff->tearoff_window()));
        _mouse_mode_tearoff->Attach.connect (sigc::bind (sigc::mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
-                                                         &_mouse_mode_tearoff->tearoff_window(), 1));
+                                                        &_mouse_mode_tearoff->tearoff_window(), 1));
        _mouse_mode_tearoff->Hidden.connect (sigc::bind (sigc::mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
-                                                         &_mouse_mode_tearoff->tearoff_window()));
+                                                        &_mouse_mode_tearoff->tearoff_window()));
        _mouse_mode_tearoff->Visible.connect (sigc::bind (sigc::mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
-                                                          &_mouse_mode_tearoff->tearoff_window(), 1));
+                                                         &_mouse_mode_tearoff->tearoff_window(), 1));
 
        mouse_move_button.set_mode (false);
        mouse_select_button.set_mode (false);
@@ -2968,13 +2839,13 @@ Editor::setup_toolbar ()
        }
 
        _tools_tearoff->Detach.connect (sigc::bind (sigc::mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
-                                                    &_tools_tearoff->tearoff_window()));
+                                                   &_tools_tearoff->tearoff_window()));
        _tools_tearoff->Attach.connect (sigc::bind (sigc::mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
-                                                    &_tools_tearoff->tearoff_window(), 0));
+                                                   &_tools_tearoff->tearoff_window(), 0));
        _tools_tearoff->Hidden.connect (sigc::bind (sigc::mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
-                                                    &_tools_tearoff->tearoff_window()));
+                                                   &_tools_tearoff->tearoff_window()));
        _tools_tearoff->Visible.connect (sigc::bind (sigc::mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
-                                                     &_tools_tearoff->tearoff_window(), 0));
+                                                    &_tools_tearoff->tearoff_window(), 0));
 
        toolbar_hbox.set_spacing (10);
        toolbar_hbox.set_border_width (1);
@@ -3374,8 +3245,8 @@ Editor::show_verbose_canvas_cursor_with (const string & txt, int32_t xoffset, in
        track_canvas->get_pointer (x, y);
        track_canvas->window_to_world (x, y, wx, wy);
 
-        wx += xoffset;
-        wy += yoffset;
+       wx += xoffset;
+       wy += yoffset;
 
        /* don't get too close to the edge */
        verbose_canvas_cursor->property_x() = clamp_verbose_cursor_x (wx);
@@ -3772,24 +3643,24 @@ Editor::set_follow_playhead (bool yn)
 void
 Editor::toggle_stationary_playhead ()
 {
-       RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
-       if (act) {
-               RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
-               set_stationary_playhead (tact->get_active());
-       }
+       RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
+       if (act) {
+               RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+               set_stationary_playhead (tact->get_active());
+       }
 }
 
 void
 Editor::set_stationary_playhead (bool yn)
 {
-       if (_stationary_playhead != yn) {
-               if ((_stationary_playhead = yn) == true) {
-                       /* catch up */
-                       // FIXME need a 3.0 equivalent of this 2.X call
-                       // update_current_screen ();
-               }
-               instant_save ();
-       }
+       if (_stationary_playhead != yn) {
+               if ((_stationary_playhead = yn) == true) {
+                       /* catch up */
+                       // FIXME need a 3.0 equivalent of this 2.X call
+                       // update_current_screen ();
+               }
+               instant_save ();
+       }
 }
 
 void
@@ -4093,6 +3964,7 @@ Editor::maximise_editing_space ()
                _tools_tearoff->set_visible (true);
                _zoom_tearoff->set_visible (true);
        }
+
 }
 
 void
@@ -4377,6 +4249,8 @@ Editor::post_zoom ()
        refresh_location_display();
        _summary->set_overlays_dirty ();
 
+       update_marker_labels ();
+
        instant_save ();
 }
 
@@ -4648,7 +4522,7 @@ Editor::get_regions_after (RegionSelection& rs, framepos_t where, const TrackVie
                        if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
 
                                Playlist::RegionList* regions = pl->regions_touched (
-                                        (framepos_t) floor ( (double)where * tr->speed()), max_framepos);
+                                       (framepos_t) floor ( (double)where * tr->speed()), max_framepos);
 
                                for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
 
@@ -4863,7 +4737,7 @@ Editor::idle_resize ()
                }
        }
 
-        _pending_resize_amount = 0;
+       _pending_resize_amount = 0;
        flush_canvas ();
        _group_tabs->set_dirty ();
        resize_idle_id = -1;
@@ -5144,11 +5018,11 @@ Editor::show_region_in_region_list ()
 void
 Editor::step_edit_status_change (bool yn)
 {
-        if (yn) {
-                start_step_editing ();
-        } else {
-                stop_step_editing ();
-        }
+       if (yn) {
+               start_step_editing ();
+       } else {
+               stop_step_editing ();
+       }
 }
 
 void
@@ -5329,33 +5203,33 @@ Editor::super_rapid_screen_update ()
                        playhead_cursor->set_position (frame);
                }
 
-                if (!_stationary_playhead) {
+               if (!_stationary_playhead) {
 
-                        if (!_dragging_playhead && _follow_playhead && _session->requested_return_frame() < 0) {
-                                reset_x_origin_to_follow_playhead ();
-                        }
+                       if (!_dragging_playhead && _follow_playhead && _session->requested_return_frame() < 0) {
+                               reset_x_origin_to_follow_playhead ();
+                       }
 
-                } else {
+               } else {
                        
-                        /* don't do continuous scroll till the new position is in the rightmost quarter of the
-                           editor canvas
-                        */
+                       /* don't do continuous scroll till the new position is in the rightmost quarter of the
+                          editor canvas
+                       */
 #if 0                        
-                        // FIXME DO SOMETHING THAT WORKS HERE - this is 2.X code                         
-                        double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit;
-                        if (target <= 0.0) {
-                                target = 0.0;
-                        }
-                        if (fabs(target - current) < current_page_frames() / frames_per_unit) {
-                                target = (target * 0.15) + (current * 0.85);
-                        } else {
-                                /* relax */
-                        }
+                       // FIXME DO SOMETHING THAT WORKS HERE - this is 2.X code                         
+                       double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit;
+                       if (target <= 0.0) {
+                               target = 0.0;
+                       }
+                       if (fabs(target - current) < current_page_frames() / frames_per_unit) {
+                               target = (target * 0.15) + (current * 0.85);
+                       } else {
+                               /* relax */
+                       }
                         
-                        current = target;
-                        set_horizontal_position (current);
+                       current = target;
+                       set_horizontal_position (current);
 #endif
-                }
+               }
                
        }
 }
@@ -5449,31 +5323,31 @@ Editor::change_region_layering_order ()
 {
        framepos_t const position = get_preferred_edit_position ();
        
-        if (!clicked_routeview) {
-                if (layering_order_editor) {
-                        layering_order_editor->hide ();
-                }
+       if (!clicked_routeview) {
+               if (layering_order_editor) {
+                       layering_order_editor->hide ();
+               }
                return;
        }
 
-        boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (clicked_routeview->route());
+       boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (clicked_routeview->route());
 
-        if (!track) {
-                return;
-        }
+       if (!track) {
+               return;
+       }
 
        boost::shared_ptr<Playlist> pl = track->playlist();
 
        if (!pl) {
-                return;
-        }
+               return;
+       }
                 
-        if (layering_order_editor == 0) {
-                layering_order_editor = new RegionLayeringOrderEditor(*this);
-        }
+       if (layering_order_editor == 0) {
+               layering_order_editor = new RegionLayeringOrderEditor(*this);
+       }
 
-        layering_order_editor->set_context (clicked_routeview->name(), _session, pl, position);
-        layering_order_editor->maybe_present ();
+       layering_order_editor->set_context (clicked_routeview->name(), _session, pl, position);
+       layering_order_editor->maybe_present ();
 }
 
 void
@@ -5505,6 +5379,9 @@ Editor::setup_fade_images ()
 Gtk::MenuItem&
 Editor::action_menu_item (std::string const & name)
 {
-       return *manage (editor_actions->get_action(name)->create_menu_item ());
+       Glib::RefPtr<Action> a = editor_actions->get_action (name);
+       assert (a);
+       
+       return *manage (a->create_menu_item ());
 }