mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
time_axis_view now compiles
git-svn-id: svn://localhost/trunk/ardour2@86 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
435d1d4964
commit
ab91bcfdac
20 changed files with 342 additions and 282 deletions
|
|
@ -163,6 +163,7 @@ time_selection.cc
|
||||||
utils.cc
|
utils.cc
|
||||||
version.cc
|
version.cc
|
||||||
visual_time_axis.cc
|
visual_time_axis.cc
|
||||||
|
waveview.cc
|
||||||
""")
|
""")
|
||||||
|
|
||||||
mtest_files=Split("""
|
mtest_files=Split("""
|
||||||
|
|
|
||||||
|
|
@ -1203,11 +1203,13 @@ AudioTimeAxisView::add_gain_automation_child ()
|
||||||
_route.gain_automation_curve());
|
_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,
|
line = new AutomationGainLine ("automation gain", _session, *gain_track,
|
||||||
*gain_track->canvas_display,
|
*gain_track->canvas_display,
|
||||||
_route.gain_automation_curve(),
|
_route.gain_automation_curve(), cslot, lslot);
|
||||||
PublicEditor::canvas_control_point_event,
|
|
||||||
PublicEditor::canvas_line_event);
|
|
||||||
line->set_line_color (color_map[cAutomationLine]);
|
line->set_line_color (color_map[cAutomationLine]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,11 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ARDOUR;
|
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,
|
Curve& c,
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*> point_callback,
|
||||||
gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
|
sigc::slot<bool,GdkEvent*,AutomationLine*> line_callback)
|
||||||
|
|
||||||
: AutomationLine (name, tv, parent, c, point_callback, line_callback),
|
: AutomationLine (name, tv, parent, c, point_callback, line_callback),
|
||||||
session (s)
|
session (s)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,9 @@ class TimeAxisView;
|
||||||
class AutomationGainLine : public AutomationLine
|
class AutomationGainLine : public AutomationLine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutomationGainLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Item* parent,
|
AutomationGainLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Group& parent,
|
||||||
ARDOUR::Curve&,
|
ARDOUR::Curve&,
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*>, sigc::slot<bool,GdkEvent*,AutomationLine*>);
|
||||||
gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
|
|
||||||
|
|
||||||
void view_to_model_y (double&);
|
void view_to_model_y (double&);
|
||||||
void model_to_view_y (double&);
|
void model_to_view_y (double&);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include <ardour/curve.h>
|
#include <ardour/curve.h>
|
||||||
#include <ardour/dB.h>
|
#include <ardour/dB.h>
|
||||||
|
|
||||||
#include "canvas-simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "automation_line.h"
|
#include "automation_line.h"
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
|
|
@ -46,10 +46,12 @@
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace sigc;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace Editing;
|
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)
|
: line (al)
|
||||||
{
|
{
|
||||||
model = al.the_list().end();
|
model = al.the_list().end();
|
||||||
|
|
@ -61,17 +63,14 @@ ControlPoint::ControlPoint (AutomationLine& al, gint (*event_handler)(Gnome::Can
|
||||||
_size = 4.0;
|
_size = 4.0;
|
||||||
selected = false;
|
selected = false;
|
||||||
|
|
||||||
item = gnome_canvas_item_new (line.canvas_group(),
|
item = new Canvas::SimpleRect (line.canvas_group());
|
||||||
gnome_canvas_simplerect_get_type(),
|
item->property_draw() = true;
|
||||||
"draw", (gboolean) TRUE,
|
item->property_fill() = false;
|
||||||
"fill", (gboolean) FALSE,
|
item->property_fill_color_rgba() = color_map[cControlPointFill];
|
||||||
"fill_color_rgba", color_map[cControlPointFill],
|
item->property_outline_color_rgba() = color_map[cControlPointOutline];
|
||||||
"outline_color_rgba", color_map[cControlPointOutline],
|
item->property_outline_pixels() = 1;
|
||||||
"outline_pixels", (gint) 1,
|
item->set_data ("control_point", this);
|
||||||
NULL);
|
item->signal_event().connect (bind (handler, this));
|
||||||
|
|
||||||
gtk_object_set_data (GTK_OBJECT(item), "control_point", this);
|
|
||||||
gtk_signal_connect (GTK_OBJECT(item), "event", (GtkSignalFunc) event_handler, this);
|
|
||||||
|
|
||||||
hide ();
|
hide ();
|
||||||
set_visible (false);
|
set_visible (false);
|
||||||
|
|
@ -93,12 +92,10 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool dummy_arg_to_force_s
|
||||||
_size = other._size;
|
_size = other._size;
|
||||||
selected = false;
|
selected = false;
|
||||||
|
|
||||||
item = gnome_canvas_item_new (line.canvas_group(),
|
item = new Canvas::SimpleRect (line.canvas_group());
|
||||||
gnome_canvas_simplerect_get_type(),
|
item->property_fill() = false;
|
||||||
"fill", (gboolean) FALSE,
|
item->property_outline_color_rgba() = color_map[cEnteredControlPointOutline];
|
||||||
"outline_color_rgba", color_map[cEnteredControlPointOutline],
|
item->property_outline_pixels() = 1;
|
||||||
"outline_pixels", (gint) 1,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
/* NOTE: no event handling in copied ControlPoints */
|
/* 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,
|
AutomationLine::AutomationLine (string name, TimeAxisView& tv, Gnome::Canvas::Group& parent, AutomationList& al,
|
||||||
gint (*point_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
slot<bool,GdkEvent*,ControlPoint*> point_handler,
|
||||||
gint (*line_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
|
slot<bool,GdkEvent*,AutomationLine*> line_handler)
|
||||||
|
|
||||||
: trackview (tv),
|
: trackview (tv),
|
||||||
_name (name),
|
_name (name),
|
||||||
alist (al)
|
alist (al),
|
||||||
|
_parent_group (parent)
|
||||||
{
|
{
|
||||||
point_coords = 0;
|
|
||||||
points_visible = false;
|
points_visible = false;
|
||||||
update_pending = false;
|
update_pending = false;
|
||||||
_vc_uses_gain_mapping = false;
|
_vc_uses_gain_mapping = false;
|
||||||
no_draw = false;
|
no_draw = false;
|
||||||
_visible = true;
|
_visible = true;
|
||||||
point_callback = point_handler;
|
point_slot = point_handler;
|
||||||
_parent_group = parent;
|
|
||||||
terminal_points_can_slide = true;
|
terminal_points_can_slide = true;
|
||||||
_height = 0;
|
_height = 0;
|
||||||
|
|
||||||
group = new Gnome::Canvas::Group (*parent);
|
group = new Gnome::Canvas::Group (parent);
|
||||||
group->set_property ("x", 0.0);
|
group->set_property ("x", 0.0);
|
||||||
group->set_property ("y", 0.0);
|
group->set_property ("y", 0.0);
|
||||||
|
|
||||||
line = new Gnome::Canvas::Line (*group);
|
line = new Gnome::Canvas::Line (*group);
|
||||||
line->set_property ("width_pixels", (guint)1);
|
line->set_property ("width_pixels", (guint)1);
|
||||||
|
|
||||||
// cerr << _name << " line @ " << line << endl;
|
|
||||||
|
|
||||||
line->set_data ("line", this);
|
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));
|
alist.StateChanged.connect (mem_fun(*this, &AutomationLine::list_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
AutomationLine::~AutomationLine ()
|
AutomationLine::~AutomationLine ()
|
||||||
{
|
{
|
||||||
if (point_coords) {
|
|
||||||
gnome_canvas_points_unref (point_coords->gobj());
|
|
||||||
}
|
|
||||||
|
|
||||||
vector_delete (&control_points);
|
vector_delete (&control_points);
|
||||||
|
|
||||||
gtk_object_destroy (GTK_OBJECT(group));
|
gtk_object_destroy (GTK_OBJECT(group));
|
||||||
|
|
@ -467,16 +458,14 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi
|
||||||
void
|
void
|
||||||
AutomationLine::reset_line_coords (ControlPoint& cp)
|
AutomationLine::reset_line_coords (ControlPoint& cp)
|
||||||
{
|
{
|
||||||
if (point_coords) {
|
line_points[cp.view_index].set_x (cp.get_x());
|
||||||
point_coords[cp.view_index] = cp.get_x();
|
line_points[cp.view_index].set_y (cp.get_y());
|
||||||
point_coords[cp.view_index] = cp.get_y();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AutomationLine::update_line ()
|
AutomationLine::update_line ()
|
||||||
{
|
{
|
||||||
line->set_property ("points", point_coords);
|
line->property_points() = line_points;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -657,12 +646,11 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
|
AutomationLine::determine_visible_control_points (ALPoints& points)
|
||||||
{
|
{
|
||||||
uint32_t xi, yi, view_index, pi;
|
uint32_t view_index, pi, n;
|
||||||
int n;
|
|
||||||
AutomationList::iterator model;
|
AutomationList::iterator model;
|
||||||
uint32_t npoints = points->size();
|
uint32_t npoints;
|
||||||
double last_control_point_x = 0.0;
|
double last_control_point_x = 0.0;
|
||||||
double last_control_point_y = 0.0;
|
double last_control_point_y = 0.0;
|
||||||
uint32_t this_rx = 0;
|
uint32_t this_rx = 0;
|
||||||
|
|
@ -671,30 +659,38 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
|
||||||
uint32_t prev_ry = 0;
|
uint32_t prev_ry = 0;
|
||||||
double* slope;
|
double* slope;
|
||||||
|
|
||||||
|
/* hide all existing points, and the line */
|
||||||
|
|
||||||
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
|
||||||
(*i)->hide();
|
(*i)->hide();
|
||||||
}
|
}
|
||||||
gnome_canvas_item_hide (line);
|
|
||||||
|
|
||||||
if (points == 0 || points->num_points == 0) {
|
line->hide ();
|
||||||
|
|
||||||
|
if (points.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
npoints = points.size();
|
||||||
|
|
||||||
/* compute derivative/slope for the entire line */
|
/* compute derivative/slope for the entire line */
|
||||||
|
|
||||||
slope = new double[npoints];
|
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) {
|
for (n = 0; n < npoints - 1; ++n) {
|
||||||
double xdelta;
|
double xdelta = points[n+1].x - points[n].x;
|
||||||
double ydelta;
|
double ydelta = points[n+1].y - points[n].y;
|
||||||
xdelta = points->coords[xi] - points->coords[xi-2];
|
slope[n] = ydelta/xdelta;
|
||||||
ydelta = points->coords[yi] - points->coords[yi-2];
|
|
||||||
slope[view_index] = ydelta/xdelta;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read all points and decide which ones to show as control points */
|
/* 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
|
/* now ensure that the control_points vector reflects the current curve
|
||||||
state, but don't plot control points too close together. also, don't
|
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.
|
points.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this_rx = (uint32_t) rint (points->coords[xi]);
|
this_rx = (uint32_t) rint (tx);
|
||||||
this_ry = (unsigned long) rint (points->coords[yi]);
|
this_ry = (unsigned long) rint (ty);
|
||||||
|
|
||||||
if (view_index && pi != npoints && (this_rx == prev_rx) && (this_ry == prev_ry)) {
|
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()) {
|
if (view_index >= control_points.size()) {
|
||||||
/* make sure we have enough control points */
|
/* 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) {
|
if (_height > (guint32) TimeAxisView::Larger) {
|
||||||
ncp->set_size (8.0);
|
ncp->set_size (8.0);
|
||||||
|
|
@ -758,7 +754,7 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
|
||||||
if (!terminal_points_can_slide) {
|
if (!terminal_points_can_slide) {
|
||||||
if (pi == 0) {
|
if (pi == 0) {
|
||||||
control_points[view_index]->can_slide = false;
|
control_points[view_index]->can_slide = false;
|
||||||
if (points->coords[xi] == 0) {
|
if (tx == 0) {
|
||||||
shape = ControlPoint::Start;
|
shape = ControlPoint::Start;
|
||||||
} else {
|
} else {
|
||||||
shape = ControlPoint::Full;
|
shape = ControlPoint::Full;
|
||||||
|
|
@ -775,10 +771,10 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
|
||||||
shape = ControlPoint::Full;
|
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];
|
control_points[view_index]->reset (tx, ty, model, view_index, shape);
|
||||||
last_control_point_y = points->coords[yi];
|
|
||||||
|
|
||||||
prev_rx = this_rx;
|
prev_rx = this_rx;
|
||||||
prev_ry = this_ry;
|
prev_ry = this_ry;
|
||||||
|
|
@ -811,39 +807,25 @@ AutomationLine::determine_visible_control_points (Gnome::Canvas::Points* points)
|
||||||
|
|
||||||
delete [] slope;
|
delete [] slope;
|
||||||
|
|
||||||
/* Now make sure the "point_coords" array is large enough
|
|
||||||
to represent all the visible points.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (view_index > 1) {
|
if (view_index > 1) {
|
||||||
|
|
||||||
npoints = view_index;
|
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 */
|
/* reset the line coordinates */
|
||||||
|
|
||||||
uint32_t pci;
|
while (line_points.size() < npoints) {
|
||||||
|
line_points.push_back (Art::Point (0,0));
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cerr << "set al2 points, nc = " << point_coords->num_points << endl;
|
for (view_index = 0; view_index < npoints; ++view_index) {
|
||||||
gnome_canvas_item_set (line, "points", point_coords, NULL);
|
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) {
|
if (_visible) {
|
||||||
gnome_canvas_item_show (line);
|
line->show ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -869,16 +851,16 @@ AutomationLine::get_verbose_cursor_string (float fraction)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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
|
void
|
||||||
AutomationLine::invalidate_point (GnomeCanvasPoints* p, uint32_t index)
|
AutomationLine::invalidate_point (ALPoints& p, uint32_t index)
|
||||||
{
|
{
|
||||||
p->coords[index*2] = max_frames;
|
p[index].x = max_frames;
|
||||||
p->coords[(index*2)+1] = DBL_MAX;
|
p[index].y = DBL_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1191,7 +1173,7 @@ AutomationLine::list_changed (Change ignored)
|
||||||
void
|
void
|
||||||
AutomationLine::reset_callback (const AutomationList& events)
|
AutomationLine::reset_callback (const AutomationList& events)
|
||||||
{
|
{
|
||||||
Gnome::Canvas::Points *tmp_points;
|
ALPoints tmp_points;
|
||||||
uint32_t npoints = events.size();
|
uint32_t npoints = events.size();
|
||||||
|
|
||||||
if (npoints == 0) {
|
if (npoints == 0) {
|
||||||
|
|
@ -1203,26 +1185,20 @@ AutomationLine::reset_callback (const AutomationList& events)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_points = get_canvas_points ("autoline reset", max (npoints, (uint32_t) 2));
|
|
||||||
|
|
||||||
uint32_t xi, yi;
|
|
||||||
AutomationList::const_iterator ai;
|
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;
|
double translated_y;
|
||||||
|
|
||||||
translated_y = (*ai)->value;
|
translated_y = (*ai)->value;
|
||||||
model_to_view_y (translated_y);
|
model_to_view_y (translated_y);
|
||||||
tmp_points[yi] = _height - (translated_y * _height);
|
|
||||||
|
tmp_points.push_back (ALPoint (trackview.editor.frame_to_unit ((*ai)->when),
|
||||||
|
_height - (translated_y * _height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_points->num_points = npoints;
|
|
||||||
|
|
||||||
determine_visible_control_points (tmp_points);
|
determine_visible_control_points (tmp_points);
|
||||||
gnome_canvas_points_unref (tmp_points->gobj());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,16 @@ class AutomationTimeAxisView;
|
||||||
class Selectable;
|
class Selectable;
|
||||||
class Selection;
|
class Selection;
|
||||||
|
|
||||||
|
namespace Gnome {
|
||||||
|
namespace Canvas {
|
||||||
|
class SimpleRect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ControlPoint
|
class ControlPoint
|
||||||
{
|
{
|
||||||
public:
|
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 (const ControlPoint&, bool dummy_arg_to_force_special_copy_constructor);
|
||||||
~ControlPoint ();
|
~ControlPoint ();
|
||||||
|
|
||||||
|
|
@ -71,7 +77,7 @@ class ControlPoint
|
||||||
void set_size (double);
|
void set_size (double);
|
||||||
void set_visible (bool);
|
void set_visible (bool);
|
||||||
|
|
||||||
Gnome::Canvas::Item* item;
|
Gnome::Canvas::SimpleRect* item;
|
||||||
AutomationLine& line;
|
AutomationLine& line;
|
||||||
uint32_t view_index;
|
uint32_t view_index;
|
||||||
ARDOUR::AutomationList::iterator model;
|
ARDOUR::AutomationList::iterator model;
|
||||||
|
|
@ -88,9 +94,8 @@ class ControlPoint
|
||||||
class AutomationLine : public sigc::trackable
|
class AutomationLine : public sigc::trackable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutomationLine (string name, TimeAxisView&, Gnome::Canvas::Item&, ARDOUR::AutomationList&,
|
AutomationLine (string name, TimeAxisView&, Gnome::Canvas::Group&, ARDOUR::AutomationList&,
|
||||||
gint (*point_event_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*>, sigc::slot<bool,GdkEvent*,AutomationLine*>);
|
||||||
gint (*line_event_handler)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
|
|
||||||
|
|
||||||
virtual ~AutomationLine ();
|
virtual ~AutomationLine ();
|
||||||
|
|
||||||
|
|
@ -131,18 +136,15 @@ class AutomationLine : public sigc::trackable
|
||||||
|
|
||||||
TimeAxisView& trackview;
|
TimeAxisView& trackview;
|
||||||
|
|
||||||
Gnome::Canvas::Group* canvas_group() const { return group; }
|
Gnome::Canvas::Group& canvas_group() const { return *group; }
|
||||||
Gnome::Canvas::Item* parent_group() const { return _parent_group; }
|
Gnome::Canvas::Item& parent_group() const { return _parent_group; }
|
||||||
Gnome::Canvas::Item* grab_item() const { return line; }
|
Gnome::Canvas::Item& grab_item() const { return *line; }
|
||||||
|
|
||||||
void show_selection();
|
void show_selection();
|
||||||
void hide_selection ();
|
void hide_selection ();
|
||||||
|
|
||||||
void set_point_size (double size);
|
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 string get_verbose_cursor_string (float);
|
||||||
virtual void view_to_model_y (double&) = 0;
|
virtual void view_to_model_y (double&) = 0;
|
||||||
virtual void model_to_view_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 no_draw : 1;
|
||||||
bool points_visible : 1;
|
bool points_visible : 1;
|
||||||
|
|
||||||
Gnome::Canvas::Item* _parent_group;
|
Gnome::Canvas::Group& _parent_group;
|
||||||
Gnome::Canvas::Group* group;
|
Gnome::Canvas::Group* group;
|
||||||
Gnome::Canvas::Line* line; /* line */
|
Gnome::Canvas::Line* line; /* line */
|
||||||
Gnome::Canvas::Points* point_coords; /* coordinates for canvas line */
|
Gnome::Canvas::Points line_points; /* coordinates for canvas line */
|
||||||
vector<ControlPoint*> control_points; /* visible control points */
|
vector<ControlPoint*> control_points; /* visible control points */
|
||||||
|
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer);
|
sigc::slot<bool,GdkEvent*,ControlPoint*> point_slot;
|
||||||
|
|
||||||
void determine_visible_control_points (Gnome::Canvas::Points*);
|
struct ALPoint {
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
ALPoint (double xx, double yy) : x(xx), y(yy) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
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_from (ControlPoint&);
|
||||||
void sync_model_with_view_point (ControlPoint&);
|
void sync_model_with_view_point (ControlPoint&);
|
||||||
void sync_model_with_view_line (uint32_t, uint32_t);
|
void sync_model_with_view_line (uint32_t, uint32_t);
|
||||||
|
|
@ -190,7 +203,6 @@ class AutomationLine : public sigc::trackable
|
||||||
|
|
||||||
UndoAction get_memento();
|
UndoAction get_memento();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t drags;
|
uint32_t drags;
|
||||||
double first_drag_fraction;
|
double first_drag_fraction;
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,12 @@
|
||||||
|
|
||||||
using namespace ARDOUR;
|
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,
|
Curve& c,
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
|
||||||
gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
|
sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler)
|
||||||
: AutomationLine (name, tv, parent, c, point_callback, line_callback),
|
|
||||||
|
: AutomationLine (name, tv, parent, c, point_handler, line_handler),
|
||||||
session (s)
|
session (s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ class TimeAxisView;
|
||||||
class AutomationPanLine : public AutomationLine
|
class AutomationPanLine : public AutomationLine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutomationPanLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Item* parent,
|
AutomationPanLine (string name, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Group& parent,
|
||||||
ARDOUR::Curve&,
|
ARDOUR::Curve&,
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
|
||||||
gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
|
sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler);
|
||||||
|
|
||||||
void view_to_model_y (double&);
|
void view_to_model_y (double&);
|
||||||
void model_to_view_y (double&);
|
void model_to_view_y (double&);
|
||||||
|
|
|
||||||
|
|
@ -1145,6 +1145,16 @@ class Editor : public PublicEditor
|
||||||
|
|
||||||
/* Canvas event handlers */
|
/* 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_crossfade_view_event (GdkEvent* event);
|
||||||
gint canvas_fade_in_event (GdkEvent* event);
|
gint canvas_fade_in_event (GdkEvent* event);
|
||||||
gint canvas_fade_in_handle_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_stream_view_event (GdkEvent* event);
|
||||||
gint canvas_marker_event (GdkEvent* event);
|
gint canvas_marker_event (GdkEvent* event);
|
||||||
gint canvas_zoom_rect_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_tempo_marker_event (GdkEvent* event);
|
||||||
gint canvas_meter_marker_event (GdkEvent* event);
|
gint canvas_meter_marker_event (GdkEvent* event);
|
||||||
gint canvas_tempo_bar_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_markerview_end_handle_event(GdkEvent* event) ;
|
||||||
gint canvas_automation_track_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_copy_region_event (GdkEvent* event);
|
||||||
gint canvas_playhead_cursor_event (GdkEvent* event);
|
gint canvas_playhead_cursor_event (GdkEvent* event);
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,16 @@ enum Width {
|
||||||
Narrow,
|
Narrow,
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <libgnomecanvas/libgnomecanvas.h>
|
namespace Gnome {
|
||||||
|
namespace Canvas {
|
||||||
|
class SimpleRect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct SelectionRect {
|
struct SelectionRect {
|
||||||
GnomeCanvasItem *rect;
|
Gnome::Canvas::SimpleRect *rect;
|
||||||
GnomeCanvasItem *end_trim;
|
Gnome::Canvas::SimpleRect *end_trim;
|
||||||
GnomeCanvasItem *start_trim;
|
Gnome::Canvas::SimpleRect *start_trim;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ GainAutomationTimeAxisView::~GainAutomationTimeAxisView ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
double x = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class GainAutomationTimeAxisView : public AutomationTimeAxisView
|
||||||
|
|
||||||
~GainAutomationTimeAxisView();
|
~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:
|
private:
|
||||||
ARDOUR::Curve& curve;
|
ARDOUR::Curve& curve;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ class PluginSelector;
|
||||||
class PlaylistSelector;
|
class PlaylistSelector;
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
class Selection;
|
class Selection;
|
||||||
|
class AutomationLine;
|
||||||
|
class ControlPoint;
|
||||||
|
class SelectionRect;
|
||||||
|
|
||||||
class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget {
|
class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget {
|
||||||
public:
|
public:
|
||||||
|
|
@ -114,6 +117,17 @@ class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget
|
||||||
sigc::signal<void> XOriginChanged;
|
sigc::signal<void> XOriginChanged;
|
||||||
sigc::signal<void> Resized;
|
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_crossfade_view_event (GdkEvent* event) = 0;
|
||||||
virtual gint canvas_fade_in_event (GdkEvent* event) = 0;
|
virtual gint canvas_fade_in_event (GdkEvent* event) = 0;
|
||||||
virtual gint canvas_fade_in_handle_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_stream_view_event (GdkEvent* event) = 0;
|
||||||
virtual gint canvas_marker_event (GdkEvent* event) = 0;
|
virtual gint canvas_marker_event (GdkEvent* event) = 0;
|
||||||
virtual gint canvas_zoom_rect_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_tempo_marker_event (GdkEvent* event) = 0;
|
||||||
virtual gint canvas_meter_marker_event (GdkEvent* event) = 0;
|
virtual gint canvas_meter_marker_event (GdkEvent* event) = 0;
|
||||||
virtual gint canvas_tempo_bar_event (GdkEvent* event) = 0;
|
virtual gint canvas_tempo_bar_event (GdkEvent* event) = 0;
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ using namespace std;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
RedirectAutomationLine::RedirectAutomationLine (string name, Redirect& rd, uint32_t port, Session& s,
|
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,
|
AutomationList& l,
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
|
||||||
gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer))
|
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),
|
session (s),
|
||||||
_redirect (rd),
|
_redirect (rd),
|
||||||
_port (port)
|
_port (port)
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,11 @@ class TimeAxisView;
|
||||||
class RedirectAutomationLine : public AutomationLine
|
class RedirectAutomationLine : public AutomationLine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RedirectAutomationLine (string name, ARDOUR::Redirect&, uint32_t port, ARDOUR::Session&, TimeAxisView&, Gnome::Canvas::Item& parent,
|
RedirectAutomationLine (string name, ARDOUR::Redirect&, uint32_t port, ARDOUR::Session&, TimeAxisView&,
|
||||||
|
Gnome::Canvas::Group& parent,
|
||||||
ARDOUR::AutomationList&,
|
ARDOUR::AutomationList&,
|
||||||
gint (*point_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer),
|
sigc::slot<bool,GdkEvent*,ControlPoint*> point_handler,
|
||||||
gint (*line_callback)(Gnome::Canvas::Item*, GdkEvent*, gpointer));
|
sigc::slot<bool,GdkEvent*,AutomationLine*> line_handler);
|
||||||
|
|
||||||
uint32_t port() const { return _port; }
|
uint32_t port() const { return _port; }
|
||||||
ARDOUR::Redirect& redirect() const { return _redirect; }
|
ARDOUR::Redirect& redirect() const { return _redirect; }
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,88 @@ GType SimpleRect::get_base_type()
|
||||||
return gnome_canvas_simplerect_get_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
|
} // namespace Canvas
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,26 @@ public:
|
||||||
SimpleRect(Group& parent, double x1, double y1, double x2, double y2);
|
SimpleRect(Group& parent, double x1, double y1, double x2, double y2);
|
||||||
explicit SimpleRect(Group& parent);
|
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;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "time_axis_view.h"
|
#include "time_axis_view.h"
|
||||||
#include "canvas-simplerect.h"
|
#include "simplerect.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "rgb_macros.h"
|
#include "rgb_macros.h"
|
||||||
|
|
@ -50,34 +50,20 @@ using namespace Gtk;
|
||||||
using namespace sigc;
|
using namespace sigc;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace Editing;
|
using namespace Editing;
|
||||||
|
using namespace Gnome::Canvas;
|
||||||
|
|
||||||
const double trim_handle_size = 6.0; /* pixels */
|
const double trim_handle_size = 6.0; /* pixels */
|
||||||
|
|
||||||
TimeAxisView::TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Gtk::Widget *canvas)
|
TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
|
||||||
: AxisView (sess),
|
: AxisView (sess),
|
||||||
editor (ed),
|
editor (ed),
|
||||||
controls_table (2, 9)
|
controls_table (2, 9)
|
||||||
{
|
{
|
||||||
//GTK2FIX -- whats going on here? is this canvas really a group?
|
canvas_display = new Group (*canvas.root(), 0.0, 0.0);
|
||||||
//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);
|
|
||||||
|
|
||||||
|
selection_group = new Group (*canvas_display);
|
||||||
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();
|
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);
|
|
||||||
|
|
||||||
control_parent = 0;
|
control_parent = 0;
|
||||||
display_menu = 0;
|
display_menu = 0;
|
||||||
size_menu = 0;
|
size_menu = 0;
|
||||||
|
|
@ -167,12 +153,12 @@ TimeAxisView::~TimeAxisView()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection_group) {
|
if (selection_group) {
|
||||||
gtk_object_destroy (GTK_OBJECT (selection_group));
|
delete selection_group;
|
||||||
selection_group = 0;
|
selection_group = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canvas_display) {
|
if (canvas_display) {
|
||||||
gtk_object_destroy (GTK_OBJECT (canvas_display));
|
delete canvas_display;
|
||||||
canvas_display = 0;
|
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->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) {
|
if (iy1 < 0) {
|
||||||
iy1 = 0;
|
iy1 = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -510,9 +498,9 @@ TimeAxisView::show_selection (TimeSelection& ts)
|
||||||
while (!used_selection_rects.empty()) {
|
while (!used_selection_rects.empty()) {
|
||||||
free_selection_rects.push_front (used_selection_rects.front());
|
free_selection_rects.push_front (used_selection_rects.front());
|
||||||
used_selection_rects.pop_front();
|
used_selection_rects.pop_front();
|
||||||
gnome_canvas_item_hide (free_selection_rects.front()->rect);
|
free_selection_rects.front()->rect->hide();
|
||||||
gnome_canvas_item_hide (free_selection_rects.front()->start_trim);
|
free_selection_rects.front()->start_trim->hide();
|
||||||
gnome_canvas_item_hide (free_selection_rects.front()->end_trim);
|
free_selection_rects.front()->end_trim->hide();
|
||||||
}
|
}
|
||||||
selection_group->hide();
|
selection_group->hide();
|
||||||
}
|
}
|
||||||
|
|
@ -555,14 +543,14 @@ TimeAxisView::show_selection (TimeSelection& ts)
|
||||||
"x2", x2,
|
"x2", x2,
|
||||||
"y2", 1.0 + trim_handle_size,
|
"y2", 1.0 + trim_handle_size,
|
||||||
NULL);
|
NULL);
|
||||||
gnome_canvas_item_show (rect->start_trim);
|
rect->start_trim->show();
|
||||||
gnome_canvas_item_show (rect->end_trim);
|
rect->end_trim->show();
|
||||||
} else {
|
} else {
|
||||||
gnome_canvas_item_hide (rect->start_trim);
|
rect->start_trim->hide();
|
||||||
gnome_canvas_item_hide (rect->end_trim);
|
rect->end_trim->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
gnome_canvas_item_show (rect->rect);
|
rect->rect->show ();
|
||||||
used_selection_rects.push_back (rect);
|
used_selection_rects.push_back (rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -584,9 +572,9 @@ TimeAxisView::hide_selection ()
|
||||||
while (!used_selection_rects.empty()) {
|
while (!used_selection_rects.empty()) {
|
||||||
free_selection_rects.push_front (used_selection_rects.front());
|
free_selection_rects.push_front (used_selection_rects.front());
|
||||||
used_selection_rects.pop_front();
|
used_selection_rects.pop_front();
|
||||||
gnome_canvas_item_hide (free_selection_rects.front()->rect);
|
free_selection_rects.front()->rect->hide();
|
||||||
gnome_canvas_item_hide (free_selection_rects.front()->start_trim);
|
free_selection_rects.front()->start_trim->hide();
|
||||||
gnome_canvas_item_hide (free_selection_rects.front()->end_trim);
|
free_selection_rects.front()->end_trim->hide();
|
||||||
}
|
}
|
||||||
selection_group->hide();
|
selection_group->hide();
|
||||||
}
|
}
|
||||||
|
|
@ -604,15 +592,15 @@ 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) {
|
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,
|
/* make one trim handle be "above" the other so that if they overlap,
|
||||||
the top one is the one last used.
|
the top one is the one last used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gnome_canvas_item_raise_to_top ((*i)->rect);
|
(*i)->rect->raise_to_top ();
|
||||||
gnome_canvas_item_raise_to_top (put_start_on_top ? (*i)->start_trim : (*i)->end_trim);
|
(put_start_on_top ? (*i)->start_trim : (*i)->end_trim)->raise_to_top ();
|
||||||
gnome_canvas_item_raise_to_top (put_start_on_top ? (*i)->end_trim : (*i)->start_trim);
|
(put_start_on_top ? (*i)->end_trim : (*i)->start_trim)->raise_to_top ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -647,47 +635,31 @@ TimeAxisView::get_selection_rect (uint32_t id)
|
||||||
|
|
||||||
rect = new SelectionRect;
|
rect = new SelectionRect;
|
||||||
|
|
||||||
rect->rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP(selection_group),
|
rect->rect = new SimpleRect (*selection_group);
|
||||||
gnome_canvas_simplerect_get_type(),
|
rect->rect->property_x1() = 0.0;
|
||||||
"x1", 0.0,
|
rect->rect->property_y1() = 0.0;
|
||||||
"y1", 0.0,
|
rect->rect->property_x2() = 0.0;
|
||||||
"x2", 0.0,
|
rect->rect->property_y2() = 0.0;
|
||||||
"y2", 0.0,
|
rect->rect->property_fill_color_rgba() = color_map[cSelectionRectFill];
|
||||||
"fill_color_rgba", color_map[cSelectionRectFill],
|
rect->rect->property_outline_color_rgba() = color_map[cSelectionRectOutline];
|
||||||
"outline_color_rgba" , color_map[cSelectionRectOutline],
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
|
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),
|
rect->end_trim = new SimpleRect (*selection_group);
|
||||||
gnome_canvas_simplerect_get_type(),
|
rect->end_trim->property_x1() = 0.0;
|
||||||
"x1", (gdouble) 0.0,
|
rect->end_trim->property_x2() = 0.0;
|
||||||
"x2", (gdouble) 0.0,
|
rect->end_trim->property_fill_color_rgba() = color_map[cSelectionEndFill];
|
||||||
"fill_color_rgba" , color_map[cSelectionStartFill],
|
rect->end_trim->property_outline_color_rgba() = color_map[cSelectionEndOutline];
|
||||||
"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);
|
|
||||||
free_selection_rects.push_front (rect);
|
free_selection_rects.push_front (rect);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT(rect->rect), "event",
|
rect->rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_rect_event), rect));
|
||||||
(GtkSignalFunc) PublicEditor::canvas_selection_rect_event,
|
rect->start_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_start_trim_event), rect));
|
||||||
&editor);
|
rect->end_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_end_trim_event), rect));
|
||||||
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 = free_selection_rects.front();
|
rect = free_selection_rects.front();
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class TimeAxisView : public virtual AxisView
|
||||||
Small = 21
|
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 ();
|
virtual ~TimeAxisView ();
|
||||||
|
|
||||||
/* public data: XXX create accessor/mutators for these ?? */
|
/* public data: XXX create accessor/mutators for these ?? */
|
||||||
|
|
@ -88,7 +88,7 @@ class TimeAxisView : public virtual AxisView
|
||||||
int order;
|
int order;
|
||||||
|
|
||||||
|
|
||||||
Gnome::Canvas::Item *canvas_display;
|
Gnome::Canvas::Group *canvas_display;
|
||||||
Gtk::VBox *control_parent;
|
Gtk::VBox *control_parent;
|
||||||
|
|
||||||
/* The Standard LHS Controls */
|
/* The Standard LHS Controls */
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Editing;
|
using namespace Editing;
|
||||||
|
using namespace Glib;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/** Initialize static memeber data */
|
/** Initialize static memeber data */
|
||||||
|
|
@ -209,7 +210,7 @@ TimeAxisViewItem::set_position(jack_nframes_t pos, void* src, double* delta)
|
||||||
double old_unit_pos ;
|
double old_unit_pos ;
|
||||||
double new_unit_pos = pos / samples_per_unit ;
|
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) {
|
if (new_unit_pos != old_unit_pos) {
|
||||||
group->move (new_unit_pos - old_unit_pos, 0.0);
|
group->move (new_unit_pos - old_unit_pos, 0.0);
|
||||||
|
|
@ -691,7 +692,7 @@ TimeAxisViewItem::set_colors()
|
||||||
double height = NAME_HIGHLIGHT_THRESH;
|
double height = NAME_HIGHLIGHT_THRESH;
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
frame->get_property ("y2", &height);
|
height = frame->property_y2();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height < NAME_HIGHLIGHT_THRESH) {
|
if (height < NAME_HIGHLIGHT_THRESH) {
|
||||||
|
|
@ -795,7 +796,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
|
||||||
|
|
||||||
if (name_highlight) {
|
if (name_highlight) {
|
||||||
|
|
||||||
name_highlight->get_property ("y2", &height);
|
double height = name_highlight->property_y2 ();
|
||||||
|
|
||||||
if (height < NAME_HIGHLIGHT_THRESH) {
|
if (height < NAME_HIGHLIGHT_THRESH) {
|
||||||
name_highlight->hide();
|
name_highlight->hide();
|
||||||
|
|
@ -832,22 +833,22 @@ TimeAxisViewItem::reset_name_width (double pixel_width)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
ustring ustr;
|
||||||
Pango::FontDescription fd (NAME_FONT);
|
Pango::FontDescription fd (NAME_FONT);
|
||||||
|
|
||||||
if (name_text == 0) {
|
if (name_text == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int namelen = item_name.length();
|
ustr = item_name;
|
||||||
char cstr[namelen+1];
|
int namelen = ustr.length();
|
||||||
strcpy (cstr, item_name.c_str());
|
|
||||||
|
|
||||||
Glib::RefPtr<Pango::Layout> layout = group->get_canvas()->create_pango_layout();
|
Glib::RefPtr<Pango::Layout> layout = group->get_canvas()->create_pango_layout (ustr);
|
||||||
layout->set_font_description (fd);
|
layout->set_font_description (fd);
|
||||||
|
|
||||||
while (namelen) {
|
while (namelen) {
|
||||||
|
|
||||||
layout->set_text (cstr);
|
layout->set_text (ustr);
|
||||||
layout->get_pixel_size (width, height);
|
layout->get_pixel_size (width, height);
|
||||||
|
|
||||||
if (width < (pixel_width - NAME_X_OFFSET)) {
|
if (width < (pixel_width - NAME_X_OFFSET)) {
|
||||||
|
|
@ -855,8 +856,7 @@ TimeAxisViewItem::reset_name_width (double pixel_width)
|
||||||
}
|
}
|
||||||
|
|
||||||
--namelen;
|
--namelen;
|
||||||
cstr[namelen] = '\0';
|
ustr = ustr.substr (0, namelen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (namelen == 0) {
|
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();
|
name_text->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue