Option to show lines below markers (#3529).
git-svn-id: svn://localhost/ardour2/branches/3.0@7993 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -439,6 +439,7 @@
|
||||
<menuitem action='ToggleMeasureVisibility'/>
|
||||
<menuitem action='ToggleSummary'/>
|
||||
<menuitem action='ToggleGroupTabs'/>
|
||||
<menuitem action='show-marker-lines'/>
|
||||
</menu>
|
||||
<menu name='JACK' action='JACK'>
|
||||
<menuitem action='JACKDisconnect'/>
|
||||
|
||||
@@ -739,6 +739,8 @@ Editor::Editor ()
|
||||
_last_region_menu_was_main = false;
|
||||
_popup_region_menu_item = 0;
|
||||
|
||||
_show_marker_lines = false;
|
||||
|
||||
constructed = true;
|
||||
instant_save ();
|
||||
|
||||
@@ -2342,38 +2344,45 @@ Editor::set_state (const XMLNode& node, int /*version*/)
|
||||
if ((prop = node.property ("show-editor-mixer"))) {
|
||||
|
||||
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
|
||||
if (act) {
|
||||
assert (act);
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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);
|
||||
}
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
|
||||
assert(act);
|
||||
if (act) {
|
||||
assert (act);
|
||||
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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);
|
||||
}
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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<Action> act = ActionManager::get_action (X_("Editor"), X_("show-marker-lines"));
|
||||
assert (act);
|
||||
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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);
|
||||
@@ -2466,6 +2475,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 ());
|
||||
|
||||
@@ -5496,3 +5507,4 @@ Editor::action_menu_item (std::string const & name)
|
||||
{
|
||||
return *manage (editor_actions->get_action(name)->create_menu_item ());
|
||||
}
|
||||
|
||||
|
||||
@@ -576,6 +576,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
void remove_marker (ArdourCanvas::Item&, GdkEvent*);
|
||||
gint really_remove_marker (ARDOUR::Location* loc);
|
||||
void goto_nth_marker (int nth);
|
||||
void toggle_marker_lines ();
|
||||
void set_marker_line_visibility (bool);
|
||||
|
||||
uint32_t location_marker_color;
|
||||
uint32_t location_range_color;
|
||||
@@ -584,24 +586,30 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
||||
uint32_t location_cd_marker_color;
|
||||
|
||||
struct LocationMarkers {
|
||||
Marker* start;
|
||||
Marker* end;
|
||||
bool valid;
|
||||
Marker* start;
|
||||
Marker* end;
|
||||
bool valid;
|
||||
|
||||
LocationMarkers () : start(0), end(0), valid (true) {}
|
||||
|
||||
~LocationMarkers ();
|
||||
|
||||
void hide ();
|
||||
void show ();
|
||||
|
||||
LocationMarkers () : start(0), end(0), valid (true) {}
|
||||
|
||||
~LocationMarkers ();
|
||||
|
||||
void hide();
|
||||
void show ();
|
||||
void set_name (const std::string&);
|
||||
void set_position (framepos_t start, framepos_t end = 0);
|
||||
void set_color_rgba (uint32_t);
|
||||
void hide_lines ();
|
||||
void show_lines (ArdourCanvas::Group *, double);
|
||||
void set_lines_vpos (double, double);
|
||||
|
||||
void set_name (const std::string&);
|
||||
void set_position (framepos_t start, framepos_t end = 0);
|
||||
void set_color_rgba (uint32_t);
|
||||
};
|
||||
|
||||
LocationMarkers *find_location_markers (ARDOUR::Location *) const;
|
||||
ARDOUR::Location* find_location_from_marker (Marker *, bool& is_start) const;
|
||||
Marker* entered_marker;
|
||||
bool _show_marker_lines;
|
||||
|
||||
typedef std::map<ARDOUR::Location*,LocationMarkers *> LocationMarkerMap;
|
||||
LocationMarkerMap location_markers;
|
||||
|
||||
@@ -579,6 +579,8 @@ Editor::register_actions ()
|
||||
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-sync"), _("Snap to Region Sync"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionSync)));
|
||||
ActionManager::register_radio_action (snap_actions, snap_choice_group, X_("snap-to-region-boundary"), _("Snap to Region Boundary"), (sigc::bind (sigc::mem_fun(*this, &Editor::snap_type_chosen), Editing::SnapToRegionBoundary)));
|
||||
|
||||
ActionManager::register_toggle_action (editor_actions, X_("show-marker-lines"), _("Show Marker Lines"), sigc::mem_fun (*this, &Editor::toggle_marker_lines));
|
||||
|
||||
/* RULERS */
|
||||
|
||||
Glib::RefPtr<ActionGroup> ruler_actions = ActionGroup::create (X_("Rulers"));
|
||||
|
||||
@@ -341,8 +341,8 @@ Editor::track_canvas_size_allocated ()
|
||||
playhead_cursor->set_length (_canvas_height);
|
||||
}
|
||||
|
||||
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
|
||||
(*x)->set_line_vpos (0, _canvas_height);
|
||||
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
|
||||
i->second->set_lines_vpos (0, _canvas_height);
|
||||
}
|
||||
|
||||
vertical_adjustment.set_page_size (_canvas_height);
|
||||
|
||||
@@ -145,6 +145,12 @@ Editor::add_new_location (Location *location)
|
||||
selection->set (lam->start);
|
||||
select_new_marker = false;
|
||||
}
|
||||
|
||||
if (_show_marker_lines) {
|
||||
lam->show_lines (cursor_group, _canvas_height);
|
||||
} else {
|
||||
lam->hide_lines ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -356,14 +362,48 @@ void
|
||||
Editor::LocationMarkers::hide()
|
||||
{
|
||||
start->hide ();
|
||||
if (end) { end->hide(); }
|
||||
if (end) {
|
||||
end->hide ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::LocationMarkers::show()
|
||||
{
|
||||
start->show ();
|
||||
if (end) { end->show(); }
|
||||
if (end) {
|
||||
end->show ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::LocationMarkers::show_lines (ArdourCanvas::Group* g, double h)
|
||||
{
|
||||
/* add_line may be required, and it calls show_line even if it isn't */
|
||||
|
||||
start->add_line (g, 0, h);
|
||||
|
||||
if (end) {
|
||||
end->add_line (g, 0, h);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::LocationMarkers::hide_lines ()
|
||||
{
|
||||
start->hide_line ();
|
||||
if (end) {
|
||||
end->hide_line ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::LocationMarkers::set_lines_vpos (double y, double h)
|
||||
{
|
||||
start->set_line_vpos (y, h);
|
||||
if (end) {
|
||||
end->set_line_vpos (y, h);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1203,15 +1243,9 @@ Editor::marker_selection_changed ()
|
||||
return;
|
||||
}
|
||||
|
||||
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
|
||||
LocationMarkers* lam = i->second;
|
||||
|
||||
if (lam->start) {
|
||||
lam->start->hide_line();
|
||||
}
|
||||
|
||||
if (lam->end) {
|
||||
lam->end->hide_line();
|
||||
if (!_show_marker_lines) {
|
||||
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
|
||||
i->second->hide_lines ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1277,3 +1311,17 @@ Editor::toggle_marker_menu_glue ()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_marker_lines ()
|
||||
{
|
||||
_show_marker_lines = !_show_marker_lines;
|
||||
|
||||
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
|
||||
if (_show_marker_lines) {
|
||||
i->second->show_lines (cursor_group, _canvas_height);
|
||||
} else {
|
||||
i->second->hide_lines ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user