From 9c984fc2adb98eb069e0a413fb40c2bd384d3b6e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 12 Aug 2023 01:03:48 +0200 Subject: [PATCH] Add dedicated Section Ruler and UI for section boundary markers --- gtk2_ardour/ardour.menus.in | 1 + gtk2_ardour/editor.cc | 11 ++ gtk2_ardour/editor.h | 13 +- gtk2_ardour/editor_actions.cc | 1 + gtk2_ardour/editor_canvas.cc | 12 +- gtk2_ardour/editor_items.h | 1 + gtk2_ardour/editor_markers.cc | 150 ++++++++---------- gtk2_ardour/editor_mouse.cc | 9 ++ gtk2_ardour/editor_rulers.cc | 44 ++++- gtk2_ardour/enums.cc | 1 + gtk2_ardour/ruler_dialog.cc | 2 + gtk2_ardour/ruler_dialog.h | 1 + .../themes/blueberry_milk-ardour.colors | 2 + gtk2_ardour/themes/caineville-ardour.colors | 2 + gtk2_ardour/themes/clear_gray-ardour.colors | 2 + gtk2_ardour/themes/cubasish-ardour.colors | 2 + gtk2_ardour/themes/dark-ardour.colors | 2 + gtk2_ardour/themes/diehard3-ardour.colors | 2 + gtk2_ardour/themes/recbox-ardour.colors | 2 + gtk2_ardour/themes/unastudia-ardour.colors | 2 + gtk2_ardour/themes/xcolors-ardour.colors | 2 + 21 files changed, 171 insertions(+), 93 deletions(-) diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 0a82463aba..459557a028 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -541,6 +541,7 @@ + diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index ab6391e24f..0de5683c41 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -288,6 +288,7 @@ Editor::Editor () , range_marker_group (0) , transport_marker_group (0) , cd_marker_group (0) + , section_marker_group (0) , _time_markers_group (0) , _selection_marker_group (0) , _selection_marker (new LocationMarkers) @@ -318,11 +319,13 @@ Editor::Editor () , visible_timebars (0) , editor_ruler_menu (0) , tempo_bar (0) + , mapping_bar (0) , meter_bar (0) , marker_bar (0) , range_marker_bar (0) , transport_marker_bar (0) , cd_marker_bar (0) + , section_marker_bar (0) , cue_marker_bar (0) , ruler_separator (0) , minsec_label (_("Mins:Secs")) @@ -335,6 +338,7 @@ Editor::Editor () , range_mark_label (_("Range Markers")) , transport_mark_label (_("Loop/Punch Ranges")) , cd_mark_label (_("CD Markers")) + , section_mark_label (_("Sections")) , cue_mark_label (_("Cue Markers")) , videotl_label (_("Video Timeline")) , videotl_group (0) @@ -558,6 +562,13 @@ Editor::Editor () cd_mark_label.hide(); cd_mark_label.set_no_show_all(); + section_mark_label.set_name ("EditorRulerLabel"); + section_mark_label.set_size_request (-1, (int)timebar_height); + section_mark_label.set_alignment (1.0, 0.5); + section_mark_label.set_padding (5,0); + section_mark_label.hide(); + section_mark_label.set_no_show_all(); + cue_mark_label.set_name ("EditorRulerLabel"); cue_mark_label.set_size_request (-1, (int)timebar_height); cue_mark_label.set_alignment (1.0, 0.5); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 8d45390dba..2a26e47fdc 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -759,6 +759,8 @@ private: void set_color (std::string const&); }; + static void reparent_location_markers (LocationMarkers*, ArdourCanvas::Item*); + LocationMarkers* find_location_markers (ARDOUR::Location*) const; ARDOUR::Location* find_location_from_marker (ArdourMarker*, bool& is_start) const; ArdourMarker* find_marker_from_location_id (PBD::ID const&, bool) const; @@ -789,10 +791,8 @@ private: void mouse_add_new_loop (Temporal::timepos_t); void mouse_add_new_punch (Temporal::timepos_t); bool choose_new_marker_name(std::string &name, bool is_range=false); - void update_cd_marker_display (); - void ensure_cd_marker_updated (LocationMarkers* lam, ARDOUR::Location* location); - void update_cue_marker_display (); - void ensure_cue_marker_updated (LocationMarkers* lam, ARDOUR::Location* location); + void update_marker_display (); + void ensure_marker_updated (LocationMarkers* lam, ARDOUR::Location* location); void update_all_marker_lanes (); TimeAxisView* clicked_axisview; @@ -926,6 +926,7 @@ private: ArdourCanvas::Container* range_marker_group; ArdourCanvas::Container* transport_marker_group; ArdourCanvas::Container* cd_marker_group; + ArdourCanvas::Container* section_marker_group; ArdourCanvas::Container* cue_marker_group; /* parent for groups which themselves contain time markers */ @@ -974,6 +975,7 @@ private: Glib::RefPtr ruler_range_action; Glib::RefPtr ruler_loop_punch_action; Glib::RefPtr ruler_cd_marker_action; + Glib::RefPtr ruler_section_action; Glib::RefPtr ruler_marker_action; Glib::RefPtr ruler_cue_marker_action; bool no_ruler_shown_update; @@ -1066,6 +1068,7 @@ private: ArdourCanvas::Rectangle* range_marker_bar; ArdourCanvas::Rectangle* transport_marker_bar; ArdourCanvas::Rectangle* cd_marker_bar; + ArdourCanvas::Rectangle* section_marker_bar; ArdourCanvas::Rectangle* cue_marker_bar; ArdourCanvas::Line* ruler_separator; @@ -1081,6 +1084,7 @@ private: Gtk::Label range_mark_label; Gtk::Label transport_mark_label; Gtk::Label cd_mark_label; + Gtk::Label section_mark_label; Gtk::Label cue_mark_label; /* videtimline related actions */ @@ -1856,6 +1860,7 @@ private: void toggle_tempo_type (); void ramp_to_next_tempo (); void toggle_marker_menu_lock (); + void toggle_marker_section (); void marker_menu_hide (); void marker_menu_set_origin (); void marker_menu_loop_range (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 7319b80091..47022ceb7b 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -728,6 +728,7 @@ Editor::register_actions () ruler_range_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-range-ruler"), _("Range Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility))); ruler_loop_punch_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-loop-punch-ruler"), _("Loop/Punch Ranges"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility))); ruler_cd_marker_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-cd-marker-ruler"), _("CD Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility))); + ruler_section_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-section-ruler"), _("Section Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility))); ruler_marker_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-marker-ruler"), _("Location Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility))); ruler_cue_marker_action = Glib::RefPtr::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-cue-marker-ruler"), _("Cue Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility))); diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index fb755f8932..68dd77bc8f 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -157,7 +157,7 @@ Editor::initialize_canvas () cd_marker_group = new ArdourCanvas::Container (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0)); CANVAS_DEBUG_NAME (cd_marker_group, "cd marker group"); - /* the vide is temporarily placed a the same location as the + /* the video ruler is temporarily placed a the same location as the cd_marker_group, but is moved later. */ videotl_group = new ArdourCanvas::Container (_time_markers_group, ArdourCanvas::Duple(0.0, 0.0)); @@ -170,6 +170,8 @@ Editor::initialize_canvas () CANVAS_DEBUG_NAME (range_marker_group, "range marker group"); tempo_meta_group = new ArdourCanvas::Container (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 4.0) + 1.0)); CANVAS_DEBUG_NAME (tempo_meta_group, "tempo meta group"); + section_marker_group = new ArdourCanvas::Container (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 5.0) + 1.0)); + CANVAS_DEBUG_NAME (tempo_meta_group, "Section marker group"); tempo_group = new ArdourCanvas::Container (tempo_meta_group, ArdourCanvas::Duple (0.0, 0.0)); CANVAS_DEBUG_NAME (tempo_group, "tempo group"); mapping_group = new ArdourCanvas::Container (tempo_meta_group, ArdourCanvas::Duple (0.0, 0.0)); @@ -218,6 +220,9 @@ Editor::initialize_canvas () cd_marker_bar = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, timebar_top, ArdourCanvas::COORD_MAX, timebar_btm)); CANVAS_DEBUG_NAME (cd_marker_bar, "CD Marker Bar"); + section_marker_bar = new ArdourCanvas::Rectangle (section_marker_group, ArdourCanvas::Rect (0.0, timebar_top, ArdourCanvas::COORD_MAX, timebar_btm)); + CANVAS_DEBUG_NAME (section_marker_bar, "Section Marker Bar"); + cue_marker_group = new ArdourCanvas::Container (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0)); cue_marker_bar = new ArdourCanvas::Rectangle (cue_marker_group, ArdourCanvas::Rect (0.0, timebar_top, ArdourCanvas::COORD_MAX, timebar_btm)); CANVAS_DEBUG_NAME (cue_marker_bar, "Cue Marker Bar"); @@ -270,6 +275,7 @@ Editor::initialize_canvas () meter_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), meter_bar, MeterBarItem, "meter bar")); marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), marker_bar, MarkerBarItem, "marker bar")); cd_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), cd_marker_bar, CdMarkerBarItem, "cd marker bar")); + section_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), section_marker_bar, SectionMarkerBarItem, "section marker bar")); cue_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), cue_marker_bar, CueMarkerBarItem, "cd marker bar")); videotl_group->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_group)); range_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), range_marker_bar, RangeMarkerBarItem, "range marker bar")); @@ -1083,6 +1089,9 @@ Editor::color_handler() cd_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("cd marker bar", "marker bar")); cd_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); + section_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("section marker bar", "marker bar")); + section_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); + cue_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("cd marker bar", "marker bar")); cue_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator")); @@ -1493,6 +1502,7 @@ Editor::which_canvas_cursor(ItemType type) const case MarkerBarItem: case RangeMarkerBarItem: case CdMarkerBarItem: + case SectionMarkerBarItem: case CueMarkerBarItem: case VideoBarItem: case TransportMarkerBarItem: diff --git a/gtk2_ardour/editor_items.h b/gtk2_ardour/editor_items.h index d8925741e8..3f1a456ba4 100644 --- a/gtk2_ardour/editor_items.h +++ b/gtk2_ardour/editor_items.h @@ -30,6 +30,7 @@ enum ItemType { MarkerBarItem, RangeMarkerBarItem, CdMarkerBarItem, + SectionMarkerBarItem, CueMarkerBarItem, VideoBarItem, TransportMarkerBarItem, diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index bb7c07c0db..c4b0c462d6 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -107,6 +107,8 @@ Editor::add_new_location_internal (Location* location) if (location->is_cd_marker()) { color = X_("location cd marker"); + } else if (location->is_section()) { + color = X_("location section marker"); } else if (location->is_mark()) { color = X_("location marker"); } else if (location->is_auto_loop()) { @@ -126,6 +128,9 @@ Editor::add_new_location_internal (Location* location) lam->start = new ArdourMarker (*this, *cue_marker_group, color, location->name(), ArdourMarker::Cue, location->start()); lam->start->set_cue_index(location->cue_id()); group = cue_marker_group; + } else if (location->is_section() && ruler_section_action->get_active()) { + lam->start = new ArdourMarker (*this, *section_marker_group, color, location->name(), ArdourMarker::RangeStart, location->start()); + group = section_marker_group; } else { lam->start = new ArdourMarker (*this, *marker_group, color, location->name(), ArdourMarker::Mark, location->start()); group = marker_group; @@ -414,11 +419,13 @@ Editor::location_flags_changed (Location *location) return; } - // move cd markers to/from cd marker bar as appropriate - ensure_cd_marker_updated (lam, location); + // moved markers to/from cd marker bar as appropriate + ensure_marker_updated (lam, location); if (location->is_cd_marker()) { lam->set_color ("location cd marker"); + } else if (location->is_section()) { + lam->set_color ("location section marker"); } else if (location->is_mark()) { lam->set_color ("location marker"); } else if (location->is_auto_punch()) { @@ -437,97 +444,48 @@ Editor::location_flags_changed (Location *location) } void -Editor::update_cd_marker_display () +Editor::update_marker_display () { - for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) { - LocationMarkers * lam = i->second; - Location * location = i->first; - - ensure_cd_marker_updated (lam, location); - } -} - - -void Editor::ensure_cd_marker_updated (LocationMarkers * lam, Location * location) -{ - if (location->is_cd_marker() - && (ruler_cd_marker_action->get_active() && lam->start->get_parent() != cd_marker_group)) - { - //cerr << "reparenting non-cd marker so it can be relocated: " << location->name() << endl; - if (lam->start) { - lam->start->reparent (*cd_marker_group); - } - if (lam->end) { - lam->end->reparent (*cd_marker_group); - } - } - else if ( (!location->is_cd_marker() || !ruler_cd_marker_action->get_active()) - && (lam->start->get_parent() == cd_marker_group)) - { - //cerr << "reparenting non-cd marker so it can be relocated: " << location->name() << endl; - if (location->is_mark()) { - if (lam->start) { - lam->start->reparent (*marker_group); - } - if (lam->end) { - lam->end->reparent (*marker_group); - } - } - else { - if (lam->start) { - lam->start->reparent (*range_marker_group); - } - if (lam->end) { - lam->end->reparent (*range_marker_group); - } - } + for (auto const& i : location_markers) { + ensure_marker_updated (i.second, i.first); } } void -Editor::update_cue_marker_display () +Editor::reparent_location_markers (LocationMarkers* lam, ArdourCanvas::Item* new_parent) { - for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) { - LocationMarkers * lam = i->second; - Location * location = i->first; - - ensure_cue_marker_updated (lam, location); + if (lam->start && lam->start->get_parent() != new_parent) { + lam->start->reparent (*new_parent); + } + if (lam->end && lam->end->get_parent() != new_parent) { + lam->end->reparent (*new_parent); } } -void Editor::ensure_cue_marker_updated (LocationMarkers * lam, Location * location) +void Editor::ensure_marker_updated (LocationMarkers* lam, Location* location) { - if (location->is_cd_marker() - && (ruler_cd_marker_action->get_active() && lam->start->get_parent() != cd_marker_group)) - { - //cerr << "reparenting non-cd marker so it can be relocated: " << location->name() << endl; - if (lam->start) { - lam->start->reparent (*cd_marker_group); - } - if (lam->end) { - lam->end->reparent (*cd_marker_group); + if (location->is_cd_marker()) { + if (ruler_cd_marker_action->get_active ()) { + reparent_location_markers (lam, cd_marker_group); + } else if (location->is_mark()) { + reparent_location_markers (lam, marker_group); + } else { + reparent_location_markers (lam, range_marker_group); } + return; } - else if ( (!location->is_cd_marker() || !ruler_cd_marker_action->get_active()) - && (lam->start->get_parent() == cd_marker_group)) - { - //cerr << "reparenting non-cd marker so it can be relocated: " << location->name() << endl; - if (location->is_mark()) { - if (lam->start) { - lam->start->reparent (*marker_group); - } - if (lam->end) { - lam->end->reparent (*marker_group); - } - } - else { - if (lam->start) { - lam->start->reparent (*range_marker_group); - } - if (lam->end) { - lam->end->reparent (*range_marker_group); - } + + if (location->is_section()) { + if (ruler_section_action->get_active ()) { + reparent_location_markers (lam, section_marker_group); + } else { + reparent_location_markers (lam, marker_group); } + return; + } + + if (location->is_mark() || location->matches (Location::Flags(0))) { + reparent_location_markers (lam, marker_group); } } @@ -1102,6 +1060,16 @@ Editor::build_marker_menu (Location* loc) items.push_back (SeparatorElem()); + if (!loc->is_range () && !loc->is_xrun ()) { + items.push_back (CheckMenuElem (_("Section Boundary"))); + Gtk::CheckMenuItem* item = static_cast (&items.back()); + if (loc->is_section ()) { + item->set_active (); + } + item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_section)); + items.push_back (SeparatorElem()); + } + items.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &Editor::marker_menu_remove))); } @@ -1728,6 +1696,28 @@ Editor::toggle_marker_menu_lock () } } +void +Editor::toggle_marker_section () +{ + ArdourMarker* marker; + + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { + fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; + abort(); /*NOTREACHED*/ + } + + Location* loc; + bool ignored; + + loc = find_location_from_marker (marker, ignored); + + if (!loc) { + return; + } + + loc->set_section (!loc->is_section ()); +} + void Editor::marker_menu_rename () { diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index d04f2101ca..4d4d0e95ac 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -854,6 +854,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT case SamplesRulerItem: case MinsecRulerItem: case MarkerBarItem: + case SectionMarkerBarItem: if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier) && !ArdourKeyboard::indicates_constraint (event->button.state)) { _drags->set (new CursorDrag (this, *_playhead_cursor, false), event); @@ -1715,6 +1716,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT case RangeMarkerBarItem: case TransportMarkerBarItem: case CdMarkerBarItem: + case SectionMarkerBarItem: case TempoBarItem: case MappingBarItem: case TempoCurveItem: @@ -1837,6 +1839,13 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT } return true; + case SectionMarkerBarItem: + if (!_dragging_playhead) { + snap_to_with_modifier (where, event, Temporal::RoundNearest, SnapToGrid_Scaled); + mouse_add_new_marker (where, Location::IsSection); + } + return true; + case CueMarkerBarItem: if (!_dragging_playhead) { /* if we get here then a dragged range wasn't done */ diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index c74c394b8f..d2d4b838a4 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -178,6 +178,7 @@ Editor::initialize_rulers () lab_children.push_back (Element(range_mark_label, PACK_SHRINK, PACK_START)); lab_children.push_back (Element(transport_mark_label, PACK_SHRINK, PACK_START)); lab_children.push_back (Element(cd_mark_label, PACK_SHRINK, PACK_START)); + lab_children.push_back (Element(section_mark_label, PACK_SHRINK, PACK_START)); lab_children.push_back (Element(mark_label, PACK_SHRINK, PACK_START)); lab_children.push_back (Element(cue_mark_label, PACK_SHRINK, PACK_START)); lab_children.push_back (Element(videotl_label, PACK_SHRINK, PACK_START)); @@ -241,8 +242,11 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t) break; case CdMarkerBarItem: - // TODO - ruler_items.push_back (MenuElem (_("New CD Track Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCDMarker, 0))); + ruler_items.push_back (MenuElem (_("New CD Track Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags(Location::IsMark |Location::IsCDMarker), 0))); + break; + + case SectionMarkerBarItem: + ruler_items.push_back (MenuElem (_("New Section Marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags(Location::IsMark | Location::IsSection), 0))); break; case CueMarkerBarItem: @@ -341,6 +345,7 @@ Editor::store_ruler_visibility () node->set_property (X_("rangemarker"), ruler_range_action->get_active()); node->set_property (X_("transportmarker"), ruler_loop_punch_action->get_active()); node->set_property (X_("cdmarker"), ruler_cd_marker_action->get_active()); + node->set_property (X_("section"), ruler_section_action->get_active()); node->set_property (X_("marker"), ruler_marker_action->get_active()); node->set_property (X_("cuemarker"), ruler_cue_marker_action->get_active()); node->set_property (X_("videotl"), ruler_video_action->get_active()); @@ -401,6 +406,12 @@ Editor::restore_ruler_visibility () } } + if (node->get_property ("section", yn)) { + ruler_section_action->set_active (yn); + } else { + ruler_section_action->set_active (true); + } + if (node->get_property ("cuemarker", yn)) { ruler_cue_marker_action->set_active (yn); } else { @@ -455,6 +466,7 @@ Editor::update_ruler_visibility () range_mark_label.hide(); transport_mark_label.hide(); cd_mark_label.hide(); + section_mark_label.hide(); cue_mark_label.hide(); mark_label.hide(); videotl_label.hide(); @@ -604,12 +616,32 @@ Editor::update_ruler_visibility () tbgpos += timebar_height; visible_timebars++; // make sure all cd markers show up in their respective places - update_cd_marker_display(); + update_marker_display(); } else { cd_marker_group->hide(); cd_mark_label.hide(); // make sure all cd markers show up in their respective places - update_cd_marker_display(); + update_marker_display(); + } + + if (ruler_section_action->get_active()) { + old_unit_pos = section_marker_group->position().y; + if (tbpos != old_unit_pos) { + section_marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos)); + } + section_marker_group->show(); + section_mark_label.show(); + + section_marker_bar->set_outline(false); + + tbpos += timebar_height; + tbgpos += timebar_height; + visible_timebars++; + update_marker_display(); + } else { + section_marker_group->hide(); + section_mark_label.hide(); + update_marker_display(); } if (ruler_marker_action->get_active()) { @@ -643,13 +675,9 @@ Editor::update_ruler_visibility () tbpos += timebar_height; tbgpos += timebar_height; visible_timebars++; - // make sure all cd markers show up in their respective places - update_cue_marker_display(); } else { cue_marker_group->hide(); cue_mark_label.hide(); - // make sure all cd markers show up in their respective places - update_cue_marker_display(); } if (ruler_video_action->get_active()) { diff --git a/gtk2_ardour/enums.cc b/gtk2_ardour/enums.cc index fc912e4569..1149bade3e 100644 --- a/gtk2_ardour/enums.cc +++ b/gtk2_ardour/enums.cc @@ -150,6 +150,7 @@ setup_gtk_ardour_enums () REGISTER_ENUM (MarkerBarItem); REGISTER_ENUM (RangeMarkerBarItem); REGISTER_ENUM (CdMarkerBarItem); + REGISTER_ENUM (SectionMarkerBarItem); REGISTER_ENUM (CueMarkerBarItem); REGISTER_ENUM (VideoBarItem); REGISTER_ENUM (TransportMarkerBarItem); diff --git a/gtk2_ardour/ruler_dialog.cc b/gtk2_ardour/ruler_dialog.cc index eef69f0833..e57d37468c 100644 --- a/gtk2_ardour/ruler_dialog.cc +++ b/gtk2_ardour/ruler_dialog.cc @@ -38,6 +38,7 @@ RulerDialog::RulerDialog () get_vbox()->pack_start (range_button); get_vbox()->pack_start (loop_punch_button); get_vbox()->pack_start (cdmark_button); + get_vbox()->pack_start (section_button); get_vbox()->pack_start (mark_button); get_vbox()->pack_start (cuemark_button); get_vbox()->pack_start (video_button); @@ -54,6 +55,7 @@ RulerDialog::RulerDialog () connect_action (range_button, "range-ruler"); connect_action (mark_button, "marker-ruler"); connect_action (cdmark_button, "cd-marker-ruler"); + connect_action (section_button, "section-ruler"); connect_action (cuemark_button, "cue-marker-ruler"); connect_action (video_button, "video-ruler"); } diff --git a/gtk2_ardour/ruler_dialog.h b/gtk2_ardour/ruler_dialog.h index f06d7244b6..d175117de4 100644 --- a/gtk2_ardour/ruler_dialog.h +++ b/gtk2_ardour/ruler_dialog.h @@ -45,6 +45,7 @@ private: Gtk::CheckButton range_button; Gtk::CheckButton mark_button; Gtk::CheckButton cdmark_button; + Gtk::CheckButton section_button; Gtk::CheckButton cuemark_button; Gtk::CheckButton video_button; diff --git a/gtk2_ardour/themes/blueberry_milk-ardour.colors b/gtk2_ardour/themes/blueberry_milk-ardour.colors index cee82eea43..dbda39e048 100644 --- a/gtk2_ardour/themes/blueberry_milk-ardour.colors +++ b/gtk2_ardour/themes/blueberry_milk-ardour.colors @@ -175,6 +175,7 @@ + @@ -373,6 +374,7 @@ + diff --git a/gtk2_ardour/themes/caineville-ardour.colors b/gtk2_ardour/themes/caineville-ardour.colors index 9d9db7dc96..31dd990eb0 100644 --- a/gtk2_ardour/themes/caineville-ardour.colors +++ b/gtk2_ardour/themes/caineville-ardour.colors @@ -176,6 +176,7 @@ + @@ -374,6 +375,7 @@ + diff --git a/gtk2_ardour/themes/clear_gray-ardour.colors b/gtk2_ardour/themes/clear_gray-ardour.colors index ba3df0bbd9..bdf3353b23 100644 --- a/gtk2_ardour/themes/clear_gray-ardour.colors +++ b/gtk2_ardour/themes/clear_gray-ardour.colors @@ -176,6 +176,7 @@ + @@ -374,6 +375,7 @@ + diff --git a/gtk2_ardour/themes/cubasish-ardour.colors b/gtk2_ardour/themes/cubasish-ardour.colors index d9d8f0c8d0..a9296699df 100644 --- a/gtk2_ardour/themes/cubasish-ardour.colors +++ b/gtk2_ardour/themes/cubasish-ardour.colors @@ -176,6 +176,7 @@ + @@ -374,6 +375,7 @@ + diff --git a/gtk2_ardour/themes/dark-ardour.colors b/gtk2_ardour/themes/dark-ardour.colors index 0eb9a6e69a..7a95dbe0b0 100644 --- a/gtk2_ardour/themes/dark-ardour.colors +++ b/gtk2_ardour/themes/dark-ardour.colors @@ -177,6 +177,7 @@ + @@ -375,6 +376,7 @@ + diff --git a/gtk2_ardour/themes/diehard3-ardour.colors b/gtk2_ardour/themes/diehard3-ardour.colors index cfba541c5c..a191186ed8 100644 --- a/gtk2_ardour/themes/diehard3-ardour.colors +++ b/gtk2_ardour/themes/diehard3-ardour.colors @@ -177,6 +177,7 @@ + @@ -376,6 +377,7 @@ + diff --git a/gtk2_ardour/themes/recbox-ardour.colors b/gtk2_ardour/themes/recbox-ardour.colors index 3d9aa3b177..5918e03cbc 100644 --- a/gtk2_ardour/themes/recbox-ardour.colors +++ b/gtk2_ardour/themes/recbox-ardour.colors @@ -177,6 +177,7 @@ + @@ -375,6 +376,7 @@ + diff --git a/gtk2_ardour/themes/unastudia-ardour.colors b/gtk2_ardour/themes/unastudia-ardour.colors index 83880aff66..a10dbaef57 100644 --- a/gtk2_ardour/themes/unastudia-ardour.colors +++ b/gtk2_ardour/themes/unastudia-ardour.colors @@ -175,6 +175,7 @@ + @@ -372,6 +373,7 @@ + diff --git a/gtk2_ardour/themes/xcolors-ardour.colors b/gtk2_ardour/themes/xcolors-ardour.colors index 08ca0264c9..e269a15e55 100644 --- a/gtk2_ardour/themes/xcolors-ardour.colors +++ b/gtk2_ardour/themes/xcolors-ardour.colors @@ -176,6 +176,7 @@ + @@ -374,6 +375,7 @@ +