region trimming and height patch from lincoln. great work
[ardour.git] / gtk2_ardour / region_view.cc
index 1819df040172ea239450867d6a58534fd17b673c..7fa453faf72734daf5a6d63f4fc9179b6fdca10d 100644 (file)
 #include <gtkmm.h>
 
 #include <gtkmm2ext/gtk_ui.h>
-#include <pbd/stacktrace.h>
+#include "pbd/stacktrace.h"
 
-#include <ardour/playlist.h>
-#include <ardour/audioregion.h>
-#include <ardour/audiosource.h>
-#include <ardour/audio_diskstream.h>
+#include "ardour/playlist.h"
+#include "ardour/audioregion.h"
+#include "ardour/audiosource.h"
+#include "ardour/audio_diskstream.h"
 
 #include "ardour_ui.h"
 #include "streamview.h"
@@ -49,6 +49,7 @@
 
 #include "i18n.h"
 
+using namespace std;
 using namespace sigc;
 using namespace ARDOUR;
 using namespace PBD;
@@ -63,10 +64,10 @@ RegionView::RegionView (ArdourCanvas::Group*              parent,
                         TimeAxisView&                     tv,
                         boost::shared_ptr<ARDOUR::Region> r,
                         double                            spu,
-                        Gdk::Color&                       basic_color)
+                        Gdk::Color const &                basic_color)
        : TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false,
-                       TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText|
-                               TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame))
+                           TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText|
+                                                         TimeAxisViewItem::ShowNameHighlight| TimeAxisViewItem::ShowFrame))
        , _region (r)
        , sync_mark(0)
        , sync_line(0)
@@ -82,7 +83,8 @@ RegionView::RegionView (ArdourCanvas::Group*              parent,
 }
 
 RegionView::RegionView (const RegionView& other)
-       : TimeAxisViewItem (other)
+       : sigc::trackable(other)
+       , TimeAxisViewItem (other)
        , _time_converter(other._time_converter)
 {
        /* derived concrete type will call init () */
@@ -95,7 +97,8 @@ RegionView::RegionView (const RegionView& other)
 }
 
 RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other_region)
-       : TimeAxisViewItem (other)
+       : sigc::trackable(other)
+       , TimeAxisViewItem (other)
        , _time_converter(other._time_converter)
 {
        /* this is a pseudo-copy constructor used when dragging regions 
@@ -115,7 +118,7 @@ RegionView::RegionView (ArdourCanvas::Group*         parent,
                         TimeAxisView&                tv,
                         boost::shared_ptr<ARDOUR::Region> r,
                         double                       spu,
-                        Gdk::Color&                  basic_color,
+                        Gdk::Color const &           basic_color,
                                                bool recording,
                         TimeAxisViewItem::Visibility visibility)
        : TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), recording, visibility)
@@ -134,7 +137,7 @@ RegionView::RegionView (ArdourCanvas::Group*         parent,
 }
 
 void
-RegionView::init (Gdk::Color& basic_color, bool wfd)
+RegionView::init (Gdk::Color const & basic_color, bool wfd)
 {
        editor        = 0;
        valid         = true;
@@ -151,10 +154,19 @@ RegionView::init (Gdk::Color& basic_color, bool wfd)
        if (name_highlight) {
                name_highlight->set_data ("regionview", this);
                name_highlight->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
+               
+               frame_handle_start->set_data ("regionview", this);
+               frame_handle_start->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), frame_handle_start, this));
+
+               frame_handle_end->set_data ("regionview", this);
+               frame_handle_end->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), frame_handle_end, this));
+
+               frame_handle_start->raise_to_top();
+               frame_handle_end->raise_to_top();
        }
 
-       if (name_text) {
-               name_text->set_data ("regionview", this);
+       if (name_pixbuf) {
+               name_pixbuf->set_data ("regionview", this);
        }
 
        if (wfd)
@@ -189,7 +201,7 @@ RegionView::~RegionView ()
 }
 
 gint
-RegionView::_lock_toggle (ArdourCanvas::Item* item, GdkEvent* ev, void* arg)
+RegionView::_lock_toggle (ArdourCanvas::Item*, GdkEvent* ev, void* arg)
 {
        switch (ev->type) {
        case GDK_BUTTON_RELEASE:
@@ -298,7 +310,7 @@ RegionView::lower_to_bottom ()
 }
 
 bool
-RegionView::set_position (nframes_t pos, void* src, double* ignored)
+RegionView::set_position (nframes_t pos, void* /*src*/, double* ignored)
 {
        double delta;
        bool ret;
@@ -347,12 +359,6 @@ RegionView::set_duration (nframes_t frames, void *src)
        return true;
 }
 
-void
-RegionView::compute_colors (Gdk::Color& basic_color)
-{
-       TimeAxisViewItem::compute_colors (basic_color);
-}
-
 void
 RegionView::set_colors ()
 {