X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fghostregion.cc;h=41911f27d37e933483ef5194111c03dc937c2e35;hb=39a4068e36f632f2ff8abf99881d40e26d7e5183;hp=8caacac3b3d31b0dd1bb0f9acbe0eab2fce13990;hpb=209d967b1bb80a9735d690d8f4f0455ecb9970ca;p=ardour.git diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index 8caacac3b3..41911f27d3 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -1,30 +1,52 @@ -#include "canvas-simplerect.h" +/* + Copyright (C) 2000-2007 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "simplerect.h" +#include "waveview.h" #include "ghostregion.h" #include "automation_time_axis.h" #include "rgb_macros.h" +#include "ardour_ui.h" using namespace Editing; +using namespace ArdourCanvas; 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); + //group = gnome_canvas_item_new (GNOME_CANVAS_GROUP(trackview.canvas_display), + // gnome_canvas_group_get_type(), + // "x", initial_pos, + // "y", 0.0, + // NULL); + group = new ArdourCanvas::Group (*trackview.canvas_display); + group->property_x() = initial_pos; + group->property_y() = 0.0; + + base_rect = new ArdourCanvas::SimpleRect (*group); + base_rect->property_x1() = (double) 0.0; + base_rect->property_y1() = (double) 0.0; + base_rect->property_y2() = (double) trackview.current_height(); + base_rect->property_outline_what() = (guint32) 0; + base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get(); + base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get(); + group->lower_to_bottom (); atv.add_ghost (this); } @@ -32,37 +54,52 @@ GhostRegion::GhostRegion (AutomationTimeAxisView& atv, double initial_pos) GhostRegion::~GhostRegion () { GoingAway (this); - gtk_object_destroy (GTK_OBJECT(group)); + delete base_rect; + delete group; } void GhostRegion::set_samples_per_unit (double spu) { - for (vector::iterator i = waves.begin(); i != waves.end(); ++i) { - gtk_canvas_item_set ((*i), "samples_per_unit", spu, NULL); + for (vector::iterator i = waves.begin(); i != waves.end(); ++i) { + (*i)->property_samples_per_unit() = spu; } } void GhostRegion::set_duration (double units) { - gtk_canvas_item_set (base_rect, "x2", units, NULL); + base_rect->property_x2() = units; } void GhostRegion::set_height () { gdouble ht; - vector::iterator i; + vector::iterator i; uint32_t n; - gtk_canvas_item_set (base_rect, "y2", (double) trackview.height, NULL); - - ht = ((trackview.height) / (double) waves.size()); + base_rect->property_y2() = (double) trackview.current_height(); + ht = ((trackview.current_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); + (*i)->property_height() = ht; + (*i)->property_y() = yoff; } } +void +GhostRegion::set_colors () +{ + base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get(); + base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get(); + + for (uint32_t n=0; n < waves.size(); ++n) { + waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get(); + waves[n]->property_fill_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get(); + + waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get(); + waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get(); + } +}