summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2005-11-13 18:13:50 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2005-11-13 18:13:50 +0000
commitab91bcfdace8f4c3e76de3a9ffbfff93102997fb (patch)
tree9e2ffe6593f3917b1b1a30caf1cb5e41c782bfee /gtk2_ardour
parent435d1d49642cda521d4934aa1b3ba6433ce8c639 (diff)
time_axis_view now compiles
git-svn-id: svn://localhost/trunk/ardour2@86 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/SConscript1
-rw-r--r--gtk2_ardour/audio_time_axis.cc8
-rw-r--r--gtk2_ardour/automation_gain_line.cc7
-rw-r--r--gtk2_ardour/automation_gain_line.h7
-rw-r--r--gtk2_ardour/automation_line.cc176
-rw-r--r--gtk2_ardour/automation_line.h46
-rw-r--r--gtk2_ardour/automation_pan_line.cc9
-rw-r--r--gtk2_ardour/automation_pan_line.h8
-rw-r--r--gtk2_ardour/editor.h41
-rw-r--r--gtk2_ardour/enums.h12
-rw-r--r--gtk2_ardour/gain_automation_time_axis.cc2
-rw-r--r--gtk2_ardour/gain_automation_time_axis.h2
-rw-r--r--gtk2_ardour/public_editor.h20
-rw-r--r--gtk2_ardour/redirect_automation_line.cc8
-rw-r--r--gtk2_ardour/redirect_automation_line.h9
-rw-r--r--gtk2_ardour/simplerect.cc82
-rw-r--r--gtk2_ardour/simplerect.h26
-rw-r--r--gtk2_ardour/time_axis_view.cc134
-rw-r--r--gtk2_ardour/time_axis_view.h4
-rw-r--r--gtk2_ardour/time_axis_view_item.cc24
20 files changed, 343 insertions, 283 deletions
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript
index d6ac933acb..752e336013 100644
--- a/gtk2_ardour/SConscript
+++ b/gtk2_ardour/SConscript
@@ -163,6 +163,7 @@ time_selection.cc
utils.cc
version.cc
visual_time_axis.cc
+waveview.cc
""")
mtest_files=Split("""
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index 545f8eea7f..5f9c020025 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -1202,12 +1202,14 @@ AudioTimeAxisView::add_gain_automation_child ()
gain_track = new GainAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _("gain"),
_route.gain_automation_curve());
+
+ sigc::slot<bool,GdkEvent*,ControlPoint*> cslot = mem_fun (editor, &PublicEditor::canvas_control_point_event);
+ sigc::slot<bool,GdkEvent*,AutomationLine*> lslot = mem_fun (editor, &PublicEditor::canvas_line_event);
line = new AutomationGainLine ("automation gain", _session, *gain_track,
*gain_track->canvas_display,
- _route.gain_automation_curve(),
- PublicEditor::canvas_control_point_event,
- PublicEditor::canvas_line_event);
+ _route.gain_automation_curve(), cslot, lslot);
+
line->set_line_color (color_map[cAutomationLine]);
diff --git a/gtk2_ardour/automation_gain_line.cc b/gtk2_ardour/automation_gain_line.cc
index 0d09e1839d..b07f3c14a1 100644
--- a/gtk2_ardour/automation_gain_line.cc
+++ b/gtk2_ardour/automation_gain_line.cc
@@ -32,10 +32,11 @@
using namespace std;
using namespace ARDOUR;
-AutomationGainLine::AutomationGainLine (string name, Session& s, TimeAxisView& tv, Gnome::Canvas::Item* parent,
+AutomationGainLine::AutomationGainLine (string name, Session& s, TimeAxisView& tv, Gnome::Canvas::Group& parent,
Curve& c,
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
+ sigc::slot<bool,GdkEvent*,ControlPoint*> point_callback,
+ sigc::slot<bool,GdkEvent*,AutomationLine*> line_callback)
+
: AutomationLine (name, tv, parent, c, point_callback, line_callback),
session (s)
{
diff --git a/gtk2_ardour/automation_gain_line.h b/gtk2_ardour/automation_gain_line.h
index 51a8f2502a..ba95b64480 100644
--- a/gtk2_ardour/automation_gain_line.h
+++ b/gtk2_ardour/automation_gain_line.h
@@ -17,10 +17,9 @@ class TimeAxisView;
class AutomationGainLine : public AutomationLine
{
public:
- AutomationGainLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Item* parent,
- ARDOUR::Curve&,
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
+ AutomationGainLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Group& parent,
+ ARDOUR::Curve&,
+ sigc::slot<bool,GdkEvent*,ControlPoint*>, sigc::slot<bool,GdkEvent*,AutomationLine*>);
void view_to_model_y (double&);
void model_to_view_y (double&);
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index dd30848c43..c21cf70582 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -28,7 +28,7 @@
#include <ardour/curve.h>
#include <ardour/dB.h>
-#include "canvas-simplerect.h"
+#include "simplerect.h"
#include "automation_line.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
@@ -46,10 +46,12 @@
#include "i18n.h"
using namespace std;
+using namespace sigc;
using namespace ARDOUR;
using namespace Editing;
+using namespace Gnome; // for Canvas
-ControlPoint::ControlPoint (AutomationLine& al, gint (*event_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
+ControlPoint::ControlPoint (AutomationLine& al, sigc::slot<bool,GdkEvent*,ControlPoint*> handler)
: line (al)
{
model = al.the_list().end();
@@ -61,17 +63,14 @@ ControlPoint::ControlPoint (AutomationLine& al, gint (*event_handler)(Gnome::Can
_size = 4.0;
selected = false;
- item = gnome_canvas_item_new (line.canvas_group(),
- gnome_canvas_simplerect_get_type(),
- "draw", (gboolean) TRUE,
- "fill", (gboolean) FALSE,
- "fill_color_rgba", color_map[cControlPointFill],
- "outline_color_rgba", color_map[cControlPointOutline],
- "outline_pixels", (gint) 1,
- NULL);
-
- gtk_object_set_data (GTK_OBJECT(item), "control_point", this);
- gtk_signal_connect (GTK_OBJECT(item), "event", (GtkSignalFunc) event_handler, this);
+ item = new Canvas::SimpleRect (line.canvas_group());
+ item->property_draw() = true;
+ item->property_fill() = false;
+ item->property_fill_color_rgba() = color_map[cControlPointFill];
+ item->property_outline_color_rgba() = color_map[cControlPointOutline];
+ item->property_outline_pixels() = 1;
+ item->set_data ("control_point", this);
+ item->signal_event().connect (bind (handler, this));
hide ();
set_visible (false);
@@ -93,12 +92,10 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool dummy_arg_to_force_s
_size = other._size;
selected = false;
- item = gnome_canvas_item_new (line.canvas_group(),
- gnome_canvas_simplerect_get_type(),
- "fill", (gboolean) FALSE,
- "outline_color_rgba", color_map[cEnteredControlPointOutline],
- "outline_pixels", (gint) 1,
- NULL);
+ item = new Canvas::SimpleRect (line.canvas_group());
+ item->property_fill() = false;
+ item->property_outline_color_rgba() = color_map[cEnteredControlPointOutline];
+ item->property_outline_pixels() = 1;
/* NOTE: no event handling in copied ControlPoints */
@@ -214,45 +211,39 @@ ControlPoint::move_to (double x, double y, ShapeType shape)
/*****/
-AutomationLine::AutomationLine (string name, TimeAxisView& tv, Gnome::Canvas::Item* parent, AutomationList& al,
- gint (*point_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
+AutomationLine::AutomationLine (string name, TimeAxisView& tv, Gnome::Canvas::Group& parent, AutomationList& al,
+ slot<bool,GdkEvent*,ControlPoint*> point_handler,
+ slot<bool,GdkEvent*,AutomationLine*> line_handler)
+
: trackview (tv),
_name (name),
- alist (al)
+ alist (al),
+ _parent_group (parent)
{
- point_coords = 0;
points_visible = false;
update_pending = false;
_vc_uses_gain_mapping = false;
no_draw = false;
_visible = true;
- point_callback = point_handler;
- _parent_group = parent;
+ point_slot = point_handler;
terminal_points_can_slide = true;
_height = 0;
- group = new Gnome::Canvas::Group (*parent);
+ group = new Gnome::Canvas::Group (parent);
group->set_property ("x", 0.0);
group->set_property ("y", 0.0);
line = new Gnome::Canvas::Line (*group);
line->set_property ("width_pixels", (guint)1);
- // cerr << _name << " line @ " << line << endl;
-
line->set_data ("line", this);
- gtk_signal_connect (GTK_OBJECT(line), "event", (GtkSignalFunc) line_handler, this);
+ line->signal_event().connect (bind (line_handler, this));
alist.StateChanged.connect (mem_fun(*this, &AutomationLine::list_changed));
}
AutomationLine::~AutomationLine ()
{
- if (point_coords) {
- gnome_canvas_points_unref (point_coords->gobj());
- }
-
vector_delete (&control_points);
gtk_object_destroy (GTK_OBJECT(group));
@@ -467,16 +458,14 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi
void
AutomationLine::reset_line_coords (ControlPoint& cp)
{
- if (point_coords) {
- point_coords[cp.view_index] = cp.get_x();
- point_coords[cp.view_index] = cp.get_y();
- }
+ line_points[cp.view_index].set_x (cp.get_x());
+ line_points[cp.view_index].set_y (cp.get_y());
}
void
AutomationLine::update_line ()
{
- line->set_property ("points", point_coords);
+ line->property_points() = line_points;
}
void
@@ -657,12 +646,11 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp)
}
void
-AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
+AutomationLine::determine_visible_control_points (ALPoints& points)
{
- uint32_t xi, yi, view_index, pi;
- int n;
+ uint32_t view_index, pi, n;
AutomationList::iterator model;
- uint32_t npoints = points->size();
+ uint32_t npoints;
double last_control_point_x = 0.0;
double last_control_point_y = 0.0;
uint32_t this_rx = 0;
@@ -670,31 +658,39 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
uint32_t this_ry = 0;
uint32_t prev_ry = 0;
double* slope;
+
+ /* hide all existing points, and the line */
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->hide();
}
- gnome_canvas_item_hide (line);
- if (points == 0 || points->num_points == 0) {
+ line->hide ();
+
+ if (points.empty()) {
return;
}
+ npoints = points.size();
+
/* compute derivative/slope for the entire line */
slope = new double[npoints];
- for (n = 0, xi = 2, yi = 3, view_index = 0; n < points->num_points - 1; xi += 2, yi +=2, ++n, ++view_index) {
- double xdelta;
- double ydelta;
- xdelta = points->coords[xi] - points->coords[xi-2];
- ydelta = points->coords[yi] - points->coords[yi-2];
- slope[view_index] = ydelta/xdelta;
+ for (n = 0; n < npoints - 1; ++n) {
+ double xdelta = points[n+1].x - points[n].x;
+ double ydelta = points[n+1].y - points[n].y;
+ slope[n] = ydelta/xdelta;
}
/* read all points and decide which ones to show as control points */
- for (model = alist.begin(), pi = 0, xi = 0, yi = 1, view_index = 0; pi < npoints; ++model, xi += 2, yi +=2, ++pi) {
+ view_index = 0;
+
+ for (model = alist.begin(), pi = 0; pi < npoints; ++model, ++pi) {
+
+ double tx = points[pi].x;
+ double ty = points[pi].y;
/* now ensure that the control_points vector reflects the current curve
state, but don't plot control points too close together. also, don't
@@ -727,8 +723,8 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
points.
*/
- this_rx = (uint32_t) rint (points->coords[xi]);
- this_ry = (unsigned long) rint (points->coords[yi]);
+ this_rx = (uint32_t) rint (tx);
+ this_ry = (unsigned long) rint (ty);
if (view_index && pi != npoints && (this_rx == prev_rx) && (this_ry == prev_ry)) {
@@ -740,7 +736,7 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
if (view_index >= control_points.size()) {
/* make sure we have enough control points */
- ControlPoint* ncp = new ControlPoint (*this, point_callback);
+ ControlPoint* ncp = new ControlPoint (*this, point_slot);
if (_height > (guint32) TimeAxisView::Larger) {
ncp->set_size (8.0);
@@ -758,7 +754,7 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
if (!terminal_points_can_slide) {
if (pi == 0) {
control_points[view_index]->can_slide = false;
- if (points->coords[xi] == 0) {
+ if (tx == 0) {
shape = ControlPoint::Start;
} else {
shape = ControlPoint::Full;
@@ -775,10 +771,10 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
shape = ControlPoint::Full;
}
- control_points[view_index]->reset (points->coords[xi], points->coords[yi], model, view_index, shape);
+ last_control_point_x = tx;
+ last_control_point_y = ty;
- last_control_point_x = points->coords[xi];
- last_control_point_y = points->coords[yi];
+ control_points[view_index]->reset (tx, ty, model, view_index, shape);
prev_rx = this_rx;
prev_ry = this_ry;
@@ -811,39 +807,25 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
delete [] slope;
- /* Now make sure the "point_coords" array is large enough
- to represent all the visible points.
- */
-
if (view_index > 1) {
npoints = view_index;
- if (point_coords) {
- if (point_coords->num_points < (int) npoints) {
- gnome_canvas_points_unref (point_coords);
- point_coords = get_canvas_points ("autoline", npoints);
- } else {
- point_coords->num_points = npoints;
- }
- } else {
- point_coords = get_canvas_points ("autoline", npoints);
- }
-
/* reset the line coordinates */
- uint32_t pci;
-
- for (pci = 0, view_index = 0; view_index < npoints; ++view_index) {
- point_coords->coords[pci++] = control_points[view_index]->get_x();
- point_coords->coords[pci++] = control_points[view_index]->get_y();
+ while (line_points.size() < npoints) {
+ line_points.push_back (Art::Point (0,0));
}
- // cerr << "set al2 points, nc = " << point_coords->num_points << endl;
- gnome_canvas_item_set (line, "points", point_coords, NULL);
+ for (view_index = 0; view_index < npoints; ++view_index) {
+ line_points[view_index].set_x (control_points[view_index]->get_x());
+ line_points[view_index].set_y (control_points[view_index]->get_y());
+ }
+
+ line->property_points() = line_points;
if (_visible) {
- gnome_canvas_item_show (line);
+ line->show ();
}
}
@@ -869,16 +851,16 @@ AutomationLine::get_verbose_cursor_string (float fraction)
}
bool
-AutomationLine::invalid_point (GnomeCanvasPoints* p, uint32_t index)
+AutomationLine::invalid_point (ALPoints& p, uint32_t index)
{
- return p->coords[index*2] == max_frames && p->coords[(index*2)+1] == DBL_MAX;
+ return p[index].x == max_frames && p[index].y == DBL_MAX;
}
void
-AutomationLine::invalidate_point (GnomeCanvasPoints* p, uint32_t index)
+AutomationLine::invalidate_point (ALPoints& p, uint32_t index)
{
- p->coords[index*2] = max_frames;
- p->coords[(index*2)+1] = DBL_MAX;
+ p[index].x = max_frames;
+ p[index].y = DBL_MAX;
}
void
@@ -1191,7 +1173,7 @@ AutomationLine::list_changed (Change ignored)
void
AutomationLine::reset_callback (const AutomationList& events)
{
- Gnome::Canvas::Points *tmp_points;
+ ALPoints tmp_points;
uint32_t npoints = events.size();
if (npoints == 0) {
@@ -1203,26 +1185,20 @@ AutomationLine::reset_callback (const AutomationList& events)
return;
}
- tmp_points = get_canvas_points ("autoline reset", max (npoints, (uint32_t) 2));
-
- uint32_t xi, yi;
AutomationList::const_iterator ai;
- for (ai = events.const_begin(), xi = 0, yi = 0; ai != events.const_end(); xi += 1, yi +=1, ++ai) {
+ for (ai = events.const_begin(); ai != events.const_end(); ++ai) {
- tmp_points[xi] = trackview.editor.frame_to_unit ((*ai)->when);
double translated_y;
-
+
translated_y = (*ai)->value;
model_to_view_y (translated_y);
- tmp_points[yi] = _height - (translated_y * _height);
- }
-
- tmp_points->num_points = npoints;
+ tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when),
+ _height - (translated_y * _height)));
+ }
+
determine_visible_control_points (tmp_points);
- gnome_canvas_points_unref (tmp_points->gobj());
-
}
void
diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h
index fb31befbee..dbb920f52a 100644
--- a/gtk2_ardour/automation_line.h
+++ b/gtk2_ardour/automation_line.h
@@ -46,10 +46,16 @@ class AutomationTimeAxisView;
class Selectable;
class Selection;
+namespace Gnome {
+ namespace Canvas {
+ class SimpleRect;
+ }
+}
+
class ControlPoint
{
public:
- ControlPoint (AutomationLine& al, gint (*event_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
+ ControlPoint (AutomationLine& al, sigc::slot<bool,GdkEvent*,ControlPoint*>);
ControlPoint (const ControlPoint&, bool dummy_arg_to_force_special_copy_constructor);
~ControlPoint ();
@@ -71,7 +77,7 @@ class ControlPoint
void set_size (double);
void set_visible (bool);
- Gnome::Canvas::Item* item;
+ Gnome::Canvas::SimpleRect* item;
AutomationLine& line;
uint32_t view_index;
ARDOUR::AutomationList::iterator model;
@@ -88,9 +94,8 @@ class ControlPoint
class AutomationLine : public sigc::trackable
{
public:
- AutomationLine (string name, TimeAxisView&, Gnome::Canvas::Item&, ARDOUR::AutomationList&,
- gint (*point_event_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_event_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
+ AutomationLine (string name, TimeAxisView&, Gnome::Canvas::Group&, ARDOUR::AutomationList&,
+ sigc::slot<bool,GdkEvent*,ControlPoint*>, sigc::slot<bool,GdkEvent*,AutomationLine*>);
virtual ~AutomationLine ();
@@ -131,18 +136,15 @@ class AutomationLine : public sigc::trackable
TimeAxisView& trackview;
- Gnome::Canvas::Group* canvas_group() const { return group; }
- Gnome::Canvas::Item* parent_group() const { return _parent_group; }
- Gnome::Canvas::Item* grab_item() const { return line; }
+ Gnome::Canvas::Group& canvas_group() const { return *group; }
+ Gnome::Canvas::Item& parent_group() const { return _parent_group; }
+ Gnome::Canvas::Item& grab_item() const { return *line; }
void show_selection();
void hide_selection ();
void set_point_size (double size);
- static void invalidate_point (Gnome::Canvas::Points*, uint32_t index);
- static bool invalid_point (Gnome::Canvas::Points*, uint32_t index);
-
virtual string get_verbose_cursor_string (float);
virtual void view_to_model_y (double&) = 0;
virtual void model_to_view_y (double&) = 0;
@@ -168,15 +170,26 @@ class AutomationLine : public sigc::trackable
bool no_draw : 1;
bool points_visible : 1;
- Gnome::Canvas::Item* _parent_group;
+ Gnome::Canvas::Group& _parent_group;
Gnome::Canvas::Group* group;
Gnome::Canvas::Line* line; /* line */
- Gnome::Canvas::Points* point_coords; /* coordinates for canvas line */
- vector<ControlPoint*> control_points; /* visible control points */
+ Gnome::Canvas::Points line_points; /* coordinates for canvas line */
+ vector<ControlPoint*> control_points; /* visible control points */
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer);
+ sigc::slot<bool,GdkEvent*,ControlPoint*> point_slot;
+
+ struct ALPoint {
+ double x;
+ double y;
+ ALPoint (double xx, double yy) : x(xx), y(yy) {}
+ };
- void determine_visible_control_points (Gnome::Canvas::Points*);
+ typedef std::vector<ALPoint> ALPoints;
+
+ static void invalidate_point (ALPoints&, uint32_t index);
+ static bool invalid_point (ALPoints&, uint32_t index);
+
+ void determine_visible_control_points (ALPoints&);
void sync_model_from (ControlPoint&);
void sync_model_with_view_point (ControlPoint&);
void sync_model_with_view_line (uint32_t, uint32_t);
@@ -189,7 +202,6 @@ class AutomationLine : public sigc::trackable
void list_changed (ARDOUR::Change);
UndoAction get_memento();
-
private:
uint32_t drags;
diff --git a/gtk2_ardour/automation_pan_line.cc b/gtk2_ardour/automation_pan_line.cc
index f7414c9061..516795dff7 100644
--- a/gtk2_ardour/automation_pan_line.cc
+++ b/gtk2_ardour/automation_pan_line.cc
@@ -31,11 +31,12 @@
using namespace ARDOUR;
-AutomationPanLine::AutomationPanLine (string name, Session& s, TimeAxisView& tv, Gnome::Canvas::Item* parent,
+AutomationPanLine::AutomationPanLine (string name, Session& s, TimeAxisView& tv, Gnome::Canvas::Group& parent,
Curve& c,
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
- : AutomationLine (name, tv, parent, c, point_callback, line_callback),
+ sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
+ sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler)
+
+ : AutomationLine (name, tv, parent, c, point_handler, line_handler),
session (s)
{
}
diff --git a/gtk2_ardour/automation_pan_line.h b/gtk2_ardour/automation_pan_line.h
index ccd4a07ee1..9957f52016 100644
--- a/gtk2_ardour/automation_pan_line.h
+++ b/gtk2_ardour/automation_pan_line.h
@@ -16,10 +16,10 @@ class TimeAxisView;
class AutomationPanLine : public AutomationLine
{
public:
- AutomationPanLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Item* parent,
- ARDOUR::Curve&,
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
+ AutomationPanLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Group& parent,
+ ARDOUR::Curve&,
+ sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
+ sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler);
void view_to_model_y (double&);
void model_to_view_y (double&);
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 379d52a862..3602e4348c 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1145,6 +1145,16 @@ class Editor : public PublicEditor
/* Canvas event handlers */
+ // FIXED FOR GTK2
+
+ bool canvas_control_point_event (GdkEvent* event,ControlPoint*);
+ bool canvas_line_event (GdkEvent* event,AutomationLine*);
+ bool canvas_selection_rect_event (GdkEvent* event,SelectionRect*);
+ bool canvas_selection_start_trim_event (GdkEvent* event,SelectionRect*);
+ bool canvas_selection_end_trim_event (GdkEvent* event,SelectionRect*);
+
+ // PENDING
+
gint canvas_crossfade_view_event (GdkEvent* event);
gint canvas_fade_in_event (GdkEvent* event);
gint canvas_fade_in_handle_event (GdkEvent* event);
@@ -1156,11 +1166,6 @@ class Editor : public PublicEditor
gint canvas_stream_view_event (GdkEvent* event);
gint canvas_marker_event (GdkEvent* event);
gint canvas_zoom_rect_event (GdkEvent* event);
- gint canvas_selection_rect_event (GdkEvent* event);
- gint canvas_selection_start_trim_event (GdkEvent* event);
- gint canvas_selection_end_trim_event (GdkEvent* event);
- gint canvas_control_point_event (GdkEvent* event);
- gint canvas_line_event (GdkEvent* event);
gint canvas_tempo_marker_event (GdkEvent* event);
gint canvas_meter_marker_event (GdkEvent* event);
gint canvas_tempo_bar_event (GdkEvent* event);
@@ -1178,32 +1183,6 @@ class Editor : public PublicEditor
gint canvas_markerview_end_handle_event(GdkEvent* event) ;
gint canvas_automation_track_event(GdkEvent* event) ;
-#if 0
- gint canvas_crossfade_view_event (GnomeCanvasItem* item, GdkEvent* event, CrossfadeView*);
- gint canvas_fade_in_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
- gint canvas_fade_in_handle_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
- gint canvas_fade_out_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
- gint canvas_fade_out_handle_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
- gint canvas_region_view_event (GnomeCanvasItem* item, GdkEvent* event, AudioRegionView*);
- gint canvas_stream_view_event (GnomeCanvasItem* item, GdkEvent* event, AudioTimeAxisView*);
- gint canvas_automation_track_event (GnomeCanvasItem* item, GdkEvent* event, AutomationTimeAxisView*);
- gint canvas_marker_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_zoom_rect_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_selection_rect_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_selection_start_trim_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_selection_end_trim_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_control_point_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_line_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_tempo_marker_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_meter_marker_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_tempo_bar_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_meter_bar_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_range_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_transport_marker_bar_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_region_view_name_highlight_event (GnomeCanvasItem* item, GdkEvent* event);
- gint canvas_region_view_name_event (GnomeCanvasItem* item, GdkEvent* event);
-#endif
gint canvas_copy_region_event (GdkEvent* event);
gint canvas_playhead_cursor_event (GdkEvent* event);
diff --git a/gtk2_ardour/enums.h b/gtk2_ardour/enums.h
index 3c868d67a5..15ba874366 100644
--- a/gtk2_ardour/enums.h
+++ b/gtk2_ardour/enums.h
@@ -14,12 +14,16 @@ enum Width {
Narrow,
};
-#include <libgnomecanvas/libgnomecanvas.h>
+namespace Gnome {
+ namespace Canvas {
+ class SimpleRect;
+ }
+}
struct SelectionRect {
- GnomeCanvasItem *rect;
- GnomeCanvasItem *end_trim;
- GnomeCanvasItem *start_trim;
+ Gnome::Canvas::SimpleRect *rect;
+ Gnome::Canvas::SimpleRect *end_trim;
+ Gnome::Canvas::SimpleRect *start_trim;
uint32_t id;
};
diff --git a/gtk2_ardour/gain_automation_time_axis.cc b/gtk2_ardour/gain_automation_time_axis.cc
index d1780168d5..17427d57fe 100644
--- a/gtk2_ardour/gain_automation_time_axis.cc
+++ b/gtk2_ardour/gain_automation_time_axis.cc
@@ -43,7 +43,7 @@ GainAutomationTimeAxisView::~GainAutomationTimeAxisView ()
}
void
-GainAutomationTimeAxisView::add_automation_event (GnomeCanvasItem* item, GdkEvent* event, jack_nframes_t when, double y)
+GainAutomationTimeAxisView::add_automation_event (Gnome::Canvas::Item* item, GdkEvent* event, jack_nframes_t when, double y)
{
double x = 0;
diff --git a/gtk2_ardour/gain_automation_time_axis.h b/gtk2_ardour/gain_automation_time_axis.h
index f82822a04b..7d2b1fe0ea 100644
--- a/gtk2_ardour/gain_automation_time_axis.h
+++ b/gtk2_ardour/gain_automation_time_axis.h
@@ -21,7 +21,7 @@ class GainAutomationTimeAxisView : public AutomationTimeAxisView
~GainAutomationTimeAxisView();
- void add_automation_event (GnomeCanvasItem *item, GdkEvent *event, jack_nframes_t, double);
+ void add_automation_event (Gnome::Canvas::Item *item, GdkEvent *event, jack_nframes_t, double);
private:
ARDOUR::Curve& curve;
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index a8b71d427b..f82585802c 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -34,6 +34,9 @@ class PluginSelector;
class PlaylistSelector;
class XMLNode;
class Selection;
+class AutomationLine;
+class ControlPoint;
+class SelectionRect;
class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget {
public:
@@ -114,6 +117,17 @@ class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget
sigc::signal<void> XOriginChanged;
sigc::signal<void> Resized;
+ // FIXED FOR GTK2
+
+ virtual bool canvas_control_point_event (GdkEvent* event,ControlPoint*) = 0;
+ virtual bool canvas_line_event (GdkEvent* event,AutomationLine*) = 0;
+ virtual bool canvas_selection_rect_event (GdkEvent* event,SelectionRect*) = 0;
+ virtual bool canvas_selection_start_trim_event (GdkEvent* event,SelectionRect*) = 0;
+ virtual bool canvas_selection_end_trim_event (GdkEvent* event,SelectionRect*) = 0;
+
+ // PENDING
+
+
virtual gint canvas_crossfade_view_event (GdkEvent* event) = 0;
virtual gint canvas_fade_in_event (GdkEvent* event) = 0;
virtual gint canvas_fade_in_handle_event (GdkEvent* event) = 0;
@@ -125,11 +139,7 @@ class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget
virtual gint canvas_stream_view_event (GdkEvent* event) = 0;
virtual gint canvas_marker_event (GdkEvent* event) = 0;
virtual gint canvas_zoom_rect_event (GdkEvent* event) = 0;
- virtual gint canvas_selection_rect_event (GdkEvent* event) = 0;
- virtual gint canvas_selection_start_trim_event (GdkEvent* event) = 0;
- virtual gint canvas_selection_end_trim_event (GdkEvent* event) = 0;
- virtual gint canvas_control_point_event (GdkEvent* event) = 0;
- virtual gint canvas_line_event (GdkEvent* event) = 0;
+
virtual gint canvas_tempo_marker_event (GdkEvent* event) = 0;
virtual gint canvas_meter_marker_event (GdkEvent* event) = 0;
virtual gint canvas_tempo_bar_event (GdkEvent* event) = 0;
diff --git a/gtk2_ardour/redirect_automation_line.cc b/gtk2_ardour/redirect_automation_line.cc
index 94141a560f..0879bd28a4 100644
--- a/gtk2_ardour/redirect_automation_line.cc
+++ b/gtk2_ardour/redirect_automation_line.cc
@@ -34,12 +34,12 @@ using namespace std;
using namespace ARDOUR;
RedirectAutomationLine::RedirectAutomationLine (string name, Redirect& rd, uint32_t port, Session& s,
- TimeAxisView& tv, Gnome::Canvas::Item& parent,
+ TimeAxisView& tv, Gnome::Canvas::Group& parent,
AutomationList& l,
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
+ sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
+ sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler),
- : AutomationLine (name, tv, parent, l, point_callback, line_callback),
+ : AutomationLine (name, tv, parent, l, point_handler, line_handler),
session (s),
_redirect (rd),
_port (port)
diff --git a/gtk2_ardour/redirect_automation_line.h b/gtk2_ardour/redirect_automation_line.h
index b38efd3045..0a27b50835 100644
--- a/gtk2_ardour/redirect_automation_line.h
+++ b/gtk2_ardour/redirect_automation_line.h
@@ -37,10 +37,11 @@ class TimeAxisView;
class RedirectAutomationLine : public AutomationLine
{
public:
- RedirectAutomationLine (string name, ARDOUR::Redirect&, uint32_t port, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Item& parent,
- ARDOUR::AutomationList&,
- gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
- gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
+ RedirectAutomationLine (string name, ARDOUR::Redirect&, uint32_t port, ARDOUR::Session&, TimeAxisView&,
+ Gnome::Canvas::Group& parent,
+ ARDOUR::AutomationList&,
+ sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
+ sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler);
uint32_t port() const { return _port; }
ARDOUR::Redirect& redirect() const { return _redirect; }
diff --git a/gtk2_ardour/simplerect.cc b/gtk2_ardour/simplerect.cc
index 8525a5d47a..b9bedbefd9 100644
--- a/gtk2_ardour/simplerect.cc
+++ b/gtk2_ardour/simplerect.cc
@@ -135,6 +135,88 @@ GType SimpleRect::get_base_type()
return gnome_canvas_simplerect_get_type();
}
+Glib::PropertyProxy<double> SimpleRect::property_x1()
+{
+ return Glib::PropertyProxy<double> (this, "x1");
+}
+Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_x1() const
+{
+ return Glib::PropertyProxy_ReadOnly<double> (this, "x1");
+}
+Glib::PropertyProxy<double> SimpleRect::property_y1()
+{
+ return Glib::PropertyProxy<double> (this, "y1");
+}
+Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_y1() const
+{
+ return Glib::PropertyProxy_ReadOnly<double> (this, "y1");
+}
+Glib::PropertyProxy<double> SimpleRect::property_x2()
+{
+ return Glib::PropertyProxy<double> (this, "x2");
+}
+Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_x2() const
+{
+ return Glib::PropertyProxy_ReadOnly<double> (this, "x2");
+}
+Glib::PropertyProxy<double> SimpleRect::property_y2()
+{
+ return Glib::PropertyProxy<double> (this, "y2");
+}
+Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_y2() const
+{
+ return Glib::PropertyProxy_ReadOnly<double> (this, "y2");
+}
+Glib::PropertyProxy<guint> SimpleRect::property_outline_pixels()
+{
+ return Glib::PropertyProxy<guint> (this, "outline_pixels");
+}
+Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_outline_pixels() const
+{
+ return Glib::PropertyProxy_ReadOnly<guint> (this, "outline_pixels");
+}
+Glib::PropertyProxy<guint> SimpleRect::property_outline_what()
+{
+ return Glib::PropertyProxy<guint> (this, "outline_what");
+}
+Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_outline_what() const
+{
+ return Glib::PropertyProxy_ReadOnly<guint> (this, "outline_what");
+}
+Glib::PropertyProxy<bool> SimpleRect::property_fill()
+{
+ return Glib::PropertyProxy<bool> (this, "fill");
+}
+Glib::PropertyProxy_ReadOnly<bool> SimpleRect::property_fill() const
+{
+ return Glib::PropertyProxy_ReadOnly<bool> (this, "fill");
+}
+Glib::PropertyProxy<guint> SimpleRect::property_fill_color_rgba()
+{
+ return Glib::PropertyProxy<guint> (this, "fill_color_rgba");
+}
+Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_fill_color_rgba() const
+{
+ return Glib::PropertyProxy_ReadOnly<guint> (this, "fill_color_rgba");
+}
+Glib::PropertyProxy<guint> SimpleRect::property_outline_color_rgba()
+{
+ return Glib::PropertyProxy<guint> (this, "outline_color_rgba");
+}
+Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_outline_color_rgba() const
+{
+ return Glib::PropertyProxy_ReadOnly<guint> (this, "outline_color_rgba");
+}
+Glib::PropertyProxy<bool> SimpleRect::property_draw()
+{
+ return Glib::PropertyProxy<bool> (this, "draw");
+}
+Glib::PropertyProxy_ReadOnly<bool> SimpleRect::property_draw() const
+{
+ return Glib::PropertyProxy_ReadOnly<bool> (this, "draw");
+}
+
+
} // namespace Canvas
diff --git a/gtk2_ardour/simplerect.h b/gtk2_ardour/simplerect.h
index 0228e64343..329823ab2f 100644
--- a/gtk2_ardour/simplerect.h
+++ b/gtk2_ardour/simplerect.h
@@ -110,9 +110,29 @@ private:
public:
- SimpleRect(Group& parent, double x1, double y1, double x2, double y2);
- explicit SimpleRect(Group& parent);
-
+ SimpleRect(Group& parent, double x1, double y1, double x2, double y2);
+ explicit SimpleRect(Group& parent);
+
+ Glib::PropertyProxy<double> property_x1();
+ Glib::PropertyProxy_ReadOnly<double> property_x1() const;
+ Glib::PropertyProxy<double> property_y1();
+ Glib::PropertyProxy_ReadOnly<double> property_y1() const;
+ Glib::PropertyProxy<double> property_x2();
+ Glib::PropertyProxy_ReadOnly<double> property_x2() const;
+ Glib::PropertyProxy<double> property_y2();
+ Glib::PropertyProxy_ReadOnly<double> property_y2() const;
+ Glib::PropertyProxy<guint> property_outline_pixels();
+ Glib::PropertyProxy_ReadOnly<guint> property_outline_pixels() const;
+ Glib::PropertyProxy<guint> property_outline_what();
+ Glib::PropertyProxy_ReadOnly<guint> property_outline_what() const;
+ Glib::PropertyProxy<bool> property_fill();
+ Glib::PropertyProxy_ReadOnly<bool> property_fill() const;
+ Glib::PropertyProxy<guint> property_fill_color_rgba();
+ Glib::PropertyProxy_ReadOnly<guint> property_fill_color_rgba() const;
+ Glib::PropertyProxy<guint> property_outline_color_rgba();
+ Glib::PropertyProxy_ReadOnly<guint> property_outline_color_rgba() const;
+ Glib::PropertyProxy<bool> property_draw();
+ Glib::PropertyProxy_ReadOnly<bool> property_draw() const;
};
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index b438107481..c89d3e8436 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -39,7 +39,7 @@
#include "ardour_ui.h"
#include "public_editor.h"
#include "time_axis_view.h"
-#include "canvas-simplerect.h"
+#include "simplerect.h"
#include "selection.h"
#include "keyboard.h"
#include "rgb_macros.h"
@@ -50,33 +50,19 @@ using namespace Gtk;
using namespace sigc;
using namespace ARDOUR;
using namespace Editing;
+using namespace Gnome::Canvas;
const double trim_handle_size = 6.0; /* pixels */
-TimeAxisView::TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Gtk::Widget *canvas)
- : AxisView(sess),
- editor(ed),
+TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
+ : AxisView (sess),
+ editor (ed),
controls_table (2, 9)
{
- //GTK2FIX -- whats going on here? is this canvas really a group?
- //canvas_display = gnome_canvas_item_new (gnome_canvas_root(GNOME_CANVAS(canvas->gobj())),
- // gnome_canvas_group_get_type(),
- // "x", 0.0,
- // "y", 0.0,
- // NULL);
-
-
- canvas_display = new Gnome::Canvas::Item (*canvas);
- canvas_display->set_property ("x", 0.0);
- canvas_display->set_property ("y", 0.0);
-
- selection_group = new Gnome::Canvas::Group (*canvas_display);
- selection_group->hide();
-
- //lection_group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(canvas_display),
- // gnome_canvas_group_get_type (),
- // NULL);
- //ome_canvas_item_hide (selection_group);
+ canvas_display = new Group (*canvas.root(), 0.0, 0.0);
+
+ selection_group = new Group (*canvas_display);
+ selection_group->hide();
control_parent = 0;
display_menu = 0;
@@ -167,12 +153,12 @@ TimeAxisView::~TimeAxisView()
}
if (selection_group) {
- gtk_object_destroy (GTK_OBJECT (selection_group));
+ delete selection_group;
selection_group = 0;
}
if (canvas_display) {
- gtk_object_destroy (GTK_OBJECT (canvas_display));
+ delete canvas_display;
canvas_display = 0;
}
@@ -209,7 +195,9 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
*/
canvas_display->get_bounds (ix1, iy1, ix2, iy2);
- canvas_display->parent()->i2w (ix1, iy1);
+ Group* pg = canvas_display->property_parent();
+ pg->i2w (ix1, iy1);
+
if (iy1 < 0) {
iy1 = 0;
}
@@ -510,9 +498,9 @@ TimeAxisView::show_selection (TimeSelection& ts)
while (!used_selection_rects.empty()) {
free_selection_rects.push_front (used_selection_rects.front());
used_selection_rects.pop_front();
- gnome_canvas_item_hide (free_selection_rects.front()->rect);
- gnome_canvas_item_hide (free_selection_rects.front()->start_trim);
- gnome_canvas_item_hide (free_selection_rects.front()->end_trim);
+ free_selection_rects.front()->rect->hide();
+ free_selection_rects.front()->start_trim->hide();
+ free_selection_rects.front()->end_trim->hide();
}
selection_group->hide();
}
@@ -555,14 +543,14 @@ TimeAxisView::show_selection (TimeSelection& ts)
"x2", x2,
"y2", 1.0 + trim_handle_size,
NULL);
- gnome_canvas_item_show (rect->start_trim);
- gnome_canvas_item_show (rect->end_trim);
+ rect->start_trim->show();
+ rect->end_trim->show();
} else {
- gnome_canvas_item_hide (rect->start_trim);
- gnome_canvas_item_hide (rect->end_trim);
+ rect->start_trim->hide();
+ rect->end_trim->hide();
}
- gnome_canvas_item_show (rect->rect);
+ rect->rect->show ();
used_selection_rects.push_back (rect);
}
}
@@ -584,9 +572,9 @@ TimeAxisView::hide_selection ()
while (!used_selection_rects.empty()) {
free_selection_rects.push_front (used_selection_rects.front());
used_selection_rects.pop_front();
- gnome_canvas_item_hide (free_selection_rects.front()->rect);
- gnome_canvas_item_hide (free_selection_rects.front()->start_trim);
- gnome_canvas_item_hide (free_selection_rects.front()->end_trim);
+ free_selection_rects.front()->rect->hide();
+ free_selection_rects.front()->start_trim->hide();
+ free_selection_rects.front()->end_trim->hide();
}
selection_group->hide();
}
@@ -604,16 +592,16 @@ TimeAxisView::order_selection_trims (Gnome::Canvas::Item *item, bool put_start_o
*/
for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
- if ((*i)->start_trim == item->gobj() || (*i)->end_trim == item->gobj()) {
-
+ if ((*i)->start_trim == item || (*i)->end_trim == item) {
+
/* make one trim handle be "above" the other so that if they overlap,
the top one is the one last used.
*/
-
- gnome_canvas_item_raise_to_top ((*i)->rect);
- gnome_canvas_item_raise_to_top (put_start_on_top ? (*i)->start_trim : (*i)->end_trim);
- gnome_canvas_item_raise_to_top (put_start_on_top ? (*i)->end_trim : (*i)->start_trim);
-
+
+ (*i)->rect->raise_to_top ();
+ (put_start_on_top ? (*i)->start_trim : (*i)->end_trim)->raise_to_top ();
+ (put_start_on_top ? (*i)->end_trim : (*i)->start_trim)->raise_to_top ();
+
break;
}
}
@@ -647,47 +635,31 @@ TimeAxisView::get_selection_rect (uint32_t id)
rect = new SelectionRect;
- rect->rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(selection_group),
- gnome_canvas_simplerect_get_type(),
- "x1", 0.0,
- "y1", 0.0,
- "x2", 0.0,
- "y2", 0.0,
- "fill_color_rgba", color_map[cSelectionRectFill],
- "outline_color_rgba" , color_map[cSelectionRectOutline],
- NULL);
+ rect->rect = new SimpleRect (*selection_group);
+ rect->rect->property_x1() = 0.0;
+ rect->rect->property_y1() = 0.0;
+ rect->rect->property_x2() = 0.0;
+ rect->rect->property_y2() = 0.0;
+ rect->rect->property_fill_color_rgba() = color_map[cSelectionRectFill];
+ rect->rect->property_outline_color_rgba() = color_map[cSelectionRectOutline];
+ rect->start_trim = new SimpleRect (*selection_group);
+ rect->start_trim->property_x1() = 0.0;
+ rect->start_trim->property_x2() = 0.0;
+ rect->start_trim->property_fill_color_rgba() = color_map[cSelectionStartFill];
+ rect->start_trim->property_outline_color_rgba() = color_map[cSelectionStartOutline];
- rect->start_trim = gnome_canvas_item_new (GNOME_CANVAS_GROUP(selection_group),
- gnome_canvas_simplerect_get_type(),
- "x1", (gdouble) 0.0,
- "x2", (gdouble) 0.0,
- "fill_color_rgba" , color_map[cSelectionStartFill],
- "outline_color_rgba" , color_map[cSelectionStartOutline],
- NULL);
-
- rect->end_trim = gnome_canvas_item_new (GNOME_CANVAS_GROUP(selection_group),
- gnome_canvas_simplerect_get_type(),
- "x1", 0.0,
- "x2", 0.0,
- "fill_color_rgba" , color_map[cSelectionEndFill],
- "outline_color_rgba" , color_map[cSelectionEndOutline],
- NULL);
+ rect->end_trim = new SimpleRect (*selection_group);
+ rect->end_trim->property_x1() = 0.0;
+ rect->end_trim->property_x2() = 0.0;
+ rect->end_trim->property_fill_color_rgba() = color_map[cSelectionEndFill];
+ rect->end_trim->property_outline_color_rgba() = color_map[cSelectionEndOutline];
+
free_selection_rects.push_front (rect);
- gtk_signal_connect (GTK_OBJECT(rect->rect), "event",
- (GtkSignalFunc) PublicEditor::canvas_selection_rect_event,
- &editor);
- gtk_signal_connect (GTK_OBJECT(rect->start_trim), "event",
- (GtkSignalFunc) PublicEditor::canvas_selection_start_trim_event,
- &editor);
- gtk_signal_connect (GTK_OBJECT(rect->end_trim), "event",
- (GtkSignalFunc) PublicEditor::canvas_selection_end_trim_event,
- &editor);
-
- gtk_object_set_data(GTK_OBJECT(rect->rect), "rect", rect);
- gtk_object_set_data(GTK_OBJECT(rect->start_trim), "rect", rect);
- gtk_object_set_data(GTK_OBJECT(rect->end_trim), "rect", rect);
+ rect->rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_rect_event), rect));
+ rect->start_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_start_trim_event), rect));
+ rect->end_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_end_trim_event), rect));
}
rect = free_selection_rects.front();
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index d422b28970..17d687c6c2 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -75,7 +75,7 @@ class TimeAxisView : public virtual AxisView
Small = 21
};
- TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* parent, Gtk::Widget *canvas);
+ TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* parent, Gnome::Canvas::Canvas& canvas);
virtual ~TimeAxisView ();
/* public data: XXX create accessor/mutators for these ?? */
@@ -88,7 +88,7 @@ class TimeAxisView : public virtual AxisView
int order;
- Gnome::Canvas::Item *canvas_display;
+ Gnome::Canvas::Group *canvas_display;
Gtk::VBox *control_parent;
/* The Standard LHS Controls */
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 7fe2ac7066..5b2e1c2af7 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -34,6 +34,7 @@
using namespace std;
using namespace Editing;
+using namespace Glib;
//------------------------------------------------------------------------------
/** Initialize static memeber data */
@@ -209,7 +210,7 @@ TimeAxisViewItem::set_position(jack_nframes_t pos, void* src, double* delta)
double old_unit_pos ;
double new_unit_pos = pos / samples_per_unit ;
- group->get_property ("x", &old_unit_pos);
+ old_unit_pos = group->property_x();
if (new_unit_pos != old_unit_pos) {
group->move (new_unit_pos - old_unit_pos, 0.0);
@@ -691,7 +692,7 @@ TimeAxisViewItem::set_colors()
double height = NAME_HIGHLIGHT_THRESH;
if (frame) {
- frame->get_property ("y2", &height);
+ height = frame->property_y2();
}
if (height < NAME_HIGHLIGHT_THRESH) {
@@ -795,7 +796,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
if (name_highlight) {
- name_highlight->get_property ("y2", &height);
+ double height = name_highlight->property_y2 ();
if (height < NAME_HIGHLIGHT_THRESH) {
name_highlight->hide();
@@ -832,22 +833,22 @@ TimeAxisViewItem::reset_name_width (double pixel_width)
{
int width;
int height;
+ ustring ustr;
Pango::FontDescription fd (NAME_FONT);
if (name_text == 0) {
return;
}
- int namelen = item_name.length();
- char cstr[namelen+1];
- strcpy (cstr, item_name.c_str());
-
- Glib::RefPtr<Pango::Layout> layout = group->get_canvas()->create_pango_layout();
+ ustr = item_name;
+ int namelen = ustr.length();
+
+ Glib::RefPtr<Pango::Layout> layout = group->get_canvas()->create_pango_layout (ustr);
layout->set_font_description (fd);
while (namelen) {
- layout->set_text (cstr);
+ layout->set_text (ustr);
layout->get_pixel_size (width, height);
if (width < (pixel_width - NAME_X_OFFSET)) {
@@ -855,8 +856,7 @@ TimeAxisViewItem::reset_name_width (double pixel_width)
}
--namelen;
- cstr[namelen] = '\0';
-
+ ustr = ustr.substr (0, namelen);
}
if (namelen == 0) {
@@ -879,7 +879,7 @@ TimeAxisViewItem::reset_name_width (double pixel_width)
}
}
- name_text->set_property ("text", cstr);
+ name_text->property_text() = ustr;
name_text->show();
}
}