2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2009 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <algorithm>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
2006-07-23 08:03:19 -04:00
|
|
|
#include <cassert>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-10-30 11:30:22 -04:00
|
|
|
#include "ardour/session.h"
|
2009-07-01 19:20:18 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "editor.h"
|
2007-03-18 02:07:08 -04:00
|
|
|
#include "keyboard.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "audio_time_axis.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "midi_time_axis.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "mixer_strip.h"
|
|
|
|
#include "gui_thread.h"
|
2007-03-18 02:07:08 -04:00
|
|
|
#include "actions.h"
|
2009-06-17 21:48:11 -04:00
|
|
|
#include "utils.h"
|
2009-06-20 09:41:55 -04:00
|
|
|
#include "editor_group_tabs.h"
|
2009-07-03 14:37:15 -04:00
|
|
|
#include "editor_routes.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/unknown_type.h"
|
2006-08-24 03:37:17 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/route.h"
|
2010-08-15 06:33:41 -04:00
|
|
|
#include "ardour/midi_track.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-11-21 12:20:57 -05:00
|
|
|
#include "gtkmm2ext/cell_renderer_pixbuf_multi.h"
|
2009-08-08 18:36:32 -04:00
|
|
|
#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "i18n.h"
|
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace ARDOUR;
|
Large nasty commit in the form of a 5000 line patch chock-full of completely
unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one)
Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now.
Relevant (significant) changes:
- Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...)
- IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why)
- AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output.
- (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise.
- MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here.
- Random cleanups and variable renamings etc. because I have OCD and can't help myself. :)
Known broken: Loading of sessions containing MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
2009-07-01 19:20:18 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2008-01-10 16:20:59 -05:00
|
|
|
using namespace Glib;
|
2009-12-04 17:51:32 -05:00
|
|
|
using Gtkmm2ext::Keyboard;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::EditorRoutes (Editor* e)
|
|
|
|
: EditorComponent (e),
|
2009-07-01 19:20:18 -04:00
|
|
|
_ignore_reorder (false),
|
|
|
|
_no_redisplay (false),
|
|
|
|
_redisplay_does_not_sync_order_keys (false),
|
|
|
|
_redisplay_does_not_reset_order_keys (false),
|
|
|
|
_menu (0)
|
|
|
|
{
|
|
|
|
_scroller.add (_display);
|
|
|
|
_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
|
|
|
|
|
|
|
|
_model = ListStore::create (_columns);
|
|
|
|
_display.set_model (_model);
|
|
|
|
|
2009-11-16 08:35:00 -05:00
|
|
|
// Record enable toggle
|
2010-08-15 06:33:41 -04:00
|
|
|
CellRendererPixbufMulti* rec_col_renderer = manage (new CellRendererPixbufMulti());
|
2009-07-01 19:20:18 -04:00
|
|
|
|
2010-08-15 06:33:41 -04:00
|
|
|
rec_col_renderer->set_pixbuf (0, ::get_icon("act-disabled"));
|
|
|
|
rec_col_renderer->set_pixbuf (1, ::get_icon("rec-in-progress"));
|
|
|
|
rec_col_renderer->set_pixbuf (2, ::get_icon("rec-enabled"));
|
|
|
|
rec_col_renderer->set_pixbuf (3, ::get_icon("step-editing"));
|
|
|
|
rec_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_rec_enable_changed));
|
2009-07-01 19:20:18 -04:00
|
|
|
|
2009-11-30 14:48:50 -05:00
|
|
|
TreeViewColumn* rec_state_column = manage (new TreeViewColumn("R", *rec_col_renderer));
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2010-08-15 06:33:41 -04:00
|
|
|
rec_state_column->add_attribute(rec_col_renderer->property_state(), _columns.rec_state);
|
2009-07-01 19:20:18 -04:00
|
|
|
rec_state_column->add_attribute(rec_col_renderer->property_visible(), _columns.is_track);
|
2010-01-22 12:23:58 -05:00
|
|
|
rec_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
rec_state_column->set_alignment(ALIGN_CENTER);
|
|
|
|
rec_state_column->set_expand(false);
|
|
|
|
rec_state_column->set_fixed_width(15);
|
2009-07-01 19:20:18 -04:00
|
|
|
|
2009-11-16 08:35:00 -05:00
|
|
|
// Mute enable toggle
|
2009-11-21 12:20:57 -05:00
|
|
|
CellRendererPixbufMulti* mute_col_renderer = manage (new CellRendererPixbufMulti());
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2009-11-21 12:20:57 -05:00
|
|
|
mute_col_renderer->set_pixbuf (0, ::get_icon("act-disabled"));
|
|
|
|
mute_col_renderer->set_pixbuf (1, ::get_icon("mute-enabled"));
|
2009-12-11 18:29:48 -05:00
|
|
|
mute_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled));
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2009-11-30 14:48:50 -05:00
|
|
|
TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer));
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2009-11-21 12:20:57 -05:00
|
|
|
mute_state_column->add_attribute(mute_col_renderer->property_state(), _columns.mute_state);
|
2010-01-22 12:23:58 -05:00
|
|
|
mute_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
mute_state_column->set_alignment(ALIGN_CENTER);
|
|
|
|
mute_state_column->set_expand(false);
|
|
|
|
mute_state_column->set_fixed_width(15);
|
2009-11-16 08:35:00 -05:00
|
|
|
|
|
|
|
// Solo enable toggle
|
2009-11-21 12:20:57 -05:00
|
|
|
CellRendererPixbufMulti* solo_col_renderer = manage (new CellRendererPixbufMulti());
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2009-11-21 12:20:57 -05:00
|
|
|
solo_col_renderer->set_pixbuf (0, ::get_icon("act-disabled"));
|
|
|
|
solo_col_renderer->set_pixbuf (1, ::get_icon("solo-enabled"));
|
2009-12-11 18:29:48 -05:00
|
|
|
solo_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_enable_toggled));
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2009-11-30 14:48:50 -05:00
|
|
|
TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer));
|
2009-11-16 08:35:00 -05:00
|
|
|
|
2009-11-21 12:20:57 -05:00
|
|
|
solo_state_column->add_attribute(solo_col_renderer->property_state(), _columns.solo_state);
|
2010-01-22 12:23:58 -05:00
|
|
|
solo_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
solo_state_column->set_alignment(ALIGN_CENTER);
|
|
|
|
solo_state_column->set_expand(false);
|
|
|
|
solo_state_column->set_fixed_width(15);
|
2009-11-30 14:48:50 -05:00
|
|
|
|
2009-12-10 15:51:35 -05:00
|
|
|
// Solo isolate toggle
|
|
|
|
CellRendererPixbufMulti* solo_iso_renderer = manage (new CellRendererPixbufMulti());
|
|
|
|
|
|
|
|
solo_iso_renderer->set_pixbuf (0, ::get_icon("act-disabled"));
|
|
|
|
solo_iso_renderer->set_pixbuf (1, ::get_icon("solo-isolated"));
|
2009-12-11 18:29:48 -05:00
|
|
|
solo_iso_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_isolate_toggled));
|
2009-12-10 15:51:35 -05:00
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
TreeViewColumn* solo_isolate_state_column = manage (new TreeViewColumn("SI", *solo_iso_renderer));
|
2009-12-10 15:51:35 -05:00
|
|
|
|
|
|
|
solo_isolate_state_column->add_attribute(solo_iso_renderer->property_state(), _columns.solo_isolate_state);
|
2010-01-22 12:23:58 -05:00
|
|
|
solo_isolate_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
solo_isolate_state_column->set_alignment(ALIGN_CENTER);
|
|
|
|
solo_isolate_state_column->set_expand(false);
|
|
|
|
solo_isolate_state_column->set_fixed_width(15);
|
2009-12-10 15:51:35 -05:00
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
// Solo safe toggle
|
|
|
|
CellRendererPixbufMulti* solo_safe_renderer = manage (new CellRendererPixbufMulti ());
|
|
|
|
|
|
|
|
solo_safe_renderer->set_pixbuf (0, ::get_icon("act-disabled"));
|
|
|
|
solo_safe_renderer->set_pixbuf (1, ::get_icon("solo-enabled"));
|
|
|
|
solo_safe_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_safe_toggled));
|
|
|
|
|
|
|
|
TreeViewColumn* solo_safe_state_column = manage (new TreeViewColumn(_("SS"), *solo_safe_renderer));
|
|
|
|
solo_safe_state_column->add_attribute(solo_safe_renderer->property_state(), _columns.solo_safe_state);
|
|
|
|
solo_safe_state_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
solo_safe_state_column->set_alignment(ALIGN_CENTER);
|
|
|
|
solo_safe_state_column->set_expand(false);
|
|
|
|
solo_safe_state_column->set_fixed_width(22);
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_display.append_column (*rec_state_column);
|
2009-11-16 08:35:00 -05:00
|
|
|
_display.append_column (*mute_state_column);
|
|
|
|
_display.append_column (*solo_state_column);
|
2009-12-10 15:51:35 -05:00
|
|
|
_display.append_column (*solo_isolate_state_column);
|
2010-04-05 16:08:37 -04:00
|
|
|
_display.append_column (*solo_safe_state_column);
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_display.append_column (_("Name"), _columns.text);
|
2010-01-24 21:03:24 -05:00
|
|
|
_display.append_column (_("V"), _columns.visible);
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_display.set_headers_visible (true);
|
|
|
|
_display.set_name ("TrackListDisplay");
|
2009-11-11 19:17:45 -05:00
|
|
|
_display.get_selection()->set_mode (SELECTION_SINGLE);
|
2009-07-01 19:20:18 -04:00
|
|
|
_display.set_reorderable (true);
|
|
|
|
_display.set_rules_hint (true);
|
|
|
|
_display.set_size_request (100, -1);
|
|
|
|
_display.add_object_drag (_columns.route.index(), "routes");
|
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
CellRendererText* name_cell = dynamic_cast<CellRendererText*> (_display.get_column_cell_renderer (5));
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-11-11 19:17:45 -05:00
|
|
|
assert (name_cell);
|
2009-11-24 18:59:15 -05:00
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
TreeViewColumn* name_column = _display.get_column (5);
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-11-24 18:59:15 -05:00
|
|
|
assert (name_column);
|
|
|
|
|
|
|
|
name_column->add_attribute (name_cell->property_editable(), _columns.name_editable);
|
2010-01-22 12:23:58 -05:00
|
|
|
name_column->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
name_column->set_expand(true);
|
|
|
|
name_column->set_min_width(50);
|
|
|
|
|
2009-11-11 19:17:45 -05:00
|
|
|
name_cell->property_editable() = true;
|
2009-12-11 18:29:48 -05:00
|
|
|
name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRoutes::name_edit));
|
2009-11-11 19:17:45 -05:00
|
|
|
|
2010-01-22 12:23:58 -05:00
|
|
|
// Set the visible column cell renderer to radio toggle
|
2010-04-05 16:08:37 -04:00
|
|
|
CellRendererToggle* visible_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (6));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
visible_cell->property_activatable() = true;
|
|
|
|
visible_cell->property_radio() = false;
|
2009-12-11 18:29:48 -05:00
|
|
|
visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRoutes::visible_changed));
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
TreeViewColumn* visible_col = dynamic_cast<TreeViewColumn*> (_display.get_column (6));
|
2010-01-22 12:23:58 -05:00
|
|
|
visible_col->set_expand(false);
|
2010-01-24 21:03:24 -05:00
|
|
|
visible_col->set_sizing(TREE_VIEW_COLUMN_FIXED);
|
|
|
|
visible_col->set_fixed_width(30);
|
|
|
|
visible_col->set_alignment(ALIGN_CENTER);
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
_model->signal_row_deleted().connect (sigc::mem_fun (*this, &EditorRoutes::route_deleted));
|
|
|
|
_model->signal_rows_reordered().connect (sigc::mem_fun (*this, &EditorRoutes::reordered));
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
_display.signal_button_press_event().connect (sigc::mem_fun (*this, &EditorRoutes::button_press), false);
|
2009-07-01 19:20:18 -04:00
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, ui_bind (&EditorRoutes::sync_order_keys, this, _1), gui_context());
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
EditorRoutes::set_session (Session* s)
|
2009-07-04 09:44:01 -04:00
|
|
|
{
|
2010-07-19 17:47:07 -04:00
|
|
|
SessionHandlePtr::set_session (s);
|
2009-07-04 09:44:01 -04:00
|
|
|
|
|
|
|
initial_display ();
|
2009-11-25 22:02:16 -05:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
2010-03-30 11:18:43 -04:00
|
|
|
_session->SoloChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::solo_changed_so_update_mute, this), gui_context());
|
2010-08-15 06:33:41 -04:00
|
|
|
_session->RecordStateChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
|
2009-12-17 13:24:23 -05:00
|
|
|
}
|
2009-07-04 09:44:01 -04:00
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2010-08-15 06:33:41 -04:00
|
|
|
EditorRoutes::on_tv_rec_enable_changed (Glib::ustring const & path_string)
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
|
|
|
// Get the model row that has been toggled.
|
|
|
|
Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
|
|
|
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
|
2009-07-01 19:20:18 -04:00
|
|
|
|
|
|
|
if (atv != 0 && atv->is_audio_track()){
|
2009-12-10 12:45:18 -05:00
|
|
|
boost::shared_ptr<RouteList> rl (new RouteList);
|
|
|
|
rl->push_back (atv->route());
|
2010-07-24 12:40:56 -04:00
|
|
|
_session->set_record_enabled (rl, !atv->track()->record_enabled(), Session::rt_cleanup);
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
|
|
|
}
|
2006-07-27 21:08:57 -04:00
|
|
|
|
2009-11-16 08:35:00 -05:00
|
|
|
void
|
|
|
|
EditorRoutes::on_tv_mute_enable_toggled (Glib::ustring const & path_string)
|
|
|
|
{
|
|
|
|
// Get the model row that has been toggled.
|
|
|
|
Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
|
|
|
|
|
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
|
|
|
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
|
|
|
|
|
2009-11-25 22:02:16 -05:00
|
|
|
if (atv != 0) {
|
2009-12-10 12:45:18 -05:00
|
|
|
boost::shared_ptr<RouteList> rl (new RouteList);
|
|
|
|
rl->push_back (atv->route());
|
|
|
|
_session->set_mute (rl, !atv->route()->muted(), Session::rt_cleanup);
|
2009-11-16 08:35:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EditorRoutes::on_tv_solo_enable_toggled (Glib::ustring const & path_string)
|
|
|
|
{
|
|
|
|
// Get the model row that has been toggled.
|
|
|
|
Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
|
|
|
|
|
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
|
|
|
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
|
|
|
|
|
2009-11-25 22:02:16 -05:00
|
|
|
if (atv != 0) {
|
2009-12-10 12:45:18 -05:00
|
|
|
boost::shared_ptr<RouteList> rl (new RouteList);
|
|
|
|
rl->push_back (atv->route());
|
|
|
|
_session->set_solo (rl, !atv->route()->soloed(), Session::rt_cleanup);
|
2009-11-16 08:35:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-10 15:51:35 -05:00
|
|
|
void
|
|
|
|
EditorRoutes::on_tv_solo_isolate_toggled (Glib::ustring const & path_string)
|
|
|
|
{
|
|
|
|
// Get the model row that has been toggled.
|
|
|
|
Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
|
|
|
|
|
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
|
|
|
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
|
|
|
|
|
|
|
|
if (atv != 0) {
|
|
|
|
atv->route()->set_solo_isolated (!atv->route()->solo_isolated(), this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
void
|
|
|
|
EditorRoutes::on_tv_solo_safe_toggled (Glib::ustring const & path_string)
|
|
|
|
{
|
|
|
|
// Get the model row that has been toggled.
|
|
|
|
Gtk::TreeModel::Row row = *_model->get_iter (Gtk::TreeModel::Path (path_string));
|
|
|
|
|
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
|
|
|
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
|
|
|
|
|
|
|
|
if (atv != 0) {
|
|
|
|
atv->route()->set_solo_safe (!atv->route()->solo_safe(), this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::build_menu ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
using namespace Menu_Helpers;
|
|
|
|
using namespace Gtk;
|
|
|
|
|
|
|
|
_menu = new Menu;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
MenuList& items = _menu->items();
|
|
|
|
_menu->set_name ("ArdourContextMenu");
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Show All"), sigc::mem_fun (*this, &EditorRoutes::show_all_routes)));
|
|
|
|
items.push_back (MenuElem (_("Hide All"), sigc::mem_fun (*this, &EditorRoutes::hide_all_routes)));
|
|
|
|
items.push_back (MenuElem (_("Show All Audio Tracks"), sigc::mem_fun (*this, &EditorRoutes::show_all_audiotracks)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Audio Tracks"), sigc::mem_fun (*this, &EditorRoutes::hide_all_audiotracks)));
|
|
|
|
items.push_back (MenuElem (_("Show All Audio Busses"), sigc::mem_fun (*this, &EditorRoutes::show_all_audiobus)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Audio Busses"), sigc::mem_fun (*this, &EditorRoutes::hide_all_audiobus)));
|
2010-06-05 20:56:19 -04:00
|
|
|
items.push_back (MenuElem (_("Show All Midi Tracks"), sigc::mem_fun (*this, &EditorRoutes::show_all_miditracks)));
|
|
|
|
items.push_back (MenuElem (_("Hide All Midi Tracks"), sigc::mem_fun (*this, &EditorRoutes::hide_all_miditracks)));
|
2009-12-11 18:29:48 -05:00
|
|
|
items.push_back (MenuElem (_("Show Tracks With Regions Under Playhead"), sigc::mem_fun (*this, &EditorRoutes::show_tracks_with_regions_at_playhead)));
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::show_menu ()
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
|
|
|
if (_menu == 0) {
|
|
|
|
build_menu ();
|
|
|
|
}
|
2009-06-09 16:21:19 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_menu->popup (1, gtk_get_current_event_time());
|
|
|
|
}
|
2009-06-09 16:21:19 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::redisplay ()
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_no_redisplay || !_session) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
uint32_t position;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView *tv = (*i)[_columns.tv];
|
2009-07-01 19:20:18 -04:00
|
|
|
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
|
|
|
|
|
|
|
if (tv == 0) {
|
|
|
|
// just a "title" row
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_redisplay_does_not_reset_order_keys) {
|
|
|
|
/* this reorder is caused by user action, so reassign sort order keys
|
|
|
|
to tracks.
|
|
|
|
*/
|
2009-07-04 08:40:26 -04:00
|
|
|
route->set_order_key (N_ ("editor"), n);
|
2006-08-24 03:37:17 -04:00
|
|
|
}
|
2009-07-01 19:20:18 -04:00
|
|
|
|
|
|
|
bool visible = (*i)[_columns.visible];
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
/* show or hide the TimeAxisView */
|
2009-07-01 19:20:18 -04:00
|
|
|
if (visible) {
|
|
|
|
tv->set_marked_for_display (true);
|
|
|
|
position += tv->show_at (position, n, &_editor->edit_controls_vbox);
|
|
|
|
tv->clip_to_viewport ();
|
2006-08-24 03:37:17 -04:00
|
|
|
} else {
|
2009-07-01 19:20:18 -04:00
|
|
|
tv->set_marked_for_display (false);
|
|
|
|
tv->hide ();
|
2006-08-24 03:37:17 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
n++;
|
|
|
|
}
|
2008-09-12 05:01:52 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
/* whenever we go idle, update the track view list to reflect the new order.
|
|
|
|
we can't do this here, because we could mess up something that is traversing
|
|
|
|
the track order and has caused a redisplay of the list.
|
|
|
|
*/
|
2009-12-11 18:29:48 -05:00
|
|
|
Glib::signal_idle().connect (sigc::mem_fun (*_editor, &Editor::sync_track_view_list_and_routes));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_editor->full_canvas_height = position + _editor->canvas_timebars_vsize;
|
|
|
|
_editor->vertical_adjustment.set_upper (_editor->full_canvas_height);
|
2007-11-06 07:53:04 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
if ((_editor->vertical_adjustment.get_value() + _editor->_canvas_height) > _editor->vertical_adjustment.get_upper()) {
|
2009-10-14 12:10:01 -04:00
|
|
|
/*
|
2009-07-01 19:20:18 -04:00
|
|
|
We're increasing the size of the canvas while the bottom is visible.
|
|
|
|
We scroll down to keep in step with the controls layout.
|
|
|
|
*/
|
|
|
|
_editor->vertical_adjustment.set_value (_editor->full_canvas_height - _editor->_canvas_height);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
if (!_redisplay_does_not_reset_order_keys && !_redisplay_does_not_sync_order_keys) {
|
2009-07-04 09:44:01 -04:00
|
|
|
_session->sync_order_keys (N_ ("editor"));
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
EditorRoutes::route_deleted (Gtk::TreeModel::Path const &)
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
2009-12-22 15:21:43 -05:00
|
|
|
if (!_session || _session->deletion_in_progress()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this could require an order reset & sync */
|
2009-07-04 09:44:01 -04:00
|
|
|
_session->set_remote_control_ids();
|
2009-07-01 19:20:18 -04:00
|
|
|
_ignore_reorder = true;
|
|
|
|
redisplay ();
|
|
|
|
_ignore_reorder = false;
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
void
|
2009-11-30 14:48:50 -05:00
|
|
|
EditorRoutes::visible_changed (Glib::ustring const & path)
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
2009-12-22 15:21:43 -05:00
|
|
|
if (_session && _session->deletion_in_progress()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-11-30 14:48:50 -05:00
|
|
|
TreeIter iter;
|
|
|
|
|
|
|
|
if ((iter = _model->get_iter (path))) {
|
|
|
|
TimeAxisView* tv = (*iter)[_columns.tv];
|
|
|
|
if (tv) {
|
|
|
|
bool visible = (*iter)[_columns.visible];
|
|
|
|
(*iter)[_columns.visible] = !visible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_redisplay_does_not_reset_order_keys = true;
|
2009-07-04 09:44:01 -04:00
|
|
|
_session->set_remote_control_ids();
|
2009-07-01 19:20:18 -04:00
|
|
|
redisplay ();
|
|
|
|
_redisplay_does_not_reset_order_keys = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-09 13:58:13 -04:00
|
|
|
EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
|
|
|
TreeModel::Row row;
|
|
|
|
|
|
|
|
_redisplay_does_not_sync_order_keys = true;
|
|
|
|
suspend_redisplay ();
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
for (list<RouteTimeAxisView*>::iterator x = routes.begin(); x != routes.end(); ++x) {
|
2009-07-01 19:20:18 -04:00
|
|
|
|
|
|
|
row = *(_model->append ());
|
|
|
|
|
|
|
|
row[_columns.text] = (*x)->route()->name();
|
|
|
|
row[_columns.visible] = (*x)->marked_for_display();
|
|
|
|
row[_columns.tv] = *x;
|
|
|
|
row[_columns.route] = (*x)->route ();
|
|
|
|
row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0);
|
2010-01-22 12:23:58 -05:00
|
|
|
row[_columns.mute_state] = (*x)->route()->muted();
|
|
|
|
row[_columns.solo_state] = (*x)->route()->soloed();
|
|
|
|
row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated();
|
2010-04-05 16:08:37 -04:00
|
|
|
row[_columns.solo_safe_state] = (*x)->route()->solo_safe();
|
2010-02-02 20:23:38 -05:00
|
|
|
row[_columns.name_editable] = true;
|
2009-07-01 19:20:18 -04:00
|
|
|
|
|
|
|
_ignore_reorder = true;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
/* added a new fresh one at the end */
|
2009-07-04 08:40:26 -04:00
|
|
|
if ((*x)->route()->order_key (N_ ("editor")) == -1) {
|
|
|
|
(*x)->route()->set_order_key (N_ ("editor"), _model->children().size()-1);
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_ignore_reorder = false;
|
|
|
|
|
|
|
|
boost::weak_ptr<Route> wr ((*x)->route());
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
(*x)->route()->gui_changed.connect (*this, MISSING_INVALIDATOR, ui_bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
|
|
|
|
(*x)->route()->PropertyChanged.connect (*this, MISSING_INVALIDATOR, ui_bind (&EditorRoutes::route_property_changed, this, _1, wr), gui_context());
|
2009-06-10 21:05:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
if ((*x)->is_track()) {
|
|
|
|
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> ((*x)->route());
|
2010-04-21 16:42:22 -04:00
|
|
|
t->RecordEnableChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
2009-11-25 22:02:16 -05:00
|
|
|
|
2010-08-15 06:33:41 -04:00
|
|
|
if ((*x)->is_midi_track()) {
|
|
|
|
boost::shared_ptr<MidiTrack> t = boost::dynamic_pointer_cast<MidiTrack> ((*x)->route());
|
|
|
|
t->StepEditStatusChange.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_rec_display, this), gui_context());
|
|
|
|
}
|
|
|
|
|
2010-03-30 11:18:43 -04:00
|
|
|
(*x)->route()->mute_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_mute_display, this), gui_context());
|
2010-04-26 23:10:53 -04:00
|
|
|
(*x)->route()->solo_changed.connect (*this, MISSING_INVALIDATOR, ui_bind (&EditorRoutes::update_solo_display, this, _1), gui_context());
|
2010-03-30 11:18:43 -04:00
|
|
|
(*x)->route()->solo_isolated_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_isolate_display, this), gui_context());
|
2010-04-05 16:08:37 -04:00
|
|
|
(*x)->route()->solo_safe_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::update_solo_safe_display, this), gui_context());
|
2009-07-01 19:20:18 -04:00
|
|
|
}
|
|
|
|
|
2009-11-24 18:59:15 -05:00
|
|
|
update_rec_display ();
|
2010-01-14 19:06:11 -05:00
|
|
|
update_mute_display ();
|
2010-04-26 23:10:53 -04:00
|
|
|
update_solo_display (true);
|
2010-01-14 19:06:11 -05:00
|
|
|
update_solo_isolate_display ();
|
2010-04-05 16:08:37 -04:00
|
|
|
update_solo_safe_display ();
|
2009-07-01 19:20:18 -04:00
|
|
|
resume_redisplay ();
|
|
|
|
_redisplay_does_not_sync_order_keys = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-22 15:21:43 -05:00
|
|
|
EditorRoutes::handle_gui_changes (string const & what, void*)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRoutes::handle_gui_changes, what, src)
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (what == "track_height") {
|
2009-10-14 12:10:01 -04:00
|
|
|
/* Optional :make tracks change height while it happens, instead
|
2008-09-10 11:03:30 -04:00
|
|
|
of on first-idle
|
|
|
|
*/
|
2009-06-12 15:05:16 -04:00
|
|
|
//update_canvas_now ();
|
2009-07-01 19:20:18 -04:00
|
|
|
redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
if (what == "visible_tracks") {
|
2009-07-01 19:20:18 -04:00
|
|
|
redisplay ();
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2009-07-09 13:58:13 -04:00
|
|
|
EditorRoutes::route_removed (TimeAxisView *tv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRoutes::route_removed, tv)
|
2005-10-26 14:12:00 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator ri;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
/* the core model has changed, there is no need to sync
|
2008-12-08 13:16:12 -05:00
|
|
|
view orders.
|
|
|
|
*/
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_redisplay_does_not_sync_order_keys = true;
|
2007-11-06 07:53:04 -05:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
2009-07-09 13:58:13 -04:00
|
|
|
if ((*ri)[_columns.tv] == tv) {
|
2009-07-01 19:20:18 -04:00
|
|
|
_model->erase (ri);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_redisplay_does_not_sync_order_keys = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-02-19 13:09:08 -05:00
|
|
|
EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Route> r)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-02-19 13:09:08 -05:00
|
|
|
if (!what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &EditorRoutes::route_name_changed, r)
|
2009-07-01 19:20:18 -04:00
|
|
|
|
|
|
|
boost::shared_ptr<Route> route = r.lock ();
|
2010-02-19 13:09:08 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
if (!route) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-07-01 19:20:18 -04:00
|
|
|
boost::shared_ptr<Route> t = (*i)[_columns.route];
|
|
|
|
if (t == route) {
|
|
|
|
(*i)[_columns.text] = route->name();
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::update_visibility ()
|
2008-09-10 11:03:30 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2008-09-10 11:03:30 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-07-01 19:20:18 -04:00
|
|
|
|
|
|
|
suspend_redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView *tv = (*i)[_columns.tv];
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = tv->marked_for_display ();
|
2008-09-12 05:01:52 -04:00
|
|
|
cerr << "marked " << tv->name() << " for display = " << tv->marked_for_display() << endl;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
resume_redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-09 13:58:13 -04:00
|
|
|
EditorRoutes::hide_track_in_display (TimeAxisView& tv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
if ((*i)[_columns.tv] == &tv) {
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = false;
|
2006-01-09 23:25:47 -05:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
2010-05-22 21:50:59 -04:00
|
|
|
|
|
|
|
redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-09 13:58:13 -04:00
|
|
|
EditorRoutes::show_track_in_display (TimeAxisView& tv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
if ((*i)[_columns.tv] == &tv) {
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = true;
|
2006-01-09 23:25:47 -05:00
|
|
|
break;
|
2005-10-26 14:12:00 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2010-05-22 21:50:59 -04:00
|
|
|
|
|
|
|
redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
EditorRoutes::reordered (TreeModel::Path const &, TreeModel::iterator const &, int* /*what*/)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-08-10 17:13:33 -04:00
|
|
|
/** If src != "editor", take editor order keys from each route and use them to rearrange the
|
2009-07-04 09:44:01 -04:00
|
|
|
* route list so that the visual arrangement of routes matches the order keys from the routes.
|
|
|
|
*/
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
2009-07-04 08:40:26 -04:00
|
|
|
EditorRoutes::sync_order_keys (string const & src)
|
2007-10-11 18:07:47 -04:00
|
|
|
{
|
|
|
|
vector<int> neworder;
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2007-10-11 18:07:47 -04:00
|
|
|
TreeModel::Children::iterator ri;
|
|
|
|
|
2009-11-25 09:34:42 -05:00
|
|
|
if (src == N_ ("editor") || !_session || (_session->state_of_the_state() & (Session::Loading|Session::Deletion)) || rows.empty()) {
|
2007-10-11 18:07:47 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
|
|
|
neworder.push_back (0);
|
|
|
|
}
|
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
bool changed = false;
|
|
|
|
int order;
|
|
|
|
|
|
|
|
for (order = 0, ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
|
2009-07-01 19:20:18 -04:00
|
|
|
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
2008-12-08 13:16:12 -05:00
|
|
|
|
|
|
|
int old_key = order;
|
2009-07-04 08:40:26 -04:00
|
|
|
int new_key = route->order_key (N_ ("editor"));
|
2008-12-08 13:16:12 -05:00
|
|
|
|
|
|
|
neworder[new_key] = old_key;
|
|
|
|
|
|
|
|
if (new_key != old_key) {
|
|
|
|
changed = true;
|
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
if (changed) {
|
2009-07-01 19:20:18 -04:00
|
|
|
_redisplay_does_not_reset_order_keys = true;
|
|
|
|
_model->reorder (neworder);
|
|
|
|
_redisplay_does_not_reset_order_keys = false;
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-04-15 14:04:23 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
EditorRoutes::hide_all_tracks (bool /*with_select*/)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
suspend_redisplay ();
|
2006-01-09 23:25:47 -05:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Row row = (*i);
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
2006-01-09 23:25:47 -05:00
|
|
|
|
|
|
|
if (tv == 0) {
|
|
|
|
continue;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
row[_columns.visible] = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-01-09 23:25:47 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
resume_redisplay ();
|
2006-01-09 23:25:47 -05:00
|
|
|
|
|
|
|
/* XXX this seems like a hack and half, but its not clear where to put this
|
|
|
|
otherwise.
|
|
|
|
*/
|
|
|
|
|
2008-09-10 17:27:39 -04:00
|
|
|
//reset_scrolling_region ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::set_all_tracks_visibility (bool yn)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
suspend_redisplay ();
|
2006-01-09 23:25:47 -05:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2006-01-09 23:25:47 -05:00
|
|
|
|
|
|
|
TreeModel::Row row = (*i);
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView* tv = row[_columns.tv];
|
2006-01-09 23:25:47 -05:00
|
|
|
|
|
|
|
if (tv == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = yn;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2006-01-09 23:25:47 -05:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
resume_redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-06-05 20:56:19 -04:00
|
|
|
EditorRoutes::set_all_audio_midi_visibility (int tracks, bool yn)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
suspend_redisplay ();
|
2006-01-09 23:25:47 -05:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2010-06-05 20:56:19 -04:00
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
TreeModel::Row row = (*i);
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView* tv = row[_columns.tv];
|
2010-06-05 20:56:19 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
AudioTimeAxisView* atv;
|
2010-06-05 20:56:19 -04:00
|
|
|
MidiTimeAxisView* mtv;
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
if (tv == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
if ((atv = dynamic_cast<AudioTimeAxisView*>(tv)) != 0) {
|
2006-01-09 23:25:47 -05:00
|
|
|
switch (tracks) {
|
|
|
|
case 0:
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = yn;
|
2006-01-09 23:25:47 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
if (atv->is_audio_track()) {
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = yn;
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
case 2:
|
|
|
|
if (!atv->is_audio_track()) {
|
2009-07-01 19:20:18 -04:00
|
|
|
(*i)[_columns.visible] = yn;
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
2010-06-05 20:56:19 -04:00
|
|
|
else if ((mtv = dynamic_cast<MidiTimeAxisView*>(tv)) != 0) {
|
|
|
|
switch (tracks) {
|
|
|
|
case 0:
|
|
|
|
(*i)[_columns.visible] = yn;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
if (mtv->is_midi_track()) {
|
|
|
|
(*i)[_columns.visible] = yn;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
resume_redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::hide_all_routes ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-01-09 23:25:47 -05:00
|
|
|
set_all_tracks_visibility (false);
|
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::show_all_routes ()
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
|
|
|
set_all_tracks_visibility (true);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-06-05 20:56:19 -04:00
|
|
|
void
|
|
|
|
EditorRoutes::show_all_audiotracks()
|
|
|
|
{
|
|
|
|
set_all_audio_midi_visibility (1, true);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
EditorRoutes::hide_all_audiotracks ()
|
|
|
|
{
|
|
|
|
set_all_audio_midi_visibility (1, false);
|
|
|
|
}
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::show_all_audiobus ()
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
2010-06-05 20:56:19 -04:00
|
|
|
set_all_audio_midi_visibility (2, true);
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::hide_all_audiobus ()
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
2010-06-05 20:56:19 -04:00
|
|
|
set_all_audio_midi_visibility (2, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-06-05 20:56:19 -04:00
|
|
|
EditorRoutes::show_all_miditracks()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-06-05 20:56:19 -04:00
|
|
|
set_all_audio_midi_visibility (3, true);
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
|
|
|
void
|
2010-06-05 20:56:19 -04:00
|
|
|
EditorRoutes::hide_all_miditracks ()
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
2010-06-05 20:56:19 -04:00
|
|
|
set_all_audio_midi_visibility (3, false);
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
bool
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::button_press (GdkEventButton* ev)
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
2009-07-01 19:20:18 -04:00
|
|
|
show_menu ();
|
2006-01-09 23:25:47 -05:00
|
|
|
return true;
|
|
|
|
}
|
2010-01-22 12:23:58 -05:00
|
|
|
|
|
|
|
//Scroll editor canvas to selected track
|
|
|
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
|
|
|
|
|
|
|
TreeModel::Path path;
|
|
|
|
TreeViewColumn *tvc;
|
|
|
|
int cell_x;
|
|
|
|
int cell_y;
|
|
|
|
|
|
|
|
_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, tvc, cell_x, cell_y);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-01-22 12:23:58 -05:00
|
|
|
// Get the model row.
|
|
|
|
Gtk::TreeModel::Row row = *_model->get_iter (path);
|
|
|
|
|
|
|
|
TimeAxisView *tv = row[_columns.tv];
|
|
|
|
|
|
|
|
int y_pos = tv->y_position();
|
|
|
|
|
|
|
|
//Clamp the y pos so that we do not extend beyond the canvas full height.
|
|
|
|
if (_editor->full_canvas_height - y_pos < _editor->_canvas_height){
|
|
|
|
y_pos = _editor->full_canvas_height - _editor->_canvas_height;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Only scroll to if the track is visible
|
|
|
|
if(y_pos != -1){
|
|
|
|
_editor->reset_y_origin (y_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
bool
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const &, TreeModel::Path const &, bool)
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
|
|
|
return true;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
struct EditorOrderRouteSorter {
|
2006-07-27 21:08:57 -04:00
|
|
|
bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
|
2006-01-09 23:25:47 -05:00
|
|
|
/* use of ">" forces the correct sort order */
|
2009-07-04 08:40:26 -04:00
|
|
|
return a->order_key (N_ ("editor")) < b->order_key (N_ ("editor"));
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::initial_display ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
suspend_redisplay ();
|
|
|
|
_model->clear ();
|
|
|
|
|
|
|
|
if (!_session) {
|
|
|
|
resume_redisplay ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-07-04 09:44:01 -04:00
|
|
|
boost::shared_ptr<RouteList> routes = _session->get_routes();
|
2009-01-30 02:40:13 -05:00
|
|
|
RouteList r (*routes);
|
2006-01-09 23:25:47 -05:00
|
|
|
EditorOrderRouteSorter sorter;
|
|
|
|
|
2006-07-27 21:08:57 -04:00
|
|
|
r.sort (sorter);
|
2009-07-01 19:20:18 -04:00
|
|
|
_editor->handle_new_route (r);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
/* don't show master bus in a new session */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
if (ARDOUR_UI::instance()->session_is_new ()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_no_redisplay = true;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2010-01-22 12:23:58 -05:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView *tv = (*i)[_columns.tv];
|
|
|
|
RouteTimeAxisView *rtv;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
if ((rtv = dynamic_cast<RouteTimeAxisView*>(tv)) != 0) {
|
2009-07-01 19:20:18 -04:00
|
|
|
if (rtv->route()->is_master()) {
|
|
|
|
_display.get_selection()->unselect (i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_no_redisplay = false;
|
|
|
|
redisplay ();
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
resume_redisplay ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-01-09 23:25:47 -05:00
|
|
|
void
|
2009-07-21 11:55:17 -04:00
|
|
|
EditorRoutes::track_list_reorder (Gtk::TreeModel::Path const &, Gtk::TreeModel::iterator const &, int* /*new_order*/)
|
2006-01-09 23:25:47 -05:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
_redisplay_does_not_sync_order_keys = true;
|
2009-07-04 09:44:01 -04:00
|
|
|
_session->set_remote_control_ids();
|
2009-07-01 19:20:18 -04:00
|
|
|
redisplay ();
|
|
|
|
_redisplay_does_not_sync_order_keys = false;
|
2006-01-09 23:25:47 -05:00
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::display_drag_data_received (const RefPtr<Gdk::DragContext>& context,
|
2009-10-14 12:10:01 -04:00
|
|
|
int x, int y,
|
2009-07-01 19:20:18 -04:00
|
|
|
const SelectionData& data,
|
|
|
|
guint info, guint time)
|
2008-01-10 16:20:59 -05:00
|
|
|
{
|
|
|
|
if (data.get_target() == "GTK_TREE_MODEL_ROW") {
|
2009-07-01 19:20:18 -04:00
|
|
|
_display.on_drag_data_received (context, x, y, data, info, time);
|
2008-01-10 16:20:59 -05:00
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
context->drag_finish (true, false, time);
|
|
|
|
}
|
2008-02-10 13:16:25 -05:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::move_selected_tracks (bool up)
|
2008-12-08 13:16:12 -05:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
if (_editor->selection->tracks.empty()) {
|
2008-12-08 13:16:12 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
typedef std::pair<TimeAxisView*,boost::shared_ptr<Route> > ViewRoute;
|
2008-12-08 13:16:12 -05:00
|
|
|
std::list<ViewRoute> view_routes;
|
|
|
|
std::vector<int> neworder;
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2008-12-08 13:16:12 -05:00
|
|
|
TreeModel::Children::iterator ri;
|
|
|
|
|
|
|
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
2009-07-09 13:58:13 -04:00
|
|
|
TimeAxisView* tv = (*ri)[_columns.tv];
|
2009-07-01 19:20:18 -04:00
|
|
|
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
2008-12-08 13:16:12 -05:00
|
|
|
|
|
|
|
view_routes.push_back (ViewRoute (tv, route));
|
|
|
|
}
|
|
|
|
|
|
|
|
list<ViewRoute>::iterator trailing;
|
|
|
|
list<ViewRoute>::iterator leading;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
if (up) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
trailing = view_routes.begin();
|
|
|
|
leading = view_routes.begin();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
++leading;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
while (leading != view_routes.end()) {
|
2009-07-01 19:20:18 -04:00
|
|
|
if (_editor->selection->selected (leading->first)) {
|
2008-12-08 13:16:12 -05:00
|
|
|
view_routes.insert (trailing, ViewRoute (leading->first, leading->second));
|
|
|
|
leading = view_routes.erase (leading);
|
|
|
|
} else {
|
|
|
|
++leading;
|
|
|
|
++trailing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* if we could use reverse_iterator in list::insert, this code
|
|
|
|
would be a beautiful reflection of the code above. but we can't
|
|
|
|
and so it looks like a bit of a mess.
|
|
|
|
*/
|
|
|
|
|
|
|
|
trailing = view_routes.end();
|
|
|
|
leading = view_routes.end();
|
|
|
|
|
|
|
|
--leading; if (leading == view_routes.begin()) { return; }
|
|
|
|
--leading;
|
|
|
|
--trailing;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
if (_editor->selection->selected (leading->first)) {
|
2008-12-08 13:16:12 -05:00
|
|
|
list<ViewRoute>::iterator tmp;
|
|
|
|
|
|
|
|
/* need to insert *after* trailing, not *before* it,
|
|
|
|
which is what insert (iter, val) normally does.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tmp = trailing;
|
|
|
|
tmp++;
|
|
|
|
|
|
|
|
view_routes.insert (tmp, ViewRoute (leading->first, leading->second));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
/* can't use iter = cont.erase (iter); form here, because
|
|
|
|
we need iter to move backwards.
|
|
|
|
*/
|
|
|
|
|
|
|
|
tmp = leading;
|
|
|
|
--tmp;
|
|
|
|
|
|
|
|
bool done = false;
|
|
|
|
|
|
|
|
if (leading == view_routes.begin()) {
|
|
|
|
/* the one we've just inserted somewhere else
|
|
|
|
was the first in the list. erase this copy,
|
|
|
|
and then break, because we're done.
|
|
|
|
*/
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
view_routes.erase (leading);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-08 13:16:12 -05:00
|
|
|
if (done) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
leading = tmp;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if (leading == view_routes.begin()) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
--leading;
|
|
|
|
--trailing;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
|
2009-07-04 08:40:26 -04:00
|
|
|
neworder.push_back (leading->second->order_key (N_ ("editor")));
|
2008-12-08 13:16:12 -05:00
|
|
|
}
|
|
|
|
|
2009-07-01 19:20:18 -04:00
|
|
|
_model->reorder (neworder);
|
2009-12-30 11:48:58 -05:00
|
|
|
|
|
|
|
_session->sync_order_keys (N_ ("editor"));
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
2009-06-17 21:48:11 -04:00
|
|
|
|
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::update_rec_display ()
|
2009-06-17 21:48:11 -04:00
|
|
|
{
|
2009-07-01 19:20:18 -04:00
|
|
|
TreeModel::Children rows = _model->children();
|
2009-06-17 21:48:11 -04:00
|
|
|
TreeModel::Children::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-17 21:48:11 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
2009-07-01 19:20:18 -04:00
|
|
|
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
2009-06-17 21:48:11 -04:00
|
|
|
|
2010-08-15 06:33:41 -04:00
|
|
|
if (boost::dynamic_pointer_cast<Track> (route)) {
|
|
|
|
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
|
|
|
|
|
|
|
|
if (route->record_enabled()) {
|
|
|
|
if (_session->record_status() == Session::Recording) {
|
|
|
|
(*i)[_columns.rec_state] = 1;
|
|
|
|
} else {
|
|
|
|
(*i)[_columns.rec_state] = 2;
|
|
|
|
}
|
|
|
|
} else if (mt && mt->step_editing()) {
|
|
|
|
(*i)[_columns.rec_state] = 3;
|
|
|
|
} else {
|
|
|
|
(*i)[_columns.rec_state] = 0;
|
|
|
|
}
|
|
|
|
|
2009-11-24 18:59:15 -05:00
|
|
|
(*i)[_columns.name_editable] = !route->record_enabled ();
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2009-06-17 21:48:11 -04:00
|
|
|
}
|
|
|
|
}
|
2009-07-01 19:20:18 -04:00
|
|
|
|
2009-11-16 08:35:00 -05:00
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
EditorRoutes::update_mute_display ()
|
2009-11-16 08:35:00 -05:00
|
|
|
{
|
|
|
|
TreeModel::Children rows = _model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
2009-12-17 13:24:23 -05:00
|
|
|
(*i)[_columns.mute_state] = RouteUI::mute_visual_state (_session, route) > 0 ? 1 : 0;
|
2009-11-16 08:35:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-04-26 23:10:53 -04:00
|
|
|
EditorRoutes::update_solo_display (bool /* selfsoloed */)
|
2009-11-16 08:35:00 -05:00
|
|
|
{
|
|
|
|
TreeModel::Children rows = _model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
2009-11-25 22:02:16 -05:00
|
|
|
(*i)[_columns.solo_state] = RouteUI::solo_visual_state (route) > 0 ? 1 : 0;
|
2009-11-16 08:35:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-10 15:51:35 -05:00
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
EditorRoutes::update_solo_isolate_display ()
|
2009-12-10 15:51:35 -05:00
|
|
|
{
|
|
|
|
TreeModel::Children rows = _model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
|
|
|
(*i)[_columns.solo_isolate_state] = RouteUI::solo_isolate_visual_state (route) > 0 ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-05 16:08:37 -04:00
|
|
|
void
|
|
|
|
EditorRoutes::update_solo_safe_display ()
|
|
|
|
{
|
|
|
|
TreeModel::Children rows = _model->children();
|
|
|
|
TreeModel::Children::iterator i;
|
|
|
|
|
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
|
|
|
(*i)[_columns.solo_safe_state] = RouteUI::solo_safe_visual_state (route) > 0 ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
list<TimeAxisView*>
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::views () const
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
2009-07-09 13:58:13 -04:00
|
|
|
list<TimeAxisView*> v;
|
2009-07-01 19:20:18 -04:00
|
|
|
for (TreeModel::Children::iterator i = _model->children().begin(); i != _model->children().end(); ++i) {
|
|
|
|
v.push_back ((*i)[_columns.tv]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-07-03 14:37:15 -04:00
|
|
|
EditorRoutes::clear ()
|
2009-07-01 19:20:18 -04:00
|
|
|
{
|
|
|
|
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
|
|
|
|
_model->clear ();
|
|
|
|
_display.set_model (_model);
|
|
|
|
}
|
2009-11-11 19:17:45 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
EditorRoutes::name_edit (Glib::ustring const & path, Glib::ustring const & new_text)
|
|
|
|
{
|
|
|
|
TreeIter iter = _model->get_iter (path);
|
|
|
|
if (!iter) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
boost::shared_ptr<Route> route = (*iter)[_columns.route];
|
|
|
|
|
2009-11-24 18:59:15 -05:00
|
|
|
if (route && route->name() != new_text) {
|
2009-11-11 19:17:45 -05:00
|
|
|
route->set_name (new_text);
|
|
|
|
}
|
|
|
|
}
|
2009-11-25 22:02:16 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
EditorRoutes::solo_changed_so_update_mute ()
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
update_mute_display ();
|
2009-11-25 22:02:16 -05:00
|
|
|
}
|
2009-11-29 07:47:59 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
EditorRoutes::show_tracks_with_regions_at_playhead ()
|
|
|
|
{
|
|
|
|
boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_frame ());
|
|
|
|
|
|
|
|
set<TimeAxisView*> show;
|
|
|
|
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
|
2009-12-09 22:25:32 -05:00
|
|
|
TimeAxisView* tav = _editor->axis_view_from_route (*i);
|
2009-11-29 07:47:59 -05:00
|
|
|
if (tav) {
|
|
|
|
show.insert (tav);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
suspend_redisplay ();
|
|
|
|
|
|
|
|
TreeModel::Children rows = _model->children ();
|
|
|
|
for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
TimeAxisView* tv = (*i)[_columns.tv];
|
|
|
|
(*i)[_columns.visible] = (show.find (tv) != show.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
resume_redisplay ();
|
|
|
|
}
|