Make scroll-wheel modifier keys consistent in editor summary pane.
[ardour.git] / gtk2_ardour / editor_regions.cc
index 1a2043943f17be5a3d87831597edaa8ced13b9e2..ad5263d1d198eb043295b5c99ce2730d994dac46 100644 (file)
 
 #include "ardour/audioregion.h"
 #include "ardour/audiofilesource.h"
+#include "ardour/silentfilesource.h"
 #include "ardour/region_factory.h"
 #include "ardour/session.h"
-#include "ardour/session_playlists.h"
-#include "ardour/silentfilesource.h"
 #include "ardour/profile.h"
 
 #include "gtkmm2ext/choice.h"
@@ -48,6 +47,7 @@
 #include "utils.h"
 #include "editor_regions.h"
 #include "editor_drag.h"
+#include "main_clock.h"
 
 #include "i18n.h"
 
@@ -79,6 +79,7 @@ EditorRegions::EditorRegions (Editor* e)
 {
        _display.set_size_request (100, -1);
        _display.set_rules_hint (true);
+       _display.set_name ("EditGroupList");
 
        /* Try to prevent single mouse presses from initiating edits.
           This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
@@ -212,11 +213,11 @@ EditorRegions::EditorRegions (Editor* e)
 
        //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
        ARDOUR_UI::instance()->secondary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
-       ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
-       ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context());
+       ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
+       ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::add_region, this, _1), gui_context());
 
-       e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::freeze_tree_model, this), gui_context());
-       e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::thaw_tree_model, this), gui_context());
+       e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::freeze_tree_model, this), gui_context());
+       e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::thaw_tree_model, this), gui_context());
 }
 
 bool
@@ -303,7 +304,6 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
 
                TreeModel::iterator iter = _model->get_iter ("0");
                TreeModel::Row parent;
-               TreeModel::Row child;
 
                if (!iter) {
                        parent = *(_model->append());
@@ -550,7 +550,8 @@ EditorRegions::selection_changed ()
 
                for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
 
-                       if (iter = _model->get_iter (*i)) {
+                       if ((iter = _model->get_iter (*i))) {
+
                                boost::shared_ptr<Region> region = (*iter)[_columns.region];
 
                                // they could have clicked on a row that is just a placeholder, like "Hidden"
@@ -559,18 +560,12 @@ EditorRegions::selection_changed ()
 
                                if (region) {
 
-                                       if (region->automatic()) {
-
-                                               _display.get_selection()->unselect(*i);
-
-                                       } else {
-                                               _change_connection.block (true);
-                                               _editor->set_selected_regionview_from_region_list (region, Selection::Add);
-
-                                               _change_connection.block (false);
-                                       }
+                                       _change_connection.block (true);
+                                       _editor->set_selected_regionview_from_region_list (region, Selection::Add);
+                                       _change_connection.block (false);
                                }
                        }
+                       
                }
        } else {
                _editor->get_selection().clear_regions ();
@@ -835,7 +830,6 @@ EditorRegions::populate_row_position (boost::shared_ptr<Region> region, TreeMode
                row[_columns.position] = _("Mult.");
        } else {
                char buf[16];
-               cerr << "Adding a region " << region->name() << " at " << region->position() << endl;
                format_position (region->position(), buf, sizeof (buf));
                row[_columns.position] = buf;
        }
@@ -1239,7 +1233,9 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
 
        if (_editor->convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
                framepos_t pos = 0;
-               if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
+               bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
+
+               if (Profile->get_sae() || Config->get_only_copy_imported_files() || copy) {
                        _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos);
                } else {
                        _editor->do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);
@@ -1301,7 +1297,7 @@ EditorRegions::name_edit (const std::string& path, const std::string& new_text)
 
        if (region) {
                vector<RegionView*> equivalents;
-               _editor->get_regions_corresponding_to (region, equivalents);
+               _editor->get_regions_corresponding_to (region, equivalents, false);
 
                for (vector<RegionView*>::iterator i = equivalents.begin(); i != equivalents.end(); ++i) {
                        if (new_text != (*i)->region()->name()) {