add/remove edit groups via buttons (still a bit of work left to do)
git-svn-id: svn://localhost/trunk/ardour2@364 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b4c1744333
commit
06ee54887d
@ -568,9 +568,9 @@ Editor::Editor (AudioEngine& eng)
|
||||
group_model->signal_row_changed().connect (mem_fun (*this, &Editor::edit_group_row_change));
|
||||
|
||||
edit_group_display.set_name ("EditGroupList");
|
||||
edit_group_display.get_selection()->set_mode (SELECTION_NONE);
|
||||
edit_group_display.get_selection()->set_mode (SELECTION_SINGLE);
|
||||
edit_group_display.set_reorderable (false);
|
||||
|
||||
edit_group_display.set_rules_hint (true);
|
||||
edit_group_display.set_size_request (75, -1);
|
||||
|
||||
edit_group_display_scroller.add (edit_group_display);
|
||||
@ -578,14 +578,19 @@ Editor::Editor (AudioEngine& eng)
|
||||
|
||||
edit_group_display.signal_button_press_event().connect (mem_fun(*this, &Editor::edit_group_list_button_press_event), false);
|
||||
|
||||
{
|
||||
TreeModel::Row row;
|
||||
row = *(group_model->append());
|
||||
row[group_columns.is_active] = false;
|
||||
row[group_columns.is_visible] = true;
|
||||
row[group_columns.text] = (_("-all-"));
|
||||
row[group_columns.routegroup] = 0;
|
||||
}
|
||||
VBox* edit_group_display_packer = manage (new VBox());
|
||||
HButtonBox* edit_group_display_button_box = manage (new HButtonBox());
|
||||
Button* edit_group_add_button = manage (new Button ("+"));
|
||||
Button* edit_group_remove_button = manage (new Button("-"));
|
||||
|
||||
edit_group_add_button->signal_clicked().connect (mem_fun (*this, &Editor::new_edit_group));
|
||||
edit_group_remove_button->signal_clicked().connect (mem_fun (*this, &Editor::remove_selected_edit_group));
|
||||
|
||||
edit_group_display_button_box->pack_start (*edit_group_add_button);
|
||||
edit_group_display_button_box->pack_start (*edit_group_remove_button);
|
||||
|
||||
edit_group_display_packer->pack_start (edit_group_display_scroller, true, true);
|
||||
edit_group_display_packer->pack_start (*edit_group_display_button_box, false, false);
|
||||
|
||||
region_list_display.set_size_request (100, -1);
|
||||
region_list_display.set_name ("RegionListDisplay");
|
||||
@ -662,7 +667,7 @@ Editor::Editor (AudioEngine& eng)
|
||||
the_notebook.append_page (region_list_scroller, _("Regions"));
|
||||
the_notebook.append_page (route_list_scroller, _("Tracks/Busses"));
|
||||
the_notebook.append_page (snapshot_display_scroller, _("Snapshots"));
|
||||
the_notebook.append_page (edit_group_display_scroller, _("Edit Groups"));
|
||||
the_notebook.append_page (*edit_group_display_packer, _("Edit Groups"));
|
||||
the_notebook.append_page (named_selection_scroller, _("Chunks"));
|
||||
the_notebook.set_show_tabs (true);
|
||||
the_notebook.set_scrollable (true);
|
||||
@ -1029,12 +1034,6 @@ Editor::session_control_changed (Session::ControlType t)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::fake_add_edit_group (RouteGroup *group)
|
||||
{
|
||||
Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun(*this, &Editor::add_edit_group), group));
|
||||
}
|
||||
|
||||
void
|
||||
Editor::fake_handle_new_audio_region (AudioRegion *region)
|
||||
{
|
||||
@ -1182,7 +1181,8 @@ Editor::connect_to_session (Session *t)
|
||||
session_connections.push_back (session->AudioRegionAdded.connect (mem_fun(*this, &Editor::fake_handle_new_audio_region)));
|
||||
session_connections.push_back (session->AudioRegionRemoved.connect (mem_fun(*this, &Editor::fake_handle_audio_region_removed)));
|
||||
session_connections.push_back (session->DurationChanged.connect (mem_fun(*this, &Editor::fake_handle_new_duration)));
|
||||
session_connections.push_back (session->edit_group_added.connect (mem_fun(*this, &Editor::fake_add_edit_group)));
|
||||
session_connections.push_back (session->edit_group_added.connect (mem_fun(*this, &Editor::add_edit_group)));
|
||||
session_connections.push_back (session->edit_group_removed.connect (mem_fun(*this, &Editor::edit_groups_changed)));
|
||||
session_connections.push_back (session->NamedSelectionAdded.connect (mem_fun(*this, &Editor::handle_new_named_selection)));
|
||||
session_connections.push_back (session->NamedSelectionRemoved.connect (mem_fun(*this, &Editor::handle_new_named_selection)));
|
||||
session_connections.push_back (session->DirtyChanged.connect (mem_fun(*this, &Editor::update_title)));
|
||||
@ -1195,7 +1195,7 @@ Editor::connect_to_session (Session *t)
|
||||
|
||||
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
|
||||
|
||||
session->foreach_edit_group (mem_fun (*this, &Editor::add_edit_group));
|
||||
edit_groups_changed ();
|
||||
|
||||
edit_cursor_clock.set_session (session);
|
||||
selection_start_clock.set_session (session);
|
||||
|
@ -1521,7 +1521,10 @@ class Editor : public PublicEditor
|
||||
gint edit_group_list_button_press_event (GdkEventButton* ev);
|
||||
void edit_group_selection_changed ();
|
||||
void fake_add_edit_group (ARDOUR::RouteGroup* group);
|
||||
void fake_remove_edit_group (ARDOUR::RouteGroup* group);
|
||||
void add_edit_group (ARDOUR::RouteGroup* group);
|
||||
void remove_selected_edit_group ();
|
||||
void edit_groups_changed ();
|
||||
void group_flags_changed (void*, ARDOUR::RouteGroup*);
|
||||
|
||||
Gtk::VBox list_vpacker;
|
||||
|
@ -97,6 +97,31 @@ Editor::new_edit_group ()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::remove_selected_edit_group ()
|
||||
{
|
||||
Glib::RefPtr<TreeSelection> selection = edit_group_display.get_selection();
|
||||
TreeView::Selection::ListHandle_Path rows = selection->get_selected_rows ();
|
||||
|
||||
if (rows.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeView::Selection::ListHandle_Path::iterator i = rows.begin();
|
||||
TreeIter iter;
|
||||
|
||||
/* selection mode is single, so rows.begin() is it */
|
||||
|
||||
if ((iter = group_model->get_iter (*i))) {
|
||||
|
||||
RouteGroup* rg = (*iter)[group_columns.routegroup];
|
||||
|
||||
if (rg) {
|
||||
session->remove_edit_group (*rg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::edit_group_list_button_clicked ()
|
||||
{
|
||||
@ -203,6 +228,29 @@ Editor::add_edit_group (RouteGroup* group)
|
||||
group->FlagsChanged.connect (bind (mem_fun(*this, &Editor::group_flags_changed), group));
|
||||
}
|
||||
|
||||
void
|
||||
Editor::edit_groups_changed ()
|
||||
{
|
||||
ENSURE_GUI_THREAD (mem_fun (*this, &Editor::edit_groups_changed));
|
||||
|
||||
/* just rebuild the while thing */
|
||||
|
||||
edit_group_display.set_model (Glib::RefPtr<TreeModel>(0));
|
||||
group_model->clear ();
|
||||
|
||||
{
|
||||
TreeModel::Row row;
|
||||
row = *(group_model->append());
|
||||
row[group_columns.is_active] = false;
|
||||
row[group_columns.is_visible] = true;
|
||||
row[group_columns.text] = (_("-all-"));
|
||||
row[group_columns.routegroup] = 0;
|
||||
}
|
||||
|
||||
session->foreach_edit_group (mem_fun (*this, &Editor::add_edit_group));
|
||||
edit_group_display.set_model (group_model);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::group_flags_changed (void* src, RouteGroup* group)
|
||||
{
|
||||
|
@ -177,7 +177,6 @@ Editor::hide_track_in_display (TimeAxisView& tv)
|
||||
{
|
||||
TreeModel::Children rows = route_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
Glib::RefPtr<TreeSelection> selection = route_list_display.get_selection();
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
if ((*i)[route_display_columns.tv] == &tv) {
|
||||
@ -199,7 +198,6 @@ Editor::show_track_in_display (TimeAxisView& tv)
|
||||
{
|
||||
TreeModel::Children rows = route_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
Glib::RefPtr<TreeSelection> selection = route_list_display.get_selection();
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
if ((*i)[route_display_columns.tv] == &tv) {
|
||||
|
@ -127,9 +127,11 @@ class Route : public IO
|
||||
bool phase_invert() const { return _phase_invert; }
|
||||
|
||||
void set_edit_group (RouteGroup *, void *);
|
||||
void drop_edit_group (void *);
|
||||
RouteGroup *edit_group () { return _edit_group; }
|
||||
|
||||
void set_mix_group (RouteGroup *, void *);
|
||||
void drop_mix_group (void *);
|
||||
RouteGroup *mix_group () { return _mix_group; }
|
||||
|
||||
virtual void set_meter_point (MeterPoint, void *src);
|
||||
|
@ -69,9 +69,15 @@ class RouteGroup : public Stateful, public sigc::trackable {
|
||||
|
||||
int remove (Route *);
|
||||
|
||||
void apply (void (Route::*func)(void *), void *src) {
|
||||
for (list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) {
|
||||
((*i)->*func)(src);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void apply (void (Route::*func)(T, void *), T val, void *src) {
|
||||
for (list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) {
|
||||
((*i)->*func)(val, this);
|
||||
((*i)->*func)(val, src);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,11 +505,16 @@ class Session : public sigc::trackable, public Stateful
|
||||
RouteGroup* add_edit_group (string);
|
||||
RouteGroup* add_mix_group (string);
|
||||
|
||||
void remove_edit_group (RouteGroup&);
|
||||
void remove_mix_group (RouteGroup&);
|
||||
|
||||
RouteGroup *mix_group_by_name (string);
|
||||
RouteGroup *edit_group_by_name (string);
|
||||
|
||||
sigc::signal<void,RouteGroup*> edit_group_added;
|
||||
sigc::signal<void,RouteGroup*> mix_group_added;
|
||||
sigc::signal<void> edit_group_removed;
|
||||
sigc::signal<void> mix_group_removed;
|
||||
|
||||
void foreach_edit_group (sigc::slot<void,RouteGroup*> sl) {
|
||||
for (list<RouteGroup *>::iterator i = edit_groups.begin(); i != edit_groups.end(); i++) {
|
||||
|
@ -1833,16 +1833,27 @@ void
|
||||
Route::set_edit_group (RouteGroup *eg, void *src)
|
||||
|
||||
{
|
||||
if (eg == _edit_group) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_edit_group) {
|
||||
_edit_group->remove (this);
|
||||
}
|
||||
|
||||
if ((_edit_group = eg)) {
|
||||
if ((_edit_group = eg) != 0) {
|
||||
_edit_group->add (this);
|
||||
}
|
||||
|
||||
_session.set_dirty ();
|
||||
edit_group_changed (src); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
void
|
||||
Route::drop_edit_group (void *src)
|
||||
{
|
||||
_edit_group = 0;
|
||||
_session.set_dirty ();
|
||||
edit_group_changed (src); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
@ -1850,16 +1861,27 @@ void
|
||||
Route::set_mix_group (RouteGroup *mg, void *src)
|
||||
|
||||
{
|
||||
if (mg == _mix_group) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_mix_group) {
|
||||
_mix_group->remove (this);
|
||||
}
|
||||
|
||||
if ((_mix_group = mg)) {
|
||||
if ((_mix_group = mg) != 0) {
|
||||
_mix_group->add (this);
|
||||
}
|
||||
|
||||
_session.set_dirty ();
|
||||
|
||||
mix_group_changed (src); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
void
|
||||
Route::drop_mix_group (void *src)
|
||||
{
|
||||
_mix_group = 0;
|
||||
_session.set_dirty ();
|
||||
mix_group_changed (src); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
|
@ -2415,6 +2415,34 @@ Session::add_mix_group (string name)
|
||||
return rg;
|
||||
}
|
||||
|
||||
void
|
||||
Session::remove_edit_group (RouteGroup& rg)
|
||||
{
|
||||
list<RouteGroup*>::iterator i;
|
||||
|
||||
if ((i = find (edit_groups.begin(), edit_groups.end(), &rg)) != edit_groups.end()) {
|
||||
(*i)->apply (&Route::drop_edit_group, this);
|
||||
edit_groups.erase (i);
|
||||
edit_group_removed (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
delete &rg;
|
||||
}
|
||||
|
||||
void
|
||||
Session::remove_mix_group (RouteGroup& rg)
|
||||
{
|
||||
list<RouteGroup*>::iterator i;
|
||||
|
||||
if ((i = find (mix_groups.begin(), mix_groups.end(), &rg)) != mix_groups.end()) {
|
||||
(*i)->apply (&Route::drop_mix_group, this);
|
||||
mix_groups.erase (i);
|
||||
mix_group_removed (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
delete &rg;
|
||||
}
|
||||
|
||||
RouteGroup *
|
||||
Session::mix_group_by_name (string name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user