mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
selecting a track/bus in the editor list now selects it in the canvas, and also ensures that it is visible
Visibility is done with Editor::ensure_time_axis_view_is_visible(), and ctrl-click in the editor list was also modified to use the same method.
This commit is contained in:
parent
47c849cf95
commit
012504d35a
2 changed files with 33 additions and 12 deletions
|
|
@ -222,6 +222,7 @@ EditorRoutes::EditorRoutes (Editor* e)
|
||||||
_display.set_headers_visible (true);
|
_display.set_headers_visible (true);
|
||||||
_display.get_selection()->set_mode (SELECTION_SINGLE);
|
_display.get_selection()->set_mode (SELECTION_SINGLE);
|
||||||
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
|
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
|
||||||
|
_display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::selection_changed));
|
||||||
_display.set_reorderable (true);
|
_display.set_reorderable (true);
|
||||||
_display.set_name (X_("EditGroupList"));
|
_display.set_name (X_("EditGroupList"));
|
||||||
_display.set_rules_hint (true);
|
_display.set_rules_hint (true);
|
||||||
|
|
@ -1288,27 +1289,46 @@ EditorRoutes::button_press (GdkEventButton* ev)
|
||||||
//Scroll editor canvas to selected track
|
//Scroll editor canvas to selected track
|
||||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||||
|
|
||||||
// Get the model row.
|
|
||||||
Gtk::TreeModel::Row row = *_model->get_iter (path);
|
Gtk::TreeModel::Row row = *_model->get_iter (path);
|
||||||
|
|
||||||
TimeAxisView *tv = row[_columns.tv];
|
TimeAxisView *tv = row[_columns.tv];
|
||||||
|
|
||||||
int y_pos = tv->y_position();
|
if (tv) {
|
||||||
|
_editor->ensure_time_axis_view_is_visible (*tv);
|
||||||
//Clamp the y pos so that we do not extend beyond the canvas full height.
|
|
||||||
if (_editor->_full_canvas_height - y_pos < _editor->_visible_canvas_height){
|
|
||||||
y_pos = _editor->_full_canvas_height - _editor->_visible_canvas_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Only scroll to if the track is visible
|
|
||||||
if(y_pos != -1){
|
|
||||||
_editor->reset_y_origin (y_pos);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EditorRoutes::selection_changed ()
|
||||||
|
{
|
||||||
|
if (_display.get_selection()->count_selected_rows() > 0) {
|
||||||
|
|
||||||
|
TreeIter iter;
|
||||||
|
TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
|
||||||
|
TrackViewList selected;
|
||||||
|
|
||||||
|
_editor->get_selection().clear_regions ();
|
||||||
|
|
||||||
|
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
|
||||||
|
|
||||||
|
if ((iter = _model->get_iter (*i))) {
|
||||||
|
|
||||||
|
TimeAxisView* tv = (*iter)[_columns.tv];
|
||||||
|
selected.push_back (tv);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_editor->get_selection().set (selected);
|
||||||
|
_editor->ensure_time_axis_view_is_visible (*(selected.front()));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
_editor->get_selection().clear_tracks ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
|
EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const&, bool /*selected*/)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ private:
|
||||||
void show_all_miditracks ();
|
void show_all_miditracks ();
|
||||||
void hide_all_miditracks ();
|
void hide_all_miditracks ();
|
||||||
void show_tracks_with_regions_at_playhead ();
|
void show_tracks_with_regions_at_playhead ();
|
||||||
|
void selection_changed ();
|
||||||
|
|
||||||
void display_drag_data_received (
|
void display_drag_data_received (
|
||||||
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue