X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Feditor.cc;h=cfa8770ba393479c5c0b8babef2e98cd1729ee57;hb=4336bb25d739cd007811ccd0298a15acc5e20787;hp=b50acd52533bac680d02c82cd699c866b9b74b1d;hpb=b5ab2e030b3c8de6c7f41c8d533de2462437ce7c;p=ardour.git diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index b50acd5253..cfa8770ba3 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -19,7 +19,6 @@ /* Note: public Editor methods are documented in public_editor.h */ -#define __STDC_LIMIT_MACROS 1 #include #include #include @@ -116,6 +115,8 @@ #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 (&edit_pane))); #ifdef GTKOSX - Glib::PropertyProxy proxy = edit_pane.property_position(); - proxy.signal_changed().connect (bind (sigc::ptr_fun (pane_size_watcher), static_cast (&edit_pane))); + Glib::PropertyProxy proxy = edit_pane.property_position(); + proxy.signal_changed().connect (bind (sigc::ptr_fun (pane_size_watcher), static_cast (&edit_pane))); #endif top_hbox.pack_start (toolbar_frame, false, true); @@ -736,8 +709,12 @@ Editor::Editor () TimeAxisView::CatchDeletion.connect (*this, invalidator (*this), ui_bind (&Editor::timeaxisview_deleted, this, _1), gui_context()); _ignore_region_action = false; + _last_region_menu_was_main = false; _popup_region_menu_item = 0; + _show_marker_lines = false; + _over_region_trim_target = false; + constructed = true; instant_save (); @@ -810,7 +787,7 @@ Editor::set_entered_regionview (RegionView* rv) entered_regionview->entered (internal_editing ()); } - if (!_all_region_actions_sensitized) { + if (!_all_region_actions_sensitized && _last_region_menu_was_main) { /* This RegionView entry might have changed what region actions are allowed, so sensitize them all in case a key is pressed. */ @@ -1108,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()); @@ -1125,11 +1101,11 @@ Editor::set_session (Session *t) _session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context()); if (Profile->get_sae()) { - BBT_Time bbt; + Timecode::BBT_Time bbt; 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); @@ -1207,111 +1183,19 @@ void Editor::action_pre_activated (Glib::RefPtr const & a) { if (a->get_name() == "RegionMenu") { - /* When the region menu is opened, we setup the actions so that they look right - in the menu. + /* When the main menu's region menu is opened, we setup the actions so that they look right + in the menu. I can't find a way of getting a signal when this menu is subsequently closed, + so we resensitize all region actions when the entered regionview or the region selection + changes. HOWEVER we can't always resensitize on entered_regionview change because that + happens after the region context menu is opened. So we set a flag here, too. + + What a carry on :( */ sensitize_the_right_region_actions (); + _last_region_menu_was_main = true; } } -void -Editor::build_cursors () -{ - using namespace Gdk; - - { - Glib::RefPtr 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 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 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 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 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 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 grabber_pixbuf (::get_icon ("grabber")); - grabber_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_pixbuf, 5, 0); - } - - { - Glib::RefPtr grabber_note_pixbuf (::get_icon ("grabber_note")); - grabber_note_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_note_pixbuf, 5, 10); - } - - { - Glib::RefPtr 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 apixbuf (::get_icon ("trim_left_cursor")); - left_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 5, 11); - } - - { - Glib::RefPtr apixbuf (::get_icon ("trim_right_cursor")); - right_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11); - } - - { - Glib::RefPtr apixbuf (::get_icon ("fade_in_cursor")); - fade_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 0, 40); - } - - { - Glib::RefPtr 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) @@ -1470,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) { @@ -1514,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 */ @@ -1523,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())) { @@ -1586,11 +1470,18 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, clicked_routeview->build_underlay_menu(menu); } + /* When the region menu is opened, we setup the actions so that they look right + in the menu. + */ + sensitize_the_right_region_actions (); + _last_region_menu_was_main = false; + + menu->signal_hide().connect (sigc::bind (sigc::mem_fun (*this, &Editor::sensitize_all_region_actions), true)); menu->popup (button, time); } Menu* -Editor::build_track_context_menu (framepos_t) +Editor::build_track_context_menu () { using namespace Menu_Helpers; @@ -1602,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; @@ -1614,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(); @@ -1636,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); } } @@ -1648,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(); @@ -1665,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; @@ -1673,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); } } @@ -1721,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(); @@ -1827,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()); } @@ -1853,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()); @@ -2214,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); @@ -2302,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 act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead")); - if (act) { - RefPtr tact = RefPtr::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 act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead")); + if (act) { + RefPtr tact = RefPtr::cast_dynamic(act); + if (tact->get_active() != yn) { + tact->set_active (yn); + } + } + } if ((prop = node.property ("region-list-sort-type"))) { RegionListSortType st; @@ -2328,38 +2219,45 @@ Editor::set_state (const XMLNode& node, int /*version*/) if ((prop = node.property ("show-editor-mixer"))) { Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer")); - if (act) { - - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - bool yn = string_is_affirmative (prop->value()); + assert (act); - /* do it twice to force the change */ - - tact->set_active (!yn); - tact->set_active (yn); - } + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + bool yn = string_is_affirmative (prop->value()); + + /* do it twice to force the change */ + + tact->set_active (!yn); + tact->set_active (yn); } if ((prop = node.property ("show-editor-list"))) { Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("show-editor-list")); - assert(act); - if (act) { - - Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); - bool yn = string_is_affirmative (prop->value()); + assert (act); - /* do it twice to force the change */ - - tact->set_active (!yn); - tact->set_active (yn); - } + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic(act); + bool yn = string_is_affirmative (prop->value()); + + /* do it twice to force the change */ + + tact->set_active (!yn); + tact->set_active (yn); } if ((prop = node.property (X_("editor-list-page")))) { the_notebook.set_current_page (atoi (prop->value ())); } + if ((prop = node.property (X_("show-marker-lines")))) { + Glib::RefPtr act = ActionManager::get_action (X_("Editor"), X_("show-marker-lines")); + assert (act); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + bool yn = string_is_affirmative (prop->value ()); + + tact->set_active (!yn); + tact->set_active (yn); + } + XMLNodeList children = node.children (); for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { selection->set_state (**i, Stateful::current_state_version); @@ -2430,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)); @@ -2452,6 +2350,8 @@ Editor::get_state () snprintf (buf, sizeof (buf), "%d", the_notebook.get_current_page ()); node->add_property (X_("editor-list-page"), buf); + node->add_property (X_("show-marker-lines"), _show_marker_lines ? "yes" : "no"); + node->add_child_nocopy (selection->get_state ()); node->add_child_nocopy (_regions->get_state ()); @@ -2528,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; @@ -2540,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: @@ -2810,13 +2706,13 @@ Editor::setup_toolbar () } _mouse_mode_tearoff->Detach.connect (sigc::bind (sigc::mem_fun(*this, &Editor::detach_tearoff), static_cast(&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 (&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(&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 (&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); @@ -2943,13 +2839,13 @@ Editor::setup_toolbar () } _tools_tearoff->Detach.connect (sigc::bind (sigc::mem_fun(*this, &Editor::detach_tearoff), static_cast(&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 (&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(&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 (&toolbar_hbox), - &_tools_tearoff->tearoff_window(), 0)); + &_tools_tearoff->tearoff_window(), 0)); toolbar_hbox.set_spacing (10); toolbar_hbox.set_border_width (1); @@ -3349,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); @@ -3747,24 +3643,24 @@ Editor::set_follow_playhead (bool yn) void Editor::toggle_stationary_playhead () { - RefPtr act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead")); - if (act) { - RefPtr tact = RefPtr::cast_dynamic(act); - set_stationary_playhead (tact->get_active()); - } + RefPtr act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead")); + if (act) { + RefPtr tact = RefPtr::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 @@ -4068,6 +3964,7 @@ Editor::maximise_editing_space () _tools_tearoff->set_visible (true); _zoom_tearoff->set_visible (true); } + } void @@ -4352,6 +4249,8 @@ Editor::post_zoom () refresh_location_display(); _summary->set_overlays_dirty (); + update_marker_labels (); + instant_save (); } @@ -4623,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) { @@ -4838,7 +4737,7 @@ Editor::idle_resize () } } - _pending_resize_amount = 0; + _pending_resize_amount = 0; flush_canvas (); _group_tabs->set_dirty (); resize_idle_id = -1; @@ -5119,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 @@ -5304,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 - } + } } } @@ -5424,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 = boost::dynamic_pointer_cast (clicked_routeview->route()); + boost::shared_ptr track = boost::dynamic_pointer_cast (clicked_routeview->route()); - if (!track) { - return; - } + if (!track) { + return; + } boost::shared_ptr 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 @@ -5480,5 +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 a = editor_actions->get_action (name); + assert (a); + + return *manage (a->create_menu_item ()); } +