#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
#include "ardour/route.h"
+#include "ardour/selection.h"
#include "ardour/session.h"
#include "ardour/solo_isolate_control.h"
#include "ardour/utils.h"
_display.set_enable_search (false);
Route::PluginSetup.connect_same_thread (*this, boost::bind (&EditorRoutes::plugin_setup, this, _1, _2, _3));
- PresentationInfo::Change.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::presentation_info_changed, this, _1), gui_context());
}
bool
items.push_back (MenuElem (_("Only Show Tracks with Regions Under Playhead"), sigc::mem_fun (*this, &EditorRoutes::show_tracks_with_regions_at_playhead)));
}
-void
-EditorRoutes::show_menu ()
-{
- if (_menu == 0) {
- build_menu ();
- }
-
- _menu->popup (1, gtk_get_current_event_time());
-}
-
void
EditorRoutes::redisplay_real ()
{
}
}
- _display.set_model (Glib::RefPtr<ListStore>());
+ {
+ PBD::Unwinder<bool> uw (_ignore_selection_change, true);
+ _display.set_model (Glib::RefPtr<ListStore>());
+ }
for (list<TimeAxisView*>::iterator x = tavs.begin(); x != tavs.end(); ++x) {
row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> (stripable) != 0);
-
if (midi_trk) {
row[_columns.is_input_active] = midi_trk->input_active ();
row[_columns.is_midi] = true;
update_input_active_display ();
update_active_display ();
- _display.set_model (_model);
+ {
+ PBD::Unwinder<bool> uw (_ignore_selection_change, true);
+ _display.set_model (_model);
+ }
/* now update route order keys from the treeview/track display order */
TreeModel::Children rows = _model->children();
TreeModel::Children::iterator ri;
+ PBD::Unwinder<bool> uw (_ignore_selection_change, true);
+
for (ri = rows.begin(); ri != rows.end(); ++ri) {
if ((*ri)[_columns.tv] == tv) {
PBD::Unwinder<bool> uw (_route_deletion_in_progress, true);
break;
}
}
-
- /* the deleted signal for the treeview/model will take
- care of any updates.
- */
}
void
}
}
-void
-EditorRoutes::presentation_info_changed (PropertyChange const & what_changed)
-{
- PropertyChange soh;
- soh.add (Properties::selected);
- soh.add (Properties::order);
- soh.add (Properties::hidden);
-
- if (what_changed.contains (soh)) {
- sync_treeview_from_presentation_info (what_changed);
- }
-}
-
void
EditorRoutes::sync_treeview_from_presentation_info (PropertyChange const & what_changed)
{
if (what_changed.contains (Properties::selected)) {
+ /* by the time this is invoked, the GUI Selection model has
+ * already updated itself.
+ */
+
TrackViewList tvl;
PBD::Unwinder<bool> uw (_ignore_selection_change, true);
- /* step one: set the treeview model selection state */
+ /* set the treeview model selection state */
+
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
- if (stripable && stripable->presentation_info().selected()) {
+ if (stripable && stripable->is_selected()) {
TimeAxisView* tav = (*ri)[_columns.tv];
if (tav) {
tvl.push_back (tav);
_display.get_selection()->unselect (*ri);
}
}
-
- /* step two: set the Selection (for stripables/routes) */
- _editor->get_selection().set (tvl);
}
redisplay ();
EditorRoutes::button_press (GdkEventButton* ev)
{
if (Keyboard::is_context_menu_event (ev)) {
- show_menu ();
+ if (_menu == 0) {
+ build_menu ();
+ }
+ _menu->popup (ev->button, ev->time);
return true;
}
void
EditorRoutes::initial_display ()
{
- _model->clear ();
if (!_session) {
+ _model->clear ();
return;
}
DisplaySuspender ds;
+ _model->clear ();
StripableList s;
/* build a list that includes time axis view information */
for (StripableList::const_iterator sli = sl.begin(); sli != sl.end(); ++sli) {
- TimeAxisView* tv = _editor->axis_view_from_stripable (*sli);
+ TimeAxisView* tv = _editor->time_axis_view_from_stripable (*sli);
view_stripables.push_back (ViewStripable (tv, *sli));
}
while (vsi != view_stripables.end()) {
- if (vsi->stripable->presentation_info().selected()) {
+ if (vsi->stripable->is_selected()) {
if (unselected_neighbour != view_stripables.end()) {
--vsi;
- if (vsi->stripable->presentation_info().selected()) {
+ if (vsi->stripable->is_selected()) {
if (unselected_neighbour != view_stripables.end()) {
void
EditorRoutes::clear ()
{
+ PBD::Unwinder<bool> uw (_ignore_selection_change, true);
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
_model->clear ();
_display.set_model (_model);
set<TimeAxisView*> show;
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
- TimeAxisView* tav = _editor->axis_view_from_stripable (*i);
+ TimeAxisView* tav = _editor->time_axis_view_from_stripable (*i);
if (tav) {
show.insert (tav);
}