summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-05-16 07:30:28 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:42 -0400
commite0ff70cf86c01c42f98faf8b0eaf1a8ccf867946 (patch)
treedcb5ac7037e3b41d850930ea0a1759d79f8ca82a /gtk2_ardour
parentbae9474e9f04e324b1a2776b0fa9faefb5e6f0c2 (diff)
first vaguely working version using PresentationInfo
remote control ID and "order keys" have been removed.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui.cc81
-rw-r--r--gtk2_ardour/ardour_ui.h31
-rw-r--r--gtk2_ardour/editor.cc4
-rw-r--r--gtk2_ardour/editor.h2
-rw-r--r--gtk2_ardour/editor_audio_import.cc7
-rw-r--r--gtk2_ardour/editor_canvas_events.cc4
-rw-r--r--gtk2_ardour/editor_drag.cc10
-rw-r--r--gtk2_ardour/editor_group_tabs.cc5
-rw-r--r--gtk2_ardour/editor_group_tabs.h1
-rw-r--r--gtk2_ardour/editor_ops.cc6
-rw-r--r--gtk2_ardour/editor_pt_import.cc2
-rw-r--r--gtk2_ardour/editor_routes.cc155
-rw-r--r--gtk2_ardour/editor_routes.h4
-rw-r--r--gtk2_ardour/editor_selection.cc8
-rw-r--r--gtk2_ardour/editor_summary.cc2
-rw-r--r--gtk2_ardour/export_channel_selector.cc15
-rw-r--r--gtk2_ardour/group_tabs.cc12
-rw-r--r--gtk2_ardour/group_tabs.h1
-rw-r--r--gtk2_ardour/luasignal_syms.h4
-rw-r--r--gtk2_ardour/meter_strip.cc4
-rw-r--r--gtk2_ardour/meterbridge.cc18
-rw-r--r--gtk2_ardour/meterbridge.h2
-rw-r--r--gtk2_ardour/mixer_group_tabs.cc5
-rw-r--r--gtk2_ardour/mixer_group_tabs.h1
-rw-r--r--gtk2_ardour/mixer_ui.cc145
-rw-r--r--gtk2_ardour/mixer_ui.h6
-rw-r--r--gtk2_ardour/port_group.cc2
-rw-r--r--gtk2_ardour/port_matrix.cc2
-rw-r--r--gtk2_ardour/route_ui.cc8
-rw-r--r--gtk2_ardour/vca_master_strip.cc38
-rw-r--r--gtk2_ardour/vca_master_strip.h2
31 files changed, 232 insertions, 355 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 6ecfd9772c..3ca1bd9394 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1818,7 +1818,8 @@ ARDOUR_UI::session_add_mixed_track (
const string& name_template,
bool strict_io,
PluginInfoPtr instrument,
- Plugin::PresetRecord* pset)
+ Plugin::PresetRecord* pset,
+ ARDOUR::PresentationInfo::order_t order)
{
list<boost::shared_ptr<MidiTrack> > tracks;
@@ -1828,7 +1829,7 @@ ARDOUR_UI::session_add_mixed_track (
}
try {
- tracks = _session->new_midi_track (input, output, instrument, ARDOUR::Normal, route_group, how_many, name_template, pset);
+ tracks = _session->new_midi_track (input, output, instrument, pset, route_group, how_many, name_template, order, ARDOUR::Normal);
if (tracks.size() != how_many) {
error << string_compose(P_("could not create %1 new mixed track", "could not create %1 new mixed tracks", how_many), how_many) << endmsg;
@@ -1854,7 +1855,8 @@ ARDOUR_UI::session_add_midi_bus (
const string& name_template,
bool strict_io,
PluginInfoPtr instrument,
- Plugin::PresetRecord* pset)
+ Plugin::PresetRecord* pset,
+ ARDOUR::PresentationInfo::order_t order)
{
RouteList routes;
@@ -1864,7 +1866,8 @@ ARDOUR_UI::session_add_midi_bus (
}
try {
- routes = _session->new_midi_route (route_group, how_many, name_template, instrument, pset);
+
+ routes = _session->new_midi_route (route_group, how_many, name_template, instrument, pset, PresentationInfo::MidiBus, order);
if (routes.size() != how_many) {
error << string_compose(P_("could not create %1 new Midi Bus", "could not create %1 new Midi Busses", how_many), how_many) << endmsg;
}
@@ -1890,15 +1893,16 @@ ARDOUR_UI::session_add_midi_route (
const string& name_template,
bool strict_io,
PluginInfoPtr instrument,
- Plugin::PresetRecord* pset)
+ Plugin::PresetRecord* pset,
+ ARDOUR::PresentationInfo::order_t order)
{
ChanCount one_midi_channel;
one_midi_channel.set (DataType::MIDI, 1);
if (disk) {
- session_add_mixed_track (one_midi_channel, one_midi_channel, route_group, how_many, name_template, strict_io, instrument, pset);
+ session_add_mixed_track (one_midi_channel, one_midi_channel, route_group, how_many, name_template, strict_io, order, instrument, pset);
} else {
- session_add_midi_bus (route_group, how_many, name_template, strict_io, instrument, pset);
+ session_add_midi_bus (route_group, how_many, name_template, strict_io, order, instrument, pset);
}
}
@@ -1911,8 +1915,8 @@ ARDOUR_UI::session_add_audio_route (
RouteGroup* route_group,
uint32_t how_many,
string const & name_template,
- bool strict_io
- )
+ bool strict_io,
+ ARDOUR::PresentationInfo::order_t order)
{
list<boost::shared_ptr<AudioTrack> > tracks;
RouteList routes;
@@ -1924,7 +1928,7 @@ ARDOUR_UI::session_add_audio_route (
try {
if (track) {
- tracks = _session->new_audio_track (input_channels, output_channels, mode, route_group, how_many, name_template);
+ tracks = _session->new_audio_track (input_channels, output_channels, route_group, how_many, name_template, order, mode);
if (tracks.size() != how_many) {
error << string_compose (P_("could not create %1 new audio track", "could not create %1 new audio tracks", how_many), how_many)
@@ -1933,7 +1937,7 @@ ARDOUR_UI::session_add_audio_route (
} else {
- routes = _session->new_audio_route (input_channels, output_channels, route_group, how_many, name_template);
+ routes = _session->new_audio_route (input_channels, output_channels, route_group, how_many, name_template, PresentationInfo::AudioBus, order);
if (routes.size() != how_many) {
error << string_compose (P_("could not create %1 new audio bus", "could not create %1 new audio busses", how_many), how_many)
@@ -2377,7 +2381,7 @@ ARDOUR_UI::transport_forward (int option)
}
void
-ARDOUR_UI::toggle_record_enable (uint32_t rid)
+ARDOUR_UI::toggle_record_enable (uint16_t rid)
{
if (!_session) {
return;
@@ -2385,7 +2389,7 @@ ARDOUR_UI::toggle_record_enable (uint32_t rid)
boost::shared_ptr<Route> r;
- if ((r = _session->route_by_remote_id (rid)) != 0) {
+ if ((r = _session->get_remote_nth_route (rid)) != 0) {
boost::shared_ptr<Track> t;
@@ -3902,15 +3906,15 @@ ARDOUR_UI::cleanup_peakfiles ()
}
}
-void
-ARDOUR_UI::setup_order_hint (AddRouteDialog::InsertAt place)
+PresentationInfo::order_t
+ARDOUR_UI::translate_order (AddRouteDialog::InsertAt place)
{
- uint32_t order_hint = UINT32_MAX;
-
if (editor->get_selection().tracks.empty()) {
- return;
+ return PresentationInfo::max_order;
}
+ PresentationInfo::order_t order_hint = PresentationInfo::max_order;
+
/*
we want the new routes to have their order keys set starting from
the highest order key in the selection + 1 (if available).
@@ -3919,42 +3923,21 @@ ARDOUR_UI::setup_order_hint (AddRouteDialog::InsertAt place)
if (place == AddRouteDialog::AfterSelection) {
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView*> (editor->get_selection().tracks.back());
if (rtav) {
- order_hint = rtav->route()->order_key();
+ order_hint = rtav->route()->presentation_info().group_order();
order_hint++;
}
} else if (place == AddRouteDialog::BeforeSelection) {
RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView*> (editor->get_selection().tracks.front());
if (rtav) {
- order_hint = rtav->route()->order_key();
+ order_hint = rtav->route()->presentation_info().group_order();
}
} else if (place == AddRouteDialog::First) {
order_hint = 0;
} else {
- /* leave order_hint at UINT32_MAX */
- }
-
- if (order_hint == UINT32_MAX) {
- /** AddRouteDialog::Last or selection with first/last not a RouteTimeAxisView
- * not setting an order hint will place new routes last.
- */
- return;
+ /* leave order_hint at max_order */
}
- _session->set_order_hint (order_hint);
-
- /* create a gap in the existing route order keys to accomodate new routes.*/
- boost::shared_ptr <RouteList> rd = _session->get_routes();
- for (RouteList::iterator ri = rd->begin(); ri != rd->end(); ++ri) {
- boost::shared_ptr<Route> rt (*ri);
-
- if (rt->is_monitor()) {
- continue;
- }
-
- if (rt->order_key () >= order_hint) {
- rt->set_order_key (rt->order_key () + add_route_dialog->count());
- }
- }
+ return order_hint;
}
void
@@ -4001,7 +3984,7 @@ ARDOUR_UI::add_route ()
return;
}
- setup_order_hint(add_route_dialog->insert_at());
+ PresentationInfo::order_t order = translate_order (add_route_dialog->insert_at());
string template_path = add_route_dialog->track_template();
DisplaySuspender ds;
@@ -4033,19 +4016,19 @@ ARDOUR_UI::add_route ()
switch (add_route_dialog->type_wanted()) {
case AddRouteDialog::AudioTrack:
- session_add_audio_track (input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template, strict_io);
+ session_add_audio_track (input_chan.n_audio(), output_chan.n_audio(), add_route_dialog->mode(), route_group, count, name_template, strict_io, order);
break;
case AddRouteDialog::MidiTrack:
- session_add_midi_track (route_group, count, name_template, strict_io, instrument);
+ session_add_midi_track (route_group, count, name_template, strict_io, instrument, 0, order);
break;
case AddRouteDialog::MixedTrack:
- session_add_mixed_track (input_chan, output_chan, route_group, count, name_template, strict_io, instrument, 0);
+ session_add_mixed_track (input_chan, output_chan, route_group, count, name_template, strict_io, instrument, 0, order);
break;
case AddRouteDialog::AudioBus:
- session_add_audio_bus (input_chan.n_audio(), output_chan.n_audio(), route_group, count, name_template, strict_io);
+ session_add_audio_bus (input_chan.n_audio(), output_chan.n_audio(), route_group, count, name_template, strict_io, order);
break;
case AddRouteDialog::MidiBus:
- session_add_midi_bus (route_group, count, name_template, strict_io, instrument, 0);
+ session_add_midi_bus (route_group, count, name_template, strict_io, instrument, 0, order);
break;
case AddRouteDialog::VCAMaster:
session_add_vca (name_template, count);
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 737cb110af..0a7996ebbd 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -281,9 +281,10 @@ public:
ARDOUR::RouteGroup* route_group,
uint32_t how_many,
std::string const & name_template,
- bool strict_io
+ bool strict_io,
+ ARDOUR::PresentationInfo::order_t order
) {
- session_add_audio_route (true, input_channels, output_channels, mode, route_group, how_many, name_template, strict_io);
+ session_add_audio_route (true, input_channels, output_channels, mode, route_group, how_many, name_template, strict_io, order);
}
void session_add_audio_bus (
@@ -292,9 +293,10 @@ public:
ARDOUR::RouteGroup* route_group,
uint32_t how_many,
std::string const & name_template,
- bool strict_io
+ bool strict_io,
+ ARDOUR::PresentationInfo::order_t order
) {
- session_add_audio_route (false, input_channels, output_channels, ARDOUR::Normal, route_group, how_many, name_template, strict_io);
+ session_add_audio_route (false, input_channels, output_channels, ARDOUR::Normal, route_group, how_many, name_template, strict_io, order);
}
void session_add_midi_track (
@@ -302,15 +304,20 @@ public:
uint32_t how_many,
std::string const & name_template,
bool strict_io,
+ ARDOUR::PresentationInfo::order_t order,
ARDOUR::PluginInfoPtr instrument,
ARDOUR::Plugin::PresetRecord* preset = NULL) {
- session_add_midi_route (true, route_group, how_many, name_template, strict_io, instrument, preset);
+ session_add_midi_route (true, route_group, how_many, name_template, strict_io, order, instrument, preset);
}
- void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*);
- void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*);
- void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool);
- void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*);
+ void session_add_mixed_track (const ARDOUR::ChanCount&, const ARDOUR::ChanCount&, ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr,
+ ARDOUR::PresentationInfo::order_t order);
+ void session_add_midi_bus (ARDOUR::RouteGroup*, uint32_t, std::string const &, bool, ARDOUR::PluginInfoPtr,
+ ARDOUR::PresentationInfo::order_t order);
+ void session_add_audio_route (bool, int32_t, int32_t, ARDOUR::TrackMode, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool,
+ ARDOUR::PresentationInfo::order_t order);
+ void session_add_midi_route (bool, ARDOUR::RouteGroup *, uint32_t, std::string const &, bool, ARDOUR::PresentationInfo::order_t order,
+ ARDOUR::PluginInfoPtr, ARDOUR::Plugin::PresetRecord*);
void display_insufficient_ports_message ();
@@ -401,7 +408,7 @@ private:
void button_change_tabbable_visibility (Gtkmm2ext::Tabbable*);
void key_change_tabbable_visibility (Gtkmm2ext::Tabbable*);
void toggle_editor_and_mixer ();
-
+
void tabbable_state_change (Gtkmm2ext::Tabbable&);
void toggle_meterbridge ();
@@ -664,7 +671,7 @@ private:
bool save_as_progress_update (float fraction, int64_t cnt, int64_t total, Gtk::Label* label, Gtk::ProgressBar* bar);
void save_session_as ();
void rename_session ();
- void setup_order_hint (AddRouteDialog::InsertAt);
+ ARDOUR::PresentationInfo::order_t translate_order (AddRouteDialog::InsertAt);
int create_mixer ();
int create_editor ();
@@ -720,7 +727,7 @@ private:
void install_actions ();
- void toggle_record_enable (uint32_t);
+ void toggle_record_enable (uint16_t);
uint32_t rec_enabled_streams;
void count_recenabled_streams (ARDOUR::Route&);
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 345694d101..3dbdd8a992 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -1000,7 +1000,7 @@ Editor::control_unselect ()
}
void
-Editor::control_select (uint32_t rid, Selection::Operation op)
+Editor::control_select (uint16_t rid, Selection::Operation op)
{
/* handles the (static) signal from the ControlProtocol class that
* requests setting the selected track to a given RID
@@ -1010,7 +1010,7 @@ Editor::control_select (uint32_t rid, Selection::Operation op)
return;
}
- boost::shared_ptr<Route> r = _session->route_by_remote_id (rid);
+ boost::shared_ptr<Route> r = _session->get_remote_nth_route (rid);
if (!r) {
return;
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 0fd9fccec1..9f579a3d81 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1088,7 +1088,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void control_step_tracks_down ();
void control_view (uint32_t);
void control_scroll (float);
- void control_select (uint32_t rid, Selection::Operation);
+ void control_select (uint16_t rid, Selection::Operation);
void control_unselect ();
void access_action (std::string,std::string);
bool deferred_control_scroll (framepos_t);
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index e35e566dee..11a53c4268 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -937,7 +937,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
{
if (!existing_track) {
if (ar) {
- list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, Normal, 0, 1));
+ list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, 0, 1, string(), PresentationInfo::max_order, Normal));
if (at.empty()) {
return -1;
@@ -954,7 +954,8 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
_session->new_midi_track (ChanCount (DataType::MIDI, 1),
ChanCount (DataType::MIDI, 1),
instrument,
- Normal, 0, 1));
+ 0, 1, string(),
+ PresentationInfo::max_order));
if (mt.empty()) {
return -1;
@@ -990,7 +991,7 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
return -1;
}
- list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, Destructive));
+ list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, 0, 1, string(), PresentationInfo::max_order, Destructive));
if (!at.empty()) {
boost::shared_ptr<Playlist> playlist = at.front()->playlist();
boost::shared_ptr<Region> copy (RegionFactory::create (region, true));
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index 22c701673e..559961512d 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -1280,12 +1280,12 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
output_chan = session()->master_out()->n_inputs().n_audio();
}
list<boost::shared_ptr<AudioTrack> > audio_tracks;
- audio_tracks = session()->new_audio_track (region->n_channels(), output_chan, ARDOUR::Normal, 0, 1, region->name());
+ audio_tracks = session()->new_audio_track (region->n_channels(), output_chan, 0, 1, region->name(), PresentationInfo::max_order, ARDOUR::Normal);
rtav = axis_view_from_route (audio_tracks.front());
} else if (boost::dynamic_pointer_cast<MidiRegion> (region)) {
ChanCount one_midi_port (DataType::MIDI, 1);
list<boost::shared_ptr<MidiTrack> > midi_tracks;
- midi_tracks = session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(), ARDOUR::Normal, 0, 1, region->name());
+ midi_tracks = session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(), 0, 1, region->name(), PresentationInfo::max_order, ARDOUR::Normal);
rtav = axis_view_from_route (midi_tracks.front());
} else {
return;
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index f209aed59d..16b52b9330 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -525,12 +525,12 @@ Drag::add_midi_region (MidiTimeAxisView* view, bool commit)
return boost::shared_ptr<Region>();
}
-struct EditorOrderTimeAxisViewSorter {
+struct PresentationInfoTimeAxisViewSorter {
bool operator() (TimeAxisView* a, TimeAxisView* b) {
RouteTimeAxisView* ra = dynamic_cast<RouteTimeAxisView*> (a);
RouteTimeAxisView* rb = dynamic_cast<RouteTimeAxisView*> (b);
assert (ra && rb);
- return ra->route()->order_key () < rb->route()->order_key ();
+ return ra->route()->presentation_info () < rb->route()->presentation_info();
}
};
@@ -546,7 +546,7 @@ RegionDrag::RegionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<Re
*/
TrackViewList track_views = _editor->track_views;
- track_views.sort (EditorOrderTimeAxisViewSorter ());
+ track_views.sort (PresentationInfoTimeAxisViewSorter ());
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
_time_axis_views.push_back (*i);
@@ -1397,7 +1397,7 @@ RegionMoveDrag::create_destination_time_axis (boost::shared_ptr<Region> region,
if ((Config->get_output_auto_connect() & AutoConnectMaster) && _editor->session()->master_out()) {
output_chan = _editor->session()->master_out()->n_inputs().n_audio();
}
- audio_tracks = _editor->session()->new_audio_track (region->n_channels(), output_chan, ARDOUR::Normal, 0, 1, region->name());
+ audio_tracks = _editor->session()->new_audio_track (region->n_channels(), output_chan, 0, 1, region->name(), PresentationInfo::max_order, ARDOUR::Normal);
RouteTimeAxisView* rtav = _editor->axis_view_from_route (audio_tracks.front());
if (rtav) {
rtav->set_height (original->current_height());
@@ -1406,7 +1406,7 @@ RegionMoveDrag::create_destination_time_axis (boost::shared_ptr<Region> region,
} else {
ChanCount one_midi_port (DataType::MIDI, 1);
list<boost::shared_ptr<MidiTrack> > midi_tracks;
- midi_tracks = _editor->session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(), ARDOUR::Normal, 0, 1, region->name());
+ midi_tracks = _editor->session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(), 0, 1, region->name(), PresentationInfo::max_order, ARDOUR::Normal);
RouteTimeAxisView* rtav = _editor->axis_view_from_route (midi_tracks.front());
if (rtav) {
rtav->set_height (original->current_height());
diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc
index 48fe9e231d..04446c7ce7 100644
--- a/gtk2_ardour/editor_group_tabs.cc
+++ b/gtk2_ardour/editor_group_tabs.cc
@@ -192,8 +192,3 @@ EditorGroupTabs::selected_routes () const
return rl;
}
-void
-EditorGroupTabs::sync_order_keys ()
-{
- _editor->_routes->sync_order_keys_from_treeview ();
-}
diff --git a/gtk2_ardour/editor_group_tabs.h b/gtk2_ardour/editor_group_tabs.h
index 7377911f8b..61e0ecfd0f 100644
--- a/gtk2_ardour/editor_group_tabs.h
+++ b/gtk2_ardour/editor_group_tabs.h
@@ -37,5 +37,4 @@ private:
}
void add_menu_items (Gtk::Menu *, ARDOUR::RouteGroup *);
ARDOUR::RouteList selected_routes () const;
- void sync_order_keys ();
};
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index eb84428f92..598725c72c 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -6153,12 +6153,6 @@ Editor::split_region ()
}
}
-struct EditorOrderRouteSorter {
- bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
- return a->order_key () < b->order_key ();
- }
-};
-
void
Editor::select_next_route()
{
diff --git a/gtk2_ardour/editor_pt_import.cc b/gtk2_ardour/editor_pt_import.cc
index 23a6fd2f06..d0bfdec27d 100644
--- a/gtk2_ardour/editor_pt_import.cc
+++ b/gtk2_ardour/editor_pt_import.cc
@@ -244,7 +244,7 @@ Editor::do_ptimport (std::string ptpath,
} else {
// Put on a new track
DEBUG_TRACE (DEBUG::FileUtils, string_compose ("\twav(%1) reg(%2) new_tr(%3)\n", a->reg.wave.filename.c_str(), a->reg.index, nth));
- list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (1, 2, Normal, 0, 1));
+ list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (1, 2, 0, 1, string(), PresentationInfo::max_order, Normal));
if (at.empty()) {
return;
}
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 7daeea3d7c..d28eb5d006 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -28,6 +28,7 @@
#include "pbd/unwind.h"
#include "ardour/debug.h"
+#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
#include "ardour/route.h"
#include "ardour/session.h"
@@ -313,9 +314,8 @@ EditorRoutes::EditorRoutes (Editor* e)
_display.set_enable_search (false);
- Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this), gui_context());
Route::PluginSetup.connect_same_thread (*this, boost::bind (&EditorRoutes::plugin_setup, this, _1, _2, _3));
-
+ Stripable::PresentationInfoChange.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_presentation_info, this), gui_context());
}
bool
@@ -623,27 +623,28 @@ EditorRoutes::row_deleted (Gtk::TreeModel::Path const &)
* when a route is actually removed. we don't differentiate between
* the two cases.
*
- * note that the sync_orders_keys() step may not actually change any
- * RID's (e.g. the last track may be removed, so all other tracks keep
- * the same RID), which means that no redisplay would happen. so we
- * have to force a redisplay.
+ * note that the sync_presentation_info_from_treeview() step may not
+ * actually change any presentation info (e.g. the last track may be
+ * removed, so all other tracks keep the same presentation info), which
+ * means that no redisplay would happen. so we have to force a
+ * redisplay.
*/
DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview row deleted\n");
DisplaySuspender ds;
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
void
EditorRoutes::reordered (TreeModel::Path const &, TreeModel::iterator const &, int* /*what*/)
{
- /* reordering implies that RID's will change, so sync_order_keys() will
- cause a redisplay.
+ /* reordering implies that RID's will change, so
+ sync_presentation_info_from_treeview() will cause a redisplay.
*/
DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview reordered\n");
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
void
@@ -691,7 +692,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
for (Gtk::TreeModel::Children::iterator it = _model->children().begin(); it != _model->children().end(); ++it) {
boost::shared_ptr<Route> r = (*it)[_columns.route];
- if (r->order_key() == (routes.front()->route()->order_key() + routes.size())) {
+ if (r->presentation_info().group_order() == (routes.front()->route()->presentation_info().group_order() + routes.size())) {
insert_iter = it;
break;
}
@@ -767,7 +768,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
/* now update route order keys from the treeview/track display order */
if (!from_scratch) {
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
}
@@ -862,7 +863,7 @@ EditorRoutes::update_visibility ()
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
void
@@ -905,60 +906,10 @@ EditorRoutes::reset_remote_control_ids ()
return;
}
- TreeModel::Children rows = _model->children();
-
- if (rows.empty()) {
- return;
- }
-
-
- DEBUG_TRACE (DEBUG::OrderKeys, "editor reset remote control ids\n");
-
- TreeModel::Children::iterator ri;
- bool rid_change = false;
- uint32_t rid = 1;
- uint32_t invisible_key = UINT32_MAX;
-
- for (ri = rows.begin(); ri != rows.end(); ++ri) {
-
- /* skip two special values */
-
- if (rid == Route::MasterBusRemoteControlID) {
- rid++;
- }
-
- if (rid == Route::MonitorBusRemoteControlID) {
- rid++;
- }
-
- boost::shared_ptr<Route> route = (*ri)[_columns.route];
- bool visible = (*ri)[_columns.visible];
-
- if (!route->is_master() && !route->is_monitor()) {
-
- uint32_t new_rid = (visible ? rid : invisible_key--);
-
- if (new_rid != route->remote_control_id()) {
- route->set_remote_control_id_explicit (new_rid);
- rid_change = true;
- }
-
- if (visible) {
- rid++;
- }
-
- }
- }
-
- if (rid_change) {
- /* tell the world that we changed the remote control IDs */
- _session->notify_remote_id_change ();
- }
+ sync_presentation_info_from_treeview ();
}
-
-
void
-EditorRoutes::sync_order_keys_from_treeview ()
+EditorRoutes::sync_presentation_info_from_treeview ()
{
if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
return;
@@ -970,60 +921,46 @@ EditorRoutes::sync_order_keys_from_treeview ()
return;
}
-
DEBUG_TRACE (DEBUG::OrderKeys, "editor sync order keys from treeview\n");
TreeModel::Children::iterator ri;
- bool changed = false;
- bool rid_change = false;
- uint32_t order = 0;
- uint32_t rid = 1;
- uint32_t invisible_key = UINT32_MAX;
+ bool change = false;
+ PresentationInfo::order_t order = 0;
+
+ /* hmm, problem ... editor doesn't represent all Stripables... we can't
+ reset the whole presentation order from here.
+ */
for (ri = rows.begin(); ri != rows.end(); ++ri) {
boost::shared_ptr<Route> route = (*ri)[_columns.route];
bool visible = (*ri)[_columns.visible];
- uint32_t old_key = route->order_key ();
-
- if (order != old_key) {
- route->set_order_key (order);
-
- changed = true;
+ if (route->presentation_info().special ()) {
+ continue;
}
- if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) {
-
- uint32_t new_rid = (visible ? rid : invisible_key--);
-
- if (new_rid != route->remote_control_id()) {
- route->set_remote_control_id_explicit (new_rid);
- rid_change = true;
- }
-
- if (visible) {
- rid++;
- }
+ if (!visible) {
+ route->presentation_info().set_flag (PresentationInfo::Hidden);
+ } else {
+ route->presentation_info().unset_flag (PresentationInfo::Hidden);
+ }
+ if (order != route->presentation_info().group_order()) {
+ route->set_presentation_group_order_explicit (order);
+ change = true;
}
++order;
}
- if (changed) {
- /* tell the world that we changed the editor sort keys */
- _session->sync_order_keys ();
- }
-
- if (rid_change) {
- /* tell the world that we changed the remote control IDs */
- _session->notify_remote_id_change ();
+ if (change) {
+ Stripable::PresentationInfoChange(); /* EMIT SIGNAL */
}
}
void
-EditorRoutes::sync_treeview_from_order_keys ()
+EditorRoutes::sync_treeview_from_presentation_info ()
{
/* Some route order key(s) have been changed, make sure that
we update out tree/list model and GUI to reflect the change.
@@ -1033,7 +970,7 @@ EditorRoutes::sync_treeview_from_order_keys ()
return;
}
- DEBUG_TRACE (DEBUG::OrderKeys, "editor sync model from order keys.\n");
+ DEBUG_TRACE (DEBUG::OrderKeys, "editor sync model from presentation info.\n");
/* we could get here after either a change in the Mixer or Editor sort
* order, but either way, the mixer order keys reflect the intended
@@ -1053,7 +990,11 @@ EditorRoutes::sync_treeview_from_order_keys ()
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
boost::shared_ptr<Route> route = (*ri)[_columns.route];
- sorted.push_back (OrderKeys (old_order, route->order_key ()));
+ sorted.push_back (OrderKeys (old_order, route->presentation_info().group_order()));
+ DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("build new order: route %3 old = %1 new = %1\n",
+ old_order,
+ route->presentation_info().group_order(),
+ route->name()));
}
SortByNewDisplayOrder cmp;
@@ -1128,7 +1069,7 @@ EditorRoutes::set_all_tracks_visibility (bool yn)
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
void
@@ -1193,7 +1134,7 @@ EditorRoutes::set_all_audio_midi_visibility (int tracks, bool yn)
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
void
@@ -1427,7 +1368,7 @@ EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path
return true;
}
-struct EditorOrderRouteSorter
+struct PresentationInfoRouteSorter
{
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
if (a->is_master()) {
@@ -1437,7 +1378,7 @@ struct EditorOrderRouteSorter
/* everything else before master */
return false;
}
- return a->order_key () < b->order_key ();
+ return a->presentation_info().global_order () < b->presentation_info().global_order ();
}
};
@@ -1453,7 +1394,7 @@ EditorRoutes::initial_display ()
RouteList r (*_session->get_routes());
- r.sort (EditorOrderRouteSorter ());
+ r.sort (PresentationInfoRouteSorter ());
_editor->add_routes (r);
}
@@ -1575,7 +1516,7 @@ EditorRoutes::move_selected_tracks (bool up)
}
for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
- uint32_t order = leading->second->order_key ();
+ uint32_t order = (uint32_t) leading->second->presentation_info().group_order ();
neworder.push_back (order);
}
@@ -1781,7 +1722,7 @@ EditorRoutes::show_tracks_with_regions_at_playhead ()
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
int
diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h
index 460f66af32..cd2e4deb43 100644
--- a/gtk2_ardour/editor_routes.h
+++ b/gtk2_ardour/editor_routes.h
@@ -61,7 +61,7 @@ public:
std::list<TimeAxisView*> views () const;
void hide_all_tracks (bool);
void clear ();
- void sync_order_keys_from_treeview ();
+ void sync_presentation_info_from_treeview ();
void reset_remote_control_ids ();
private:
@@ -76,7 +76,7 @@ private:
void on_tv_solo_safe_toggled (std::string const &);
void build_menu ();
void show_menu ();
- void sync_treeview_from_order_keys ();
+ void sync_treeview_from_presentation_info ();
void row_deleted (Gtk::TreeModel::Path const &);
void visible_changed (std::string const &);
void active_changed (std::string const &);
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index 64d17f9ae5..10dc282aa0 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -791,7 +791,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
RouteTimeAxisView* closest = 0;
int distance = INT_MAX;
- int key = rtv->route()->order_key ();
+ int key = rtv->route()->presentation_info().global_order ();
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
@@ -806,7 +806,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
if (result.second) {
/* newly added to already_in_selection */
- int d = artv->route()->order_key ();
+ int d = artv->route()->presentation_info().global_order ();
d -= key;
@@ -822,7 +822,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
/* now add all tracks between that one and this one */
- int okey = closest->route()->order_key ();
+ int okey = closest->route()->presentation_info().global_order ();
if (okey > key) {
swap (okey, key);
@@ -832,7 +832,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
RouteTimeAxisView* artv = dynamic_cast<RouteTimeAxisView*>(*x);
if (artv && artv != rtv) {
- int k = artv->route()->order_key ();
+ int k = artv->route()->presentation_info().global_order ();
if (k >= okey && k <= key) {
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index ba03d91e2d..ecc29757f2 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -107,7 +107,7 @@ EditorSummary::set_session (Session* s)
if (_session) {
Region::RegionPropertyChanged.connect (region_property_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
- Route::RemoteControlIDChange.connect (route_ctrl_id_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
+ Stripable::PresentationInfoChange.connect (route_ctrl_id_connection, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
_editor->playhead_cursor->PositionChanged.connect (position_connection, invalidator (*this), boost::bind (&EditorSummary::playhead_position_changed, this, _1), gui_context());
_session->StartTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
_session->EndTimeChanged.connect (_session_connections, invalidator (*this), boost::bind (&EditorSummary::set_background_dirty, this), gui_context());
diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc
index c411c2b22c..45fdc07c45 100644
--- a/gtk2_ardour/export_channel_selector.cc
+++ b/gtk2_ardour/export_channel_selector.cc
@@ -18,8 +18,6 @@
*/
-#include "export_channel_selector.h"
-
#include <algorithm>
#include "pbd/convert.h"
@@ -33,6 +31,9 @@
#include <sstream>
+#include "export_channel_selector.h"
+#include "route_sorter.h"
+
#include "i18n.h"
using namespace std;
@@ -40,12 +41,6 @@ using namespace Glib;
using namespace ARDOUR;
using namespace PBD;
-struct EditorOrderRouteSorter {
- bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
- return a->order_key () < b->order_key ();
- }
-};
-
PortExportChannelSelector::PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager) :
ExportChannelSelector (session, manager),
channels_label (_("Channels:"), Gtk::ALIGN_LEFT),
@@ -126,7 +121,7 @@ PortExportChannelSelector::fill_route_list ()
channel_view.add_route (master);
}
- routes.sort (EditorOrderRouteSorter ());
+ routes.sort (PresentationInfoSorter ());
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
if ((*it)->is_master () || (*it)->is_monitor ()) {
@@ -700,7 +695,7 @@ TrackExportChannelSelector::add_track (boost::shared_ptr<Route> route)
row[track_cols.selected] = false;
row[track_cols.label] = route->name();
row[track_cols.route] = route;
- row[track_cols.order_key] = route->order_key();
+ row[track_cols.order_key] = route->presentation_info().global_order();
}
void
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc
index a930fbbce4..e079aa1386 100644
--- a/gtk2_ardour/group_tabs.cc
+++ b/gtk2_ardour/group_tabs.cc
@@ -451,13 +451,13 @@ GroupTabs::un_subgroup (RouteGroup* g)
struct CollectSorter {
bool operator () (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
- return a->order_key () < b->order_key ();
+ return a->presentation_info () < b->presentation_info();
}
};
struct OrderSorter {
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
- return a->order_key () < b->order_key ();
+ return a->presentation_info() < b->presentation_info();
}
};
@@ -480,7 +480,7 @@ GroupTabs::collect (RouteGroup* g)
int coll = -1;
while (i != group_routes->end() && j != routes->end()) {
- int const k = (*j)->order_key ();
+ PresentationInfo::order_t const k = (*j)->presentation_info ().group_order();
if (*i == *j) {
@@ -491,21 +491,21 @@ GroupTabs::collect (RouteGroup* g)
--diff;
}
- (*j)->set_order_key (coll);
+ (*j)->set_presentation_group_order_explicit (coll);
++coll;
++i;
} else {
- (*j)->set_order_key (k + diff);
+ (*j)->set_presentation_group_order_explicit (k + diff);
}
++j;
}
- _session->sync_order_keys ();
+ _session->notify_presentation_info_change ();
}
void
diff --git a/gtk2_ardour/group_tabs.h b/gtk2_ardour/group_tabs.h
index e31ad9643e..325e3f7ee7 100644
--- a/gtk2_ardour/group_tabs.h
+++ b/gtk2_ardour/group_tabs.h
@@ -92,7 +92,6 @@ private:
virtual void add_menu_items (Gtk::Menu *, ARDOUR::RouteGroup *) {}
virtual ARDOUR::RouteList selected_routes () const = 0;
- virtual void sync_order_keys () = 0;
void new_from_selection ();
void new_from_rec_enabled ();
diff --git a/gtk2_ardour/luasignal_syms.h b/gtk2_ardour/luasignal_syms.h
index 85bed3fbc4..290db843ee 100644
--- a/gtk2_ardour/luasignal_syms.h
+++ b/gtk2_ardour/luasignal_syms.h
@@ -61,7 +61,6 @@ SESSION(PositionChanged, PositionChanged, 1)
SESSION(Located, Located, 0)
SESSION(RoutesReconnected, session_routes_reconnected, 0)
SESSION(RouteAdded, RouteAdded, 1)
-SESSION(RouteAddedOrRemoved, RouteAddedOrRemoved, 1)
SESSION(RouteGroupPropertyChanged, RouteGroupPropertyChanged, 1)
SESSION(RouteAddedToRouteGroup, RouteAddedToRouteGroup, 2)
SESSION(RouteRemovedFromRouteGroup, RouteRemovedFromRouteGroup, 2)
@@ -70,9 +69,6 @@ SESSION(RouteGroupAdded, route_group_added, 1)
SESSION(RouteGroupRemoved, route_group_removed, 0)
SESSION(RouteGroupsReordered, route_groups_reordered, 0)
-// route static globals
-STATIC(SyncOrderKeys, &Route::SyncOrderKeys, 0)
-
// plugin manager instance
STATIC(PluginListChanged, &(PluginManager::instance().PluginListChanged), 0)
STATIC(PluginStatusesChanged, &(PluginManager::instance().PluginStatusesChanged), 0)
diff --git a/gtk2_ardour/meter_strip.cc b/gtk2_ardour/meter_strip.cc
index b324a846ff..c8992ee0b2 100644
--- a/gtk2_ardour/meter_strip.cc
+++ b/gtk2_ardour/meter_strip.cc
@@ -801,12 +801,12 @@ MeterStrip::name_changed () {
}
name_label.set_text(_route->name ());
if (_session && _session->config.get_track_name_number()) {
- const int64_t track_number = _route->track_number ();
+ const uint64_t track_number = _route->track_number();
if (track_number == 0) {
number_label.set_text("-");
number_label.hide();
} else {
- number_label.set_text (PBD::to_string (abs(_route->track_number ()), std::dec));
+ number_label.set_text (PBD::to_string (track_number, std::dec));
number_label.show();
}
const int tnh = 4 + std::max(2u, _session->track_number_decimals()) * 8; // TODO 8 = max_width_of_digit_0_to_9()
diff --git a/gtk2_ardour/meterbridge.cc b/gtk2_ardour/meterbridge.cc
index 5906d7343a..f687d0c72d 100644
--- a/gtk2_ardour/meterbridge.cc
+++ b/gtk2_ardour/meterbridge.cc
@@ -40,7 +40,6 @@
#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
-#include "ardour/route_sorters.h"
#include "meterbridge.h"
@@ -124,7 +123,6 @@ Meterbridge::Meterbridge ()
signal_delete_event().connect (sigc::mem_fun (*this, &Meterbridge::hide_window));
signal_configure_event().connect (sigc::mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
- Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Meterbridge::sync_order_keys, this), gui_context());
MeterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Meterbridge::remove_strip, this, _1), gui_context());
MeterStrip::MetricChanged.connect (*this, invalidator (*this), boost::bind(&Meterbridge::resync_order, this), gui_context());
MeterStrip::ConfigurationChanged.connect (*this, invalidator (*this), boost::bind(&Meterbridge::queue_resize, this), gui_context());
@@ -400,6 +398,20 @@ Meterbridge::on_scroll()
metrics_right.set_metric_mode(mm_right, mt_right);
}
+struct PresentationInfoRouteSorter
+{
+ bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
+ if (a->is_master()) {
+ /* master before everything else */
+ return true;
+ } else if (b->is_master()) {
+ /* everything else before b */
+ return false;
+ }
+ return a->presentation_info() < b->presentation_info();
+ }
+};
+
void
Meterbridge::set_session (Session* s)
{
@@ -422,7 +434,7 @@ Meterbridge::set_session (Session* s)
_show_master = _session->config.get_show_master_on_meterbridge();
_show_midi = _session->config.get_show_midi_on_meterbridge();
- ARDOUR::SignalOrderRouteSorter sorter;
+ PresentationInfoRouteSorter sorter;
boost::shared_ptr<RouteList> routes = _session->get_routes();
RouteList copy(*routes);
diff --git a/gtk2_ardour/meterbridge.h b/gtk2_ardour/meterbridge.h
index 1709455ae4..5e06907917 100644
--- a/gtk2_ardour/meterbridge.h
+++ b/gtk2_ardour/meterbridge.h
@@ -107,7 +107,7 @@ class Meterbridge :
/* everything comes before b */
return true;
}
- return a->order_key () < b->order_key ();
+ return a->presentation_info() < b->presentation_info ();
}
};
diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc
index bccf649b42..e9977b0b51 100644
--- a/gtk2_ardour/mixer_group_tabs.cc
+++ b/gtk2_ardour/mixer_group_tabs.cc
@@ -193,8 +193,3 @@ MixerGroupTabs::selected_routes () const
return rl;
}
-void
-MixerGroupTabs::sync_order_keys ()
-{
- _mixer->sync_order_keys_from_treeview ();
-}
diff --git a/gtk2_ardour/mixer_group_tabs.h b/gtk2_ardour/mixer_group_tabs.h
index 5f15255c5c..8da5a1be49 100644
--- a/gtk2_ardour/mixer_group_tabs.h
+++ b/gtk2_ardour/mixer_group_tabs.h
@@ -36,7 +36,6 @@ private:
}
ARDOUR::RouteList selected_routes () const;
- void sync_order_keys ();
Mixer_UI* _mixer;
};
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 4d0c2c3e7f..9f5cb5684f 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -42,10 +42,10 @@
#include "ardour/amp.h"
#include "ardour/debug.h"
+#include "ardour/audio_track.h"
#include "ardour/midi_track.h"
#include "ardour/plugin_manager.h"
#include "ardour/route_group.h"
-#include "ardour/route_sorters.h"
#include "ardour/session.h"
#include "ardour/vca.h"
#include "ardour/vca_manager.h"
@@ -107,7 +107,7 @@ Mixer_UI::Mixer_UI ()
, _maximised (false)
, _show_mixer_list (true)
{
- Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_order_keys, this), gui_context());
+ Stripable::PresentationInfoChange.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_presentation_info, this), gui_context());
/* bindings was already set in MixerActor constructor */
@@ -427,7 +427,7 @@ Mixer_UI::add_strips (RouteList& routes)
nroutes++;
- if (r->order_key() == (routes.front()->order_key() + routes.size())) {
+ if (r->presentation_info().group_order() == (routes.front()->presentation_info().group_order() + routes.size())) {
insert_iter = it;
break;
}
@@ -512,7 +512,7 @@ Mixer_UI::add_strips (RouteList& routes)
no_track_list_redisplay = false;
track_display.set_model (track_model);
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
redisplay_track_list ();
}
@@ -576,69 +576,9 @@ Mixer_UI::remove_strip (MixerStrip* strip)
}
void
-Mixer_UI::reset_remote_control_ids ()
+Mixer_UI::sync_presentation_info_from_treeview ()
{
- if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) {
- return;
- }
-
- TreeModel::Children rows = track_model->children();
-
- if (rows.empty()) {
- return;
- }
-
- DEBUG_TRACE (DEBUG::OrderKeys, "mixer resets remote control ids after remote model change\n");
-
- TreeModel::Children::iterator ri;
- bool rid_change = false;
- uint32_t rid = 1;
- uint32_t invisible_key = UINT32_MAX;
-
- for (ri = rows.begin(); ri != rows.end(); ++ri) {
-
- /* skip two special values */
-
- if (rid == Route::MasterBusRemoteControlID) {
- rid++;
- }
-
- if (rid == Route::MonitorBusRemoteControlID) {
- rid++;
- }
-
- boost::shared_ptr<Route> route = (*ri)[track_columns.route];
- bool visible = (*ri)[track_columns.visible];
-
- if (!route) {
- continue;
- }
-
- if (!route->is_master() && !route->is_monitor()) {
-
- uint32_t new_rid = (visible ? rid : invisible_key--);
-
- if (new_rid != route->remote_control_id()) {
- route->set_remote_control_id_explicit (new_rid);
- rid_change = true;
- }
-
- if (visible) {
- rid++;
- }
- }
- }
-
- if (rid_change) {
- /* tell the world that we changed the remote control IDs */
- _session->notify_remote_id_change ();
- }
-}
-
-void
-Mixer_UI::sync_order_keys_from_treeview ()
-{
- if (ignore_reorder || !_session || _session->deletion_in_progress()) {
+ if (ignore_reorder || !_session || _session->deletion_in_progress() || (Config->get_remote_model() != MixerOrdered)) {
return;
}
@@ -651,58 +591,46 @@ Mixer_UI::sync_order_keys_from_treeview ()
DEBUG_TRACE (DEBUG::OrderKeys, "mixer sync order keys from model\n");
TreeModel::Children::iterator ri;
- bool changed = false;
- bool rid_change = false;
+ bool change = false;
uint32_t order = 0;
- uint32_t rid = 1;
- uint32_t invisible_key = UINT32_MAX;
for (ri = rows.begin(); ri != rows.end(); ++ri) {
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
bool visible = (*ri)[track_columns.visible];
+
if (!route) {
continue;
}
- uint32_t old_key = route->order_key ();
-
- if (order != old_key) {
- route->set_order_key (order);
- changed = true;
+ if (route->presentation_info().special()) {
+ continue;
}
- if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) {
-
- uint32_t new_rid = (visible ? rid : invisible_key--);
-
- if (new_rid != route->remote_control_id()) {
- route->set_remote_control_id_explicit (new_rid);
- rid_change = true;
- }
+ if (!visible) {
+ route->presentation_info().set_flag (PresentationInfo::Hidden);
+ } else {
+ route->presentation_info().unset_flag (PresentationInfo::Hidden);
+ }
- if (visible) {
- rid++;
- }
+ DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("route %1 old order %2 new order %3\n", route->name(), route->presentation_info().group_order(), order));
+ if (order != route->presentation_info().group_order()) {
+ route->set_presentation_group_order_explicit (order);
+ change = true;
}
++order;
}
- if (changed) {
- /* tell everyone that we changed the mixer sort keys */
- _session->sync_order_keys ();
- }
-
- if (rid_change) {
- /* tell the world that we changed the remote control IDs */
- _session->notify_remote_id_change ();
+ if (change) {
+ DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
+ _session->notify_presentation_info_change ();
}
}
void
-Mixer_UI::sync_treeview_from_order_keys ()
+Mixer_UI::sync_treeview_from_presentation_info ()
{
if (!_session || _session->deletion_in_progress()) {
return;
@@ -736,7 +664,7 @@ Mixer_UI::sync_treeview_from_order_keys ()
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
if (route) {
- max_route_order_key = max (route->order_key(), max_route_order_key);
+ max_route_order_key = max (route->presentation_info().group_order(), max_route_order_key);
}
}
@@ -749,7 +677,7 @@ Mixer_UI::sync_treeview_from_order_keys ()
*/
sorted.push_back (OrderKeys (old_order, max_route_order_key + ++vca_cnt));
} else {
- sorted.push_back (OrderKeys (old_order, route->order_key ()));
+ sorted.push_back (OrderKeys (old_order, route->presentation_info().group_order()));
}
}
@@ -1007,10 +935,10 @@ Mixer_UI::update_track_visibility ()
}
}
- /* force route order keys catch up with visibility changes
+ /* force presentation catch up with visibility changes
*/
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
redisplay_track_list ();
@@ -1207,7 +1135,7 @@ void
Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
{
DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n");
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
}
void
@@ -1221,7 +1149,7 @@ Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
*/
DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n");
- sync_order_keys_from_treeview ();
+ sync_presentation_info_from_treeview ();
if (_route_deletion_in_progress) {
redisplay_track_list ();
@@ -1302,8 +1230,10 @@ Mixer_UI::redisplay_track_list ()
if (n_masters == 0) {
UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::remove_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
+ vca_scroller.hide ();
} else {
UIConfiguration::instance().set_mixer_strip_visibility (VisibilityGroup::add_element (UIConfiguration::instance().get_mixer_strip_visibility(), X_("VCA")));
+ vca_scroller.show ();
}
_group_tabs->set_dirty ();
@@ -1336,12 +1266,19 @@ Mixer_UI::strip_width_changed ()
}
+struct PresentationInfoRouteSorter
+{
+ bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
+ return a->presentation_info().global_order () < b->presentation_info().global_order ();
+ }
+};
+
void
Mixer_UI::initial_track_display ()
{
boost::shared_ptr<RouteList> routes = _session->get_routes();
RouteList copy (*routes);
- ARDOUR::SignalOrderRouteSorter sorter;
+ PresentationInfoRouteSorter sorter;
copy.sort (sorter);
@@ -1355,8 +1292,6 @@ Mixer_UI::initial_track_display ()
add_strips (copy);
}
- _session->sync_order_keys ();
-
redisplay_track_list ();
}
@@ -2133,8 +2068,6 @@ Mixer_UI::parameter_changed (string const & p)
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
(*i)->set_width_enum (s ? Narrow : Wide, this);
}
- } else if (p == "remote-model") {
- reset_remote_control_ids ();
} else if (p == "use-monitor-bus") {
if (_session && !_session->monitor_out()) {
monitor_section_detached ();
diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h
index e8e7dc5864..413e5900f3 100644
--- a/gtk2_ardour/mixer_ui.h
+++ b/gtk2_ardour/mixer_ui.h
@@ -320,10 +320,8 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p
Width _strip_width;
- void sync_order_keys_from_treeview ();
- void sync_treeview_from_order_keys ();
- void reset_remote_control_ids ();
- void reset_order_keys ();
+ void sync_presentation_info_from_treeview ();
+ void sync_treeview_from_presentation_info ();
bool ignore_reorder;
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc
index 2d445dcbb2..b23ebd21a2 100644
--- a/gtk2_ardour/port_group.cc
+++ b/gtk2_ardour/port_group.cc
@@ -316,7 +316,7 @@ struct RouteIOs {
class RouteIOsComparator {
public:
bool operator() (RouteIOs const & a, RouteIOs const & b) {
- return a.route->order_key () < b.route->order_key ();
+ return a.route->presentation_info ().group_order() < b.route->presentation_info().group_order();
}
};
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index 1bfb920c3b..84349d8236 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -159,7 +159,7 @@ PortMatrix::init ()
_session->engine().PortRegisteredOrUnregistered.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
/* watch for route order keys changing, which changes the order of things in our global ports list(s) */
- Route::SyncOrderKeys.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports_proxy, this), gui_context());
+ Stripable::PresentationInfoChange.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports_proxy, this), gui_context());
/* Part 3: other stuff */
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 126e3af996..1175aa620a 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -2031,7 +2031,7 @@ RouteUI::open_remote_control_id_dialog ()
spin->set_digits (0);
spin->set_increments (1, 10);
spin->set_range (0, limit);
- spin->set_value (_route->remote_control_id());
+ spin->set_value (_route->presentation_info().group_order());
hbox->pack_start (*spin);
dialog.get_vbox()->pack_start (*hbox);
@@ -2043,14 +2043,14 @@ RouteUI::open_remote_control_id_dialog ()
l->set_markup (string_compose (_("The remote control ID of %1 is: %2\n\n\n"
"The remote control ID of %3 cannot be changed."),
Gtkmm2ext::markup_escape_text (_route->name()),
- _route->remote_control_id(),
+ _route->presentation_info().group_order(),
(_route->is_master() ? _("the master bus") : _("the monitor bus"))));
} else {
l->set_markup (string_compose (_("The remote control ID of %5 is: %2\n\n\n"
"Remote Control IDs are currently determined by track/bus ordering in %6.\n\n"
"%3Use the User Interaction tab of the Preferences window if you want to change this%4"),
(is_track() ? _("track") : _("bus")),
- _route->remote_control_id(),
+ _route->presentation_info().group_order(),
"<span size=\"small\" style=\"italic\">",
"</span>",
Gtkmm2ext::markup_escape_text (_route->name()),
@@ -2064,7 +2064,7 @@ RouteUI::open_remote_control_id_dialog ()
int const r = dialog.run ();
if (r == RESPONSE_ACCEPT && spin) {
- _route->set_remote_control_id (spin->get_value_as_int ());
+ _route->set_presentation_group_order_explicit (spin->get_value_as_int ());
}
}
diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc
index ba1b58d3bc..332ca230ff 100644
--- a/gtk2_ardour/vca_master_strip.cc
+++ b/gtk2_ardour/vca_master_strip.cc
@@ -16,6 +16,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <gtkmm/stock.h>
+
#include "pbd/convert.h"
#include "ardour/rc_configuration.h"
@@ -26,8 +28,9 @@
#include "gtkmm2ext/doi.h"
#include "gtkmm2ext/keyboard.h"
-#include "gui_thread.h"
+#include "ardour_dialog.h"
#include "floating_text_entry.h"
+#include "gui_thread.h"
#include "tooltips.h"
#include "vca_master_strip.h"
@@ -47,6 +50,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
, _vca (v)
, gain_meter (s, 250)
, context_menu (0)
+ , delete_dialog (0)
{
gain_meter.set_controls (boost::shared_ptr<Route>(),
boost::shared_ptr<PeakMeter>(),
@@ -150,6 +154,9 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
VCAMasterStrip::~VCAMasterStrip ()
{
+ delete delete_dialog;
+ delete context_menu;
+
CatchDeletion (this); /* EMIT SIGNAL */
}
@@ -193,10 +200,31 @@ VCAMasterStrip::name() const
void
VCAMasterStrip::hide_clicked ()
{
- /* get everything to deassign. This will also delete ourselves (when
- * idle) and that in turn will remove us from the Mixer GUI
- */
- _session->vca_manager().remove_vca (_vca);
+ if (!delete_dialog) {
+ delete_dialog = new MessageDialog (_("Removing a Master will deassign all slaves. Remove it anyway?"),
+ true, MESSAGE_WARNING, BUTTONS_YES_NO, true);
+ delete_dialog->signal_response().connect (sigc::mem_fun (*this, &VCAMasterStrip::hide_confirmation));
+ }
+
+ delete_dialog->set_position (Gtk::WIN_POS_MOUSE);
+ delete_dialog->present ();
+}
+
+void
+VCAMasterStrip::hide_confirmation (int response)
+{
+ delete_dialog->hide ();
+
+ switch (response) {
+ case RESPONSE_OK:
+ /* get everything to deassign. This will also delete ourselves (when
+ * idle) and that in turn will remove us from the Mixer GUI
+ */
+ _session->vca_manager().remove_vca (_vca);
+ break;
+ default:
+ break;
+ }
}
bool
diff --git a/gtk2_ardour/vca_master_strip.h b/gtk2_ardour/vca_master_strip.h
index b3fdc5d310..1e0779aa1f 100644
--- a/gtk2_ardour/vca_master_strip.h
+++ b/gtk2_ardour/vca_master_strip.h
@@ -68,6 +68,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
ArdourButton assign_button;
Gtk::Menu* context_menu;
PBD::ScopedConnectionList vca_connections;
+ Gtk::MessageDialog* delete_dialog;
void hide_clicked();
bool width_button_pressed (GdkEventButton *);
@@ -87,6 +88,7 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox
void vca_property_changed (PBD::PropertyChange const & what_changed);
void update_vca_name ();
void build_context_menu ();
+ void hide_confirmation (int);
void self_delete ();
};