2005-11-22 00:10:12 -05:00
|
|
|
#include "simplerect.h"
|
|
|
|
#include "waveview.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "ghostregion.h"
|
|
|
|
#include "automation_time_axis.h"
|
|
|
|
#include "rgb_macros.h"
|
|
|
|
|
|
|
|
using namespace Editing;
|
2005-11-22 00:10:12 -05:00
|
|
|
using namespace ArdourCanvas;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos)
|
|
|
|
: trackview (atv)
|
|
|
|
{
|
2005-11-12 22:53:51 -05:00
|
|
|
//group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(trackview.canvas_display),
|
|
|
|
// gnome_canvas_group_get_type(),
|
|
|
|
// "x", initial_pos,
|
|
|
|
// "y", 0.0,
|
|
|
|
// NULL);
|
2005-11-23 12:21:12 -05:00
|
|
|
group = new ArdourCanvas::Group (*trackview.canvas_display);
|
2005-11-27 17:35:04 -05:00
|
|
|
group->property_x() = initial_pos;
|
|
|
|
group->property_y() = 0.0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-23 12:21:12 -05:00
|
|
|
base_rect = new ArdourCanvas::SimpleRect (*group);
|
2005-11-27 17:35:04 -05:00
|
|
|
base_rect->property_x1() = (double) 0.0;
|
|
|
|
base_rect->property_y1() = (double) 0.0;
|
|
|
|
base_rect->property_y2() = (double) trackview.height;
|
|
|
|
base_rect->property_outline_what() = (guint32) 0;
|
|
|
|
base_rect->property_outline_color_rgba() = color_map[cGhostTrackBaseOutline];
|
|
|
|
base_rect->property_fill_color_rgba() = color_map[cGhostTrackBaseFill];
|
2005-11-12 22:53:51 -05:00
|
|
|
group->lower_to_bottom ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
atv.add_ghost (this);
|
|
|
|
}
|
|
|
|
|
|
|
|
GhostRegion::~GhostRegion ()
|
|
|
|
{
|
|
|
|
GoingAway (this);
|
2005-11-22 00:10:12 -05:00
|
|
|
delete base_rect;
|
|
|
|
delete group;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GhostRegion::set_samples_per_unit (double spu)
|
|
|
|
{
|
2005-11-22 00:10:12 -05:00
|
|
|
for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
|
2005-11-27 15:07:16 -05:00
|
|
|
(*i)->property_samples_per_unit() = spu;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GhostRegion::set_duration (double units)
|
|
|
|
{
|
2005-11-27 17:35:04 -05:00
|
|
|
base_rect->property_x2() = units;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GhostRegion::set_height ()
|
|
|
|
{
|
|
|
|
gdouble ht;
|
2005-11-22 00:10:12 -05:00
|
|
|
vector<WaveView*>::iterator i;
|
2005-09-25 14:42:24 -04:00
|
|
|
uint32_t n;
|
|
|
|
|
2005-11-27 17:35:04 -05:00
|
|
|
base_rect->property_y2() = (double) trackview.height;
|
2005-09-25 14:42:24 -04:00
|
|
|
ht = ((trackview.height) / (double) waves.size());
|
|
|
|
|
|
|
|
for (n = 0, i = waves.begin(); i != waves.end(); ++i, ++n) {
|
|
|
|
gdouble yoff = n * ht;
|
2005-11-27 15:07:16 -05:00
|
|
|
(*i)->property_height() = ht;
|
|
|
|
(*i)->property_y() = yoff;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|