13
0

prevent everything except the name column from changing selection in EditorRoutes

This commit is contained in:
Paul Davis 2020-01-13 23:13:04 -07:00
parent 659683c686
commit 9f474953fd
2 changed files with 40 additions and 7 deletions

View File

@ -85,6 +85,7 @@ EditorRoutes::EditorRoutes (Editor* e)
: EditorComponent (e)
, _ignore_reorder (false)
, _ignore_selection_change (false)
, column_does_not_select (false)
, _no_redisplay (false)
, _adding_routes (false)
, _route_deletion_in_progress (false)
@ -103,6 +104,8 @@ EditorRoutes::EditorRoutes (Editor* e)
_model = ListStore::create (_columns);
_display.set_model (_model);
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::select_function));
// Record enable toggle
CellRendererPixbufMulti* rec_col_renderer = manage (new CellRendererPixbufMulti());
@ -224,6 +227,10 @@ EditorRoutes::EditorRoutes (Editor* e)
_visible_column = _display.append_column ("", _columns.visible) - 1;
_active_column = _display.append_column ("", _columns.active) - 1;
name_column = _display.get_column (_name_column);
visible_column = _display.get_column (_visible_column);
active_column = _display.get_column (_active_column);
_display.append_column (*input_active_column);
_display.append_column (*rec_state_column);
_display.append_column (*rec_safe_column);
@ -313,6 +320,7 @@ EditorRoutes::EditorRoutes (Editor* e)
_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
_display.signal_button_press_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_press), false);
_display.signal_button_release_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_release), false);
_scroller.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorRoutes::key_press), false);
_scroller.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditorRoutes::focus_in), false);
@ -1394,6 +1402,19 @@ EditorRoutes::get_relevant_routes (boost::shared_ptr<RouteList> rl)
return !rl->empty();
}
bool
EditorRoutes::select_function(const Glib::RefPtr<Gtk::TreeModel>&, const Gtk::TreeModel::Path&, bool)
{
return !column_does_not_select;
}
bool
EditorRoutes::button_release (GdkEventButton*)
{
column_does_not_select = false;
return false;
}
bool
EditorRoutes::button_press (GdkEventButton* ev)
{
@ -1418,7 +1439,17 @@ EditorRoutes::button_press (GdkEventButton* ev)
return true;
}
cerr << "BP in cell " << cell_x << ", " << cell_y << " path " << path.to_string() << endl;
if ((tvc == rec_state_column) ||
(tvc == rec_safe_column) ||
(tvc == input_active_column) ||
(tvc == mute_state_column) ||
(tvc == solo_state_column) ||
(tvc == solo_safe_state_column) ||
(tvc == solo_isolate_state_column) ||
(tvc == visible_column) ||
(tvc == active_column)) {
column_does_not_select = true;
}
//Scroll editor canvas to selected track
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
@ -1431,17 +1462,13 @@ EditorRoutes::button_press (GdkEventButton* ev)
}
}
cerr << "button press unhandled\n";
return false;
}
void
EditorRoutes::selection_changed ()
{
cerr << " selection changed\n";
if (_ignore_selection_change) {
if (_ignore_selection_change || column_does_not_select) {
return;
}
@ -1459,7 +1486,6 @@ EditorRoutes::selection_changed ()
TimeAxisView* tv = (*iter)[_columns.tv];
selected.push_back (tv);
cerr << "now selected " << tv->stripable()->name() << endl;
}
}

View File

@ -92,6 +92,7 @@ private:
void active_changed (std::string const &);
void reordered (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int *);
bool button_press (GdkEventButton *);
bool button_release (GdkEventButton *);
void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Stripable>);
void handle_gui_changes (std::string const &, void *);
bool idle_update_mute_rec_solo_etc ();
@ -170,6 +171,9 @@ private:
Gtk::TreeViewColumn* solo_state_column;
Gtk::TreeViewColumn* solo_safe_state_column;
Gtk::TreeViewColumn* solo_isolate_state_column;
Gtk::TreeViewColumn* name_column;
Gtk::TreeViewColumn* visible_column;
Gtk::TreeViewColumn* active_column;
Gtk::ScrolledWindow _scroller;
Gtk::TreeView _display;
@ -181,6 +185,7 @@ private:
bool _ignore_reorder;
bool _ignore_selection_change;
bool column_does_not_select;
bool _no_redisplay;
bool _adding_routes;
bool _route_deletion_in_progress;
@ -192,6 +197,8 @@ private:
Gtk::Widget* old_focus;
Gtk::CellEditable* name_editable;
bool select_function (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool);
bool key_press (GdkEventKey* ev);
bool focus_in (GdkEventFocus*);
bool focus_out (GdkEventFocus*);