21 #include "canvas/container.h"
22 #include "canvas/polygon.h"
23 #include "canvas/rectangle.h"
24 #include "canvas/wave_view.h"
25 #include "canvas/debug.h"
45 , source_trackview (source_tv)
47 group =
new ArdourCanvas::Container (parent);
48 CANVAS_DEBUG_NAME (
group,
"ghost region");
49 group->set_position (ArdourCanvas::Duple (initial_pos, 0));
52 CANVAS_DEBUG_NAME (
base_rect,
"ghost region rect");
66 group->raise_to_top ();
100 return RGBA_TO_UINT (color.get_red() / 256, color.get_green() / 256, color.get_blue() / 256, alpha);
106 return (dynamic_cast<AutomationTimeAxisView*>(&
trackview)) != 0;
110 :
GhostRegion(tv.ghost_group(), tv, source_tv, initial_unit_pos)
118 for (vector<WaveView*>::iterator i =
waves.begin(); i !=
waves.end(); ++i) {
119 (*i)->set_samples_per_pixel (fpp);
126 vector<WaveView*>::iterator i;
133 for (n = 0, i =
waves.begin(); i !=
waves.end(); ++i, ++n) {
134 (*i)->set_height (ht);
135 (*i)->set_y_position (n * ht);
152 for (uint32_t n=0; n <
waves.size(); ++n) {
154 waves[n]->set_fill_color (fill_color);
167 :
GhostRegion(tv.ghost_group(), tv, source_tv, initial_unit_pos)
168 , _optimization_iterator (events.end ())
181 :
GhostRegion(msv.midi_underlay_group, msv.trackview(), source_tv, initial_unit_pos)
182 , _optimization_iterator (events.end ())
199 if (dynamic_cast<Note*>(e)) {
200 item =
new ArdourCanvas::Rectangle(
201 g, ArdourCanvas::Rect(e->
x0(), e->
y0(), e->
x1(), e->
y1()));
202 }
else if ((hit = dynamic_cast<Hit*>(e))) {
203 ArdourCanvas::Polygon* poly =
new ArdourCanvas::Polygon(g);
205 poly->set_position(hit->
position());
209 CANVAS_DEBUG_NAME (
item,
"ghost note item");
247 for (EventList::iterator it =
events.begin(); it !=
events.end(); ++it) {
248 (*it)->item->set_fill_color (
ARDOUR_UI::config()->color_mod((*it)->event->base_color(),
"ghost track midi fill"));
259 return std::max(1.0, floor(tv_height / note_range - 1.0));
267 const double s = tv_height / note_range;
269 return tv_height - (note_num + 1 - mv->
lowest_note()) * s;
283 for (EventList::iterator it =
events.begin(); it !=
events.end(); ++it) {
284 uint8_t
const note_num = (*it)->event->note()->note();
286 if (note_num < mv->lowest_note() || note_num > mv->
highest_note()) {
291 ArdourCanvas::Rectangle* rect = NULL;
292 ArdourCanvas::Polygon* poly = NULL;
293 if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>((*it)->item))) {
295 rect->set_y1 (y + h);
296 }
else if ((poly = dynamic_cast<ArdourCanvas::Polygon*>((*it)->item))) {
299 poly->set_position(position);
318 uint8_t
const note_num = n->
note()->note();
322 if (note_num < mv->lowest_note() || note_num > mv->
highest_note()) {
325 ArdourCanvas::Rectangle* rect = NULL;
326 ArdourCanvas::Polygon* poly = NULL;
327 if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>(event->item))) {
329 rect->set_y1 (y + h);
330 }
else if ((poly = dynamic_cast<ArdourCanvas::Polygon*>(event->item))) {
333 poly->set_position(position);
343 for (EventList::iterator it =
events.begin(); it !=
events.end(); ++it) {
363 ArdourCanvas::Rectangle* rect = NULL;
365 ArdourCanvas::Polygon* poly = NULL;
366 if ((note = dynamic_cast<Note*>(parent))) {
367 if ((rect = dynamic_cast<ArdourCanvas::Rectangle*>(ev->
item))) {
368 double const x1 = parent->
x0 ();
369 double const x2 = parent->
x1 ();
373 }
else if ((hit = dynamic_cast<Hit*>(parent))) {
374 if ((poly = dynamic_cast<ArdourCanvas::Polygon*>(ev->
item))) {
375 ArdourCanvas::Duple ppos = hit->
position();
376 ArdourCanvas::Duple gpos = poly->position();
378 poly->set_position(gpos);
417 if ((*_optimization_iterator)->event == parent) {
void set_duration(double units)
void add_note(NoteBase *)
ArdourCanvas::Color color(const std::string &, bool *failed=0) const
void remove_note(NoteBase *)
virtual ArdourCanvas::Coord x1() const =0
GhostEvent(::NoteBase *, ArdourCanvas::Container *)
ArdourCanvas::Duple position()
void set_samples_per_pixel(double spu)
virtual ArdourCanvas::Coord x0() const =0
MidiGhostRegion::GhostEvent * find_event(NoteBase *)
virtual ArdourCanvas::Coord y1() const =0
void set_samples_per_pixel(double)
virtual ArdourCanvas::Coord y0() const =0
void update_note(NoteBase *)
std::vector< ArdourCanvas::WaveView * > waves
virtual StreamView * view() const
guint source_track_color(unsigned char alpha=0xff)
uint32_t current_height() const
TimeAxisView & source_trackview
sigc::signal< void > NoteRangeChanged
uint8_t lowest_note() const
uint8_t contents_note_range() const
MidiStreamView * midi_view()
ArdourCanvas::Item * item
EventList::iterator _optimization_iterator
static double note_y(TimeAxisView &trackview, MidiStreamView *mv, uint8_t note_num)
const boost::shared_ptr< NoteType > note() const
virtual void set_colors()
ArdourCanvas::Rectangle * base_rect
static ArdourCanvas::Points points(ArdourCanvas::Distance height)
MidiGhostRegion(TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > position
static UIConfiguration * config()
uint8_t highest_note() const
bool is_automation_ghost()
static double note_height(TimeAxisView &trackview, MidiStreamView *mv)
#define RGBA_TO_UINT(r, g, b, a)
static PBD::Signal1< void, GhostRegion * > CatchDeletion
virtual void set_height()
ArdourCanvas::Container * group
AudioGhostRegion(TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)
LIBARDOUR_API PBD::PropertyDescriptor< bool > color
GhostRegion(ArdourCanvas::Container *parent, TimeAxisView &tv, TimeAxisView &source_tv, double initial_unit_pos)