From 5fb6a52a24ad7a5bf1150ab5ef42824a86d978db Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 5 Dec 2012 18:29:07 +0000 Subject: [PATCH] tweak region layering editor to use only a single click to change layering git-svn-id: svn://localhost/ardour2/branches/3.0@13603 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/region_layering_order_editor.cc | 21 +++++++++++++++------ gtk2_ardour/region_layering_order_editor.h | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/region_layering_order_editor.cc b/gtk2_ardour/region_layering_order_editor.cc index dbf3fa9dcf..b83506cf41 100644 --- a/gtk2_ardour/region_layering_order_editor.cc +++ b/gtk2_ardour/region_layering_order_editor.cc @@ -20,6 +20,9 @@ #include #include #include + +#include "pbd/stateful_diff_command.h" + #include "ardour/region.h" #include "gui_thread.h" @@ -80,7 +83,7 @@ RegionLayeringOrderEditor::RegionLayeringOrderEditor (PublicEditor& pe) info_table->attach (track_label, 0, 1, 0, 1, FILL, FILL); info_table->attach (track_name_label, 1, 2, 0, 1, FILL, FILL); info_table->attach (clock_label, 0, 1, 1, 2, FILL, FILL); - info_table->attach (clock, 1, 2, 1, 2, FILL, FILL); + info_table->attach (clock, 1, 2, 1, 2, Gtk::AttachOptions(0), FILL); Gtk::VBox* vbox = Gtk::manage (new Gtk::VBox ()); vbox->set_spacing (12); @@ -92,8 +95,8 @@ RegionLayeringOrderEditor::RegionLayeringOrderEditor (PublicEditor& pe) scroller_table->set_name ("RegionLayeringOrderTable"); layering_order_display.set_name ("RegionLayeringOrderDisplay"); - - layering_order_display.signal_row_activated ().connect (mem_fun (*this, &RegionLayeringOrderEditor::row_activated)); + layering_order_display.get_selection()->set_mode (SELECTION_SINGLE); + layering_order_display.get_selection()->signal_changed ().connect (mem_fun (*this, &RegionLayeringOrderEditor::row_selected)); layering_order_display.grab_focus (); @@ -107,13 +110,14 @@ RegionLayeringOrderEditor::~RegionLayeringOrderEditor () } void -RegionLayeringOrderEditor::row_activated (const TreeModel::Path& path, TreeViewColumn*) +RegionLayeringOrderEditor::row_selected () { if (in_row_change) { return; } - TreeModel::iterator iter = layering_order_model->get_iter (path); + Glib::RefPtr selection = layering_order_display.get_selection(); + TreeModel::iterator iter = selection->get_selected(); // only used with Gtk::SELECTION_SINGLE if (!iter) { return; @@ -124,9 +128,14 @@ RegionLayeringOrderEditor::row_activated (const TreeModel::Path& path, TreeViewC vector eq; editor.get_equivalent_regions (rv, eq, Properties::edit.property_id); + + /* XXX this should be reversible, really */ for (vector::iterator i = eq.begin(); i != eq.end(); ++i) { - (*i)->region()->raise_to_top (); + boost::shared_ptr pl = (*i)->region()->playlist(); + if (pl) { + pl->raise_region_to_top ((*i)->region()); + } } } diff --git a/gtk2_ardour/region_layering_order_editor.h b/gtk2_ardour/region_layering_order_editor.h index acdb1e59a5..eb9e252017 100644 --- a/gtk2_ardour/region_layering_order_editor.h +++ b/gtk2_ardour/region_layering_order_editor.h @@ -75,7 +75,7 @@ class RegionLayeringOrderEditor : public ArdourWindow PublicEditor& editor; TimeAxisView* _time_axis_view; - void row_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column); + void row_selected (); void refill (); void playlist_modified (); };