NO-OP; clean up script spacing and remove goto
[ardour.git] / gtk2_ardour / editor_regions.cc
index 111444ec8b8af97ab7d97dd0f12f661eb40f64cc..d7a920e0667e7c8b72c95bce577ce7095c0210f2 100644 (file)
@@ -52,7 +52,7 @@
 #include "tooltips.h"
 #include "ui_config.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -77,7 +77,7 @@ EditorRegions::EditorRegions (Editor* e)
        , _show_automatic_regions (true)
        , ignore_region_list_selection_change (false)
        , ignore_selected_region_change (false)
-       , _no_redisplay (false)
+       , _no_redisplay (false)
        , _sort_type ((Editing::RegionListSortType) 0)
        , expanded (false)
 {
@@ -96,14 +96,11 @@ EditorRegions::EditorRegions (Editor* e)
        _model->set_sort_column (0, SORT_ASCENDING);
 
        /* column widths */
-       int bbt_width, sync_width, check_width, height;
+       int bbt_width, check_width, height;
 
        Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (X_("000|000|000"));
        Gtkmm2ext::get_pixel_size (layout, bbt_width, height);
 
-       layout = _display.create_pango_layout (X_("Start "));
-       Gtkmm2ext::get_pixel_size (layout, sync_width, height);
-
        check_width = 20;
 
        TreeViewColumn* col_name = manage (new TreeViewColumn ("", _columns.name));
@@ -119,7 +116,7 @@ EditorRegions::EditorRegions (Editor* e)
        col_length->set_fixed_width (bbt_width);
        col_length->set_sizing (TREE_VIEW_COLUMN_FIXED);
        TreeViewColumn* col_sync = manage (new TreeViewColumn ("", _columns.sync));
-       col_sync->set_fixed_width (sync_width);
+       col_sync->set_fixed_width (bbt_width);
        col_sync->set_sizing (TREE_VIEW_COLUMN_FIXED);
        TreeViewColumn* col_fadein = manage (new TreeViewColumn ("", _columns.fadein));
        col_fadein->set_fixed_width (bbt_width);
@@ -483,8 +480,8 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
        row[_columns.region] = region;
 
        region_row_map.insert(pair<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::RowReference>(region, TreeRowReference(_model, TreePath (row))) );
-
-       populate_row(region, (*row));
+       PropertyChange pc;
+       populate_row(region, (*row), pc);
 }
 
 void
@@ -522,6 +519,7 @@ EditorRegions::region_changed (boost::shared_ptr<Region> r, const PropertyChange
        our_interests.add (ARDOUR::Properties::position);
        our_interests.add (ARDOUR::Properties::length);
        our_interests.add (ARDOUR::Properties::start);
+       our_interests.add (ARDOUR::Properties::sync_position);
        our_interests.add (ARDOUR::Properties::locked);
        our_interests.add (ARDOUR::Properties::position_lock_style);
        our_interests.add (ARDOUR::Properties::muted);
@@ -532,14 +530,13 @@ EditorRegions::region_changed (boost::shared_ptr<Region> r, const PropertyChange
        our_interests.add (ARDOUR::Properties::fade_out_active);
 
        if (what_changed.contains (our_interests)) {
-
                if (last_row != 0) {
 
                        TreeModel::iterator j = _model->get_iter (last_row.get_path());
                        boost::shared_ptr<Region> c = (*j)[_columns.region];
 
                        if (c == r) {
-                               populate_row (r, (*j));
+                               populate_row (r, (*j), what_changed);
 
                                if (what_changed.contains (ARDOUR::Properties::hidden)) {
                                        redisplay ();
@@ -559,7 +556,7 @@ EditorRegions::region_changed (boost::shared_ptr<Region> r, const PropertyChange
                        boost::shared_ptr<Region> c = (*j)[_columns.region];
 
                        if (c == r) {
-                               populate_row (r, (*j));
+                               populate_row (r, (*j), what_changed);
 
                                if (what_changed.contains (ARDOUR::Properties::hidden)) {
                                        redisplay ();
@@ -698,9 +695,9 @@ EditorRegions::update_row (boost::shared_ptr<Region> region)
        it = region_row_map.find (region);
 
        if (it != region_row_map.end()){
-
+               PropertyChange c;
                TreeModel::iterator j = _model->get_iter ((*it).second.get_path());
-               populate_row(region, (*j));
+               populate_row(region, (*j), c);
        }
 }
 
@@ -720,7 +717,8 @@ EditorRegions::update_all_rows ()
                boost::shared_ptr<Region> region = (*j)[_columns.region];
 
                if (!region->automatic()) {
-                       populate_row(region, (*j));
+                       PropertyChange c;
+                       populate_row(region, (*j), c);
                }
        }
 }
@@ -787,26 +785,53 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool
 }
 
 void
-EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row const &row)
+EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row const &row, PBD::PropertyChange const &what_changed)
 {
        boost::shared_ptr<AudioRegion> audioregion = boost::dynamic_pointer_cast<AudioRegion>(region);
        //uint32_t used = _session->playlists->region_use_count (region);
        /* Presently a region is only used once so let's save on the sequential scan to determine use count */
        uint32_t used = 1;
 
-       populate_row_position (region, row, used);
-       populate_row_end (region, row, used);
-       populate_row_sync (region, row, used);
-       populate_row_fade_in (region, row, used, audioregion);
-       populate_row_fade_out (region, row, used, audioregion);
-       populate_row_locked (region, row, used);
-       populate_row_glued (region, row, used);
-       populate_row_muted (region, row, used);
-       populate_row_opaque (region, row, used);
-       populate_row_length (region, row);
-       populate_row_source (region, row);
-       populate_row_name (region, row);
-       populate_row_used (region, row, used);
+       PropertyChange c;
+       const bool all = what_changed == c;
+
+       if (all || what_changed.contains (Properties::position)) {
+               populate_row_position (region, row, used);
+       }
+       if (all || what_changed.contains (Properties::start) || what_changed.contains (Properties::sync_position)) {
+               populate_row_sync (region, row, used);
+       }
+       if (all || what_changed.contains (Properties::fade_in)) {
+               populate_row_fade_in (region, row, used, audioregion);
+       }
+       if (all || what_changed.contains (Properties::fade_out)) {
+               populate_row_fade_out (region, row, used, audioregion);
+       }
+       if (all || what_changed.contains (Properties::locked)) {
+               populate_row_locked (region, row, used);
+       }
+       if (all || what_changed.contains (Properties::position_lock_style)) {
+               populate_row_glued (region, row, used);
+       }
+       if (all || what_changed.contains (Properties::muted)) {
+               populate_row_muted (region, row, used);
+       }
+       if (all || what_changed.contains (Properties::opaque)) {
+               populate_row_opaque (region, row, used);
+       }
+       if (all || what_changed.contains (Properties::length)) {
+               populate_row_end (region, row, used);
+               populate_row_length (region, row);
+       }
+       if (all) {
+               populate_row_source (region, row);
+       }
+       if (all || what_changed.contains (Properties::name)) {
+               populate_row_name (region, row);
+       }
+       if (all) {
+               populate_row_used (region, row, used);
+       }
 }
 
 #if 0
@@ -1295,7 +1320,8 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
                bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
 
                if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
-                       _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos);
+                       _editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion,
+                                           SrcBest, SMFTrackName, SMFTempoIgnore, pos);
                } else {
                        _editor->do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);
                }