NOOP, remove trailing tabs/whitespace.
[ardour.git] / gtk2_ardour / editor_regions.cc
index 1d6ac8c16cb62e74885e8fa0723cb2ae8eee09e8..31e7bf13098a73b8d7c13520aa106e7004edd3e5 100644 (file)
@@ -48,6 +48,8 @@
 #include "editor_regions.h"
 #include "editor_drag.h"
 #include "main_clock.h"
+#include "tooltips.h"
+#include "ui_config.h"
 
 #include "i18n.h"
 
@@ -122,18 +124,18 @@ EditorRegions::EditorRegions (Editor* e)
                { 10, S_("Opaque|O"),  _("Region opaque (blocks regions below it from being heard)?") },
                { -1, 0, 0 }
        };
-       
+
        for (int i = 0; ci[i].index >= 0; ++i) {
                col = _display.get_column (ci[i].index);
                l = manage (new Label (ci[i].label));
-               ARDOUR_UI::instance()->set_tip (*l, ci[i].tooltip);
+               set_tooltip (*l, ci[i].tooltip);
                col->set_widget (*l);
                l->show ();
 
                if (ci[i].index > 6) {
                        col->set_expand (false);
                        col->set_alignment (ALIGN_CENTER);
-               } 
+               }
        }
 
        _display.set_headers_visible (true);
@@ -342,14 +344,14 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
 
                if (missing_source) {
                        // c.set_rgb(65535,0,0);     // FIXME: error color from style
-                       set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list missing source"));
+                       set_color_from_rgba (c, UIConfiguration::instance().color ("region list missing source"));
 
                } else if (region->automatic()){
                        // c.set_rgb(0,65535,0);     // FIXME: error color from style
-                       set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list automatic"));
+                       set_color_from_rgba (c, UIConfiguration::instance().color ("region list automatic"));
 
                } else {
-                       set_color_from_rgba (c, ARDOUR_UI::config()->color ("region list whole file"));
+                       set_color_from_rgba (c, UIConfiguration::instance().color ("region list whole file"));
                }
 
                row[_columns.color_] = c;
@@ -388,14 +390,14 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
                row[_columns.property_toggles_visible] = false;
 
                if (missing_source) {
-                       row[_columns.path] = _("(MISSING) ") + region->source()->name();
+                       row[_columns.path] = _("(MISSING) ") + Glib::Markup::escape_text (region->source()->name());
 
                } else {
                        boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource>(region->source());
                        if (fs) {
-                               row[_columns.path] = fs->path();
+                               row[_columns.path] = Glib::Markup::escape_text (fs->path());
                        } else {
-                               row[_columns.path] = region->source()->name();
+                               row[_columns.path] = Glib::Markup::escape_text (region->source()->name());
                        }
                }
 
@@ -431,7 +433,7 @@ EditorRegions::add_region (boost::shared_ptr<Region> region)
                        */
 
                        row = *(_model->insert (subrows.end()));
-                       
+
                } else {
                        row = *(_model->append());
                }
@@ -567,7 +569,7 @@ EditorRegions::selection_changed ()
                                        _change_connection.block (false);
                                }
                        }
-                       
+
                }
        } else {
                _editor->get_selection().clear_regions ();
@@ -690,6 +692,12 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool
        Timecode::BBT_Time bbt;
        Timecode::Time timecode;
 
+       if (pos < 0) {
+               error << string_compose (_("EditorRegions::format_position: negative timecode position: %1"), pos) << endmsg;
+               snprintf (buf, bufsize, "invalid");
+               return;
+       }
+
        switch (ARDOUR_UI::instance()->secondary_clock->mode ()) {
        case AudioClock::BBT:
                _session->tempo_map().bbt_time (pos, bbt);
@@ -816,10 +824,12 @@ EditorRegions::populate_row_end (boost::shared_ptr<Region> region, TreeModel::Ro
                row[_columns.end] = "";
        } else if (used > 1) {
                row[_columns.end] = _("Mult.");
-       } else {
+       } else if (region->last_frame() >= region->first_frame()) {
                char buf[16];
                format_position (region->last_frame(), buf, sizeof (buf));
                row[_columns.end] = buf;
+       } else {
+               row[_columns.end] = "empty";
        }
 }
 
@@ -939,9 +949,9 @@ void
 EditorRegions::populate_row_name (boost::shared_ptr<Region> region, TreeModel::Row const &row)
 {
        if (region->n_channels() > 1) {
-               row[_columns.name] = string_compose("%1  [%2]", region->name(), region->n_channels());
+               row[_columns.name] = string_compose("%1  [%2]", Glib::Markup::escape_text (region->name()), region->n_channels());
        } else {
-               row[_columns.name] = region->name();
+               row[_columns.name] = Glib::Markup::escape_text (region->name());
        }
 }
 
@@ -949,9 +959,9 @@ void
 EditorRegions::populate_row_source (boost::shared_ptr<Region> region, TreeModel::Row const &row)
 {
         if (boost::dynamic_pointer_cast<SilentFileSource>(region->source())) {
-               row[_columns.path] = _("MISSING ") + region->source()->name();
+               row[_columns.path] = _("MISSING ") + Glib::Markup::escape_text (region->source()->name());
        } else {
-               row[_columns.path] = region->source()->name();
+               row[_columns.path] = Glib::Markup::escape_text (region->source()->name());
        }
 }
 
@@ -1237,7 +1247,7 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
                framepos_t pos = 0;
                bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
 
-               if (Profile->get_sae() || ARDOUR_UI::config()->get_only_copy_imported_files() || copy) {
+               if (Profile->get_sae() || UIConfiguration::instance().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);