2007-04-26 16:54:31 -04:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
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"
|
2007-06-29 13:13:09 -04:00
|
|
|
#include "ardour_ui.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
using namespace Editing;
|
2005-11-22 00:10:12 -05:00
|
|
|
using namespace ArdourCanvas;
|
2007-06-15 18:08:27 -04:00
|
|
|
using namespace ARDOUR;
|
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;
|
2007-06-29 13:13:09 -04:00
|
|
|
base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
|
|
|
|
base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
void
|
|
|
|
GhostRegion::set_colors ()
|
|
|
|
{
|
2007-06-29 13:13:09 -04:00
|
|
|
base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
|
|
|
|
base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
|
2007-06-15 18:08:27 -04:00
|
|
|
|
2007-04-11 09:07:51 -04:00
|
|
|
for (uint32_t n=0; n < waves.size(); ++n) {
|
2007-06-29 13:13:09 -04:00
|
|
|
waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWave.get();
|
2007-04-11 09:07:51 -04:00
|
|
|
|
2007-06-29 13:13:09 -04:00
|
|
|
waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get();
|
|
|
|
waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get();
|
2007-04-11 09:07:51 -04:00
|
|
|
}
|
|
|
|
}
|