copy-n-paste addition of cue marker ruler (based on cd marker ruler)

This commit is contained in:
Paul Davis 2022-01-04 14:48:52 -07:00
parent c2d18dabd5
commit 77d83540b1
10 changed files with 129 additions and 2 deletions

View File

@ -336,6 +336,7 @@ Editor::Editor ()
, range_mark_label (_("Range Markers"))
, transport_mark_label (_("Loop/Punch Ranges"))
, cd_mark_label (_("CD Markers"))
, cue_mark_label (_("Cue Markers"))
, videotl_label (_("Video Timeline"))
, videotl_group (0)
, _region_boundary_cache_dirty (true)
@ -554,6 +555,13 @@ Editor::Editor ()
cd_mark_label.hide();
cd_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);
cue_mark_label.set_padding (5,0);
cue_mark_label.hide();
cue_mark_label.set_no_show_all();
videotl_bar_height = 4;
videotl_label.set_name ("EditorRulerLabel");
videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);

View File

@ -787,6 +787,8 @@ private:
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);
TimeAxisView* clicked_axisview;
RouteTimeAxisView* clicked_routeview;
@ -916,6 +918,7 @@ private:
ArdourCanvas::Container* range_marker_group;
ArdourCanvas::Container* transport_marker_group;
ArdourCanvas::Container* cd_marker_group;
ArdourCanvas::Container* cue_marker_group;
/* parent for groups which themselves contain time markers */
ArdourCanvas::Container* _time_markers_group;
@ -960,6 +963,7 @@ private:
Glib::RefPtr<Gtk::ToggleAction> ruler_range_action;
Glib::RefPtr<Gtk::ToggleAction> ruler_loop_punch_action;
Glib::RefPtr<Gtk::ToggleAction> ruler_cd_marker_action;
Glib::RefPtr<Gtk::ToggleAction> ruler_cue_marker_action;
bool no_ruler_shown_update;
Gtk::Widget* ruler_grabbed_widget;
@ -1049,6 +1053,7 @@ private:
ArdourCanvas::Rectangle* range_marker_bar;
ArdourCanvas::Rectangle* transport_marker_bar;
ArdourCanvas::Rectangle* cd_marker_bar;
ArdourCanvas::Rectangle* cue_marker_bar;
Gtk::Label minsec_label;
Gtk::Label bbt_label;
@ -1060,6 +1065,7 @@ private:
Gtk::Label range_mark_label;
Gtk::Label transport_mark_label;
Gtk::Label cd_mark_label;
Gtk::Label cue_mark_label;
/* videtimline related actions */
Gtk::Label videotl_label;
@ -1697,6 +1703,7 @@ private:
bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_cd_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_cue_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_videotl_bar_event (GdkEvent* event, ArdourCanvas::Item*);
void update_video_timeline (bool flush = false);

View File

@ -683,6 +683,7 @@ Editor::register_actions ()
ruler_range_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-range-ruler"), _("Ranges"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
ruler_marker_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-marker-ruler"), _("Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
ruler_cd_marker_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-cd-marker-ruler"), _("CD Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
ruler_cue_marker_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-cue-marker-ruler"), _("Cue Markers"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
ruler_loop_punch_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-loop-punch-ruler"), _("Loop/Punch"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
ruler_bbt_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-bbt-ruler"), _("Bars & Beats"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
ruler_samples_action = Glib::RefPtr<ToggleAction>::cast_static (ActionManager::register_toggle_action (ruler_actions, X_("toggle-samples-ruler"), _("Samples"), sigc::mem_fun(*this, &Editor::toggle_ruler_visibility)));
@ -714,6 +715,7 @@ Editor::register_actions ()
ruler_loop_punch_action->set_active (true);
ruler_bbt_action->set_active (true);
ruler_cd_marker_action->set_active (true);
ruler_cue_marker_action->set_active (true);
ruler_timecode_action->set_active (true);
ruler_minsec_action->set_active (false);

View File

@ -184,6 +184,11 @@ Editor::initialize_canvas ()
CANVAS_DEBUG_NAME (cd_marker_bar, "CD Marker Bar");
cd_marker_bar->set_outline_what (ArdourCanvas::Rectangle::BOTTOM);
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, 0.0, ArdourCanvas::COORD_MAX, timebar_height));
CANVAS_DEBUG_NAME (cd_marker_bar, "Cue Marker Bar");
cue_marker_bar->set_outline_what (ArdourCanvas::Rectangle::BOTTOM);
ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_group, (timebar_height * videotl_bar_height));
cd_marker_bar_drag_rect = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
@ -219,6 +224,7 @@ Editor::initialize_canvas ()
meter_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
cd_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cd_marker_bar_event), cd_marker_bar));
cue_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cue_marker_bar_event), cue_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_range_marker_bar_event), range_marker_bar));
transport_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
@ -1032,6 +1038,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"));
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"));
range_marker_bar->set_fill_color (UIConfiguration::instance().color_mod ("range marker bar", "marker bar"));
range_marker_bar->set_outline_color (UIConfiguration::instance().color ("marker bar separator"));

View File

@ -1002,6 +1002,13 @@ Editor::canvas_cd_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
return typed_event (item, event, CdMarkerBarItem);
}
bool
Editor::canvas_cue_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
{
return typed_event (item, event, CueMarkerBarItem);
}
bool
Editor::canvas_videotl_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
{

View File

@ -30,6 +30,7 @@ enum ItemType {
MarkerBarItem,
RangeMarkerBarItem,
CdMarkerBarItem,
CueMarkerBarItem,
VideoBarItem,
TransportMarkerBarItem,
SelectionItem,

View File

@ -121,6 +121,9 @@ Editor::add_new_location_internal (Location* location)
if (location->is_cd_marker() && ruler_cd_marker_action->get_active()) {
lam->start = new ArdourMarker (*this, *cd_marker_group, color, location->name(), ArdourMarker::Mark, location->start());
group = cd_marker_group;
} else if (location->is_cue_marker() && ruler_cue_marker_action->get_active()) {
lam->start = new ArdourMarker (*this, *cue_marker_group, color, location->name(), ArdourMarker::Mark, location->start());
group = cue_marker_group;
} else {
lam->start = new ArdourMarker (*this, *marker_group, color, location->name(), ArdourMarker::Mark, location->start());
group = marker_group;
@ -418,7 +421,8 @@ Editor::location_flags_changed (Location *location)
}
}
void Editor::update_cd_marker_display ()
void
Editor::update_cd_marker_display ()
{
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
LocationMarkers * lam = i->second;
@ -428,6 +432,7 @@ void Editor::update_cd_marker_display ()
}
}
void Editor::ensure_cd_marker_updated (LocationMarkers * lam, Location * location)
{
if (location->is_cd_marker()
@ -464,6 +469,53 @@ void Editor::ensure_cd_marker_updated (LocationMarkers * lam, Location * locatio
}
}
void
Editor::update_cue_marker_display ()
{
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);
}
}
void Editor::ensure_cue_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);
}
}
}
}
Editor::LocationMarkers::~LocationMarkers ()
{
delete start;

View File

@ -177,6 +177,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(cue_mark_label, PACK_SHRINK, PACK_START));
lab_children.push_back (Element(mark_label, PACK_SHRINK, PACK_START));
lab_children.push_back (Element(videotl_label, PACK_SHRINK, PACK_START));
@ -316,6 +317,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_("cuemarker"), ruler_cue_marker_action->get_active());
node->set_property (X_("videotl"), ruler_video_action->get_active());
_session->add_extra_xml (*node);
@ -359,7 +361,7 @@ Editor::restore_ruler_visibility ()
}
if (node->get_property ("cdmarker", yn)) {
ruler_cd_marker_action->set_active (yn);
ruler_cd_marker_action->set_active (yn);
} else {
// this _session doesn't yet know about the cdmarker ruler
// as a benefit to the user who doesn't know the feature exists, show the ruler if
@ -374,6 +376,22 @@ Editor::restore_ruler_visibility ()
}
}
if (node->get_property ("cuemarker", yn)) {
ruler_cue_marker_action->set_active (yn);
} else {
// this _session doesn't yet know about the cue marker ruler
// as a benefit to the user who doesn't know the feature exists, show the ruler if
// any cue marks exist
ruler_cue_marker_action->set_active (false);
const Locations::LocationList & locs = _session->locations()->list();
for (Locations::LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) {
if ((*i)->is_cue_marker()) {
ruler_cue_marker_action->set_active (true);
break;
}
}
}
if (node->get_property ("videotl", yn)) {
ruler_video_action->set_active (yn);
}
@ -411,6 +429,7 @@ Editor::update_ruler_visibility ()
range_mark_label.hide();
transport_mark_label.hide();
cd_mark_label.hide();
cue_mark_label.hide();
mark_label.hide();
videotl_label.hide();
#endif
@ -555,6 +574,25 @@ Editor::update_ruler_visibility ()
update_cd_marker_display();
}
if (ruler_cue_marker_action->get_active()) {
old_unit_pos = cue_marker_group->position().y;
if (tbpos != old_unit_pos) {
cue_marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
cue_marker_group->show();
cue_mark_label.show();
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_marker_action->get_active()) {
old_unit_pos = marker_group->position().y;
if (tbpos != old_unit_pos) {

View File

@ -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 (cuemark_button);
get_vbox()->pack_start (mark_button);
get_vbox()->pack_start (video_button);
@ -53,6 +54,7 @@ RulerDialog::RulerDialog ()
connect_action (range_button, "range-ruler");
connect_action (mark_button, "marker-ruler");
connect_action (cdmark_button, "cd-marker-ruler");
connect_action (cuemark_button, "cue-marker-ruler");
connect_action (video_button, "video-ruler");
}

View File

@ -45,6 +45,7 @@ private:
Gtk::CheckButton range_button;
Gtk::CheckButton mark_button;
Gtk::CheckButton cdmark_button;
Gtk::CheckButton cuemark_button;
Gtk::CheckButton video_button;
void connect_action (Gtk::CheckButton& button, std::string const &action_name_part);