plugin selector from doug; lots and lots of fixes from karsten
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 22 Nov 2005 05:10:12 +0000 (05:10 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 22 Nov 2005 05:10:12 +0000 (05:10 +0000)
git-svn-id: svn://localhost/trunk/ardour2@105 d708f5d6-7413-0410-9779-e7cbd77b26cf

20 files changed:
gtk2_ardour/SConscript
gtk2_ardour/crossfade_view.cc
gtk2_ardour/crossfade_view.h
gtk2_ardour/editor.h
gtk2_ardour/editor_cursors.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/ghostregion.cc
gtk2_ardour/ghostregion.h
gtk2_ardour/imageframe.cc [new file with mode: 0644]
gtk2_ardour/imageframe.h [new file with mode: 0644]
gtk2_ardour/imageframe_time_axis_view.cc
gtk2_ardour/imageframe_time_axis_view.h
gtk2_ardour/marker.cc
gtk2_ardour/mtest.cc
gtk2_ardour/plugin_selector.cc
gtk2_ardour/plugin_selector.h
gtk2_ardour/regionview.cc
gtk2_ardour/regionview.h
gtk2_ardour/utils.cc
gtk2_ardour/utils.h

index 23368ad910cd8265c6c1fd0a2f025e0c8ef33e57..fe3f2762d6ca5b53b1ca9400976e95f7e5b101e0 100644 (file)
@@ -116,6 +116,7 @@ glade_factory.cc
 grouped_buttons.cc
 gtk-custom-hruler.c
 gtk-custom-ruler.c
+imageframe.cc
 imageframe_socket_handler.cc
 imageframe_time_axis.cc
 imageframe_time_axis_group.cc
index cca92198f5e7ecc408a562878ccdef03bb95b8ca..75dd3008fd87a11acea2bcc2fa90a1121aa22b9c 100644 (file)
@@ -35,6 +35,8 @@
 using namespace sigc;
 using namespace ARDOUR;
 using namespace Editing;
+using namespace Gnome;
+using namespace Canvas;
 
 sigc::signal<void,CrossfadeView*> CrossfadeView::GoingAway;
 
@@ -57,17 +59,13 @@ CrossfadeView::CrossfadeView (Gnome::Canvas::Group *parent,
        _valid = true;
        _visible = true;
 
-       fade_in = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
-                                      gnome_canvas_line_get_type(),
-                                      "fill_color_rgba", color_map[cCrossfadeLine],
-                                       "width_pixels", (guint) 1,
-                                      NULL);
-
-       fade_out = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
-                                       gnome_canvas_line_get_type(),
-                                       "fill_color_rgba", color_map[cCrossfadeLine],
-                                       "width_pixels", (guint) 1,
-                                       NULL);
+       fade_in = new Line (*group);
+       fade_in->property_fill_color_rgba().set_value(color_map[cCrossfadeLine]);
+       fade_in->property_width_pixels().set_value(1);
+
+       fade_out = new Line (*group);
+       fade_out->property_fill_color_rgba().set_value(color_map[cCrossfadeLine]);
+       fade_out->property_width_pixels().set_value(1);
        
        set_height (get_time_axis_view().height);
 
@@ -108,8 +106,8 @@ CrossfadeView::reset_width_dependent_items (double pixel_width)
        active_changed ();
 
        if (pixel_width < 5) {
-               gnome_canvas_item_hide (fade_in);
-               gnome_canvas_item_hide (fade_out);
+               fade_in->hide();
+               fade_out->hide();
        }
 }
 
@@ -147,7 +145,7 @@ CrossfadeView::crossfade_changed (Change what_changed)
 void
 CrossfadeView::redraw_curves ()
 {
-       GnomeCanvasPoints* points; 
+       Points* points; 
        int32_t npoints;
        float* vec;
        
@@ -176,12 +174,12 @@ CrossfadeView::redraw_curves ()
        npoints = std::min (gdk_screen_width(), npoints);
 
        if (!_visible || !crossfade.active() || npoints < 3) {
-               gnome_canvas_item_hide (fade_in);
-               gnome_canvas_item_hide (fade_out);
+               fade_in->hide();
+               fade_out->hide();
                return;
        } else {
-               gnome_canvas_item_show (fade_in);
-               gnome_canvas_item_show (fade_out);
+               fade_in->show();
+               fade_out->show();
        } 
 
        points = get_canvas_points ("xfade edit redraw", npoints);
@@ -189,21 +187,23 @@ CrossfadeView::redraw_curves ()
 
        crossfade.fade_in().get_vector (0, crossfade.length(), vec, npoints);
        for (int i = 0, pci = 0; i < npoints; ++i) {
-               points->coords[pci++] = i;
-               points->coords[pci++] = 2.0 + h - (h * vec[i]);
+               Art::Point &p = (*points)[pci++];
+               p.set_x(i);
+               p.set_y(2.0 + h - (h * vec[i]));
        }
-       gnome_canvas_item_set (fade_in, "points", points, NULL);
+       fade_in->property_points().set_value(*points);
 
        crossfade.fade_out().get_vector (0, crossfade.length(), vec, npoints);
        for (int i = 0, pci = 0; i < npoints; ++i) {
-               points->coords[pci++] = i;
-               points->coords[pci++] = 2.0 + h - (h * vec[i]);
+               Art::Point &p = (*points)[pci++];
+               p.set_x(i);
+               p.set_y(2.0 + h - (h * vec[i]));
        }
-       gnome_canvas_item_set (fade_out, "points", points, NULL);
+       fade_out->property_points().set_value(*points);
 
        delete [] vec;
 
-       gnome_canvas_points_unref (points);
+       delete points;
 
        /* XXX this is ugly, but it will have to wait till Crossfades are reimplented
           as regions. This puts crossfade views on top of a track, above all regions.
index 27c182929cd1822713626e8cde9e4af9bacbf711..ef137bef78058df475ac1080ec2de846ed09ea33 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <vector>
 #include <gtkmm.h>
-#include <libgnomecanvas/libgnomecanvas.h>
+#include <libgnomecanvasmm/libgnomecanvasmm.h>
 #include <sigc++/signal.h>
 #include <ardour/crossfade.h>
 
@@ -71,10 +71,10 @@ struct CrossfadeView : public TimeAxisViewItem
 
     double spu;
 
-    GnomeCanvasItem *overlap_rect;
-    GnomeCanvasItem *fade_in;
-    GnomeCanvasItem *fade_out;
-    GnomeCanvasItem *active_button;
+    Gnome::Canvas::Item *overlap_rect;
+    Gnome::Canvas::Line *fade_in;
+    Gnome::Canvas::Line *fade_out;
+    Gnome::Canvas::Item *active_button;
 
     void crossfade_changed (ARDOUR::Change);
     void active_changed ();
index 52be03c4649f689869caeea8306d3b008d7b847b..760268d023528d003b41e1a798f0420b5e6bdfdf 100644 (file)
@@ -604,8 +604,8 @@ class Editor : public PublicEditor
 
        struct Cursor {
            Editor&               editor;
-           ArdourCanvas::Points* points;
-           ArdourCanvas::Item*  canvas_item;
+           ArdourCanvas::Points  points;
+           ArdourCanvas::Line    canvas_item;
            jack_nframes_t        current_frame;
            double                length;
 
index 78552d6451ee157005bdfef5829a1ff315daf59b..3fd0a561e7204aed29e291afe59e4a93b314bf3b 100644 (file)
@@ -31,30 +31,32 @@ using namespace ARDOUR;
 using namespace Gtk;
 
 Editor::Cursor::Cursor (Editor& ed, const string& color, bool (Editor::*callbck)(GdkEvent*,ArdourCanvas::Item*))
-       : editor (ed), length(1.0)
+       : editor (ed),
+         points (2),
+         canvas_item (*editor.cursor_group),
+         length(1.0)
 {
        
        /* "randomly" initialize coords */
 
-       points->push_back(Gnome::Art::Point(-9383839.0, 0.0));
-       points->push_back(Gnome::Art::Point(1.0, 0.0));
-       Gnome::Canvas::Group *group = editor.cursor_group;
+       points.push_back(Gnome::Art::Point(-9383839.0, 0.0));
+       points.push_back(Gnome::Art::Point(1.0, 0.0));
 
        // cerr << "set cursor points, nc = " << points->num_points << endl;
 
-       canvas_item = new Gnome::Canvas::Line (*group, *points);
-       canvas_item->set_property ("fill_color", color.c_str());
-       canvas_item->set_property ("width_pixels", 1);
-       canvas_item->set_property ("first_arrowhead", (gboolean) TRUE);
-       canvas_item->set_property ("last_arrowhead", (gboolean) TRUE);
-       canvas_item->set_property ("arrow_shape_a", 11.0);
-       canvas_item->set_property ("arrow_shape_b", 0.0);
-       canvas_item->set_property ("arrow_shape_c", 9.0);
+       canvas_item.property_points().set_value(points);
+       canvas_item.property_fill_color().set_value(color.c_str());
+       canvas_item.property_width_pixels().set_value(1);
+       canvas_item.property_first_arrowhead().set_value(TRUE);
+       canvas_item.property_last_arrowhead().set_value(TRUE);
+       canvas_item.property_arrow_shape_a().set_value(11.0);
+       canvas_item.property_arrow_shape_b().set_value(0.0);
+       canvas_item.property_arrow_shape_c().set_value(9.0);
 
        // cerr << "cursor line @ " << canvas_item << endl;
 
-       canvas_item->set_data ("cursor", this);
-       canvas_item->signal_event().connect (bind (mem_fun (ed, callbck), canvas_item));
+       canvas_item.set_data ("cursor", this);
+       canvas_item.signal_event().connect (bind (mem_fun (ed, callbck), &canvas_item));
 
        current_frame = 1; /* force redraw at 0 */
 }
@@ -62,8 +64,6 @@ Editor::Cursor::Cursor (Editor& ed, const string& color, bool (Editor::*callbck)
 Editor::Cursor::~Cursor ()
 
 {
-        gtk_object_destroy (GTK_OBJECT(canvas_item));
-       gnome_canvas_points_unref (points->gobj());
 }
 
 void
@@ -72,43 +72,43 @@ Editor::Cursor::set_position (jack_nframes_t frame)
        double new_pos =  editor.frame_to_unit (frame);
 
        if (editor.session == 0) {
-               canvas_item->hide();
+               canvas_item.hide();
        } else {
-               canvas_item->show();
+               canvas_item.show();
        }
 
        current_frame = frame;
 
-       if (new_pos == points->front().get_x()) {
+       if (new_pos == points.front().get_x()) {
 
                /* change in position is not visible, so just raise it */
 
-               canvas_item->raise_to_top();
+               canvas_item.raise_to_top();
                return;
        } 
 
-       points->front().set_x(new_pos);
-       points->back().set_x(new_pos);
+       points.front().set_x(new_pos);
+       points.back().set_x(new_pos);
 
        // cerr << "set cursor2 al points, nc = " << points->num_points << endl;
-       canvas_item->set_property ("points", points);
-       canvas_item->raise_to_top();
+       canvas_item.property_points().set_value(points);
+       canvas_item.raise_to_top();
 }
 
 void
 Editor::Cursor::set_length (double units)
 {
        length = units; 
-       points->back().set_x (points->front().get_y() + length);
+       points.back().set_x (points.front().get_y() + length);
        // cerr << "set cursor3 al points, nc = " << points->num_points << endl;
-       canvas_item->set_property("points", points);
+       canvas_item.property_points().set_value(points);
 }
 
 void 
 Editor::Cursor::set_y_axis (double position)
 {
-        points->front().set_y (position);
-       points->back().set_x (position + length);
+        points.front().set_y (position);
+       points.back().set_x (position + length);
        // cerr << "set cursor4 al points, nc = " << points->num_points << endl;
-       canvas_item->set_property("points", points);
+       canvas_item.property_points().set_value(points);
 }
index 5a83bc04a364ce8c354e2a4ccd82cab62fefae89..802290a782e99fe618508ef19d918a6d8f329316 100644 (file)
@@ -85,14 +85,14 @@ Editor::event_frame (GdkEvent* event, double* pcx, double* pcy)
        case GDK_BUTTON_PRESS:
        case GDK_2BUTTON_PRESS:
        case GDK_3BUTTON_PRESS:
-               gnome_canvas_w2c_d (GNOME_CANVAS(&track_canvas), event->button.x, event->button.y, pcx, pcy);
+               track_canvas.w2c(event->button.x, event->button.y, *pcx, *pcy);
                break;
        case GDK_MOTION_NOTIFY:
-               gnome_canvas_w2c_d (GNOME_CANVAS(&track_canvas), event->motion.x, event->motion.y, pcx, pcy);
+               track_canvas.w2c(event->motion.x, event->motion.y, *pcx, *pcy);
                break;
        case GDK_ENTER_NOTIFY:
        case GDK_LEAVE_NOTIFY:
-               gnome_canvas_w2c_d (GNOME_CANVAS(&track_canvas), event->crossing.x, event->crossing.y, pcx, pcy);
+               track_canvas.w2c(event->crossing.x, event->crossing.y, *pcx, *pcy);
                break;
        default:
                warning << string_compose (_("Editor::event_frame() used on unhandled event type %1"), event->type) << endmsg;
@@ -282,7 +282,7 @@ Editor::step_mouse_mode (bool next)
        }
 }
 
-gint
+bool
 Editor::button_press_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemType item_type)
 {
        jack_nframes_t where = event_frame (event, 0, 0);
@@ -780,7 +780,7 @@ Editor::button_press_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemTy
        return FALSE;
 }
 
-gint
+bool
 Editor::button_release_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemType item_type)
 {
        jack_nframes_t where = event_frame (event, 0, 0);
@@ -1115,7 +1115,7 @@ Editor::maybe_autoscroll (GdkEvent* event)
        }
 }
 
-gint
+bool
 Editor::enter_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemType item_type)
 {
        ControlPoint* cp;
@@ -1313,7 +1313,7 @@ Editor::enter_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemType item
        return FALSE;
 }
 
-gint
+bool
 Editor::leave_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemType item_type)
 {
        AutomationLine* al;
@@ -1436,7 +1436,7 @@ Editor::left_automation_track ()
        return FALSE;
 }
 
-gint
+bool
 Editor::motion_handler (Gnome::Canvas::Item* item, GdkEvent* event, ItemType item_type)
 {
        gint x, y;
@@ -1924,11 +1924,11 @@ Editor::cursor_drag_finished_callback (Gnome::Canvas::Item* item, GdkEvent* even
        
        cursor_drag_motion_callback (item, event);
        
-       if (item == playhead_cursor->canvas_item) {
+       if (item == &playhead_cursor->canvas_item) {
                if (session) {
                        session->request_locate (playhead_cursor->current_frame, drag_info.was_rolling);
                }
-       } else if (item == edit_cursor->canvas_item) {
+       } else if (item == &edit_cursor->canvas_item) {
                edit_cursor->set_position (edit_cursor->current_frame);
                edit_cursor_clock.set (edit_cursor->current_frame);
        } 
@@ -2331,7 +2331,7 @@ Editor::control_point_drag_motion_callback (Gnome::Canvas::Item* item, GdkEvent*
        
        } 
 
-       cp->line.parent_group()->w2i (cx, cy);
+       cp->line.parent_group().w2i (cx, cy);
 
        cx = max (0.0, cx);
        cy = max (0.0, cy);
@@ -2405,7 +2405,7 @@ Editor::start_line_grab (AutomationLine* line, GdkEvent* event)
 
        cx = event->button.x;
        cy = event->button.y;
-       line->parent_group()->w2i (cx, cy);
+       line->parent_group().w2i (cx, cy);
        frame_within_region = (jack_nframes_t) floor (cx * frames_per_unit);
 
        if (!line->control_points_adjacent (frame_within_region, current_line_drag_info.before, 
@@ -2414,7 +2414,7 @@ Editor::start_line_grab (AutomationLine* line, GdkEvent* event)
                return;
        }
 
-       drag_info.item = line->grab_item();
+       drag_info.item = &line->grab_item();
        drag_info.data = line;
        drag_info.motion_callback = &Editor::line_drag_motion_callback;
        drag_info.finished_callback = &Editor::line_drag_finished_callback;
@@ -2437,7 +2437,7 @@ Editor::line_drag_motion_callback (Gnome::Canvas::Item* item, GdkEvent* event)
        double cx = drag_info.current_pointer_x;
        double cy = drag_info.current_pointer_y;
 
-       line->parent_group()->w2i (cx, cy);
+       line->parent_group().w2i (cx, cy);
        
        double fraction;
        fraction = 1.0 - (cy / line->height());
index f6a081ca35855914cd72c83c04cbc9f3d94ef055..c8a89ca5b6bdfabe705fbef2ac4cab3632ea381f 100644 (file)
@@ -1,9 +1,11 @@
-#include "canvas-simplerect.h"
+#include "simplerect.h"
+#include "waveview.h"
 #include "ghostregion.h"
 #include "automation_time_axis.h"
 #include "rgb_macros.h"
 
 using namespace Editing;
+using namespace ArdourCanvas;
 
 GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos)
        : trackview (atv)
@@ -32,14 +34,15 @@ GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos)
 GhostRegion::~GhostRegion ()
 {
        GoingAway (this);
-       gtk_object_destroy (GTK_OBJECT(group));
+       delete base_rect;
+       delete group;
 }
 
 void
 GhostRegion::set_samples_per_unit (double spu)
 {
-       for (vector<GnomeCanvasItem*>::iterator i = waves.begin(); i != waves.end(); ++i) {
-               gnome_canvas_item_set ((*i), "samples_per_unit", spu, NULL);
+       for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
+               (*i)->property_samples_per_unit().set_value(spu);
        }               
 }
 
@@ -53,7 +56,7 @@ void
 GhostRegion::set_height ()
 {
        gdouble ht;
-       vector<GnomeCanvasItem*>::iterator i;
+       vector<WaveView*>::iterator i;
        uint32_t n;
 
        base_rect->set_property ("y2", (double) trackview.height);
@@ -61,7 +64,8 @@ GhostRegion::set_height ()
        
        for (n = 0, i = waves.begin(); i != waves.end(); ++i, ++n) {
                gdouble yoff = n * ht;
-               gnome_canvas_item_set ((*i), "height", ht, "y", yoff, NULL);
+               (*i)->property_height().set_value(ht);
+               (*i)->property_y().set_value(yoff);
        }
 }
 
index a286bbc8d070e23ae36ee0bcd131b9c9d595d02a..0ca52a70e69a306da88ab7b6ca9831dbf7527594 100644 (file)
@@ -24,6 +24,7 @@
 #include <vector>
 #include <sigc++/signal.h>
 #include <libgnomecanvasmm/libgnomecanvasmm.h>
+#include "canvas.h"
 #include "simplerect.h"
 
 class AutomationTimeAxisView;
@@ -31,9 +32,9 @@ class AutomationTimeAxisView;
 struct GhostRegion : public sigc::trackable
 {
     AutomationTimeAxisView& trackview;
-    Gnome::Canvas::Group* group;
-    Gnome::Canvas::SimpleRect* base_rect;
-    std::vector<GnomeCanvasItem*> waves;
+    ArdourCanvas::Group* group;
+    ArdourCanvas::SimpleRect* base_rect;
+    std::vector<ArdourCanvas::WaveView*> waves;
 
     GhostRegion (AutomationTimeAxisView& tv, double initial_unit_pos);
     ~GhostRegion ();
diff --git a/gtk2_ardour/imageframe.cc b/gtk2_ardour/imageframe.cc
new file mode 100644 (file)
index 0000000..a376058
--- /dev/null
@@ -0,0 +1,185 @@
+// Generated by gtkmmproc -- DO NOT MODIFY!
+
+#include "imageframe.h"
+#include "imageframe_p.h"
+#include <libgnomecanvasmm/private/shape_p.h>
+
+/* $Id$ */
+
+/* rect.c
+ *
+ * Copyright (C) 1998 EMC Capital Management Inc.
+ * Developed by Havoc Pennington <hp@pobox.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+namespace Gnome
+{
+
+namespace Canvas
+{
+
+ImageFrame::ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h)
+: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
+{
+  item_construct(parentx);
+  set("x1",x1,"y1",y1,"x2",x2,"y2",y2,0);
+}
+
+ImageFrame::ImageFrame(Group& parentx)
+: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
+{
+  item_construct(parentx);
+}
+
+} /* namespace Canvas */
+} /* namespace Gnome */
+
+
+namespace
+{
+} // anonymous namespace
+
+
+namespace Glib
+{
+
+Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy)
+{
+  return dynamic_cast<Gnome::Canvas::ImageFrame *> (Glib::wrap_auto ((GObject*)(object), take_copy));
+}
+
+} /* namespace Glib */
+
+namespace Gnome
+{
+
+namespace Canvas
+{
+
+
+/* The *_Class implementation: */
+
+const Glib::Class& ImageFrame_Class::init()
+{
+  if(!gtype_) // create the GType if necessary
+  {
+    // Glib::Class has to know the class init function to clone custom types.
+    class_init_func_ = &ImageFrame_Class::class_init_function;
+
+    // This is actually just optimized away, apparently with no harm.
+    // Make sure that the parent type has been created.
+    //CppClassParent::CppObjectType::get_type();
+
+    // Create the wrapper type, with the same class/instance size as the base type.
+    register_derived_type(gnome_canvas_imageframe_get_type());
+
+    // Add derived versions of interfaces, if the C type implements any interfaces:
+  }
+
+  return *this;
+}
+
+void ImageFrame_Class::class_init_function(void* g_class, void* class_data)
+{
+  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
+  CppClassParent::class_init_function(klass, class_data);
+
+}
+
+Glib::ObjectBase* ImageFrame_Class::wrap_new(GObject* o)
+{
+  return manage(new ImageFrame((GnomeCanvasImageFrame*)(o)));
+
+}
+
+/* The implementation: */
+
+ImageFrame::ImageFrame(const Glib::ConstructParams& construct_params)
+: Item(construct_params)
+{
+  }
+
+ImageFrame::ImageFrame(GnomeCanvasImageFrame* castitem)
+: Item ((GnomeCanvasItem*)(castitem))
+{
+}
+
+ImageFrame::~ImageFrame()
+{
+  destroy_();
+}
+
+ImageFrame::CppClassType ImageFrame::rect_class_; // initialize static member
+
+GType ImageFrame::get_type()
+{
+  return rect_class_.init().get_type();
+}
+
+GType ImageFrame::get_base_type()
+{
+  return gnome_canvas_imageframe_get_type();
+}
+
+Glib::PropertyProxy<double> ImageFrame::property_x()
+{
+       return Glib::PropertyProxy<double> (this, "x");
+}
+Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_x() const
+{
+       return Glib::PropertyProxy_ReadOnly<double> (this, "x");
+}
+Glib::PropertyProxy<double> ImageFrame::property_y()
+{
+       return Glib::PropertyProxy<double> (this, "y");
+}
+Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_y() const
+{
+       return Glib::PropertyProxy_ReadOnly<double> (this, "y");
+}
+Glib::PropertyProxy<double> ImageFrame::property_width()
+{
+       return Glib::PropertyProxy<double> (this, "width");
+}
+Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_width() const
+{
+       return Glib::PropertyProxy_ReadOnly<double> (this, "width");
+}
+Glib::PropertyProxy<double> ImageFrame::property_drawwidth()
+{
+       return Glib::PropertyProxy<double> (this, "drawwidth");
+}
+Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_drawwidth() const
+{
+       return Glib::PropertyProxy_ReadOnly<double> (this, "drawwidth");
+}
+
+Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor() 
+{
+  return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor");
+}
+
+Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> ImageFrame::property_anchor() const
+{
+  return Glib::PropertyProxy_ReadOnly<Gtk::AnchorType>(this, "anchor");
+}
+
+
+
+} // namespace Canvas
+
+} // namespace Gnome
diff --git a/gtk2_ardour/imageframe.h b/gtk2_ardour/imageframe.h
new file mode 100644 (file)
index 0000000..b2ff25b
--- /dev/null
@@ -0,0 +1,144 @@
+// -*- c++ -*-
+#ifndef _LIBGNOMECANVASMM_IMAGEFRAME_H
+#define _LIBGNOMECANVASMM_IMAGEFRAME_H
+
+#include <glibmm.h>
+
+/* $Id$ */
+
+/* rect.h
+ * 
+ * Copyright (C) 1998 EMC Capital Management Inc.
+ * Developed by Havoc Pennington <hp@pobox.com>
+ *
+ * Copyright (C) 1999 The Gtk-- Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <libgnomecanvasmm/item.h>
+#include <libgnomecanvasmm/group.h>
+#include <libgnomecanvasmm/shape.h>
+#include "canvas-imageframe.h"
+
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
+typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+
+namespace Gnome
+{
+
+namespace Canvas
+{ class ImageFrame_Class; } // namespace Canvas
+
+} // namespace Gnome
+namespace Gnome
+{
+
+namespace Canvas
+{
+
+//class Group;
+
+
+class ImageFrame : public Item
+{
+  public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  typedef ImageFrame CppObjectType;
+  typedef ImageFrame_Class CppClassType;
+  typedef GnomeCanvasImageFrame BaseObjectType;
+  typedef GnomeCanvasImageFrameClass BaseClassType;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+  virtual ~ImageFrame();
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+private:
+  friend class ImageFrame_Class;
+  static CppClassType rect_class_;
+
+  // noncopyable
+  ImageFrame(const ImageFrame&);
+  ImageFrame& operator=(const ImageFrame&);
+
+protected:
+  explicit ImageFrame(const Glib::ConstructParams& construct_params);
+  explicit ImageFrame(GnomeCanvasImageFrame* castitem);
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+public:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  static GType get_type()      G_GNUC_CONST;
+  static GType get_base_type() G_GNUC_CONST;
+#endif
+
+  ///Provides access to the underlying C GtkObject.
+  GnomeCanvasImageFrame*       gobj()       { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); }
+
+  ///Provides access to the underlying C GtkObject.
+  const GnomeCanvasImageFrame* gobj() const { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); }
+
+
+public:
+  //C++ methods used to invoke GTK+ virtual functions:
+
+protected:
+  //GTK+ Virtual Functions (override these to change behaviour):
+
+  //Default Signal Handlers::
+
+
+private:
+
+
+public:
+    ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h);
+    explicit ImageFrame(Group& parent);
+
+    Glib::PropertyProxy<double> property_x();
+    Glib::PropertyProxy_ReadOnly<double> property_x() const;
+    Glib::PropertyProxy<double> property_y();
+    Glib::PropertyProxy_ReadOnly<double> property_y() const;
+    Glib::PropertyProxy<double> property_width();
+    Glib::PropertyProxy_ReadOnly<double> property_width() const;
+    Glib::PropertyProxy<double> property_drawwidth();
+    Glib::PropertyProxy_ReadOnly<double> property_drawwidth() const;
+    Glib::PropertyProxy<double> property_height();
+    Glib::PropertyProxy_ReadOnly<double> property_height() const;
+    Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ;
+    Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const;
+
+};
+
+} /* namespace Canvas */
+} /* namespace Gnome */
+
+namespace Glib
+{
+  /** @relates Gnome::Canvas::ImageFrame
+   * @param object The C instance
+   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
+   * @result A C++ instance that wraps this C instance.
+   */
+  Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy = false);
+}
+#endif /* _LIBGNOMECANVASMM_IMAGEFRAME_H */
+
index 397ea5d41e3e74cd63a989ada09d90227bce48f9..688cc4d5e2551f0cce1742622ca46a1f12f3aa37 100644 (file)
@@ -48,24 +48,17 @@ using namespace Editing;
  * @param ifta the parent ImageFrameTimeAxis of this view helper
  */
 ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv)
-       : _trackview (tv)
+       : _trackview (tv),
+         canvas_group (*_trackview.canvas_display),
+         canvas_rect (canvas_group, 0.0, 0.0, 1000000.0, tv.height)
 {
        region_color = _trackview.color() ;
        stream_base_color = color_map[cImageTrackBase] ;
 
-       canvas_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(_trackview.canvas_display), gnome_canvas_group_get_type (), 0) ;
+       canvas_rect.property_outline_color_rgba().set_value(color_map[cImageTrackOutline]);
+       canvas_rect.property_fill_color_rgba().set_value(stream_base_color);
 
-       canvas_rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_group),
-               gnome_canvas_simplerect_get_type(),
-               "x1", 0.0,
-               "y1", 0.0,
-               "x2", 1000000.0,
-               "y2", (double) tv.height,
-               "outline_color_rgba", color_map[cImageTrackOutline],
-               "fill_color_rgba", stream_base_color,
-               0) ;
-
-       canvas_rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_imageframe_view_event), canvas_rect, &_trackview));
+       canvas_rect.signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_imageframe_view_event), canvas_rect, &_trackview));
 
        _samples_per_unit = _trackview.editor.get_current_zoom() ;
 
@@ -99,18 +92,6 @@ ImageFrameTimeAxisView::~ImageFrameTimeAxisView()
                iter = next ;
        }
        
-       // Destroy all our canvas components
-       if(canvas_rect)
-       {
-               gtk_object_destroy(GTK_OBJECT(canvas_rect)) ;
-               canvas_rect = 0 ;
-       }
-       
-       if(canvas_group)
-       {
-               gtk_object_destroy(GTK_OBJECT(canvas_group));
-               canvas_group = 0 ;
-       }
 }
 
 
@@ -126,15 +107,12 @@ int
 ImageFrameTimeAxisView::set_height (gdouble h)
 {
        /* limit the values to something sane-ish */
-       if (h < 10.0 || h > 1000.0)
-       {
+       if (h < 10.0 || h > 1000.0) {
                return(-1) ;
        }
        
-       if(canvas_rect != 0)
-       {
-               gtk_object_set(GTK_OBJECT(canvas_rect), "y2", h, NULL) ;
-       }
+       canvas_rect.property_y2().set_value(h) ;
+
 
        for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer)
        {
@@ -154,7 +132,9 @@ int
 ImageFrameTimeAxisView::set_position (gdouble x, gdouble y)
 
 {
-       gnome_canvas_item_set (canvas_group, "x", x, "y", y, NULL);
+       canvas_group.property_x().set_value(x);
+       canvas_group.property_y().set_value(y);
+
        return 0;
 }
 
index f6215236f18f492332010a20f7c154fbc1e31789..46403167c42c61fe596aad92d3a4bcf4b9a6de60 100644 (file)
 #include <list>
 #include <cmath>
 
-#include <gtkmm.h>
-#include <libgnomecanvas/libgnomecanvas.h>
 #include <jack/jack.h>
+#include <gtkmm.h>
+#include <libgnomecanvasmm/libgnomecanvasmm.h>
+#include "canvas.h"
+#include "simplerect.h"
+
 
 class PublicEditor ;
 class ImageFrameTimeAxis ;
@@ -71,7 +74,7 @@ class ImageFrameTimeAxisView : public sigc::trackable
                /**
                 *
                 */
-               GnomeCanvasItem* canvas_item() { return canvas_group; }
+               ArdourCanvas::Group * canvas_item() { return &canvas_group; }
                
                
                //---------------------------------------------------------------------------------------//
@@ -256,8 +259,8 @@ class ImageFrameTimeAxisView : public sigc::trackable
                /* the TimeAxisView that this object is acting as the view helper for */
                ImageFrameTimeAxis& _trackview ;
                
-               GnomeCanvasItem *canvas_group ;
-               GnomeCanvasItem *canvas_rect; /* frame around the whole thing */
+               ArdourCanvas::Group       canvas_group ;
+               ArdourCanvas::SimpleRect  canvas_rect; /* frame around the whole thing */
                
                /** the current samples per unit */
                double _samples_per_unit ;
index 42bc98b134d52ca79abc4ce31aee1c9c596ce48f..2bac926b7e258d1063c99204f4fb8a82a7184c35 100644 (file)
@@ -267,8 +267,9 @@ Marker::Marker (PublicEditor& ed, Gnome::Canvas::Group& parent, guint32 rgba, co
 Marker::~Marker ()
 {
        /* destroying the group destroys its contents */
-       gtk_object_destroy (GTK_OBJECT(group));
-       gnome_canvas_points_unref (points->gobj());
+       delete text;
+       delete mark;
+       delete points;
 }
 
 void
index adc36c18f4a6734ff8f2f7097fceb3924a0f1e1f..0ae55c8174912f1682635904e608b307aadc946e 100644 (file)
@@ -10,23 +10,6 @@ using namespace std;
 using namespace sigc;
 using namespace Glib;
 
-struct ActionBinding {
-    Glib::ustring             name;
-    Glib::ustring             label;
-    Gtk::Action::SlotActivate binding;
-    guint                     key;
-    Gdk::ModifierType         mods;
-
-    ActionBinding (Glib::ustring n, Glib::ustring l, Gtk::Action::SlotActivate b, 
-                  guint k = GDK_VoidSymbol, Gdk::ModifierType m = Gdk::ModifierType (0)) 
-           : name (n),
-             label (l),
-             binding (b),
-             key (k),
-             mods (m) {}
-};
-
-
 void
 printit (string txt)
 {
@@ -34,62 +17,21 @@ printit (string txt)
 }
 
 Glib::RefPtr<Action>
-make_action (vector<Glib::RefPtr<ActionGroup> >& groups, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods)
-{
-       Glib::RefPtr<Action> last;
-
-       for (vector<RefPtr<ActionGroup> >::iterator g = groups.begin(); g != groups.end(); ++g) {
-               Glib::RefPtr<Action> act = Action::create (name, label);
-               (*g)->add (act, sl);
-               AccelMap::add_entry (act->get_accel_path(), key, mods);
-               last = act;
-       }
-
-       return last;
-}
-
-Glib::RefPtr<Action>
-make_action (Glib::RefPtr<ActionGroup> group, Glib::RefPtr<AccelGroup> accel_group, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods)
+make_action (Glib::RefPtr<ActionGroup> group, string name, string label, RefPtr<AccelGroup> accels, slot<void> sl, guint key, Gdk::ModifierType mods)
 {
        Glib::RefPtr<Action> act;
 
        act = Action::create (name, label);
        group->add (act, sl);
        AccelMap::add_entry (act->get_accel_path(), key, mods);
-       act->set_accel_group (accel_group);
-
-       cerr << "action " << name << " has path " << act->get_accel_path() << endl;
-       
-       return act;
-}
 
-Glib::RefPtr<Action>
-make_action (Glib::RefPtr<ActionGroup> group, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods)
-{
-       Glib::RefPtr<Action> act;
-
-       act = Action::create (name, label);
-       group->add (act, sl);
-       AccelMap::add_entry (act->get_accel_path(), key, mods);
+       act->set_accel_group (accels);
 
        cerr << "action " << name << " has path " << act->get_accel_path() << endl;
        
        return act;
 }
 
-Glib::RefPtr<Action>
-make_action (Glib::RefPtr<ActionGroup> group, string name, string label, slot<void> sl)
-{
-       Glib::RefPtr<Action> act;
-
-       act = Action::create (name, label);
-       group->add (act, sl);
-
-       cerr << "action " << name << " has path " << act->get_accel_path() << endl;
-
-       return act;
-}
-
 Glib::RefPtr<Action>
 make_action (Glib::RefPtr<ActionGroup> group, string name, string label)
 {
@@ -119,34 +61,25 @@ lookup_entry (const ustring accel_path, Gtk::AccelKey& key)
 }
 
 RefPtr<ActionGroup>
-make_shared_action_group (ustring name, vector<ActionBinding*>& actions)
+copy_actions (const RefPtr<ActionGroup> src)
 {
-       RefPtr<ActionGroup> grp = ActionGroup::create (name);
-
-       for (vector<ActionBinding*>::iterator i = actions.begin(); i != actions.end(); ++i) {
-               RefPtr<Action> act = Action::create ((*i)->name, (*i)->label);
+       RefPtr<ActionGroup> grp = ActionGroup::create (src->get_name());
+       
+       ListHandle<RefPtr<Action> > group_actions = src->get_actions();
+       
+       for (ListHandle<RefPtr<Action> >::iterator a = group_actions.begin(); a != group_actions.end(); ++a) {
+               RefPtr<Action> act = Action::create ((*a)->get_name(), (*a)->property_label());
                grp->add (act);
-
-               if ((*i)->key != GDK_VoidSymbol) {
-                       Gtk::AccelKey key;
-
-                       /* since this is a shared action, only add it once */
-
-                       if (!lookup_entry (act->get_accel_path(), key)) {
-                               AccelMap::add_entry (act->get_accel_path(), (*i)->key, (*i)->mods);
-                               cerr << "added accel map entry for " << act->get_accel_path() << endl;
-                       }
-               }
        }
 
        return grp;
 }
 
-
 int
 main (int argc, char* argv[])
 {
        Main app (argc, argv);
+       Window hidden (WINDOW_TOPLEVEL);
        Window window (WINDOW_TOPLEVEL);
        Window other_window (WINDOW_TOPLEVEL);
        Button button ("click me for baz");
@@ -169,42 +102,38 @@ main (int argc, char* argv[])
 
        uimanager = UIManager::create();
        other_uimanager = UIManager::create();
+       shared_uimanager = UIManager::create();
 
        actions = ActionGroup::create("MyActions");
        other_actions = ActionGroup::create("OtherActions");
+       shared_actions = ActionGroup::create("SharedActions");
 
        uimanager->add_ui_from_file ("mtest.menus");
        other_uimanager->add_ui_from_file ("mtest_other.menus");
        
        // AccelMap::load ("mtest.bindings");
 
-       vector<RefPtr<ActionGroup> > all_groups;
-       all_groups.push_back (actions);
-       all_groups.push_back (other_actions);
-       
+       RefPtr<AccelGroup> accels = hidden.get_accel_group();
+
        make_action (actions, "TopMenu", "top");
-       make_action (actions, "Foo", "foo", bind (sigc::ptr_fun (printit), "foo"), GDK_p, Gdk::ModifierType (0));
+       make_action (actions, "Foo", "foo", accels, bind (sigc::ptr_fun (printit), "foo"), GDK_p, Gdk::ModifierType (0));
 
        make_action (other_actions, "OTopMenu", "otop");
-       make_action (other_actions, "OFoo", "foo", bind (sigc::ptr_fun (printit), "o-foo"), GDK_p, Gdk::ModifierType (0));
-
-       vector<ActionBinding*> shared_actions;
-
-       shared_actions.push_back (new ActionBinding ("Bar", "bar", bind (sigc::ptr_fun (printit), "barshared"), GDK_p, Gdk::CONTROL_MASK));
-       shared_actions.push_back (new ActionBinding ("Baz", "baz", bind (sigc::ptr_fun (printit), "baz-shared"), GDK_p, Gdk::SHIFT_MASK));
+       make_action (other_actions, "OFoo", "foo", accels, bind (sigc::ptr_fun (printit), "o-foo"), GDK_p, Gdk::ModifierType (0));
 
-       RefPtr<Action> act = Action::create (shared_actions.back()->name, shared_actions.back()->label);
+       make_action (shared_actions, "Bar", "bar", accels, bind (sigc::ptr_fun (printit), "barshared"), GDK_p, Gdk::CONTROL_MASK);
+       RefPtr<Action> act = make_action (shared_actions, "Baz", "baz", accels, bind (sigc::ptr_fun (printit), "baz-shared"), GDK_p, Gdk::SHIFT_MASK);
        
        act->connect_proxy (button);
        act->connect_proxy (other_button);
 
-       uimanager->insert_action_group (actions);
-       uimanager->insert_action_group (make_shared_action_group ("shared", shared_actions));
-       other_uimanager->insert_action_group (other_actions);
-       other_uimanager->insert_action_group (make_shared_action_group ("othershared", shared_actions));
+       uimanager->insert_action_group (copy_actions (actions));
+       uimanager->insert_action_group (copy_actions (shared_actions));
+       other_uimanager->insert_action_group (copy_actions (other_actions));
+       other_uimanager->insert_action_group (copy_actions (shared_actions));
 
-       other_window.add_accel_group (other_uimanager->get_accel_group());
-       window.add_accel_group (uimanager->get_accel_group());
+       other_window.add_accel_group (accels);
+       window.add_accel_group (accels);
 
        Gtk::MenuBar* m;
 
index c6b41a66038376925d0272232e1f585e6c8155fc..f2a32321d09e5624e6b98132edc4ba8326f4da2d 100644 (file)
@@ -23,7 +23,6 @@
 #include <gtkmm/table.h>
 #include <gtkmm/button.h>
 #include <gtkmm/notebook.h>
-#include <gtkmm/ctree.h>
 
 #include <ardour/plugin_manager.h>
 #include <ardour/plugin.h>
 
 using namespace ARDOUR;
 
-static const gchar *i_titles[] = {
-       N_("Available LADSPA plugins"), 
-       N_("Type"),
-       N_("# Inputs"), 
-       N_("# Outputs"),
-       0
-};
-
-#ifdef VST_SUPPORT
-static const gchar *vst_titles[] = {
-       N_("Available VST plugins"), 
-       N_("# Inputs"), 
-       N_("# Outputs"),
-       0
-};
-#endif
-
-static const gchar *o_titles[] = {
-       N_("To be added"),
-       0
-};
-
 PluginSelector::PluginSelector (PluginManager *mgr)
-       : ArdourDialog ("plugin selector"),
-         ladspa_display (_input_refiller, this, internationalize (i_titles), false, true),
-#ifdef VST_SUPPORT
-        vst_display (_vst_refiller, this, internationalize (vst_titles), false, true),
-#endif
-         o_selector (_output_refiller, this, internationalize (o_titles), false, true)
+       : ArdourDialog ("plugin selector")
 {
        set_position (Gtk::WIN_POS_MOUSE);
        set_name ("PluginSelectorWindow");
@@ -78,6 +50,41 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        o_selected_plug = -1;
        i_selected_plug = 0;
 
+       lmodel = Gtk::ListStore::create(lcols);
+       ladspa_display.set_model (lmodel);
+       ladspa_display.append_column (_("Available LADSPA plugins"), lcols.name);
+       ladspa_display.append_column (_("Type"), lcols.type);
+       ladspa_display.append_column (_("# Inputs"),lcols.ins);
+       ladspa_display.append_column (_("# Outputs"), lcols.outs);
+       ladspa_display.set_headers_visible (true);
+       ladspa_display.set_reorderable (false);
+
+       amodel = Gtk::ListStore::create(acols);
+       added_list.set_model (amodel);
+       added_list.append_column (_("To be added"), acols.text);
+       added_list.set_headers_visible (true);
+       added_list.set_reorderable (false);
+
+       for (int i = 0; i <=3; i++) {
+               Gtk::TreeView::Column* column = ladspa_display.get_column(i);
+               column->set_sort_column(i);
+       }
+
+#ifdef VST_SUPPORT
+       vmodel = ListStore::create(vcols);
+       vst_display.set_model (vmodel);
+       vst_display.append_column (_("Available plugins"), vcols.name);
+       vst_display.append_column (_("# Inputs"), vcols.ins);
+       vst_display.append_column (_("# Outputs"), vcols.outs);
+       vst_display.set_headers_visible (true);
+       vst_display.set_reorderable (false);
+
+       for (int i = 0; i <=2; i++) {
+               column = vst_display.get_column(i);
+               column->set_sort_column(i);
+       }
+#endif
+
        Gtk::Button *btn_add = manage(new Gtk::Button(_("Add")));
        ARDOUR_UI::instance()->tooltips().set_tip(*btn_add, _("Add a plugin to the effect list"));
        Gtk::Button *btn_remove = manage(new Gtk::Button(_("Remove")));
@@ -101,7 +108,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        table->attach(*btn_remove, 3, 4, 5, 6, Gtk::FILL, Gtk::FILL, 5, 5);
        table->attach(*btn_update, 5, 6, 5, 6, Gtk::FILL, Gtk::FILL, 5, 5);
 
-       table->attach(o_selector, 0, 7, 7, 9);
+       table->attach(added_list, 0, 7, 7, 9);
        table->attach(*btn_ok, 1, 3, 9, 10, Gtk::FILL, Gtk::FILL, 5, 5);
        table->attach(*btn_cancel, 3, 4, 9, 10, Gtk::FILL, Gtk::FILL, 5, 5);
        add (*table);
@@ -116,30 +123,24 @@ PluginSelector::PluginSelector (PluginManager *mgr)
 
        table->set_name("PluginSelectorTable");
        //ladspa_display.set_name("PluginSelectorDisplay");
-       ladspa_display.clist().set_name("PluginSelectorList");
-       o_selector.clist().set_name("PluginSelectorList");
+       ladspa_display.set_name("PluginSelectorList");
+       added_list.set_name("PluginSelectorList");
        
-       ladspa_display.clist().column_titles_active();
-       ladspa_display.clist().column(0).set_auto_resize (false);
-       ladspa_display.clist().column(0).set_width(470);
+       //ladspa_display.clist().column(0).set_auto_resize (false);
+       //ladspa_display.clist().column(0).set_width(470);
 
-       ladspa_display.clist().column(1).set_auto_resize (true);
-       o_selector.clist().column(0).set_auto_resize (true);
+       //ladspa_display.clist().column(1).set_auto_resize (true);
+       //o_selector.clist().column(0).set_auto_resize (true);
 
-       ladspa_display.selection_made.connect (mem_fun(*this, &PluginSelector::i_plugin_selected));
-       ladspa_display.choice_made.connect(mem_fun(*this, &PluginSelector::i_plugin_chosen));
-       ladspa_display.clist().click_column.connect(bind (mem_fun(*this, &PluginSelector::column_clicked), ladspa_display.clist().gobj()));
+       ladspa_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
 #ifdef VST_SUPPORT
        if (Config->get_use_vst()) {
-               vst_display.selection_made.connect (mem_fun(*this, &PluginSelector::i_plugin_selected));
-               vst_display.choice_made.connect(mem_fun(*this, &PluginSelector::i_plugin_chosen));
-               vst_display.clist().click_column.connect(bind (mem_fun(*this, &PluginSelector::column_clicked), vst_display.clist().gobj()));
+               vst_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
        }
 #endif
-       o_selector.selection_made.connect(mem_fun(*this, &PluginSelector::o_plugin_selected));
-       o_selector.choice_made.connect(mem_fun(*this,&PluginSelector::o_plugin_chosen));
+       
        btn_update->signal_clicked().connect (mem_fun(*this, &PluginSelector::btn_update_clicked));
-       btn_add->clicked.connect(mem_fun(*this, &PluginSelector::btn_add_clicked));
+       btn_add->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_add_clicked));
        btn_remove->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_remove_clicked));
        btn_ok->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_ok_clicked));
        btn_cancel->signal_clicked().connect(mem_fun(*this,&PluginSelector::btn_cancel_clicked));
@@ -147,6 +148,13 @@ PluginSelector::PluginSelector (PluginManager *mgr)
 
 }
 
+void
+PluginSelector::row_clicked(GdkEventButton* event)
+{
+       if (event->type == GDK_2BUTTON_PRESS)
+               btn_add_clicked();
+}
+
 void
 PluginSelector::set_session (Session* s)
 {
@@ -160,16 +168,18 @@ PluginSelector::set_session (Session* s)
 }
 
 void
-PluginSelector::_input_refiller (Gtk::CList &list, void *arg)
+PluginSelector::_input_refiller (void *arg)
 {
-       ((PluginSelector *) arg)->input_refiller (list);
+       ((PluginSelector *) arg)->input_refiller ();
 }
 
+/*
 void
-PluginSelector::_output_refiller (Gtk::CList &list, void *arg)
+PluginSelector::_output_refiller (void *arg)
 {
-       ((PluginSelector *) arg)->output_refiller (list);
+       ((PluginSelector *) arg)->output_refiller ();
 }
+*/
 
 int compare(const void *left, const void *right)
 {
@@ -177,9 +187,9 @@ int compare(const void *left, const void *right)
 }
 
 void
-PluginSelector::input_refiller (Gtk::CList &clist)
+PluginSelector::input_refiller ()
 {
-       const gchar *rowdata[4];
+       //const gchar *rowdata[4];
        guint row;
        list<PluginInfo *> &plugs = manager->ladspa_plugin_info ();
        list<PluginInfo *>::iterator i;
@@ -187,64 +197,65 @@ PluginSelector::input_refiller (Gtk::CList &clist)
        
        // Insert into GTK list
        for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
-               rowdata[0] = (*i)->name.c_str();
-               rowdata[1] = (*i)->category.c_str();
+               //rowdata[0] = (*i)->name.c_str();
+               //rowdata[1] = (*i)->category.c_str();
 
                snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs);
                snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs);         
-               rowdata[2] = ibuf;
-               rowdata[3] = obuf;
                
-               clist.insert_row (row, rowdata);
-               clist.rows().back().set_data (*i);
+               Gtk::TreeModel::Row newrow = *(lmodel->append());
+               newrow[lcols.name] = (*i)->name.c_str();
+               newrow[lcols.type] = (*i)->category.c_str();
+               newrow[lcols.ins] = ibuf;
+               newrow[lcols.outs] = obuf;
+               newrow[lcols.plugin] = *i;
+               //clist.insert_row (row, rowdata);
+               //clist.rows().back().set_data (*i);
        }
 
-       clist.set_sort_column (0);
-       clist.sort ();
+       //clist.set_sort_column (0);
+       //clist.sort ();
 }
 
 #ifdef VST_SUPPORT
 
 void
-PluginSelector::_vst_refiller (Gtk::CList &list, void *arg)
+PluginSelector::_vst_refiller (void *arg)
 {
-       ((PluginSelector *) arg)->vst_refiller (list);
+       ((PluginSelector *) arg)->vst_refiller ();
 }
 
 void
-PluginSelector::vst_refiller (Gtk::CList &clist)
+PluginSelector::vst_refiller ()
 {
-       const gchar *rowdata[3];
        guint row;
        list<PluginInfo *> &plugs = manager->vst_plugin_info ();
        list<PluginInfo *>::iterator i;
        char ibuf[16], obuf[16];
        
-       if (!Config->get_use_vst()) {
-               return;
-       }
-
        // Insert into GTK list
-
-       for (row = 0, i = plugs.begin(); i != plugs.end(); ++i, ++row) {
-               rowdata[0] = (*i)->name.c_str();
+       for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
+               //rowdata[0] = (*i)->name.c_str();
+               //rowdata[1] = (*i)->category.c_str();
 
                snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs);
                snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs);         
-               rowdata[1] = ibuf;
-               rowdata[2] = obuf;
                
-               clist.insert_row (row, rowdata);
-               clist.rows().back().set_data (*i);
+               Gtk::TreeModel::Row newrow = *(vmodel->append());
+               newrow[vcols.name] = (*i)->name.c_str();
+               newrow[vcols.ins] = ibuf;
+               newrow[vcols.outs] = obuf;
+               newrow[vcols.plugin] = i;
        }
 
-       clist.set_sort_column (0);
-       clist.sort ();
+       //clist.set_sort_column (0);
+       //clist.sort ();
 }
 #endif
 
+/*
 void
-PluginSelector::output_refiller (Gtk::CList &clist)
+PluginSelector::output_refiller ()
 {
        const gchar *rowdata[2];
        guint row;
@@ -258,59 +269,7 @@ PluginSelector::output_refiller (Gtk::CList &clist)
                clist.rows().back().set_data (*i);
        }
 }
-
-void
-PluginSelector::i_plugin_chosen (Gtkmm2ext::Selector *selector,
-                                Gtkmm2ext::SelectionResult *res)
-{
-       if (res) {
-               // get text for name column (0)
-               i_selected_plug = static_cast<PluginInfo*> (selector->clist().row(res->row).get_data());
-               //i_selected_plug = *res->text;
-       } else {
-               i_selected_plug = 0;
-       }
-}
-
-void
-PluginSelector::i_plugin_selected (Gtkmm2ext::Selector *selector,
-                                  Gtkmm2ext::SelectionResult *res)
-{
-       if (res) {
-               added_plugins.push_back (static_cast<PluginInfo*> (selector->clist().row(res->row).get_data()));
-               //added_plugins.push_back(*(res->text));
-               o_selector.rescan();
-       }
-}
-
-void
-PluginSelector::o_plugin_chosen (Gtkmm2ext::Selector *selector,
-                             Gtkmm2ext::SelectionResult *res)
-{
-       if (res && res->text) {
-               o_selected_plug = res->row;
-       } else {
-               o_selected_plug = -1;
-       }
-
-}
-
-void
-PluginSelector::o_plugin_selected (Gtkmm2ext::Selector *selector,
-                               Gtkmm2ext::SelectionResult *res)
-{
-       if(res && res->text){
-               gint row = 0;
-               list<PluginInfo*>::iterator i = added_plugins.begin();
-               while (row < res->row){
-                       i++;
-                       row++;
-               }
-               added_plugins.erase(i);
-               o_selector.rescan();
-               o_selected_plug = -1;
-       }
-}
+*/
 
 void
 PluginSelector::use_plugin (PluginInfo* pi)
@@ -331,10 +290,26 @@ PluginSelector::use_plugin (PluginInfo* pi)
 void
 PluginSelector::btn_add_clicked()
 {
-       if (i_selected_plug) {
-               added_plugins.push_back (i_selected_plug);
-               o_selector.rescan();
+       bool vst = notebook.get_current_page(); // 0 = LADSPA, 1 = VST
+       std::string name;
+       ARDOUR::PluginInfo *pi;
+       Gtk::TreeModel::Row newrow = *(amodel->append());
+       
+       if (vst) {
+#ifdef VST_SUPPORT
+               Gtk::TreeModel::Row row = *(vst_display.get_selection()->get_selected());
+               name = row[vcols.name];
+               pi = row[vcols.plugin];
+               added_plugins.push_back (row[vcols.plugin]);
+#endif
+       } else {
+               Gtk::TreeModel::Row row = *(ladspa_display.get_selection()->get_selected());
+               name = row[lcols.name];
+               pi = row[lcols.plugin];
+               added_plugins.push_back (row[lcols.plugin]);
        }
+       newrow[acols.text] = name;
+       newrow[acols.plugin] = pi;
 }
 
 void
@@ -348,7 +323,7 @@ PluginSelector::btn_remove_clicked()
                        row++;
                }
                added_plugins.erase(i);
-               o_selector.rescan();
+               //o_selector.rescan();
                o_selected_plug = -1;
        }
 }
@@ -357,8 +332,6 @@ PluginSelector::btn_remove_clicked()
 void 
 PluginSelector::btn_ok_clicked()
 {
-       using namespace Gtk::CList_Helpers;
-
        list<PluginInfo*>::iterator i;
 
        for (i = added_plugins.begin(); i != added_plugins.end(); ++i){
@@ -367,23 +340,6 @@ PluginSelector::btn_ok_clicked()
 
        hide();
        added_plugins.clear();
-       o_selector.rescan();
-       i_selected_plug = 0;
-       o_selected_plug = -1;
-
-       SelectionList s_list = ladspa_display.clist().selection();
-       SelectionList::iterator s = s_list.begin();
-       if (s != s_list.end()) {
-               (*s).unselect();
-       }
-
-#ifdef VST_SUPPORT
-       SelectionList v_list = vst_display.clist().selection();
-       SelectionList::iterator v = v_list.begin();
-       if (v != v_list.end()) {
-               (*v).unselect();
-       }
-#endif
 }
 
 void
@@ -391,16 +347,13 @@ PluginSelector::btn_cancel_clicked()
 {
        hide();
        added_plugins.clear();
-       o_selector.rescan();
-       i_selected_plug = 0;
-       o_selected_plug = -1;
 }
 
 void
 PluginSelector::btn_update_clicked()
 {
        manager->refresh ();
-       ladspa_display.rescan ();
+       input_refiller ();
 }
 
 gint
@@ -409,10 +362,3 @@ PluginSelector::wm_close(GdkEventAny* ev)
        btn_cancel_clicked();
        return TRUE;
 }
-
-void
-PluginSelector::column_clicked (int column, GtkCList* clist)
-{
-       gtk_clist_set_sort_column (clist, column);
-       gtk_clist_sort (clist);
-}
index cc482ffbf050171b2f39c777150f40b7d65594fb..ca765f8aace58db01d4a4cad42a49e8760d3212e 100644 (file)
@@ -46,16 +46,63 @@ class PluginSelector : public ArdourDialog
        Gtk::Notebook notebook;
 
        // page 1
-       Gtkmm2ext::Selector ladspa_display;
+       //Gtkmm2ext::Selector ladspa_display;
+       struct LadspaColumns : public Gtk::TreeModel::ColumnRecord {
+               LadspaColumns () {
+                       add (name);
+                   add (type);
+                       add (ins);
+                       add (outs);
+                       add (plugin);
+               }
+           Gtk::TreeModelColumn<std::string> name;
+               Gtk::TreeModelColumn<std::string> type;
+               Gtk::TreeModelColumn<std::string> ins;
+               Gtk::TreeModelColumn<std::string> outs;
+           Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
+       };
+       LadspaColumns lcols;
+       Glib::RefPtr<Gtk::ListStore> lmodel;
+       Glib::RefPtr<Gtk::TreeSelection> lselection;
+       Gtk::TreeView ladspa_display;
+
+       struct AddedColumns : public Gtk::TreeModel::ColumnRecord {
+               AddedColumns () {
+                       add (text);
+                       add (plugin);
+               }
+               Gtk::TreeModelColumn<std::string> text;
+               Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
+       };
+       AddedColumns acols;
+       Glib::RefPtr<Gtk::ListStore> amodel;
+       Glib::RefPtr<Gtk::TreeSelection> aselection;
+       Gtk::TreeView added_list;
+
        void column_clicked (int column, GtkCList* clist);
 
 #ifdef VST_SUPPORT
        // page 2
-       Gtkmm2ext::Selector vst_display;
-       static void _vst_refiller (Gtk::CList &, void *);
-       void vst_refiller (Gtk::CList &);
+       struct VstColumns : public Gtk::TreeModel::ColumnRecord {
+               VstColumns () {
+                       add (name);
+                       add (ins);
+                       add (outs);
+                       add (plugin);
+               }
+           Gtk::TreeModelColumn<std::string> name;
+               Gtk::TreeModelColumn<std::string> ins;
+               Gtk::TreeModelColumn<std::string> outs;
+           Gtk::TreeModelColumn<ARDOUR::PluginInfo *> plugin;
+       };
+       LadspaColumns vcols;
+       Glib::RefPtr<Gtk::ListStore> vmodel;
+       Glib::RefPtr<Gtk::TreeSelection> vselection;
+       Gtk::TreeView vst_display;
+       static void _vst_refiller (void *);
+       void vst_refiller ();
 #endif 
-       Gtkmm2ext::Selector o_selector;
+       //Gtkmm2ext::Selector o_selector;
 
        ARDOUR::PluginInfo* i_selected_plug;
 
@@ -66,20 +113,11 @@ class PluginSelector : public ArdourDialog
        ARDOUR::PluginManager *manager;
        list<ARDOUR::PluginInfo*> added_plugins;
 
-       //static void _input_refiller (Gtk::CList &, void *);
-       //static void _output_refiller (Gtk::CList &, void *);
-
-       //void input_refiller (Gtk::CList &);
-       //void output_refiller (Gtk::CList &);
-       //void i_plugin_selected (Gtkmm2ext::Selector *selector,
-       //                      Gtkmm2ext::SelectionResult *res);
-        //void i_plugin_chosen (Gtkmm2ext::Selector *selector,
-       //                  Gtkmm2ext::SelectionResult *res);
-       //void o_plugin_selected (Gtkmm2ext::Selector *selector,
-       //                    Gtkmm2ext::SelectionResult *res);
-       //void o_plugin_chosen (Gtkmm2ext::Selector *selector,
-       //                  Gtkmm2ext::SelectionResult *res);
-       
+       static void _input_refiller (void *);
+       //static void _output_refiller (void *);
+
+       void input_refiller ();
+       void row_clicked(GdkEventButton *);
        void btn_add_clicked();
        void btn_remove_clicked();
        void btn_ok_clicked();
index 965ba84f35480ca8193e833d905e8746a1a8054b..0b63aa9d9765f4ff3b4a4e1761e6c6663dc5912f 100644 (file)
@@ -33,9 +33,9 @@
 #include "streamview.h"
 #include "regionview.h"
 #include "audio_time_axis.h"
-#include "canvas-simplerect.h"
-#include "canvas-simpleline.h"
-#include "canvas-waveview.h"
+#include "simplerect.h"
+#include "simpleline.h"
+#include "waveview.h"
 #include "public_editor.h"
 #include "region_editor.h"
 #include "region_gain_line.h"
@@ -50,6 +50,7 @@
 using namespace sigc;
 using namespace ARDOUR;
 using namespace Editing;
+using namespace ArdourCanvas;
 
 static const int32_t sync_mark_width = 9;
 
@@ -62,14 +63,14 @@ AudioRegionView::AudioRegionView (Gnome::Canvas::Group *parent, AudioTimeAxisVie
                                  Gdk::Color& basic_color,
                                  bool wfw)
 
-       : TimeAxisViewItem (r.name(), parent, tv, spu, basic_color, r.position(), r.length(),
+       : TimeAxisViewItem (r.name(), *parent, tv, spu, basic_color, r.position(), r.length(),
                            TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowNameText|
                                                          TimeAxisViewItem::ShowNameHighlight|
                                                          TimeAxisViewItem::ShowFrame)),
 
          region (r)
 {
-        Gnome::Canvas::Points *shape;
+        Gnome::Canvas::Points shape;
        XMLNode *node;
 
        editor = 0;
@@ -100,20 +101,19 @@ AudioRegionView::AudioRegionView (Gnome::Canvas::Group *parent, AudioTimeAxisVie
        gtk_object_set_data (GTK_OBJECT(name_highlight), "regionview", this);
        gtk_object_set_data (GTK_OBJECT(name_text), "regionview", this);
 
-       shape = new Gnome::Canvas::Points ();
+       //      shape = new Gnome::Canvas::Points ();
 
        /* an equilateral triangle */
 
-       shape->push_back (Gnome::Art::Point (-((sync_mark_width-1)/2), 1));
-       shape->push_back (Gnome::Art::Point ((sync_mark_width - 1)/2, 1));
-       shape->push_back (Gnome::Art::Point (0, sync_mark_width - 1));
-       shape->push_back (Gnome::Art::Point (-((sync_mark_width-1)/2), 1));
+       shape.push_back (Gnome::Art::Point (-((sync_mark_width-1)/2), 1));
+       shape.push_back (Gnome::Art::Point ((sync_mark_width - 1)/2, 1));
+       shape.push_back (Gnome::Art::Point (0, sync_mark_width - 1));
+       shape.push_back (Gnome::Art::Point (-((sync_mark_width-1)/2), 1));
 
        sync_mark =  new Gnome::Canvas::Polygon (*group);
-       sync_mark->set_property ("points", shape);
+       sync_mark->property_points().set_value(shape);
        sync_mark->set_property ("fill_color_rgba", fill_color);
        sync_mark->hide();
-       gnome_canvas_points_unref (shape->gobj());
 
        fade_in_shape = new Gnome::Canvas::Polygon (*group);
        fade_in_shape->set_property ("fill_color_rgba", fade_color);
@@ -354,7 +354,7 @@ AudioRegionView::region_scale_amplitude_changed ()
 
        for (uint32_t n = 0; n < waves.size(); ++n) {
                // force a reload of the cache
-               gnome_canvas_item_set (waves[n], "data_src", &region, NULL);
+               waves[n]->property_data_src().set_value(&region);
        }
 }
 
@@ -383,15 +383,15 @@ AudioRegionView::region_resized (Change what_changed)
                reset_width_dependent_items (unit_length);
                
                for (uint32_t n = 0; n < waves.size(); ++n) {
-                       gnome_canvas_item_set (waves[n], "region_start", (guint32) region.start(), NULL);
+                       waves[n]->property_region_start().set_value(region.start());
                }
                
                for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
 
                        (*i)->set_duration (unit_length);
 
-                       for (vector<GnomeCanvasItem*>::iterator w = (*i)->waves.begin(); w != (*i)->waves.end(); ++w) {
-                               gnome_canvas_item_set ((*w), "region_start", region.start(), NULL);
+                       for (vector<WaveView*>::iterator w = (*i)->waves.begin(); w != (*i)->waves.end(); ++w) {
+                               (*w)->property_region_start().set_value(region.start());
                        }
                }
        }
@@ -438,9 +438,9 @@ AudioRegionView::region_muted ()
 
        for (uint32_t n=0; n < waves.size(); ++n) {
                if (region.muted()) {
-                       gnome_canvas_item_set (waves[n], "wave_color", color_map[cMutedWaveForm], NULL);
+                       waves[n]->property_wave_color().set_value(color_map[cMutedWaveForm]);
                } else {
-                       gnome_canvas_item_set (waves[n], "wave_color", color_map[cWaveForm], NULL);
+                       waves[n]->property_wave_color().set_value(color_map[cWaveForm]);
                }
        }
 }
@@ -518,8 +518,8 @@ AudioRegionView::set_height (gdouble height)
                
                gdouble yoff = n * (ht+1);
                
-               gnome_canvas_item_set (waves[n], "height", ht, NULL);
-               gnome_canvas_item_set (waves[n], "y", yoff + 2, NULL);
+               waves[n]->property_height().set_value(ht);
+               waves[n]->property_y().set_value(yoff + 2);
        }
 
        if ((height/wcnt) < NAME_HIGHLIGHT_SIZE) {
@@ -574,7 +574,7 @@ AudioRegionView::reset_fade_in_shape_width (jack_nframes_t width)
 
        width = std::max ((jack_nframes_t) 64, width);
 
-       GnomeCanvasPoints* points;
+       Points* points;
        double pwidth = width / samples_per_unit;
        uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
        double h; 
@@ -621,25 +621,24 @@ AudioRegionView::reset_fade_in_shape_width (jack_nframes_t width)
        double xdelta = pwidth/npoints;
 
        for (pi = 0, pc = 0; pc < npoints; ++pc) {
-               points->coords[pi++] = 1 + (pc * xdelta);
-               points->coords[pi++] = 2 + (h - (curve[pc] * h));
+               (*points)[pi].set_x(1 + (pc * xdelta));
+               (*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
        }
        
        /* fold back */
 
-       points->coords[pi++] = pwidth;
-       points->coords[pi++] = 2;
+       (*points)[pi].set_x(pwidth);
+       (*points)[pi++].set_y(2);
 
-       points->coords[pi++] = 1;
-       points->coords[pi++] = 2;
+       (*points)[pi].set_x(1);
+       (*points)[pi++].set_y(2);
 
        /* connect the dots ... */
 
-       points->coords[pi++] = points->coords[0];
-       points->coords[pi] = points->coords[1];
+       (*points)[pi] = (*points)[0];
        
-       fade_in_shape->set_property ("points", points);
-       gnome_canvas_points_unref (points);
+       fade_in_shape->property_points().set_value(*points);
+       delete points;
 }
 
 void
@@ -655,7 +654,7 @@ AudioRegionView::reset_fade_out_shape_width (jack_nframes_t width)
 
        width = std::max ((jack_nframes_t) 64, width);
 
-       GnomeCanvasPoints* points;
+       Points* points;
        double pwidth = width / samples_per_unit;
        uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
        double h;
@@ -704,25 +703,24 @@ AudioRegionView::reset_fade_out_shape_width (jack_nframes_t width)
        double xdelta = pwidth/npoints;
 
        for (pi = 0, pc = 0; pc < npoints; ++pc) {
-               points->coords[pi++] = _pixel_width - 1 - pwidth + (pc*xdelta);
-               points->coords[pi++] = 2 + (h - (curve[pc] * h));
+               (*points)[pi] = _pixel_width - 1 - pwidth + (pc*xdelta);
+               (*points)[pi++] = 2 + (h - (curve[pc] * h));
        }
        
        /* fold back */
 
-       points->coords[pi++] = _pixel_width;
-       points->coords[pi++] = h;
+       (*points)[pi] = _pixel_width;
+       (*points)[pi++] = h;
 
-       points->coords[pi++] = _pixel_width;
-       points->coords[pi++] = 2;
+       (*points)[pi] = _pixel_width;
+       (*points)[pi++] = 2;
 
        /* connect the dots ... */
 
-       points->coords[pi++] = points->coords[0];
-       points->coords[pi] = points->coords[1];
+       (*points)[pi] = (*points)[0];
 
-       fade_out_shape->set_property ("points", points);
-       gnome_canvas_points_unref (points);
+       fade_out_shape->set_property ("points", *points);
+       delete points;
 }
 
 void
@@ -731,7 +729,7 @@ AudioRegionView::set_samples_per_unit (gdouble spu)
        TimeAxisViewItem::set_samples_per_unit (spu);
 
        for (uint32_t n=0; n < waves.size(); ++n) {
-               gnome_canvas_item_set (waves[n], "samples_per_unit", spu, NULL);
+               waves[n]->property_samples_per_unit().set_value(spu);
        }
 
        for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@@ -762,7 +760,7 @@ void
 AudioRegionView::set_amplitude_above_axis (gdouble spp)
 {
        for (uint32_t n=0; n < waves.size(); ++n) {
-               gnome_canvas_item_set (waves[n], "amplitude_above_axis", spp, NULL);
+               waves[n]->property_amplitude_above_axis().set_value(spp);
        }
 }
 
@@ -788,9 +786,9 @@ AudioRegionView::set_colors ()
 
        for (uint32_t n=0; n < waves.size(); ++n) {
                if (region.muted()) {
-                       gnome_canvas_item_set (waves[n], "wave_color", color_map[cMutedWaveForm], NULL);
+                       waves[n]->property_wave_color().set_value(color_map[cMutedWaveForm]);
                } else {
-                       gnome_canvas_item_set (waves[n], "wave_color", color_map[cWaveForm], NULL);
+                       waves[n]->property_wave_color().set_value(color_map[cWaveForm]);
                }
        }
 }
@@ -880,31 +878,27 @@ AudioRegionView::region_sync_changed ()
 
                        /* lets do it */
 
-                       GtkArg args[1];
-                       GnomeCanvasPoints* points;
+                       Points points;
                        
-                       args[0].name = X_("points");
-                       
-                       sync_mark->get (X_("points"), &points);
+                       points = sync_mark->property_points().get_value();
                        
                        double offset = sync_offset / samples_per_unit;
                        
-                       points->coords[0] = offset - ((sync_mark_width-1)/2);
-                       points->coords[1] = 1;
+                       points[0].set_x(offset - ((sync_mark_width-1)/2));
+                       points[0].set_y(1);
                        
-                       points->coords[2] = offset + (sync_mark_width-1)/2;
-                       points->coords[3] = 1;
+                       points[1].set_x(offset + (sync_mark_width-1)/2);
+                       points[1].set_y(1);
                        
-                       points->coords[4] = offset;
-                       points->coords[5] = sync_mark_width - 1;
+                       points[2].set_x(offset);
+                       points[2].set_y(sync_mark_width - 1);
                        
-                       points->coords[6] = offset - ((sync_mark_width-1)/2);
-                       points->coords[7] = 1;
+                       points[3].set_x(offset - ((sync_mark_width-1)/2));
+                       points[3].set_y(1);
                        
                        sync_mark->show();
-                       sync_mark->set_property ("points", points);
+                       sync_mark->property_points().set_value(points);
 
-                       gnome_canvas_points_unref (points);
                }
        }
 }
@@ -915,12 +909,12 @@ AudioRegionView::set_waveform_visible (bool yn)
        if (((_flags & WaveformVisible) != yn)) {
                if (yn) {
                        for (uint32_t n=0; n < waves.size(); ++n) {
-                               gnome_canvas_item_show (waves[n]);
+                               waves[n]->show();
                        }
                        _flags |= WaveformVisible;
                } else {
                        for (uint32_t n=0; n < waves.size(); ++n) {
-                               gnome_canvas_item_hide (waves[n]);
+                               waves[n]->hide();
                        }
                        _flags &= ~WaveformVisible;
                }
@@ -983,7 +977,7 @@ AudioRegionView::create_waves ()
                        break;
                }
                
-               wave_caches.push_back (gnome_canvas_waveview_cache_new ());
+               wave_caches.push_back (WaveView::create_cache ());
 
                if (wait_for_waves) {
                        if (region.source(n).peaks_ready (bind (mem_fun(*this, &AudioRegionView::peaks_ready_handler), n))) {
@@ -1021,26 +1015,42 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
        }
        gdouble yoff = which * ht;
 
-       GnomeCanvasItem *wave = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
-                                                  gnome_canvas_waveview_get_type (),
-                                                  "data_src", (gpointer) &region,
-                                                  "cache", wave_caches[which],
-                                                  "cache_updater", (gboolean) true,
-                                                  "channel", (guint32) which,
-                                                  "length_function", (gpointer) region_length_from_c,
-                                                  "sourcefile_length_function",(gpointer) sourcefile_length_from_c,
-                                                  "peak_function", (gpointer) region_read_peaks_from_c,
-                                                  "x", 0.0,
-                                                  "y", yoff,
-                                                  "height", (double) ht,
-                                                  "samples_per_unit", samples_per_unit,
-                                                  "amplitude_above_axis", _amplitude_above_axis,
-                                                  "wave_color", (guint32) (region.muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm]),
-                                                  "region_start",(guint32) region.start(),
-                                                  NULL);
+       WaveView *wave = new WaveView(*group);
+
+       wave->property_data_src().set_value( (gpointer) &region);
+       wave->property_cache().set_value( wave_caches[which]);
+       wave->property_cache_updater().set_value( (gboolean) true);
+       wave->property_channel().set_value( (guint32) which);
+       wave->property_length_function().set_value( (gpointer) region_length_from_c);
+       wave->property_sourcefile_length_function().set_value((gpointer) sourcefile_length_from_c);
+       wave->property_peak_function().set_value( (gpointer) region_read_peaks_from_c);
+       wave->property_x().set_value( 0.0);
+       wave->property_y().set_value( yoff);
+       wave->property_height().set_value( (double) ht);
+       wave->property_samples_per_unit().set_value( samples_per_unit);
+       wave->property_amplitude_above_axis().set_value( _amplitude_above_axis);
+       wave->property_wave_color().set_value(region.muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm]);
+       wave->property_region_start().set_value(region.start());
+//     WaveView *wave = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group),
+//                                                gnome_canvas_waveview_get_type (),
+//                                                "data_src", (gpointer) &region,
+//                                                "cache", wave_caches[which],
+//                                                "cache_updater", (gboolean) true,
+//                                                "channel", (guint32) which,
+//                                                "length_function", (gpointer) region_length_from_c,
+//                                                "sourcefile_length_function",(gpointer) sourcefile_length_from_c,
+//                                                "peak_function", (gpointer) region_read_peaks_from_c,
+//                                                "x", 0.0,
+//                                                "y", yoff,
+//                                                "height", (double) ht,
+//                                                "samples_per_unit", samples_per_unit,
+//                                                "amplitude_above_axis", _amplitude_above_axis,
+//                                                "wave_color", (guint32) (region.muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm]),
+//                                                "region_start",(guint32) region.start(),
+//                                                NULL);
        
        if (!(_flags & WaveformVisible)) {
-               gnome_canvas_item_hide (wave);
+               wave->hide();
        }
 
        /* note: calling this function is serialized by the lock
@@ -1185,8 +1195,8 @@ AudioRegionView::set_waveform_shape (WaveformShape shape)
        }
 
        if (yn != (bool) (_flags & WaveformRectified)) {
-               for (vector<GnomeCanvasItem *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
-                       gnome_canvas_item_set ((*wave), "rectified", (gboolean) yn, NULL);
+               for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
+                       (*wave)->property_rectified().set_value(yn);
                }
 
                if (zero_line) {
@@ -1243,21 +1253,35 @@ AudioRegionView::add_ghost (AutomationTimeAxisView& atv)
                        break;
                }
                
-               GnomeCanvasItem *wave = gnome_canvas_item_new (GNOME_CANVAS_GROUP(ghost->group),
-                                                          gnome_canvas_waveview_get_type (),
-                                                          "data_src", (gpointer) &region,
-                                                          "cache", wave_caches[n],
-                                                          "cache_updater", (gboolean) false,
-                                                          "channel", (guint32) n,
-                                                          "length_function", (gpointer) region_length_from_c,
-                                                          "sourcefile_length_function",(gpointer) sourcefile_length_from_c,
-                                                          "peak_function", (gpointer) region_read_peaks_from_c,
-                                                          "x", 0.0,
-                                                          "samples_per_unit", samples_per_unit,
-                                                          "amplitude_above_axis", _amplitude_above_axis,
-                                                          "wave_color", color_map[cGhostTrackWave],
-                                                          "region_start", (guint32) region.start(),
-                                                          NULL);
+               WaveView *wave = new WaveView(*ghost->group);
+
+               wave->property_data_src().set_value( &region);
+               wave->property_cache().set_value( wave_caches[n]);
+               wave->property_cache_updater().set_value(false);
+               wave->property_channel().set_value(n);
+               wave->property_length_function().set_value((gpointer)region_length_from_c);
+               wave->property_sourcefile_length_function().set_value((gpointer) sourcefile_length_from_c);
+               wave->property_peak_function().set_value( (gpointer) region_read_peaks_from_c);
+               wave->property_x().set_value( 0.0);
+               wave->property_samples_per_unit().set_value( samples_per_unit);
+               wave->property_amplitude_above_axis().set_value( _amplitude_above_axis);
+               wave->property_wave_color().set_value(color_map[cGhostTrackWave]);
+               wave->property_region_start().set_value(region.start());
+               //              WaveView *wave = gnome_canvas_item_new (GNOME_CANVAS_GROUP(ghost->group),
+               //                                                         gnome_canvas_waveview_get_type (),
+               //                                                         "data_src", (gpointer) &region,
+               //                                                         "cache", wave_caches[n],
+               //                                                         "cache_updater", (gboolean) false,
+               //                                                         "channel", (guint32) n,
+               //                                                         "length_function", (gpointer) region_length_from_c,
+               //                                                         "sourcefile_length_function",(gpointer) sourcefile_length_from_c,
+               //                                                         "peak_function", (gpointer) region_read_peaks_from_c,
+               //                                                         "x", 0.0,
+               //                                                         "samples_per_unit", samples_per_unit,
+               //                                                         "amplitude_above_axis", _amplitude_above_axis,
+               //                                                         "wave_color", color_map[cGhostTrackWave],
+               //                                                         "region_start", (guint32) region.start(),
+               //                                                         NULL);
 
                
                ghost->waves.push_back(wave);
@@ -1335,15 +1359,15 @@ AudioRegionView::set_waveview_data_src()
 
        for (uint32_t n = 0; n < waves.size(); ++n) {
                // TODO: something else to let it know the channel
-               gnome_canvas_item_set (waves[n], "data_src", &region, NULL);
+               waves[n]->property_data_src().set_value(&region);
        }
        
        for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
                
                (*i)->set_duration (unit_length);
                
-               for (vector<GnomeCanvasItem*>::iterator w = (*i)->waves.begin(); w != (*i)->waves.end(); ++w) {
-                       gnome_canvas_item_set ((*w), "data_src", &region, NULL);
+               for (vector<WaveView*>::iterator w = (*i)->waves.begin(); w != (*i)->waves.end(); ++w) {
+                       (*w)->property_data_src().set_value(&region);
                }
        }
 
index 1e61a8fe04de2a1e3f1c1ec56306640dd1b3d63b..26450f8fb359bfc550a86df56b2750b0ae0f2ce6 100644 (file)
@@ -31,7 +31,8 @@
 #include "time_axis_view_item.h"
 #include "automation_line.h"
 #include "enums.h"
-#include "canvas-waveview.h"
+#include "waveview.h"
+#include "canvas.h"
 
 namespace ARDOUR {
        class AudioRegion;
@@ -121,8 +122,8 @@ class AudioRegionView : public TimeAxisViewItem
            WaveformRectified = 0x8
     };
 
-    vector<GnomeCanvasItem *> waves; /* waveviews */
-    vector<GnomeCanvasItem *> tmp_waves; /* see ::create_waves()*/
+    vector<ArdourCanvas::WaveView *> waves; /* waveviews */
+    vector<ArdourCanvas::WaveView *> tmp_waves; /* see ::create_waves()*/
     Gnome::Canvas::Polygon* sync_mark; /* polgyon for sync position */
     Gnome::Canvas::Text* no_wave_msg; /* text */
     Gnome::Canvas::Line* zero_line; /* simpleline */
index 957dde55ecf004cae2a066aa70ff6b8a07533fe8..0e1b3c80f5f94b7cb918e0532c369477a83b87b5 100644 (file)
@@ -309,7 +309,7 @@ xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h)
        return (savergb);
 }
 
-GnomeCanvasPoints*
+Gnome::Canvas::Points*
 get_canvas_points (string who, uint32_t npoints)
 {
        // cerr << who << ": wants " << npoints << " canvas points" << endl;
@@ -318,7 +318,7 @@ get_canvas_points (string who, uint32_t npoints)
                abort ();
        }
 #endif
-       return gnome_canvas_points_new (npoints);
+       return new Gnome::Canvas::Points (npoints);
 }
 
 int
index cdb9e13251b4085ef43b7ba356f76789b51f847f..e1c6bb0c44d9f9457c524157bfad0794c62fe850 100644 (file)
@@ -63,7 +63,7 @@ void   allow_keyboard_focus (bool);
 unsigned char* xpm2rgb  (const char** xpm, uint32_t& w, uint32_t& h);
 unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
 
-GnomeCanvasPoints* get_canvas_points (std::string who, uint32_t npoints);
+Gnome::Canvas::Points* get_canvas_points (std::string who, uint32_t npoints);
 
 int channel_combo_get_channel_count (Gtk::ComboBoxText& combo);
 Pango::FontDescription get_font_for_style (std::string widgetname);