summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ghostregion.cc
diff options
context:
space:
mode:
authorTaybin Rutkin <taybin@taybin.com>2005-09-25 18:42:24 +0000
committerTaybin Rutkin <taybin@taybin.com>2005-09-25 18:42:24 +0000
commit209d967b1bb80a9735d690d8f4f0455ecb9970ca (patch)
tree9d76ddcd7c1ac9d91bb2b1a33d31b66ce4ded5de /gtk2_ardour/ghostregion.cc
parente4b9aed743fc765219ac775905a221c017c88fba (diff)
Initial import of gtk2_ardour.
git-svn-id: svn://localhost/trunk/ardour2@24 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ghostregion.cc')
-rw-r--r--gtk2_ardour/ghostregion.cc68
1 files changed, 68 insertions, 0 deletions
diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc
new file mode 100644
index 0000000000..8caacac3b3
--- /dev/null
+++ b/gtk2_ardour/ghostregion.cc
@@ -0,0 +1,68 @@
+#include "canvas-simplerect.h"
+#include "ghostregion.h"
+#include "automation_time_axis.h"
+#include "rgb_macros.h"
+
+using namespace Editing;
+
+GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos)
+ : trackview (atv)
+{
+ group = gtk_canvas_item_new (GTK_CANVAS_GROUP(trackview.canvas_display),
+ gtk_canvas_group_get_type(),
+ "x", initial_pos,
+ "y", 0.0,
+ NULL);
+
+ base_rect = gtk_canvas_item_new (GTK_CANVAS_GROUP(group),
+ gtk_canvas_simplerect_get_type(),
+ "x1", (double) 0.0,
+ "y1", (double) 0.0,
+ "y2", (double) trackview.height,
+ "outline_what", (guint32) 0,
+ "outline_color_rgba", color_map[cGhostTrackBaseOutline],
+ "fill_color_rgba", color_map[cGhostTrackBaseFill],
+ NULL);
+
+ gtk_canvas_item_lower_to_bottom (group);
+
+ atv.add_ghost (this);
+}
+
+GhostRegion::~GhostRegion ()
+{
+ GoingAway (this);
+ gtk_object_destroy (GTK_OBJECT(group));
+}
+
+void
+GhostRegion::set_samples_per_unit (double spu)
+{
+ for (vector<GtkCanvasItem*>::iterator i = waves.begin(); i != waves.end(); ++i) {
+ gtk_canvas_item_set ((*i), "samples_per_unit", spu, NULL);
+ }
+}
+
+void
+GhostRegion::set_duration (double units)
+{
+ gtk_canvas_item_set (base_rect, "x2", units, NULL);
+}
+
+void
+GhostRegion::set_height ()
+{
+ gdouble ht;
+ vector<GtkCanvasItem*>::iterator i;
+ uint32_t n;
+
+ gtk_canvas_item_set (base_rect, "y2", (double) trackview.height, NULL);
+
+ ht = ((trackview.height) / (double) waves.size());
+
+ for (n = 0, i = waves.begin(); i != waves.end(); ++i, ++n) {
+ gdouble yoff = n * ht;
+ gtk_canvas_item_set ((*i), "height", ht, "y", yoff, NULL);
+ }
+}
+