initial commit of hand merging, plus getting "ancient" waf script to work correctly

This commit is contained in:
Paul Davis 2013-04-04 00:32:52 -04:00
parent 1d8bac08c0
commit aaea166135
244 changed files with 131902 additions and 7357 deletions

View File

@ -29,7 +29,7 @@ export ARDOUR_DLL_PATH=$libs
export GTK_PATH=~/.ardour3:$libs/clearlooks-newer
export VAMP_PATH=$libs/vamp-plugins${VAMP_PATH:+:$VAMP_PATH}
export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=$libs/qm-dsp:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/gnomecanvas:$libs/libsndfile:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/audiographer:$libs/timecode:$libs/libltc:$libs/canvas${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
# DYLD_LIBRARY_PATH is for darwin.
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH

View File

@ -2347,6 +2347,7 @@ ARDOUR_UI::save_state_canfail (string name, bool switch_to_it)
}
save_ardour_state (); /* XXX cannot fail? yeah, right ... */
editor->save_canvas_state ();
return 0;
}

View File

@ -35,7 +35,6 @@
#include <list>
#include <cmath>
#include <libgnomecanvasmm/canvas.h>
#include "pbd/xml++.h"
#include "pbd/controllable.h"

View File

@ -34,7 +34,6 @@
#include <gtkmm/separator.h>
#include <gtkmm/spinbutton.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include "pbd/signals.h"
#include "pbd/crossthread.h"

View File

@ -37,12 +37,13 @@
#include "evoral/Curve.hpp"
#include "canvas/rectangle.h"
#include "canvas/polygon.h"
#include "canvas/pixbuf.h"
#include "streamview.h"
#include "audio_region_view.h"
#include "audio_time_axis.h"
#include "simplerect.h"
#include "simpleline.h"
#include "waveview.h"
#include "public_editor.h"
#include "audio_region_editor.h"
#include "audio_streamview.h"
@ -154,24 +155,24 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
create_waves ();
fade_in_shape = new ArdourCanvas::Polygon (*group);
fade_in_shape->property_fill_color_rgba() = fade_color;
fade_in_shape = new ArdourCanvas::Polygon (group);
fade_in_shape->set_fill_color (fade_color);
fade_in_shape->set_data ("regionview", this);
fade_out_shape = new ArdourCanvas::Polygon (*group);
fade_out_shape->property_fill_color_rgba() = fade_color;
fade_out_shape = new ArdourCanvas::Polygon (group);
fade_out_shape->set_fill_color (fade_color);
fade_out_shape->set_data ("regionview", this);
if (!_recregion) {
fade_in_handle = new ArdourCanvas::SimpleRect (*group);
fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
fade_in_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
fade_in_handle = new ArdourCanvas::Rectangle (group);
fade_in_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0));
fade_in_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
fade_in_handle->set_data ("regionview", this);
fade_out_handle = new ArdourCanvas::SimpleRect (*group);
fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fill_color, 0);
fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
fade_out_handle = new ArdourCanvas::Rectangle (group);
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0));
fade_out_handle->set_outline_color_rgba (RGBA_TO_UINT (0, 0, 0, 0));
fade_out_handle->set_data ("regionview", this);
}
@ -197,7 +198,11 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
region_sync_changed ();
region_resized (ARDOUR::bounds_change);
set_waveview_data_src();
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
(*i)->set_duration (_region->length() / frames_per_pixel);
}
region_locked ();
envelope_active_changed ();
fade_in_active_changed ();
@ -205,15 +210,15 @@ AudioRegionView::init (Gdk::Color const & basic_color, bool wfd)
reset_width_dependent_items (_pixel_width);
fade_in_shape->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_event), fade_in_shape, this));
fade_in_shape->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_event), fade_in_shape, this));
if (fade_in_handle) {
fade_in_handle->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this));
fade_in_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_in_handle_event), fade_in_handle, this));
}
fade_out_shape->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_event), fade_out_shape, this));
fade_out_shape->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_event), fade_out_shape, this));
if (fade_out_handle) {
fade_out_handle->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this));
fade_out_handle->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_fade_out_handle_event), fade_out_handle, this));
}
set_colors ();
@ -231,10 +236,6 @@ AudioRegionView::~AudioRegionView ()
RegionViewGoingAway (this); /* EMIT_SIGNAL */
for (vector<GnomeCanvasWaveViewCache *>::iterator cache = wave_caches.begin(); cache != wave_caches.end() ; ++cache) {
gnome_canvas_waveview_cache_destroy (*cache);
}
for (vector<ScopedConnection*>::iterator i = _data_ready_connections.begin(); i != _data_ready_connections.end(); ++i) {
delete *i;
}
@ -299,11 +300,13 @@ void
AudioRegionView::fade_in_active_changed ()
{
if (audio_region()->fade_in_active()) {
fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
fade_in_shape->property_width_pixels() = 1;
/* XXX: make a themable colour */
fade_in_shape->set_fill_color (RGBA_TO_UINT (45, 45, 45, 90));
fade_in_shape->set_outline_width (1);
} else {
fade_in_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
fade_in_shape->property_width_pixels() = 1;
/* XXX: make a themable colour */
fade_in_shape->set_fill_color (RGBA_TO_UINT (45, 45, 45, 20));
fade_in_shape->set_outline_width (1);
}
}
@ -311,11 +314,13 @@ void
AudioRegionView::fade_out_active_changed ()
{
if (audio_region()->fade_out_active()) {
fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,90); // FIXME make a themeable colour
fade_out_shape->property_width_pixels() = 1;
/* XXX: make a themable colour */
fade_out_shape->set_fill_color (RGBA_TO_UINT (45, 45, 45, 90));
fade_out_shape->set_outline_width (1);
} else {
fade_out_shape->property_fill_color_rgba() = RGBA_TO_UINT(45,45,45,20); // FIXME make a themeable colour
fade_out_shape->property_width_pixels() = 1;
/* XXX: make a themable colour */
fade_out_shape->set_fill_color (RGBA_TO_UINT (45, 45, 45, 20));
fade_out_shape->set_outline_width (1);
}
}
@ -326,8 +331,7 @@ AudioRegionView::region_scale_amplitude_changed ()
ENSURE_GUI_THREAD (*this, &AudioRegionView::region_scale_amplitude_changed)
for (uint32_t n = 0; n < waves.size(); ++n) {
// force a reload of the cache
waves[n]->property_data_src() = _region.get();
waves[n]->rebuild ();
}
}
@ -362,14 +366,16 @@ AudioRegionView::region_resized (const PropertyChange& what_changed)
if (what_changed.contains (interesting_stuff)) {
for (uint32_t n = 0; n < waves.size(); ++n) {
waves[n]->property_region_start() = _region->start();
waves[n]->region_resized ();
waves[n]->set_region_start (region()->start ());
}
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
if ((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
(*w)->property_region_start() = _region->start();
(*w)->region_resized ();
(*w)->set_region_start (region()->start ());
}
}
}
@ -414,12 +420,13 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
float x_pos = trackview.editor().frame_to_pixel (*i);
ArdourCanvas::Points points;
points.push_back(Gnome::Art::Point(x_pos, 2.0)); // first x-coord needs to be a non-normal value
points.push_back(Gnome::Art::Point(x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
(*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
(*l).first = *i;
(*l).second->property_points() = points;
(*l).second->set (ArdourCanvas::Duple (x_pos, 2.0),
ArdourCanvas::Duple (x_pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
}
reset_fade_shapes ();
@ -432,9 +439,9 @@ AudioRegionView::region_muted ()
for (uint32_t n=0; n < waves.size(); ++n) {
if (_region->muted()) {
waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
waves[n]->set_outline_color (UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA));
} else {
waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
waves[n]->set_outline_color (ARDOUR_UI::config()->canvasvar_WaveForm.get());
}
}
}
@ -446,13 +453,13 @@ AudioRegionView::setup_fade_handle_positions()
double const handle_pos = 2;
if (fade_in_handle) {
fade_in_handle->property_y1() = handle_pos;
fade_in_handle->property_y2() = handle_pos + handle_size;
fade_in_handle->set_y0 (handle_pos);
fade_in_handle->set_y1 (handle_pos + handle_size);
}
if (fade_out_handle) {
fade_out_handle->property_y1() = handle_pos;
fade_out_handle->property_y2() = handle_pos + handle_size;
fade_out_handle->set_y0 (handle_pos);
fade_out_handle->set_y1 (handle_pos + handle_size);
}
}
@ -474,8 +481,8 @@ AudioRegionView::set_height (gdouble height)
gdouble yoff = n * (ht + 1);
waves[n]->property_height() = ht;
waves[n]->property_y() = yoff + 2;
waves[n]->set_height (ht);
waves[n]->set_y_position (yoff + 2);
}
if (gain_line) {
@ -498,12 +505,8 @@ AudioRegionView::set_height (gdouble height)
float pos_x = trackview.editor().frame_to_pixel((*l).first);
ArdourCanvas::Points points;
points.push_back(Gnome::Art::Point(pos_x, 2.0)); // first x-coord needs to be a non-normal value
points.push_back(Gnome::Art::Point(pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
(*l).second->property_points() = points;
(*l).second->set (ArdourCanvas::Duple (pos_x, 2.0),
ArdourCanvas::Duple (pos_x, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
}
if (name_pixbuf) {
@ -540,15 +543,15 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, f
Points* points;
/* round here to prevent little visual glitches with sub-pixel placement */
double const pwidth = rint (width / samples_per_unit);
double const pwidth = rint (width / frames_per_pixel);
uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
double h;
double const handle_center = pwidth;
/* Put the fade in handle so that its left side is at the end-of-fade line */
fade_in_handle->property_x1() = handle_center;
fade_in_handle->property_x2() = handle_center + handle_size;
fade_in_handle->set_x0 (handle_center);
fade_in_handle->set_x1 (handle_center + handle_size);
if (pwidth < 5) {
hide_start_xfade();
@ -577,23 +580,23 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, f
double xdelta = pwidth/npoints;
for (pi = 0, pc = 0; pc < npoints; ++pc) {
(*points)[pi].set_x(1 + (pc * xdelta));
(*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
(*points)[pi].x = 1 + (pc * xdelta);
(*points)[pi++].y = 2 + (h - (curve[pc] * h));
}
/* fold back */
(*points)[pi].set_x(pwidth);
(*points)[pi++].set_y(2);
(*points)[pi].x = pwidth;
(*points)[pi++].y = 2;
(*points)[pi].set_x(1);
(*points)[pi++].set_y(2);
(*points)[pi].x = 1;
(*points)[pi++].y = 2;
/* connect the dots ... */
(*points)[pi] = (*points)[0];
fade_in_shape->property_points() = *points;
fade_in_shape->set (*points);
delete points;
redraw_start_xfade_to ( ar, width);
@ -627,17 +630,17 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
Points* points;
/* round here to prevent little visual glitches with sub-pixel placement */
double const pwidth = rint (width / samples_per_unit);
double const pwidth = rint (width / frames_per_pixel);
uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
double h;
double const handle_center = (_region->length() - width) / samples_per_unit;
double const handle_center = (_region->length() - width) / frames_per_pixel;
/* Put the fade out handle so that its right side is at the end-of-fade line;
* it's `one out' for precise pixel accuracy.
*/
fade_out_handle->property_x1() = handle_center - 5;
fade_out_handle->property_x2() = handle_center + 1;
fade_out_handle->set_x0 (handle_center - 5);
fade_out_handle->set_x1 (handle_center + 1);
/* don't show shape if its too small */
@ -668,23 +671,23 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
double xdelta = pwidth/npoints;
for (pi = 0, pc = 0; pc < npoints; ++pc) {
(*points)[pi].set_x(_pixel_width - pwidth + (pc * xdelta));
(*points)[pi++].set_y(2 + (h - (curve[pc] * h)));
(*points)[pi].x = _pixel_width - pwidth + (pc * xdelta);
(*points)[pi++].y = 2 + (h - (curve[pc] * h));
}
/* fold back */
(*points)[pi].set_x(_pixel_width);
(*points)[pi++].set_y(h);
(*points)[pi].x = _pixel_width;
(*points)[pi++].y = h;
(*points)[pi].set_x(_pixel_width);
(*points)[pi++].set_y(2);
(*points)[pi].x = _pixel_width;
(*points)[pi++].y = 2;
/* connect the dots ... */
(*points)[pi] = (*points)[0];
fade_out_shape->property_points() = *points;
fade_out_shape->set (*points);
delete points;
redraw_end_xfade_to (ar, width);
@ -710,13 +713,13 @@ AudioRegionView::get_fade_out_shape_width ()
void
AudioRegionView::set_samples_per_unit (gdouble spu)
AudioRegionView::set_frames_per_pixel (gdouble fpp)
{
RegionView::set_samples_per_unit (spu);
RegionView::set_frames_per_pixel (fpp);
if (Config->get_show_waveforms ()) {
for (uint32_t n = 0; n < waves.size(); ++n) {
waves[n]->property_samples_per_unit() = spu;
waves[n]->set_frames_per_pixel() (fpp);
}
}
@ -756,9 +759,9 @@ AudioRegionView::set_colors ()
for (uint32_t n=0; n < waves.size(); ++n) {
if (_region->muted()) {
waves[n]->property_wave_color() = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
waves[n]->set_outline_color (UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA));
} else {
waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
waves[n]->set_outline_color (ARDOUR_UI::config()->canvasvar_WaveForm.get());
}
waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
@ -848,8 +851,6 @@ AudioRegionView::create_waves ()
break;
}
wave_caches.push_back (WaveView::create_cache ());
// cerr << "\tchannel " << n << endl;
if (wait_for_data) {
@ -890,31 +891,28 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
WaveView *wave = new WaveView(*group);
wave->property_data_src() = (gpointer) _region.get();
wave->property_cache() = wave_caches[which];
wave->property_cache_updater() = true;
wave->property_channel() = which;
wave->property_length_function() = (gpointer) region_length_from_c;
wave->property_sourcefile_length_function() = (gpointer) sourcefile_length_from_c;
wave->property_peak_function() = (gpointer) region_read_peaks_from_c;
wave->property_x() = 0.0;
wave->property_y() = yoff;
wave->property_height() = (double) ht;
wave->property_samples_per_unit() = samples_per_unit;
WaveView *wave = new WaveView (group, audio_region ());
wave->set_channel (which);
wave->set_x_position (0);
wave->set_y_position (yoff);
wave->set_height (ht);
wave->set_frames_per_pixel (frames_per_pixel);
wave->property_amplitude_above_axis() = _amplitude_above_axis;
if (_recregion) {
wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_RecWaveForm.get();
wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get();
wave->set_outline_color (_region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_RecWaveForm.get());
wave->set_fill_color (ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get());
} else {
wave->property_wave_color() = _region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_WaveForm.get();
wave->property_fill_color() = ARDOUR_UI::config()->canvasvar_WaveFormFill.get();
wave->set_outline_color (_region->muted() ? UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA) : ARDOUR_UI::config()->canvasvar_WaveForm.get());
wave->set_fill_color (ARDOUR_UI::config()->canvasvar_WaveFormFill.get());
}
wave->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
wave->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
wave->property_zero_line() = true;
wave->property_region_start() = _region->start();
wave->set_region_start() = _region->start();
wave->property_rectified() = Config->get_waveform_shape() == Rectified;
wave->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
@ -978,7 +976,7 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev)
x = ev->button.x;
y = ev->button.y;
item->w2i (x, y);
item->canvas_to_item (x, y);
framepos_t fx = trackview.editor().pixel_to_frame (x);
@ -1045,7 +1043,7 @@ AudioRegionView::add_ghost (TimeAxisView& tv)
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&trackview);
assert(rtv);
double unit_position = _region->position () / samples_per_unit;
double unit_position = _region->position () / frames_per_pixel;
AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
uint32_t nchans;
@ -1057,26 +1055,19 @@ AudioRegionView::add_ghost (TimeAxisView& tv)
break;
}
WaveView *wave = new WaveView(*ghost->group);
WaveView *wave = new WaveView (ghost->group, audio_region());
wave->property_data_src() = _region.get();
wave->property_cache() = wave_caches[n];
wave->property_cache_updater() = false;
wave->property_channel() = n;
wave->property_length_function() = (gpointer)region_length_from_c;
wave->property_sourcefile_length_function() = (gpointer) sourcefile_length_from_c;
wave->property_peak_function() = (gpointer) region_read_peaks_from_c;
wave->property_x() = 0.0;
wave->property_samples_per_unit() = samples_per_unit;
wave->set_channel (n);
wave->set_x_position (0);
wave->set_frames_per_pixel (frames_per_pixel);
wave->property_amplitude_above_axis() = _amplitude_above_axis;
wave->property_region_start() = _region->start();
wave->set_region_start (_region->start());
ghost->waves.push_back(wave);
}
ghost->set_height ();
ghost->set_duration (_region->length() / samples_per_unit);
ghost->set_duration (_region->length() / frames_per_pixel);
ghost->set_colors();
ghosts.push_back (ghost);
@ -1094,10 +1085,10 @@ AudioRegionView::entered (bool internal_editing)
}
if (fade_in_handle && !internal_editing) {
fade_in_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 255);
fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 255);
fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 255);
fade_in_handle->set_outline_color_ (RGBA_TO_UINT (0, 0, 0, 255));
fade_in_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 255));
fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 255));
}
}
@ -1112,10 +1103,10 @@ AudioRegionView::exited ()
}
if (fade_in_handle) {
fade_in_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
fade_in_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
fade_out_handle->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 0);
fade_out_handle->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (fade_color, 0);
fade_in_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
fade_in_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 0));
fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fade_color, 0));
}
}
@ -1127,30 +1118,6 @@ AudioRegionView::envelope_active_changed ()
}
}
void
AudioRegionView::set_waveview_data_src()
{
AudioGhostRegion* agr;
double unit_length= _region->length() / samples_per_unit;
for (uint32_t n = 0; n < waves.size(); ++n) {
// TODO: something else to let it know the channel
waves[n]->property_data_src() = _region.get();
}
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
(*i)->set_duration (unit_length);
if((agr = dynamic_cast<AudioGhostRegion*>(*i)) != 0) {
for (vector<WaveView*>::iterator w = agr->waves.begin(); w != agr->waves.end(); ++w) {
(*w)->property_data_src() = _region.get();
}
}
}
}
void
AudioRegionView::color_handler ()
{
@ -1210,11 +1177,9 @@ AudioRegionView::set_frame_color ()
}
for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
if (_region->muted()) {
(*w)->property_wave_color() = wc;
} else {
(*w)->property_wave_color() = wc;
(*w)->property_fill_color() = fc;
(*w)->set_outline_color (wc);
if (!_region->muted()) {
(*w)->set_fill_color (fc);
}
}
}
@ -1281,16 +1246,12 @@ AudioRegionView::transients_changed ()
while (feature_lines.size() < analysis_features.size()) {
ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(*group);
ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(group);
ArdourCanvas::Points points;
canvas_item->set (ArdourCanvas::Duple (-1.0, 2.0),
ArdourCanvas::Duple (1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
points.push_back(Gnome::Art::Point(-1.0, 2.0)); // first x-coord needs to be a non-normal value
points.push_back(Gnome::Art::Point(1.0, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
canvas_item->property_points() = points;
canvas_item->property_width_pixels() = 1;
canvas_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
canvas_item->set_outline_width (1);
canvas_item->property_first_arrowhead() = TRUE;
canvas_item->property_last_arrowhead() = TRUE;
canvas_item->property_arrow_shape_a() = 11.0;
@ -1301,7 +1262,7 @@ AudioRegionView::transients_changed ()
canvas_item->show ();
canvas_item->set_data ("regionview", this);
canvas_item->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
canvas_item->Event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_feature_line_event), canvas_item, this));
feature_lines.push_back (make_pair(0, canvas_item));
}
@ -1317,17 +1278,15 @@ AudioRegionView::transients_changed ()
for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
ArdourCanvas::Points points;
float *pos = new float;
*pos = trackview.editor().frame_to_pixel (*i);
points.push_back(Gnome::Art::Point(*pos, 2.0)); // first x-coord needs to be a non-normal value
points.push_back(Gnome::Art::Point(*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1));
(*l).second->set (
ArdourCanvas::Duple (*pos, 2.0),
ArdourCanvas::Duple (*pos, _height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 1)
);
(*l).second->property_points() = points;
(*l).second->set_data ("position", pos);
(*l).first = *i;
}
}
@ -1419,7 +1378,7 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
}
if (!start_xfade_rect) {
start_xfade_rect = new ArdourCanvas::SimpleRect (*group);
start_xfade_rect = new ArdourCanvas::Rectangle (*group);
start_xfade_rect->property_draw() = true;
start_xfade_rect->property_fill() = true;;
start_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();
@ -1527,7 +1486,7 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
}
if (!end_xfade_rect) {
end_xfade_rect = new ArdourCanvas::SimpleRect (*group);
end_xfade_rect = new ArdourCanvas::Rectangle (*group);
end_xfade_rect->property_draw() = true;
end_xfade_rect->property_fill() = true;;
end_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get();

View File

@ -21,17 +21,16 @@
#include <vector>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
#include <sigc++/signal.h>
#include "ardour/audioregion.h"
#include "canvas/fwd.h"
#include "canvas/wave_view.h"
#include "region_view.h"
#include "time_axis_view_item.h"
#include "automation_line.h"
#include "enums.h"
#include "waveview.h"
#include "canvas.h"
namespace ARDOUR {
class AudioRegion;
@ -50,13 +49,13 @@ class AudioRegionView : public RegionView
AudioRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
double initial_samples_per_unit,
double initial_frames_per_pixel,
Gdk::Color const & basic_color);
AudioRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
double samples_per_unit,
double frames_per_pixel,
Gdk::Color const & basic_color,
bool recording,
TimeAxisViewItem::Visibility);
@ -72,7 +71,7 @@ class AudioRegionView : public RegionView
void create_waves ();
void set_height (double);
void set_samples_per_unit (double);
void set_frames_per_pixel (double);
void set_amplitude_above_axis (gdouble spp);
@ -154,17 +153,17 @@ class AudioRegionView : public RegionView
ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position
ArdourCanvas::Polygon* fade_in_shape;
ArdourCanvas::Polygon* fade_out_shape;
ArdourCanvas::SimpleRect* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::SimpleRect* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0
ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0
ArdourCanvas::Line *start_xfade_in;
ArdourCanvas::Line *start_xfade_out;
ArdourCanvas::SimpleRect* start_xfade_rect;
ArdourCanvas::Rectangle* start_xfade_rect;
bool _start_xfade_visible;
ArdourCanvas::Line *end_xfade_in;
ArdourCanvas::Line *end_xfade_out;
ArdourCanvas::SimpleRect* end_xfade_rect;
ArdourCanvas::Rectangle* end_xfade_rect;
bool _end_xfade_visible;
boost::shared_ptr<AudioRegionGainLine> gain_line;
@ -192,13 +191,10 @@ class AudioRegionView : public RegionView
void set_colors ();
void compute_colors (Gdk::Color const &);
void reset_width_dependent_items (double pixel_width);
void set_waveview_data_src();
void set_frame_color ();
void color_handler ();
std::vector<GnomeCanvasWaveViewCache*> wave_caches;
void transients_changed();
AutomationLine::VisibleAspects automation_line_visibility () const;

View File

@ -34,12 +34,12 @@
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
#include "canvas/rectangle.h"
#include "audio_streamview.h"
#include "audio_region_view.h"
#include "tape_region_view.h"
#include "audio_time_axis.h"
#include "canvas-waveview.h"
#include "canvas-simplerect.h"
#include "region_selection.h"
#include "selection.h"
#include "public_editor.h"
@ -284,14 +284,14 @@ AudioStreamView::setup_rec_box ()
break;
}
ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group);
rec_rect->property_x1() = xstart;
rec_rect->property_y1() = 1.0;
rec_rect->property_x2() = xend;
rec_rect->property_y2() = child_height ();
rec_rect->property_outline_what() = 0x0;
rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
rec_rect->property_fill_color_rgba() = fill_color;
ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group);
rec_rect->set_x0 (xstart);
rec_rect->set_y0 (1);
rec_rect->set_x1 (xend);
rec_rect->set_y1 (child_height ());
rec_rect->set_outline_what (0);
rec_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get());
rec_rect->set_fill_color (fill_color);
rec_rect->lower_to_bottom();
RecBoxInfo recbox;
@ -397,7 +397,7 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
assert (n < rec_rects.size());
if (!canvas_item_visible (rec_rects[n].rectangle)) {
if (!rec_rects[n].rectangle->visible()) {
/* rect already hidden, this region is done */
iter = tmp;
continue;
@ -434,9 +434,9 @@ AudioStreamView::update_rec_regions (framepos_t start, framecnt_t cnt)
check_record_layers (region, (region->position() - region->start() + start + cnt));
/* also update rect */
ArdourCanvas::SimpleRect * rect = rec_rects[n].rectangle;
ArdourCanvas::Rectangle * rect = rec_rects[n].rectangle;
gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
rect->property_x2() = xend;
rect->set_x1 (xend);
}
} else {
@ -529,15 +529,15 @@ AudioStreamView::color_handler ()
{
//case cAudioTrackBase:
if (_trackview.is_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_AudioTrackBase.get());
}
//case cAudioBusBase:
if (!_trackview.is_track()) {
if (Profile->get_sae() && _trackview.route()->is_master()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioMasterBusBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_AudioMasterBusBase.get());
} else {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_AudioBusBase.get());
}
}
}

View File

@ -27,7 +27,6 @@
#include "ardour/location.h"
#include "editing.h"
#include "simplerect.h"
#include "streamview.h"
namespace Gdk {

View File

@ -45,7 +45,6 @@
#include "ardour_ui.h"
#include "audio_time_axis.h"
#include "automation_line.h"
#include "canvas_impl.h"
#include "enums.h"
#include "gui_thread.h"
#include "automation_time_axis.h"
@ -54,7 +53,6 @@
#include "prompter.h"
#include "public_editor.h"
#include "audio_region_view.h"
#include "simplerect.h"
#include "audio_streamview.h"
#include "utils.h"
@ -66,7 +64,7 @@ using namespace PBD;
using namespace Gtk;
using namespace Editing;
AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
: AxisView(sess)
, RouteTimeAxisView(ed, sess, canvas)
{

View File

@ -38,7 +38,6 @@
#include "enums.h"
#include "editing.h"
#include "route_time_axis.h"
#include "canvas.h"
namespace ARDOUR {
class Session;

View File

@ -35,7 +35,6 @@
#include "evoral/Curve.hpp"
#include "simplerect.h"
#include "automation_line.h"
#include "control_point.h"
#include "gui_thread.h"
@ -57,7 +56,6 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
using namespace Gnome; // for Canvas
/** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session frames.
* This will not be deleted by AutomationLine.
@ -91,15 +89,13 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
terminal_points_can_slide = true;
_height = 0;
group = new ArdourCanvas::Group (parent);
group->property_x() = 0.0;
group->property_y() = 0.0;
group = new ArdourCanvas::Group (&parent);
line = new ArdourCanvas::Line (*group);
line->property_width_pixels() = (guint)1;
line = new ArdourCanvas::PolyLine (group);
line->set_outline_width (1);
line->set_data ("line", this);
line->signal_event().connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
line->Event.connect (sigc::mem_fun (*this, &AutomationLine::event_handler));
trackview.session()->register_with_memento_command_factory(alist->id(), this);
@ -204,7 +200,7 @@ void
AutomationLine::set_line_color (uint32_t color)
{
_line_color = color;
line->property_fill_color_rgba() = color;
line->set_outline_color (color);
}
void
@ -259,7 +255,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
reset_line_coords (cp);
if (line_points.size() > 1) {
line->property_points() = line_points;
line->set (line_points);
}
alist->freeze ();
@ -280,8 +276,8 @@ void
AutomationLine::reset_line_coords (ControlPoint& cp)
{
if (cp.view_index() < line_points.size()) {
line_points[cp.view_index()].set_x (cp.get_x());
line_points[cp.view_index()].set_y (cp.get_y());
line_points[cp.view_index()].x = cp.get_x ();
line_points[cp.view_index()].y = cp.get_y ();
}
}
@ -683,7 +679,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
*/
if (line_points.size() > 1) {
line->property_points() = line_points;
line->set (line_points);
}
}
@ -980,7 +976,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
/* reset the line coordinates given to the CanvasLine */
while (line_points.size() < vp) {
line_points.push_back (Art::Point (0,0));
line_points.push_back (ArdourCanvas::Duple (0,0));
}
while (line_points.size() > vp) {
@ -988,11 +984,11 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
}
for (uint32_t n = 0; n < vp; ++n) {
line_points[n].set_x (control_points[n]->get_x());
line_points[n].set_y (control_points[n]->get_y());
line_points[n].x (control_points[n]->get_x());
line_points[n].y (control_points[n]->get_y());
}
line->property_points() = line_points;
line->set (line_points);
if (_visible && alist->interpolation() != AutomationList::Discrete) {
line->show();

View File

@ -25,10 +25,7 @@
#include <string>
#include <sys/types.h>
#include <libgnomecanvasmm/line.h>
#include <sigc++/signal.h>
#include "canvas.h"
#include "simplerect.h"
#include "evoral/TimeConverter.hpp"
@ -39,6 +36,10 @@
#include "ardour/automation_list.h"
#include "ardour/types.h"
#include "canvas/types.h"
#include "canvas/group.h"
#include "canvas/line.h"
class AutomationLine;
class ControlPoint;
class PointSelection;
@ -47,10 +48,8 @@ class AutomationTimeAxisView;
class Selectable;
class Selection;
namespace Gnome {
namespace Canvas {
class SimpleRect;
}
namespace ArdourCanvas {
class Rectangle;
}
/** A GUI representation of an ARDOUR::AutomationList */
@ -178,7 +177,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
ArdourCanvas::Group& _parent_group;
ArdourCanvas::Group* group;
ArdourCanvas::Line* line; /* line */
ArdourCanvas::PolyLine* line; /* line */
ArdourCanvas::Points line_points; /* coordinates for canvas line */
std::vector<ControlPoint*> control_points; /* visible control points */

View File

@ -52,7 +52,7 @@ AutomationRegionView::AutomationRegionView (ArdourCanvas::Group*
create_line(list);
}
group->signal_event().connect (sigc::mem_fun (this, &AutomationRegionView::canvas_event), false);
group->Event.connect (sigc::mem_fun (this, &AutomationRegionView::canvas_event));
group->raise_to_top();
}
@ -69,7 +69,7 @@ AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/)
compute_colors (basic_color);
reset_width_dependent_items ((double) _region->length() / samples_per_unit);
reset_width_dependent_items ((double) _region->length() / frames_per_pixel);
set_height (trackview.current_height());
@ -114,7 +114,7 @@ AutomationRegionView::canvas_event (GdkEvent* ev)
double y = ev->button.y;
/* convert to item coordinates in the time axis view */
automation_view()->canvas_display()->w2i (x, y);
automation_view()->canvas_display()->canvas_to_item (x, y);
/* clamp y */
y = std::max (y, 0.0);

View File

@ -26,7 +26,6 @@
#include "automation_time_axis.h"
#include "automation_line.h"
#include "enums.h"
#include "canvas.h"
namespace ARDOUR {
class AutomationList;
@ -43,7 +42,7 @@ public:
boost::shared_ptr<ARDOUR::Region>,
const Evoral::Parameter& parameter,
boost::shared_ptr<ARDOUR::AutomationList>,
double initial_samples_per_unit,
double initial_frames_per_pixel,
Gdk::Color const & basic_color);
~AutomationRegionView();

View File

@ -31,7 +31,6 @@
#include "region_view.h"
#include "automation_region_view.h"
#include "automation_time_axis.h"
#include "canvas-simplerect.h"
#include "region_selection.h"
#include "selection.h"
#include "public_editor.h"
@ -39,8 +38,6 @@
#include "rgb_macros.h"
#include "gui_thread.h"
#include "utils.h"
#include "simplerect.h"
#include "simpleline.h"
using namespace std;
using namespace ARDOUR;
@ -49,13 +46,13 @@ using namespace Editing;
AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv)
: StreamView (*dynamic_cast<RouteTimeAxisView*>(tv.get_parent()),
new ArdourCanvas::Group(*tv.canvas_background()),
new ArdourCanvas::Group(*tv.canvas_display()))
new ArdourCanvas::Group (tv.canvas_background()),
new ArdourCanvas::Group (tv.canvas_display()))
, _automation_view(tv)
, _pending_automation_state (Off)
{
//canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->property_outline_color_rgba() = RGBA_BLACK;
canvas_rect->set_outline_color (RGBA_BLACK);
}
AutomationStreamView::~AutomationStreamView ()
@ -108,7 +105,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region
region_view = new AutomationRegionView (
_canvas_group, _automation_view, region,
_automation_view.parameter (), list,
_samples_per_unit, region_color
_frames_per_pixel, region_color
);
region_view->init (region_color, false);

View File

@ -24,7 +24,6 @@
#include "ardour/location.h"
#include "enums.h"
#include "simplerect.h"
#include "streamview.h"
#include "time_axis_view_item.h"
#include "route_time_axis.h"

View File

@ -39,11 +39,9 @@
#include "route_time_axis.h"
#include "automation_line.h"
#include "public_editor.h"
#include "simplerect.h"
#include "selection.h"
#include "rgb_macros.h"
#include "point_selection.h"
#include "canvas_impl.h"
#include "control_point.h"
#include "utils.h"
@ -110,22 +108,17 @@ AutomationTimeAxisView::AutomationTimeAxisView (
ignore_state_request = false;
first_call_to_set_height = true;
_base_rect = new SimpleRect(*_canvas_display);
_base_rect->property_x1() = 0.0;
_base_rect->property_y1() = 0.0;
/** gnomecanvas sometimes converts this value to int or adds 2 to it, so it must be
set correctly to avoid overflow.
*/
_base_rect->property_x2() = INT_MAX - 2;
_base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackOutline.get();
_base_rect = new ArdourCanvas::Rectangle (_canvas_display);
_base_rect->set_x1 (ArdourCanvas::COORD_MAX);
_base_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_AutomationTrackOutline.get());
/* outline ends and bottom */
_base_rect->property_outline_what() = (guint32) (0x1|0x2|0x8);
_base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AutomationTrackFill.get();
_base_rect->set_outline_what (0x1 | 0x2 | 0x8);
_base_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_AutomationTrackFill.get());
_base_rect->set_data ("trackview", this);
_base_rect->signal_event().connect (sigc::bind (
_base_rect->Event.connect (sigc::bind (
sigc::mem_fun (_editor, &PublicEditor::canvas_automation_track_event),
_base_rect, this));
@ -410,7 +403,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
_base_rect->set_y1 (h);
if (_line) {
_line->set_height(h);
@ -436,7 +429,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
}
if (changed) {
if (canvas_item_visible (_canvas_display) && _route) {
if (_canvas_display->visible() && _route) {
/* only emit the signal if the height really changed and we were visible */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
@ -444,16 +437,16 @@ AutomationTimeAxisView::set_height (uint32_t h)
}
void
AutomationTimeAxisView::set_samples_per_unit (double spu)
AutomationTimeAxisView::set_frames_per_pixel (double fpp)
{
TimeAxisView::set_samples_per_unit (spu);
TimeAxisView::set_frames_per_pixel (fpp);
if (_line) {
_line->reset ();
}
if (_view) {
_view->set_samples_per_unit (spu);
_view->set_frames_per_pixel (fpp);
}
}
@ -567,7 +560,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
double x = 0;
_canvas_display->w2i (x, y);
_canvas_display->canvas_to_item (x, y);
/* compute vertical fractional position */

View File

@ -30,9 +30,9 @@
#include "ardour/automatable.h"
#include "ardour/automation_list.h"
#include "canvas.h"
#include "canvas/rectangle.h"
#include "time_axis_view.h"
#include "simplerect.h"
#include "automation_controller.h"
namespace ARDOUR {
@ -69,7 +69,7 @@ class AutomationTimeAxisView : public TimeAxisView {
~AutomationTimeAxisView();
virtual void set_height (uint32_t);
void set_samples_per_unit (double);
void set_frames_per_pixel (double);
std::string name() const { return _name; }
void add_automation_event (GdkEvent *, framepos_t, double);
@ -132,7 +132,7 @@ class AutomationTimeAxisView : public TimeAxisView {
boost::shared_ptr<AutomationController> _controller;
Evoral::Parameter _parameter;
ArdourCanvas::SimpleRect* _base_rect;
ArdourCanvas::Rectangle* _base_rect;
boost::shared_ptr<AutomationLine> _line;
/** AutomationStreamView if we are editing region-based automation (for MIDI), otherwise 0 */

View File

@ -1,65 +0,0 @@
/* libgnomecanvas/gnome-canvas-curve.h: GnomeCanvas item for constrained spline curves
*
* Copyright (C) 2003 Paul Davis <pbd@op.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_CURVE_H__
#define __GNOME_CANVAS_CURVE_H__
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_CANVAS_TYPE_CANVAS_CURVE (gnome_canvas_curve_get_type ())
#define GNOME_CANVAS_CURVE(obj) (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_CURVE, GnomeCanvasCurve))
#define GNOME_CANVAS_CURVE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_CURVE, GnomeCanvasCurveClass))
#define GNOME_CANVAS_IS_CANVAS_CURVE(obj) (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_CURVE))
#define GNOME_CANVAS_IS_CANVAS_CURVE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_CURVE))
typedef struct _GnomeCanvasCurve GnomeCanvasCurve;
typedef struct _GnomeCanvasCurveClass GnomeCanvasCurveClass;
struct _GnomeCanvasCurve
{
GnomeCanvasItem item;
double x1, y1, x2, y2;
void* curve_arg;
float* vector;
size_t veclen;
uint32_t color;
/* cached values set during update/used during render */
unsigned char r, b, g, a;
guint32 bbox_ulx, bbox_uly;
guint32 bbox_lrx, bbox_lry;
};
struct _GnomeCanvasCurveClass {
GnomeCanvasItemClass parent_class;
};
GtkType gnome_canvas_curve_get_type (void);
G_END_DECLS
#endif /* __GNOME_CANVAS_CURVE_H__ */

View File

@ -1,105 +0,0 @@
/*
Copyright (C) 2012 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 <iostream>
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/rgb_macros.h"
#include "ardour_ui.h"
#include "canvas-flag.h"
#include "canvas-noevent-pixbuf.h"
#include "time_axis_view_item.h"
#include "utils.h"
using namespace Gnome::Canvas;
using namespace std;
CanvasFlag::CanvasFlag (MidiRegionView& region,
Group& parent,
double height,
guint outline_color_rgba,
guint fill_color_rgba,
double x,
double y)
: Group(parent, x, y)
, _name_pixbuf(0)
, _height(height)
, _outline_color_rgba(outline_color_rgba)
, _fill_color_rgba(fill_color_rgba)
, _region(region)
, name_pixbuf_width (0)
, _line(0)
, _rect(0)
{
}
void
CanvasFlag::delete_allocated_objects()
{
delete _name_pixbuf;
_name_pixbuf = 0;
delete _line;
_line = 0;
delete _rect;
_rect = 0;
}
void
CanvasFlag::set_text (const string& text)
{
delete_allocated_objects();
_name_pixbuf = new ArdourCanvas::NoEventPixbuf (*this);
name_pixbuf_width = Gtkmm2ext::pixel_width (text, TimeAxisViewItem::NAME_FONT) + 2;
Gdk::Color c;
set_color (c, _outline_color_rgba);
_name_pixbuf->property_pixbuf() = Gtkmm2ext::pixbuf_from_string (text, TimeAxisViewItem::NAME_FONT, name_pixbuf_width,
TimeAxisViewItem::NAME_HEIGHT, c);
_name_pixbuf->property_x() = 10.0;
_name_pixbuf->property_y() = 2.0;
_name_pixbuf->show();
double flagwidth = name_pixbuf_width + 8.0;
double flagheight = TimeAxisViewItem::NAME_HEIGHT + 3.0;
_line = new SimpleLine(*this, 0.0, 0.0, 0.0, _height);
_line->property_color_rgba() = _outline_color_rgba;
_rect = new SimpleRect(*this, 0.0, 0.0, flagwidth, flagheight);
_rect->property_outline_color_rgba() = _outline_color_rgba;
_rect->property_fill_color_rgba() = _fill_color_rgba;
_name_pixbuf->raise_to_top();
}
CanvasFlag::~CanvasFlag()
{
delete_allocated_objects();
}
void
CanvasFlag::set_height (double h)
{
_height = h;
if (_line) {
_line->property_y2() = _height;
}
}

View File

@ -1,74 +0,0 @@
/*
Copyright (C) 2012 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.
*/
#ifndef CANVASFLAG_H_
#define CANVASFLAG_H_
#include <string>
#include <libgnomecanvasmm/pixbuf.h>
#include <libgnomecanvasmm/group.h>
#include <libgnomecanvasmm/widget.h>
#include "simplerect.h"
#include "simpleline.h"
#include "canvas.h"
class MidiRegionView;
namespace Gnome {
namespace Canvas {
class CanvasFlag : public Group
{
public:
CanvasFlag (MidiRegionView& region,
Group& parent,
double height,
guint outline_color_rgba = 0xc0c0c0ff,
guint fill_color_rgba = 0x07070707,
double x = 0.0,
double y = 0.0);
virtual ~CanvasFlag();
virtual void set_text(const std::string& a_text);
virtual void set_height (double);
int width () const { return name_pixbuf_width + 10.0; }
protected:
ArdourCanvas::Pixbuf* _name_pixbuf;
double _height;
guint _outline_color_rgba;
guint _fill_color_rgba;
MidiRegionView& _region;
int name_pixbuf_width;
private:
void delete_allocated_objects();
SimpleLine* _line;
SimpleRect* _rect;
};
} // namespace Canvas
} // namespace Gnome
#endif /*CANVASFLAG_H_*/

View File

@ -1,60 +0,0 @@
/*
Copyright (C) 2012 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 "canvas-note.h"
#include "midi_region_view.h"
#include "public_editor.h"
#include "evoral/Note.hpp"
#include "utils.h"
using namespace ARDOUR;
namespace Gnome {
namespace Canvas {
CanvasHit::CanvasHit (MidiRegionView& region,
Group& group,
double size,
const boost::shared_ptr<NoteType> note,
bool with_events)
: Diamond(group, size)
, CanvasNoteEvent(region, this, note)
{
if (with_events) {
signal_event().connect (sigc::mem_fun (*this, &CanvasHit::on_event));
}
}
bool
CanvasHit::on_event(GdkEvent* ev)
{
if (!CanvasNoteEvent::on_event (ev)) {
return _region.get_time_axis_view().editor().canvas_note_event (ev, this);
}
return true;
}
void
CanvasHit::move_event(double dx, double dy)
{
move_by (dx, dy);
}
} // namespace Gnome
} // namespace Canvas

View File

@ -1,59 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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.
*/
#ifndef __gtk_ardour_canvas_hit_h__
#define __gtk_ardour_canvas_hit_h__
#include <iostream>
#include "simplerect.h"
#include "diamond.h"
namespace Gnome {
namespace Canvas {
class CanvasHit : public Diamond, public CanvasNoteEvent {
public:
typedef Evoral::Note<double> NoteType;
CanvasHit(
MidiRegionView& region,
Group& group,
double size,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
bool with_events = true);
void show() { Diamond::show(); }
void hide() { Diamond::hide(); }
double x1() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x1; }
double y1() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y1; }
double x2() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x2; }
double y2() const { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y2; }
void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; }
void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; }
bool on_event(GdkEvent* ev);
void move_event(double dx, double dy);
};
} // namespace Gnome
} // namespace Canvas
#endif /* __gtk_ardour_canvas_hit_h__ */

View File

@ -1,586 +0,0 @@
/* Image item type for GnomeCanvas widget
*
* GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is
* copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
*
* Copyright (C) 1998 The Free Software Foundation
*
* Author: Federico Mena <federico@nuclecu.unam.mx>
*/
#include <string.h> /* for memcpy() */
#include <math.h>
#include <stdio.h>
#include "libart_lgpl/art_misc.h"
#include "libart_lgpl/art_affine.h"
#include "libart_lgpl/art_pixbuf.h"
#include "libart_lgpl/art_rgb_pixbuf_affine.h"
#include "canvas-imageframe.h"
#include <libgnomecanvas/gnome-canvas-util.h>
#include "gettext.h"
#define _(Text) dgettext (PACKAGE,Text)
//GTK2FIX
//#include <libgnomecanvas/gnome-canvastypebuiltins.h>
enum {
PROP_0,
PROP_PIXBUF,
PROP_X,
PROP_Y,
PROP_WIDTH,
PROP_HEIGHT,
PROP_DRAWWIDTH,
PROP_ANCHOR
};
static void gnome_canvas_imageframe_class_init(GnomeCanvasImageFrameClass* class) ;
static void gnome_canvas_imageframe_init(GnomeCanvasImageFrame* image) ;
static void gnome_canvas_imageframe_destroy(GtkObject* object) ;
static void gnome_canvas_imageframe_set_property(GObject* object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gnome_canvas_imageframe_get_property(GObject* object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gnome_canvas_imageframe_update(GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) ;
static void gnome_canvas_imageframe_realize(GnomeCanvasItem *item) ;
static void gnome_canvas_imageframe_unrealize(GnomeCanvasItem *item) ;
static void gnome_canvas_imageframe_draw(GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) ;
static double gnome_canvas_imageframe_point(GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item) ;
static void gnome_canvas_imageframe_bounds(GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) ;
static void gnome_canvas_imageframe_render(GnomeCanvasItem *item, GnomeCanvasBuf *buf) ;
static GnomeCanvasItemClass *parent_class;
GType
gnome_canvas_imageframe_get_type (void)
{
static GType imageframe_type = 0;
if (!imageframe_type) {
GtkTypeInfo imageframe_info = {
"GnomeCanvasImageFrame",
sizeof (GnomeCanvasImageFrame),
sizeof (GnomeCanvasImageFrameClass),
(GtkClassInitFunc) gnome_canvas_imageframe_class_init,
(GtkObjectInitFunc) gnome_canvas_imageframe_init,
NULL, /* reserved_1 */
NULL, /* reserved_2 */
(GtkClassInitFunc) NULL
};
imageframe_type = gtk_type_unique (gnome_canvas_item_get_type (), &imageframe_info);
}
return imageframe_type;
}
static void
gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = gtk_type_class (gnome_canvas_item_get_type ());
gobject_class->set_property = gnome_canvas_imageframe_set_property;
gobject_class->get_property = gnome_canvas_imageframe_get_property;
g_object_class_install_property (gobject_class,
PROP_PIXBUF,
g_param_spec_pointer ("pixbuf",
_("pixbuf"),
_("the pixbuf"),
G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_X,
g_param_spec_double ("x",
_("x"),
_("x coordinate of upper left corner of rect"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_Y,
g_param_spec_double ("y",
_("y"),
_("y coordinate of upper left corner of rect "),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_WIDTH,
g_param_spec_double ("width",
_("width"),
_("the width"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_DRAWWIDTH,
g_param_spec_double ("drawwidth",
_("drawwidth"),
_("drawn width"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_HEIGHT,
g_param_spec_double ("height",
_("height"),
_("the height"),
-G_MAXDOUBLE,
G_MAXDOUBLE,
0.0,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_ANCHOR,
g_param_spec_enum ("anchor",
_("anchor"),
_("the anchor"),
GTK_TYPE_ANCHOR_TYPE,
GTK_ANCHOR_NW,
G_PARAM_READWRITE));
object_class->destroy = gnome_canvas_imageframe_destroy;
item_class->update = gnome_canvas_imageframe_update;
item_class->realize = gnome_canvas_imageframe_realize;
item_class->unrealize = gnome_canvas_imageframe_unrealize;
item_class->draw = gnome_canvas_imageframe_draw;
item_class->point = gnome_canvas_imageframe_point;
item_class->bounds = gnome_canvas_imageframe_bounds;
item_class->render = gnome_canvas_imageframe_render;
}
static void
gnome_canvas_imageframe_init (GnomeCanvasImageFrame *image)
{
image->x = 0.0;
image->y = 0.0;
image->width = 0.0;
image->height = 0.0;
image->drawwidth = 0.0;
image->anchor = GTK_ANCHOR_CENTER;
}
static void
gnome_canvas_imageframe_destroy (GtkObject *object)
{
GnomeCanvasImageFrame *image;
g_return_if_fail (object != NULL);
g_return_if_fail (GNOME_CANVAS_IS_CANVAS_IMAGEFRAME (object));
image = GNOME_CANVAS_IMAGEFRAME (object);
image->cwidth = 0;
image->cheight = 0;
if (image->pixbuf)
{
art_pixbuf_free (image->pixbuf);
image->pixbuf = NULL;
}
if(GTK_OBJECT_CLASS (parent_class)->destroy)
{
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
}
/* Get's the image bounds expressed as item-relative coordinates. */
static void
get_bounds_item_relative (GnomeCanvasImageFrame *image, double *px1, double *py1, double *px2, double *py2)
{
GnomeCanvasItem *item;
double x, y;
item = GNOME_CANVAS_ITEM (image);
/* Get item coordinates */
x = image->x;
y = image->y;
/* Anchor image */
switch (image->anchor) {
case GTK_ANCHOR_NW:
case GTK_ANCHOR_W:
case GTK_ANCHOR_SW:
break;
case GTK_ANCHOR_N:
case GTK_ANCHOR_CENTER:
case GTK_ANCHOR_S:
x -= image->width / 2;
break;
case GTK_ANCHOR_NE:
case GTK_ANCHOR_E:
case GTK_ANCHOR_SE:
x -= image->width;
break;
}
switch (image->anchor) {
case GTK_ANCHOR_NW:
case GTK_ANCHOR_N:
case GTK_ANCHOR_NE:
break;
case GTK_ANCHOR_W:
case GTK_ANCHOR_CENTER:
case GTK_ANCHOR_E:
y -= image->height / 2;
break;
case GTK_ANCHOR_SW:
case GTK_ANCHOR_S:
case GTK_ANCHOR_SE:
y -= image->height;
break;
}
/* Bounds */
*px1 = x;
*py1 = y;
*px2 = x + image->width;
*py2 = y + image->height;
}
static void
gnome_canvas_imageframe_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GnomeCanvasItem *item;
GnomeCanvasImageFrame *image;
int update;
int calc_bounds;
item = GNOME_CANVAS_ITEM (object);
image = GNOME_CANVAS_IMAGEFRAME (object);
update = FALSE;
calc_bounds = FALSE;
switch (prop_id) {
case PROP_PIXBUF:
if (item->canvas->aa && g_value_get_pointer (value)) {
if (image->pixbuf != NULL)
art_pixbuf_free (image->pixbuf);
image->pixbuf = g_value_get_pointer (value);
}
update = TRUE;
break;
case PROP_X:
image->x = g_value_get_double (value);
update = TRUE;
break;
case PROP_Y:
image->y = g_value_get_double (value);
update = TRUE;
break;
case PROP_WIDTH:
image->width = fabs (g_value_get_double (value));
update = TRUE;
break;
case PROP_HEIGHT:
image->height = fabs (g_value_get_double (value));
update = TRUE;
break;
case PROP_DRAWWIDTH:
image->drawwidth = fabs (g_value_get_double (value));
update = TRUE;
break;
case PROP_ANCHOR:
image->anchor = g_value_get_enum (value);
update = TRUE;
break;
default:
break;
}
if (update)
gnome_canvas_item_request_update (item);
}
static void
gnome_canvas_imageframe_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GnomeCanvasImageFrame *image;
image = GNOME_CANVAS_IMAGEFRAME (object);
switch (prop_id) {
case PROP_X:
g_value_set_double (value, image->x);
break;
case PROP_Y:
g_value_set_double (value, image->y);
break;
case PROP_WIDTH:
g_value_set_double (value, image->width);
break;
case PROP_HEIGHT:
g_value_set_double (value, image->height);
break;
case PROP_DRAWWIDTH:
g_value_set_double (value, image->drawwidth);
break;
case PROP_ANCHOR:
g_value_set_enum (value, image->anchor);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gnome_canvas_imageframe_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
{
GnomeCanvasImageFrame *image;
ArtDRect i_bbox, c_bbox;
int w = 0;
int h = 0;
image = GNOME_CANVAS_IMAGEFRAME (item);
if (parent_class->update)
(* parent_class->update) (item, affine, clip_path, flags);
/* only works for non-rotated, non-skewed transforms */
image->cwidth = (int) (image->width * affine[0] + 0.5);
image->cheight = (int) (image->height * affine[3] + 0.5);
if (image->pixbuf) {
image->need_recalc = TRUE ;
}
get_bounds_item_relative (image, &i_bbox.x0, &i_bbox.y0, &i_bbox.x1, &i_bbox.y1);
art_drect_affine_transform (&c_bbox, &i_bbox, affine);
/* these values only make sense in the non-rotated, non-skewed case */
image->cx = c_bbox.x0;
image->cy = c_bbox.y0;
/* add a fudge factor */
c_bbox.x0--;
c_bbox.y0--;
c_bbox.x1++;
c_bbox.y1++;
gnome_canvas_update_bbox (item, c_bbox.x0, c_bbox.y0, c_bbox.x1, c_bbox.y1);
if (image->pixbuf) {
w = image->pixbuf->width;
h = image->pixbuf->height;
}
image->affine[0] = (affine[0] * image->width) / w;
image->affine[1] = (affine[1] * image->height) / h;
image->affine[2] = (affine[2] * image->width) / w;
image->affine[3] = (affine[3] * image->height) / h;
image->affine[4] = i_bbox.x0 * affine[0] + i_bbox.y0 * affine[2] + affine[4];
image->affine[5] = i_bbox.x0 * affine[1] + i_bbox.y0 * affine[3] + affine[5];
}
static void
gnome_canvas_imageframe_realize (GnomeCanvasItem *item)
{
GnomeCanvasImageFrame *image;
image = GNOME_CANVAS_IMAGEFRAME (item);
if (parent_class->realize)
(* parent_class->realize) (item);
}
static void
gnome_canvas_imageframe_unrealize (GnomeCanvasItem *item)
{
GnomeCanvasImageFrame *image;
image = GNOME_CANVAS_IMAGEFRAME(item);
if (parent_class->unrealize)
(* parent_class->unrealize) (item);
}
static void
recalc_if_needed (GnomeCanvasImageFrame *image)
{}
static void
gnome_canvas_imageframe_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
int x, int y, int width, int height)
{
}
static double
gnome_canvas_imageframe_point (GnomeCanvasItem *item, double x, double y,
int cx, int cy, GnomeCanvasItem **actual_item)
{
GnomeCanvasImageFrame *image;
int x1, y1, x2, y2;
int dx, dy;
image = GNOME_CANVAS_IMAGEFRAME (item);
*actual_item = item;
recalc_if_needed (image);
x1 = image->cx - item->canvas->close_enough;
y1 = image->cy - item->canvas->close_enough;
x2 = image->cx + image->cwidth - 1 + item->canvas->close_enough;
y2 = image->cy + image->cheight - 1 + item->canvas->close_enough;
/* Hard case: is point inside image's gravity region? */
//if ((cx >= x1) && (cy >= y1) && (cx <= x2) && (cy <= y2))
//return dist_to_mask (image, cx, cy) / item->canvas->pixels_per_unit;
/* Point is outside image */
x1 += item->canvas->close_enough;
y1 += item->canvas->close_enough;
x2 -= item->canvas->close_enough;
y2 -= item->canvas->close_enough;
if (cx < x1)
dx = x1 - cx;
else if (cx > x2)
dx = cx - x2;
else
dx = 0;
if (cy < y1)
dy = y1 - cy;
else if (cy > y2)
dy = cy - y2;
else
dy = 0;
return sqrt (dx * dx + dy * dy) / item->canvas->pixels_per_unit;
}
static void
gnome_canvas_imageframe_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
{
GnomeCanvasImageFrame *image;
image = GNOME_CANVAS_IMAGEFRAME (item);
*x1 = image->x;
*y1 = image->y;
switch (image->anchor) {
case GTK_ANCHOR_NW:
case GTK_ANCHOR_W:
case GTK_ANCHOR_SW:
break;
case GTK_ANCHOR_N:
case GTK_ANCHOR_CENTER:
case GTK_ANCHOR_S:
*x1 -= image->width / 2.0;
break;
case GTK_ANCHOR_NE:
case GTK_ANCHOR_E:
case GTK_ANCHOR_SE:
*x1 -= image->width;
break;
}
switch (image->anchor) {
case GTK_ANCHOR_NW:
case GTK_ANCHOR_N:
case GTK_ANCHOR_NE:
break;
case GTK_ANCHOR_W:
case GTK_ANCHOR_CENTER:
case GTK_ANCHOR_E:
*y1 -= image->height / 2.0;
break;
case GTK_ANCHOR_SW:
case GTK_ANCHOR_S:
case GTK_ANCHOR_SE:
*y1 -= image->height;
break;
}
*x2 = *x1 + image->width;
*y2 = *y1 + image->height;
}
static void
gnome_canvas_imageframe_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
{
GnomeCanvasImageFrame *image;
image = GNOME_CANVAS_IMAGEFRAME (item);
gnome_canvas_buf_ensure_buf (buf);
#ifdef VERBOSE
{
char str[128];
art_affine_to_string (str, image->affine);
g_print ("gnome_canvas_imageframe_render %s\n", str);
}
#endif
art_rgb_pixbuf_affine (buf->buf,
buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
buf->buf_rowstride,
image->pixbuf,
image->affine,
ART_FILTER_NEAREST, NULL);
buf->is_bg = 0;
}

View File

@ -1,87 +0,0 @@
/* Image item type for GnomeCanvas widget
*
* GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget. Tk is
* copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
*
* Copyright (C) 1998 The Free Software Foundation
*
* Author: Federico Mena <federico@nuclecu.unam.mx>
*/
#ifndef __GNOME_CANVAS_IMAGEFRAME_H__
#define __GNOME_CANVAS_IMAGEFRAME_H__
#include <stdint.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include <gtk/gtkenums.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <libart_lgpl/art_misc.h>
#ifdef __cplusplus
}
#endif
#include <libart_lgpl/art_pixbuf.h>
G_BEGIN_DECLS
/* Image item for the canvas. Images are positioned by anchoring them to a point.
* The following arguments are available:
*
* name type read/write description
* ------------------------------------------------------------------------------------------
* pixbuf ArtPixBuf* W Pointer to an ArtPixBuf (aa-mode)
* x double RW X coordinate of anchor point
* y double RW Y coordinate of anchor point
* width double RW Width to scale image to, in canvas units
* height double RW Height to scale image to, in canvas units
* drawwidth double RW Width to scale image to, in canvas units
* anchor GtkAnchorType RW Anchor side for the image
*/
#define GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME (gnome_canvas_imageframe_get_type ())
#define GNOME_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_CAST ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrame))
#define GNOME_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME, GnomeCanvasImageFrameClass))
#define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME(obj) (GTK_CHECK_TYPE ((obj), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
#define GNOME_CANVAS_IS_CANVAS_IMAGEFRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_CANVAS_TYPE_CANVAS_IMAGEFRAME))
typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
struct _GnomeCanvasImageFrame {
GnomeCanvasItem item;
double x, y; /* Position at anchor, item relative */
double width, height; /* Size of image, item relative */
double drawwidth ; /* the amount of the image we draw width-wise (0-drawwidth)*/
GtkAnchorType anchor; /* Anchor side for image */
int cx, cy; /* Top-left canvas coordinates for display */
int cwidth, cheight; /* Rendered size in pixels */
uint32_t need_recalc : 1; /* Do we need to rescale the image? */
ArtPixBuf *pixbuf; /* A pixbuf, for aa rendering */
double affine[6]; /* The item -> canvas affine */
};
struct _GnomeCanvasImageFrameClass {
GnomeCanvasItemClass parent_class;
};
/* Standard Gtk function */
GtkType gnome_canvas_imageframe_get_type (void);
G_END_DECLS
#endif

View File

@ -1,41 +0,0 @@
/*
* Copyright (C) 2009 Paul Davis <paul@linuxaudiosystems.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __gtk2_ardour_canvas_noevent_pixbuf_h__
#define __gtk2_ardour_canvas_noevent_pixbuf_h__
#include <libgnomecanvasmm/pixbuf.h>
namespace Gnome { namespace Canvas {
class NoEventPixbuf : public Pixbuf
{
public:
NoEventPixbuf(Group& parent) : Pixbuf (parent) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} } /* namespaces */
#endif /* __gtk2_ardour_canvas_noevent_pixbuf_h__ */

View File

@ -1,44 +0,0 @@
/*
* Copyright (C) 2009 Paul Davis <paul@linuxaudiosystems.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __gtk2_ardour_canvas_noevent_rect_h__
#define __gtk2_ardour_canvas_noevent_rect_h__
#include "simplerect.h"
namespace Gnome { namespace Canvas {
class NoEventSimpleRect : public SimpleRect
{
public:
NoEventSimpleRect(Group& parent, double x1, double y1, double x2, double y2)
: SimpleRect (parent, x1, y1, x2, y2) {}
NoEventSimpleRect(Group& parent)
: SimpleRect (parent) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} } /* namespaces */
#endif /* __gtk2_ardour_canvas_noevent_text_h__ */

View File

@ -1,44 +0,0 @@
/*
* Copyright (C) 2009 Paul Davis <paul@linuxaudiosystems.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __gtk2_ardour_canvas_noevent_text_h__
#define __gtk2_ardour_canvas_noevent_text_h__
#include <libgnomecanvasmm/text.h>
namespace Gnome { namespace Canvas {
class NoEventText : public Text
{
public:
NoEventText(Group& parent, double x, double y, const std::string& text)
: Text (parent, x, y, text) {}
NoEventText(Group& parent)
: Text (parent) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} } /* namespaces */
#endif /* __gtk2_ardour_canvas_noevent_text_h__ */

View File

@ -1,375 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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 <iostream>
#include "gtkmm2ext/keyboard.h"
#include "canvas-note-event.h"
#include "midi_channel_selector.h"
#include "midi_region_view.h"
#include "public_editor.h"
#include "editing_syms.h"
#include "keyboard.h"
using namespace std;
using namespace Gtkmm2ext;
using ARDOUR::MidiModel;
namespace Gnome {
namespace Canvas {
PBD::Signal1<void,CanvasNoteEvent*> CanvasNoteEvent::CanvasNoteEventDeleted;
/// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms
const uint32_t CanvasNoteEvent::midi_channel_colors[16] = {
0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff,
0xa0d32dff, 0x7dd32dff, 0x2dd45eff, 0x2dd3c4ff,
0x2da5d3ff, 0x2d6fd3ff, 0x432dd3ff, 0x662dd3ff,
0x832dd3ff, 0xa92dd3ff, 0xd32dbfff, 0xd32d67ff
};
CanvasNoteEvent::CanvasNoteEvent(MidiRegionView& region, Item* item, const boost::shared_ptr<NoteType> note)
: _region(region)
, _item(item)
, _text(0)
, _channel_selector_widget()
, _state(None)
, _note(note)
, _selected(false)
, _valid (true)
, _mouse_x_fraction (-1.0)
, _mouse_y_fraction (-1.0)
, _channel_selection (0xffff)
{
}
CanvasNoteEvent::~CanvasNoteEvent()
{
CanvasNoteEventDeleted (this);
if (_text) {
_text->hide();
delete _text;
}
delete _channel_selector_widget;
}
void
CanvasNoteEvent::invalidate ()
{
_valid = false;
}
void
CanvasNoteEvent::validate ()
{
_valid = true;
}
void
CanvasNoteEvent::show_velocity()
{
if (!_text) {
_text = new NoEventText (*(_item->property_parent()));
_text->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiNoteVelocityText.get();
_text->property_justification() = Gtk::JUSTIFY_CENTER;
}
_text->property_x() = (x1() + x2()) /2;
_text->property_y() = (y1() + y2()) /2;
ostringstream velo(ios::ate);
velo << int(_note->velocity());
_text->property_text() = velo.str();
_text->show();
_text->raise_to_top();
}
void
CanvasNoteEvent::hide_velocity()
{
if (_text) {
_text->hide();
delete _text;
_text = 0;
}
}
void
CanvasNoteEvent::on_channel_selection_change(uint16_t selection)
{
_channel_selection = selection;
/* this takes into account whether or not the note should be drawn as inactive */
set_selected (_selected);
// this forces the item to update..... maybe slow...
_item->hide();
_item->show();
}
void
CanvasNoteEvent::on_channel_change(uint8_t channel)
{
_region.note_selected(this, true);
hide_channel_selector();
_region.change_channel(channel);
}
void
CanvasNoteEvent::show_channel_selector(void)
{
if (_channel_selector_widget == 0) {
if(_region.channel_selector_scoped_note() != 0){
_region.channel_selector_scoped_note()->hide_channel_selector();
_region.set_channel_selector_scoped_note(0);
}
SingleMidiChannelSelector* _channel_selector = new SingleMidiChannelSelector(_note->channel());
_channel_selector->show_all();
_channel_selector->channel_selected.connect(
sigc::mem_fun(this, &CanvasNoteEvent::on_channel_change));
_channel_selector->clicked.connect (
sigc::mem_fun (this, &CanvasNoteEvent::hide_channel_selector));
_channel_selector_widget = new Widget(*(_item->property_parent()),
x1(),
y2() + 2,
(Gtk::Widget &) *_channel_selector);
_channel_selector_widget->hide();
_channel_selector_widget->property_height() = 100;
_channel_selector_widget->property_width() = 100;
_channel_selector_widget->raise_to_top();
_channel_selector_widget->show();
_region.set_channel_selector_scoped_note(this);
} else {
hide_channel_selector();
}
}
void
CanvasNoteEvent::hide_channel_selector(void)
{
if (_channel_selector_widget) {
_channel_selector_widget->hide();
delete _channel_selector_widget;
_channel_selector_widget = 0;
}
}
void
CanvasNoteEvent::set_selected(bool selected)
{
if (!_note) {
return;
}
_selected = selected;
bool const active = (_channel_selection & (1 << _note->channel())) != 0;
if (_selected && active) {
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
if(_region.channel_selector_scoped_note() != 0){
_region.channel_selector_scoped_note()->hide_channel_selector();
_region.set_channel_selector_scoped_note(0);
}
set_fill_color (base_color ());
} else {
if (active) {
set_fill_color(base_color());
set_outline_color(calculate_outline(base_color()));
} else {
set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get());
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get()));
}
hide_channel_selector();
}
}
#define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257)
uint32_t
CanvasNoteEvent::base_color()
{
using namespace ARDOUR;
ColorMode mode = _region.color_mode();
const uint8_t min_opacity = 15;
uint8_t opacity = std::max(min_opacity, uint8_t(_note->velocity() + _note->velocity()));
switch (mode) {
case TrackColor:
{
Gdk::Color color = _region.midi_stream_view()->get_region_color();
return UINT_INTERPOLATE (RGBA_TO_UINT(
SCALE_USHORT_TO_UINT8_T(color.get_red()),
SCALE_USHORT_TO_UINT8_T(color.get_green()),
SCALE_USHORT_TO_UINT8_T(color.get_blue()),
opacity),
ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get(), 0.5);
}
case ChannelColors:
return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (CanvasNoteEvent::midi_channel_colors[_note->channel()],
opacity),
ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get(), 0.5);
default:
return meter_style_fill_color(_note->velocity(), selected());
};
return 0;
}
void
CanvasNoteEvent::set_mouse_fractions (GdkEvent* ev)
{
double ix, iy;
double bx1, bx2, by1, by2;
bool set_cursor = false;
switch (ev->type) {
case GDK_MOTION_NOTIFY:
ix = ev->motion.x;
iy = ev->motion.y;
set_cursor = true;
break;
case GDK_ENTER_NOTIFY:
ix = ev->crossing.x;
iy = ev->crossing.y;
set_cursor = true;
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
ix = ev->button.x;
iy = ev->button.y;
break;
default:
_mouse_x_fraction = -1.0;
_mouse_y_fraction = -1.0;
return;
}
_item->get_bounds (bx1, by1, bx2, by2);
_item->w2i (ix, iy);
/* hmm, something wrong here. w2i should give item-local coordinates
but it doesn't. for now, finesse this.
*/
ix = ix - bx1;
iy = iy - by1;
/* fraction of width/height */
double xf;
double yf;
bool notify = false;
xf = ix / (bx2 - bx1);
yf = iy / (by2 - by1);
if (xf != _mouse_x_fraction || yf != _mouse_y_fraction) {
notify = true;
}
_mouse_x_fraction = xf;
_mouse_y_fraction = yf;
if (notify) {
if (big_enough_to_trim()) {
_region.note_mouse_position (_mouse_x_fraction, _mouse_y_fraction, set_cursor);
} else {
/* pretend the mouse is in the middle, because this is not big enough
to trim right now.
*/
_region.note_mouse_position (0.5, 0.5, set_cursor);
}
}
}
bool
CanvasNoteEvent::on_event(GdkEvent* ev)
{
if (!_region.get_time_axis_view().editor().internal_editing()) {
return false;
}
switch (ev->type) {
case GDK_ENTER_NOTIFY:
set_mouse_fractions (ev);
_region.note_entered (this);
break;
case GDK_LEAVE_NOTIFY:
set_mouse_fractions (ev);
_region.note_left (this);
break;
case GDK_MOTION_NOTIFY:
set_mouse_fractions (ev);
break;
case GDK_BUTTON_PRESS:
set_mouse_fractions (ev);
if (ev->button.button == 3 && Keyboard::no_modifiers_active (ev->button.state) && _selected) {
show_channel_selector();
return true;
}
break;
case GDK_BUTTON_RELEASE:
set_mouse_fractions (ev);
if (ev->button.button == 3 && Keyboard::no_modifiers_active (ev->button.state)) {
return true;
}
break;
default:
break;
}
return false;
}
bool
CanvasNoteEvent::mouse_near_ends () const
{
return (_mouse_x_fraction >= 0.0 && _mouse_x_fraction < 0.25) ||
(_mouse_x_fraction >= 0.75 && _mouse_x_fraction < 1.0);
}
bool
CanvasNoteEvent::big_enough_to_trim () const
{
return (x2() - x1()) > 20; /* canvas units, really pixels */
}
} // namespace Canvas
} // namespace Gnome

View File

@ -1,169 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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.
*/
#ifndef __gtk_ardour_canvas_midi_event_h__
#define __gtk_ardour_canvas_midi_event_h__
#include <boost/shared_ptr.hpp>
#include <libgnomecanvasmm/text.h>
#include <libgnomecanvasmm/widget.h>
#include "ardour/midi_model.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
#include "canvas-noevent-text.h"
#include "ui_config.h"
class Editor;
class MidiRegionView;
namespace Evoral { template<typename T> class Note; }
namespace Gnome {
namespace Canvas {
/** This manages all the event handling for any MIDI event on the canvas.
*
* This is not actually a canvas item itself to avoid the dreaded diamond,
* since various types of canvas items (Note (rect), Hit (diamond), etc)
* need to share this functionality but can't share an ancestor.
*
* Note: Because of this, derived classes need to manually bounce events to
* on_event, it won't happen automatically.
*
* A newer, better canvas should remove the need for all the ugly here.
*/
class CanvasNoteEvent : virtual public sigc::trackable
{
public:
typedef Evoral::Note<ARDOUR::MidiModel::TimeType> NoteType;
CanvasNoteEvent(
MidiRegionView& region,
Item* item,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>());
virtual ~CanvasNoteEvent();
static PBD::Signal1<void,CanvasNoteEvent*> CanvasNoteEventDeleted;
virtual void show() = 0;
virtual void hide() = 0;
virtual bool on_event(GdkEvent* ev);
bool valid() const { return _valid; }
void invalidate ();
void validate ();
bool selected() const { return _selected; }
void set_selected(bool yn);
virtual void move_event(double dx, double dy) = 0;
uint32_t base_color();
void show_velocity();
void hide_velocity();
/** Channel changed for this specific event */
void on_channel_change(uint8_t channel);
/** Channel selection changed */
void on_channel_selection_change(uint16_t selection);
void show_channel_selector();
void hide_channel_selector();
virtual void set_outline_color(uint32_t c) = 0;
virtual void set_fill_color(uint32_t c) = 0;
virtual double x1() const = 0;
virtual double y1() const = 0;
virtual double x2() const = 0;
virtual double y2() const = 0;
float mouse_x_fraction() const { return _mouse_x_fraction; }
float mouse_y_fraction() const { return _mouse_y_fraction; }
const boost::shared_ptr<NoteType> note() const { return _note; }
MidiRegionView& region_view() const { return _region; }
inline static uint32_t meter_style_fill_color(uint8_t vel, bool selected) {
if (selected) {
if (vel < 64) {
return UINT_INTERPOLATE(
ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorBase.get(),
ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorMid.get(),
(vel / (double)63.0));
} else {
return UINT_INTERPOLATE(
ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorMid.get(),
ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorTop.get(),
((vel-64) / (double)63.0));
}
} else {
if (vel < 64) {
return UINT_INTERPOLATE(
ARDOUR_UI::config()->canvasvar_MidiNoteColorBase.get(),
ARDOUR_UI::config()->canvasvar_MidiNoteColorMid.get(),
(vel / (double)63.0));
} else {
return UINT_INTERPOLATE(
ARDOUR_UI::config()->canvasvar_MidiNoteColorMid.get(),
ARDOUR_UI::config()->canvasvar_MidiNoteColorTop.get(),
((vel-64) / (double)63.0));
}
}
}
/// calculate outline colors from fill colors of notes
inline static uint32_t calculate_outline(uint32_t color) {
return UINT_INTERPOLATE(color, 0x000000ff, 0.5);
}
/// hue circle divided into 16 equal-looking parts, courtesy Thorsten Wilms
static const uint32_t midi_channel_colors[16];
bool mouse_near_ends () const;
bool big_enough_to_trim () const;
protected:
enum State { None, Pressed, Dragging };
MidiRegionView& _region;
Item* const _item;
NoEventText* _text;
Widget* _channel_selector_widget;
State _state;
const boost::shared_ptr<NoteType> _note;
bool _selected;
bool _valid;
float _mouse_x_fraction;
float _mouse_y_fraction;
uint16_t _channel_selection;
void set_mouse_fractions (GdkEvent*);
};
} // namespace Gnome
} // namespace Canvas
#endif /* __gtk_ardour_canvas_midi_event_h__ */

View File

@ -1,75 +0,0 @@
/*
Copyright (C) 2012 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 "canvas-note.h"
#include "midi_region_view.h"
#include "public_editor.h"
#include "evoral/Note.hpp"
using namespace ARDOUR;
namespace Gnome {
namespace Canvas {
CanvasNote::CanvasNote (MidiRegionView& region,
Group& group,
const boost::shared_ptr<NoteType> note,
bool with_events)
: SimpleRect(group), CanvasNoteEvent(region, this, note)
{
if (with_events) {
signal_event().connect (sigc::mem_fun (*this, &CanvasNote::on_event));
}
}
bool
CanvasNote::on_event(GdkEvent* ev)
{
bool r = true;
if (!CanvasNoteEvent::on_event (ev)) {
r = _region.get_time_axis_view().editor().canvas_note_event (ev, this);
}
if (ev->type == GDK_BUTTON_RELEASE) {
_region.note_button_release ();
}
return r;
}
void
CanvasNote::move_event(double dx, double dy)
{
property_x1() = property_x1() + dx;
property_y1() = property_y1() + dy;
property_x2() = property_x2() + dx;
property_y2() = property_y2() + dy;
if (_text) {
_text->hide();
_text->property_x() = _text->property_x() + dx;
_text->property_y() = _text->property_y() + dy;
_text->show();
}
}
} // namespace Gnome
} // namespace Canvas

View File

@ -1,74 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
Author: Hans Baier
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.
*/
#ifndef __gtk_ardour_canvas_note_h__
#define __gtk_ardour_canvas_note_h__
#include <iostream>
#include "simplerect.h"
#include "canvas-note-event.h"
#include "midi_util.h"
namespace Gnome {
namespace Canvas {
class CanvasNote : public SimpleRect, public CanvasNoteEvent
{
public:
typedef Evoral::Note<Evoral::MusicalTime> NoteType;
CanvasNote (MidiRegionView& region,
Group& group,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
bool with_events = true);
double x1() const { return property_x1(); }
double y1() const { return property_y1(); }
double x2() const { return property_x2(); }
double y2() const { return property_y2(); }
void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; hide(); show(); }
void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; hide(); show(); }
void show() { SimpleRect::show(); }
void hide() { SimpleRect::hide(); }
bool on_event(GdkEvent* ev);
void move_event(double dx, double dy);
};
class NoEventCanvasNote : public CanvasNote
{
public:
NoEventCanvasNote (MidiRegionView& region,
Group& group,
const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>())
: CanvasNote (region, group, note, false) {}
double point_vfunc(double, double, int, int, GnomeCanvasItem**) {
/* return a huge value to tell the canvas that we're never the item for an event */
return 9999999999999.0;
}
};
} // namespace Gnome
} // namespace Canvas
#endif /* __gtk_ardour_canvas_note_h__ */

View File

@ -1,64 +0,0 @@
/* libgnomecanvas/gnome-canvas-simpleline.h: GnomeCanvas item for simple rects
*
* Copyright (C) 2001 Paul Davis <pbd@op.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_SIMPLELINE_H__
#define __GNOME_CANVAS_SIMPLELINE_H__
#include <stdint.h>
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_TYPE_CANVAS_SIMPLELINE (gnome_canvas_simpleline_get_type ())
#define GNOME_CANVAS_SIMPLELINE(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_SIMPLELINE, GnomeCanvasSimpleLine))
#define GNOME_CANVAS_SIMPLELINE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_SIMPLELINE, GnomeCanvasSimpleLineClass))
#define GNOME_IS_CANVAS_SIMPLELINE(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_SIMPLELINE))
#define GNOME_IS_CANVAS_SIMPLELINE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_SIMPLELINE))
#define GNOME_CANVAS_SIMPLELINE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_SIMPLELINE, GnomeCanvasSimpleLineClass))
typedef struct _GnomeCanvasSimpleLine GnomeCanvasSimpleLine;
typedef struct _GnomeCanvasSimpleLineClass GnomeCanvasSimpleLineClass;
struct _GnomeCanvasSimpleLine
{
GnomeCanvasItem item;
double x1, y1, x2, y2; /* parent-relative, world coordinates */
gint32 cx1, cy1, cx2, cy2; /* global, canvas coordinates */
uint32_t color;
/* cached values set during update/used during render */
unsigned char r, b, g, a;
};
struct _GnomeCanvasSimpleLineClass {
GnomeCanvasItemClass parent_class;
};
GType gnome_canvas_simpleline_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GNOME_CANVAS_SIMPLELINE_H__ */

View File

@ -1,72 +0,0 @@
/* libgnomecanvas/gnome-canvas-simplerect.h: GnomeCanvas item for simple rects
*
* Copyright (C) 2001 Paul Davis <pbd@op.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_SIMPLERECT_H__
#define __GNOME_CANVAS_SIMPLERECT_H__
#include <stdint.h>
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_TYPE_CANVAS_SIMPLERECT (gnome_canvas_simplerect_get_type ())
#define GNOME_CANVAS_SIMPLERECT(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_SIMPLERECT, GnomeCanvasSimpleRect))
#define GNOME_CANVAS_SIMPLERECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_SIMPLERECT, GnomeCanvasSimpleRectClass))
#define GNOME_IS_CANVAS_SIMPLERECT(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_SIMPLERECT))
#define GNOME_IS_CANVAS_SIMPLERECT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_SIMPLERECT))
#define GNOME_CANVAS_SIMPLERECT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_SIMPLERECT, GnomeCanvasSimpleRectClass))
typedef struct _GnomeCanvasSimpleRect GnomeCanvasSimpleRect;
typedef struct _GnomeCanvasSimpleRectClass GnomeCanvasSimpleRectClass;
struct _GnomeCanvasSimpleRect
{
GnomeCanvasItem item;
double x1, y1, x2, y2;
gboolean fill;
gboolean draw;
gboolean full_draw_on_update;
uint32_t fill_color;
uint32_t outline_color;
uint32_t outline_pixels;
/* cached values set during update/used during render */
unsigned char fill_r, fill_b, fill_g, fill_a;
unsigned char outline_r, outline_b, outline_g, outline_a;
unsigned char outline_what;
gint32 bbox_ulx, bbox_uly;
gint32 bbox_lrx, bbox_lry;
};
struct _GnomeCanvasSimpleRectClass {
GnomeCanvasItemClass parent_class;
};
GType gnome_canvas_simplerect_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GNOME_CANVAS_SIMPLERECT_H__ */

View File

@ -1,102 +0,0 @@
/*
Copyright (C) 2009 Paul Davis
Author: Hans Baier
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 <iostream>
#include "ardour_ui.h"
#include "midi_region_view.h"
#include "canvas-sysex.h"
using namespace Gnome::Canvas;
using namespace std;
CanvasSysEx::CanvasSysEx(
MidiRegionView& region,
Group& parent,
string& text,
double height,
double x,
double y,
const ARDOUR::MidiModel::SysExPtr sysex)
: CanvasFlag(
region,
parent,
height,
ARDOUR_UI::config()->canvasvar_MidiSysExOutline.get(),
ARDOUR_UI::config()->canvasvar_MidiSysExFill.get(),
x,
y),
_sysex(sysex)
{
_text = text;
set_text(text);
}
CanvasSysEx::~CanvasSysEx()
{
}
bool
CanvasSysEx::on_event(GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
if (ev->button.button == 3) {
return true;
}
break;
case GDK_SCROLL:
if (ev->scroll.direction == GDK_SCROLL_UP) {
return true;
} else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
return true;
}
break;
case GDK_KEY_PRESS:
switch (ev->key.keyval) {
case GDK_Delete:
case GDK_BackSpace:
_region.delete_sysex (this);
break;
default:
break;
}
break;
case GDK_ENTER_NOTIFY:
_region.sysex_entered (this);
return true;
break;
case GDK_LEAVE_NOTIFY:
_region.sysex_left (this);
return true;
break;
default:
break;
}
return false;
}

View File

@ -1,61 +0,0 @@
/*
Copyright (C) 2009 Paul Davis
Author: Hans Baier
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.
*/
#ifndef CANVAS_SYSEX_H_
#define CANVAS_SYSEX_H_
#include <string>
#include "canvas-flag.h"
#include "ardour/midi_model.h"
class MidiRegionView;
namespace Gnome {
namespace Canvas {
class CanvasSysEx : public CanvasFlag
{
public:
CanvasSysEx(
MidiRegionView& region,
Group& parent,
std::string& text,
double height,
double x,
double y,
ARDOUR::MidiModel::SysExPtr sysex);
virtual ~CanvasSysEx();
const ARDOUR::MidiModel::SysExPtr sysex() const { return _sysex; }
const string text() const { return _text; }
virtual bool on_event(GdkEvent* ev);
private:
const ARDOUR::MidiModel::SysExPtr _sysex;
string _text;
};
} // namespace Canvas
} // namespace Gnome
#endif /* CANVAS_SYSEX_H_ */

View File

@ -1,143 +0,0 @@
/* libgnomecanvas/gnome-canvas-waveview.h: GnomeCanvas item for displaying wave data
*
* Copyright (C) 2001 Paul Davis <pbd@op.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GNOME_CANVAS_WAVEVIEW_H__
#define __GNOME_CANVAS_WAVEVIEW_H__
#include <stdint.h>
#include <libgnomecanvas/libgnomecanvas.h>
G_BEGIN_DECLS
/* Wave viewer item for canvas.
*/
#define GNOME_TYPE_CANVAS_WAVEVIEW (gnome_canvas_waveview_get_type ())
#define GNOME_CANVAS_WAVEVIEW(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveView))
#define GNOME_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveViewClass))
#define GNOME_IS_CANVAS_WAVEVIEW(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_WAVEVIEW))
#define GNOME_IS_CANVAS_WAVEVIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_WAVEVIEW))
#define GNOME_CANVAS_WAVEVIEW_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNOME_TYPE_CANVAS_WAVEVIEW, GnomeCanvasWaveViewClass))
typedef struct _GnomeCanvasWaveView GnomeCanvasWaveView;
typedef struct _GnomeCanvasWaveViewClass GnomeCanvasWaveViewClass;
typedef struct _GnomeCanvasWaveViewChannelInfo GnomeCanvasWaveViewChannelInfo;
typedef struct _GnomeCanvasWaveViewCacheEntry GnomeCanvasWaveViewCacheEntry;
typedef struct _GnomeCanvasWaveViewCache GnomeCanvasWaveViewCache;
/* XXX this needs to be synced with ardour/source.h PeakData */
struct _GnomeCanvasWaveViewCacheEntry
{
float min;
float max;
};
struct _GnomeCanvasWaveViewCache
{
GnomeCanvasWaveViewCacheEntry* data;
guint32 allocated;
guint64 data_size;
gulong start;
gulong end;
};
GnomeCanvasWaveViewCache* gnome_canvas_waveview_cache_new ();
void gnome_canvas_waveview_cache_destroy (GnomeCanvasWaveViewCache*);
void gnome_canvas_waveview_set_gradient_waveforms (int);
typedef gulong (*waveview_length_function_t)(void*);
typedef gulong (*waveview_sourcefile_length_function_t)(void*, double);
typedef void (*waveview_gain_curve_function_t)(void *arg, double start, double end, float* vector, gint64 veclen);
typedef void (*waveview_peak_function_t)(void*,gulong,gulong,gulong,gpointer,guint32,double);
struct _GnomeCanvasWaveView
{
GnomeCanvasItem item;
GnomeCanvasWaveViewCache *cache;
gboolean cache_updater;
gint screen_width;
void *data_src;
guint32 channel;
waveview_peak_function_t peak_function;
waveview_length_function_t length_function;
waveview_sourcefile_length_function_t sourcefile_length_function;
waveview_gain_curve_function_t gain_curve_function;
void *gain_src;
/** x-axis: samples per canvas unit. */
double samples_per_unit;
/** y-axis: amplitude_above_axis.
*
* the default is that an (scaled, normalized -1.0 ... +1.0) amplitude of 1.0
* corresponds to the top of the area assigned to the waveview.
*
* larger values will expand the vertical scale, cutting off the peaks/troughs.
* smaller values will decrease the vertical scale, moving peaks/troughs toward
* the middle of the area assigned to the waveview.
*/
double amplitude_above_axis;
double x;
double y;
double height;
double half_height;
uint32_t wave_color;
uint32_t clip_color;
uint32_t zero_color;
uint32_t fill_color;
char filled;
char rectified;
char zero_line;
char logscaled;
/* These are updated by the update() routine
to optimize the render() routine, which may
be called several times after a single update().
*/
int32_t bbox_ulx;
int32_t bbox_uly;
int32_t bbox_lrx;
int32_t bbox_lry;
unsigned char wave_r, wave_g, wave_b, wave_a;
unsigned char clip_r, clip_g, clip_b, clip_a;
unsigned char fill_r, fill_g, fill_b, fill_a;
uint32_t samples;
uint32_t region_start;
int32_t reload_cache_in_render;
};
struct _GnomeCanvasWaveViewClass {
GnomeCanvasItemClass parent_class;
};
GType gnome_canvas_waveview_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GNOME_CANVAS_WAVEVIEW_H__ */

View File

@ -1,44 +0,0 @@
/*
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.
*/
#ifndef __ardour_gtk_canvas_h__
#define __ardour_gtk_canvas_h__
namespace Gnome {
namespace Canvas {
class Item;
class Group;
class Canvas;
class Rect;
class SimpleRect;
class SimpleLine;
class Polygon;
class WaveView;
class Text;
class Line;
class Points;
class Pixbuf;
class ImageFrame;
class LineSet;
}
}
namespace ArdourCanvas = Gnome::Canvas;
#endif /* __ardour_gtk_canvas_h__ */

View File

@ -1,34 +0,0 @@
/*
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.
*/
#ifndef __ardour_gtk_canvas_impl_h__
#define __ardour_gtk_canvas_impl_h__
#include "canvas.h"
#include <libgnomecanvasmm/canvas.h>
#include <libgnomecanvasmm/polygon.h>
#include <libgnomecanvasmm/text.h>
#include <libgnomecanvasmm/rect.h>
#include <libgnomecanvasmm/line.h>
#include <libgnomecanvasmm/item.h>
using namespace ArdourCanvas;
#endif /* __ardour_gtk_canvas_impl_h__ */

View File

@ -18,17 +18,17 @@
*/
#include "control_point.h"
#include "diamond.h"
#include "automation_line.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "canvas/rectangle.h"
#include "i18n.h"
using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace Gnome; // for Canvas
PBD::Signal1<void, ControlPoint *> ControlPoint::CatchDeletion;
@ -43,14 +43,14 @@ ControlPoint::ControlPoint (AutomationLine& al)
_shape = Full;
_size = 4.0;
_item = new Canvas::SimpleRect (_line.canvas_group());
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
_item->property_draw() = true;
_item->property_fill() = false;
_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get();
_item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
_item->property_outline_pixels() = 1;
_item->set_fill (false);
_item->set_fill_color (ARDOUR_UI::config()->canvasvar_ControlPointFill.get());
_item->set_outline_color (ARDOUR_UI::config()->canvasvar_ControlPointOutline.get());
_item->set_outline_width (1);
_item->set_data ("control_point", this);
_item->signal_event().connect (sigc::mem_fun (this, &ControlPoint::event_handler));
_item->Event.connect (sigc::mem_fun (this, &ControlPoint::event_handler));
hide ();
set_visible (false);
@ -71,10 +71,10 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool /*dummy_arg_to_force
_shape = other._shape;
_size = other._size;
_item = new Canvas::SimpleRect (_line.canvas_group());
_item->property_fill() = false;
_item->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
_item->property_outline_pixels() = 1;
_item = new ArdourCanvas::Rectangle (&_line.canvas_group());
_item->set_fill (false);
_item->set_outline_color (ARDOUR_UI::config()->canvasvar_ControlPointOutline.get());
_item->set_outline_width (1);
/* NOTE: no event handling in copied ControlPoints */
@ -146,8 +146,8 @@ ControlPoint::set_color ()
color = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
}
_item->property_outline_color_rgba() = color;
_item->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ControlPointFill.get();
_item->set_outline_color (color);
_item->set_fill_color (ARDOUR_UI::config()->canvasvar_ControlPointFill.get());
}
void
@ -179,10 +179,7 @@ ControlPoint::move_to (double x, double y, ShapeType shape)
break;
}
_item->property_x1() = x1;
_item->property_x2() = x2;
_item->property_y1() = y - half_size;
_item->property_y2() = y + half_size;
_item->set (ArdourCanvas::Rect (x1, y - half_size, x2, y + half_size));
_x = x;
_y = y;
@ -192,5 +189,5 @@ ControlPoint::move_to (double x, double y, ShapeType shape)
void
ControlPoint::i2w (double& x, double& y) const
{
_item->i2w (x, y);
_item->item_to_canvas (x, y);
}

View File

@ -21,11 +21,10 @@
#define __ardour_control_point_h__
#include <sys/types.h>
#include <gdk/gdkevents.h>
#include "ardour/automation_list.h"
#include "canvas.h"
#include "simplerect.h"
#include "selectable.h"
class AutomationLine;
@ -36,11 +35,9 @@ class AutomationTimeAxisView;
class Selectable;
class Selection;
namespace Gnome {
namespace Canvas {
class SimpleRect;
class Diamond;
}
namespace ArdourCanvas {
class Rectangle;
class Diamond;
}
class ControlPoint : public Selectable
@ -86,7 +83,7 @@ class ControlPoint : public Selectable
static PBD::Signal1<void, ControlPoint *> CatchDeletion;
private:
ArdourCanvas::SimpleRect* _item;
ArdourCanvas::Rectangle* _item;
AutomationLine& _line;
ARDOUR::AutomationList::iterator _model;
uint32_t _view_index;

View File

@ -25,7 +25,6 @@
#include <gtkmm/image.h>
#include <gtkmm/scrolledwindow.h>
#include <libgnomecanvasmm/line.h>
#include "pbd/memento_command.h"
#include "ardour/automation_list.h"
@ -41,15 +40,17 @@
#include <gtkmm2ext/gtk_ui.h>
#include "canvas/rectangle.h"
#include "canvas/wave_view.h"
#include "canvas/line.h"
#include "canvas/polygon.h"
#include "ardour_ui.h"
#include "crossfade_edit.h"
#include "rgb_macros.h"
#include "keyboard.h"
#include "utils.h"
#include "gui_thread.h"
#include "canvas_impl.h"
#include "simplerect.h"
#include "waveview.h"
#include "actions.h"
using namespace std;
@ -128,38 +129,35 @@ CrossfadeEditor::CrossfadeEditor (Session* s, boost::shared_ptr<Crossfade> xf, d
point_grabbed = false;
toplevel = 0;
canvas = new ArdourCanvas::CanvasAA ();
canvas = new ArdourCanvas::GtkCanvas ();
canvas->signal_size_allocate().connect (sigc::mem_fun(*this, &CrossfadeEditor::canvas_allocation));
canvas->set_size_request (425, 200);
toplevel = new ArdourCanvas::SimpleRect (*(canvas->root()));
toplevel->property_x1() = 0.0;
toplevel->property_y1() = 0.0;
toplevel->property_x2() = 10.0;
toplevel->property_y2() = 10.0;
toplevel->property_fill() = true;
toplevel->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorBase.get();
toplevel->property_outline_pixels() = 0;
toplevel->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
toplevel = new ArdourCanvas::Rectangle (canvas->root());
toplevel->set (ArdourCanvas::Rect (0, 0, 10, 10));
toplevel->set_fill (true);
toplevel->set_fill_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorBase.get());
toplevel->set_outline (false);
toplevel->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line = new ArdourCanvas::Line (*(canvas->root()));
fade[Out].line->property_width_pixels() = 1;
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[Out].line = new ArdourCanvas::PolyLine (canvas->root());
fade[Out].line->set_outline_width (1);
fade[Out].line->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get());
fade[Out].shading = new ArdourCanvas::Polygon (*(canvas->root()));
fade[Out].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get();
fade[Out].shading = new ArdourCanvas::Polygon (canvas->root());
fade[Out].shading->set_fill_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get());
fade[In].line = new ArdourCanvas::Line (*(canvas->root()));
fade[In].line->property_width_pixels() = 1;
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[In].line = new ArdourCanvas::PolyLine (canvas->root());
fade[In].line->set_outline_width (1);
fade[In].line->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get());
fade[In].shading = new ArdourCanvas::Polygon (*(canvas->root()));
fade[In].shading->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get();
fade[In].shading = new ArdourCanvas::Polygon (canvas->root());
fade[In].shading->set_fill_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorLineShading.get());
fade[In].shading->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[In].line->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
fade[Out].shading->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line->signal_event().connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
fade[In].shading->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[In].line->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
fade[Out].shading->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::canvas_event));
fade[Out].line->Event.connect (sigc::mem_fun (*this, &CrossfadeEditor::curve_event));
select_in_button.set_name (X_("CrossfadeEditCurveButton"));
select_out_button.set_name (X_("CrossfadeEditCurveButton"));
@ -466,15 +464,15 @@ CrossfadeEditor::make_point ()
{
Point* p = new Point;
p->box = new ArdourCanvas::SimpleRect (*(canvas->root()));
p->box->property_fill() = true;
p->box->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointFill.get();
p->box->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointOutline.get();
p->box->property_outline_pixels() = 1;
p->box = new ArdourCanvas::Rectangle (canvas->root());
p->box->set_fill (true);
p->box->set_fill_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointFill.get());
p->box->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorPointOutline.get());
p->box->set_outline_width (1);
p->curve = fade[current].line;
p->box->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &CrossfadeEditor::point_event), p));
p->box->Event.connect (sigc::bind (sigc::mem_fun (*this, &CrossfadeEditor::point_event), p));
return p;
}
@ -521,11 +519,7 @@ CrossfadeEditor::Point::move_to (double nx, double ny, double xfract, double yfr
double x1 = nx - half_size;
double x2 = nx + half_size;
box->property_x1() = x1;
box->property_x2() = x2;
box->property_y1() = ny - half_size;
box->property_y2() = ny + half_size;
box->set (ArdourCanvas::Rect (x1, ny - half_size, x2, ny + half_size));
x = xfract;
y = yfract;
@ -535,15 +529,20 @@ void
CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
{
if (toplevel) {
toplevel->property_x1() = 0.0;
toplevel->property_y1() = 0.0;
toplevel->property_x2() = (double) canvas->get_allocation().get_width() + canvas_border;
toplevel->property_y2() = (double) canvas->get_allocation().get_height() + canvas_border;
toplevel->set (
ArdourCanvas::Rect (
0,
0,
canvas->get_allocation().get_width() + canvas_border,
canvas->get_allocation().get_height() + canvas_border
)
);
}
canvas->set_scroll_region (0.0, 0.0,
canvas->get_allocation().get_width(),
canvas->get_allocation().get_height());
/* XXX: CANVAS */
// canvas->set_scroll_region (0.0, 0.0,
// canvas->get_allocation().get_width(),
// canvas->get_allocation().get_height());
Point* end = make_point ();
PointSorter cmp;
@ -623,9 +622,9 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
yoff = n * ht;
(*i)->property_y() = yoff;
(*i)->property_height() = ht;
(*i)->property_samples_per_unit() = spu;
(*i)->set_y_position (yoff);
(*i)->set_height (ht);
(*i)->set_frames_per_pixel (spu);
}
ht = canvas->get_allocation().get_height() / xfade->out()->n_channels();
@ -635,9 +634,9 @@ CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
yoff = n * ht;
(*i)->property_y() = yoff;
(*i)->property_height() = ht;
(*i)->property_samples_per_unit() = spu;
(*i)->set_y_position (yoff);
(*i)->set_height (ht);
(*i)->set_frames_per_pixel (spu);
}
}
@ -682,11 +681,11 @@ CrossfadeEditor::redraw ()
ArdourCanvas::Points spts;
while (pts.size() < npoints) {
pts.push_back (Gnome::Art::Point (0,0));
pts.push_back (ArdourCanvas::Duple (0,0));
}
while (spts.size() < npoints + 3) {
spts.push_back (Gnome::Art::Point (0,0));
spts.push_back (ArdourCanvas::Duple (0,0));
}
/* the shade coordinates *MUST* be in anti-clockwise order.
@ -696,36 +695,36 @@ CrossfadeEditor::redraw ()
/* lower left */
spts[0].set_x (canvas_border);
spts[0].set_y (effective_height() + canvas_border);
spts[0].x = canvas_border;
spts[0].y = effective_height() + canvas_border;
/* lower right */
spts[1].set_x (effective_width() + canvas_border);
spts[1].set_y (effective_height() + canvas_border);
spts[1].x = effective_width() + canvas_border;
spts[1].y = effective_height() + canvas_border;
/* upper right */
spts[2].set_x (effective_width() + canvas_border);
spts[2].set_y (canvas_border);
spts[2].x = effective_width() + canvas_border;
spts[2].y = canvas_border;
} else {
/* upper left */
spts[0].set_x (canvas_border);
spts[0].set_y (canvas_border);
spts[0].x = canvas_border;
spts[0].y = canvas_border;
/* lower left */
spts[1].set_x (canvas_border);
spts[1].set_y (effective_height() + canvas_border);
spts[1].x = canvas_border;
spts[1].y = effective_height() + canvas_border;
/* lower right */
spts[2].set_x (effective_width() + canvas_border);
spts[2].set_y (effective_height() + canvas_border);
spts[2].x = effective_width() + canvas_border;
spts[2].y = effective_height() + canvas_border;
}
@ -735,15 +734,15 @@ CrossfadeEditor::redraw ()
double y = vec[i];
pts[i].set_x (canvas_border + i);
pts[i].set_y (y_coordinate (y));
pts[i].x = canvas_border + i;
pts[i].y = y_coordinate (y);
spts[last_spt - i].set_x (canvas_border + i);
spts[last_spt - i].set_y (pts[i].get_y());
spts[last_spt - i].x = canvas_border + i;
spts[last_spt - i].y = pts[i].y;
}
fade[current].line->property_points() = pts;
fade[current].shading->property_points() = spts;
fade[current].line->set (pts);
fade[current].shading->set (pts);
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[current].waves.begin(); i != fade[current].waves.end(); ++i) {
(*i)->property_gain_src() = static_cast<Evoral::Curve*>(&fade[current].gain_curve.curve());
@ -1070,17 +1069,17 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
if (wf == In) {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get());
(*i)->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get());
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get());
(*i)->set_fill_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get());
}
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[In].line->set_outline_color (ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get());
fade[Out].line->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get());
fade[Out].shading->hide();
fade[In].shading->show();
@ -1095,17 +1094,17 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
} else {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get());
(*i)->set_fill_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get());
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
(*i)->set_outline_color (ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get());
(*i)->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get());
}
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get();
fade[Out].line->set_outline_color (ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get());
fade[In].line->set_outline_color (ARDOUR_UI::config()->canvasvar_CrossfadeEditorLine.get());
fade[In].shading->hide();
fade[Out].shading->show();
@ -1163,29 +1162,24 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
gdouble yoff = n * ht;
if (region->audio_source(n)->peaks_ready (boost::bind (&CrossfadeEditor::peaks_ready, this, boost::weak_ptr<AudioRegion>(region), which), &_peaks_ready_connection, gui_context())) {
WaveView* waveview = new WaveView (*(canvas->root()));
ArdourCanvas::WaveView* waveview = new ArdourCanvas::WaveView (canvas->root(), region);
waveview->property_data_src() = region.get();
waveview->property_cache_updater() = true;
waveview->property_cache() = WaveView::create_cache();
waveview->property_channel() = n;
waveview->property_length_function() = (void*) region_length_from_c;
waveview->property_sourcefile_length_function() = (void*) sourcefile_length_from_c;
waveview->property_peak_function() = (void*) region_read_peaks_from_c;
waveview->set_channel (n);
waveview->property_gain_function() = (void*) curve_get_vector_from_c;
waveview->property_gain_src() = static_cast<Evoral::Curve*>(&fade[which].gain_curve.curve());
waveview->property_x() = canvas_border;
waveview->property_y() = yoff;
waveview->property_height() = ht;
waveview->property_samples_per_unit() = spu;
waveview->set_x_position (canvas_border);
waveview->set_y_position (yoff);
waveview->set_height (ht);
waveview->set_frames_per_pixel (spu);
waveview->property_amplitude_above_axis() = 2.0;
waveview->property_wave_color() = color;
waveview->property_fill_color() = color;
waveview->set_outline_color (color);
waveview->set_fill_color (color);
if (which==In)
waveview->property_region_start() = region->start();
else
waveview->property_region_start() = region->start()+region->length()-xfade->length();
if (which == In) {
waveview->set_region_start (region->start());
} else {
waveview->set_region_start (region->start() + region->length() - xfade->length());
}
waveview->lower_to_bottom();
fade[which].waves.push_back (waveview);

View File

@ -26,11 +26,12 @@
#include <gtkmm/button.h>
#include <gtkmm/radiobutton.h>
#include "canvas/canvas.h"
#include "evoral/Curve.hpp"
#include "ardour/session_handle.h"
#include "ardour_dialog.h"
#include "canvas.h"
namespace ARDOUR
{
@ -39,6 +40,13 @@ namespace ARDOUR
class Crossfade;
}
namespace ArdourCanvas {
class Rectangle;
class Line;
class Polygon;
class WaveView;
}
class CrossfadeEditor : public ArdourDialog
{
public:
@ -87,8 +95,8 @@ class CrossfadeEditor : public ArdourDialog
struct Point {
~Point();
ArdourCanvas::SimpleRect* box;
ArdourCanvas::Line* curve;
ArdourCanvas::Rectangle* box;
ArdourCanvas::PolyLine* curve;
double x;
double y;
@ -103,11 +111,11 @@ class CrossfadeEditor : public ArdourDialog
}
};
ArdourCanvas::SimpleRect* toplevel;
ArdourCanvas::Canvas* canvas;
ArdourCanvas::Rectangle* toplevel;
ArdourCanvas::GtkCanvas* canvas;
struct Half {
ArdourCanvas::Line* line;
ArdourCanvas::PolyLine* line;
ArdourCanvas::Polygon* shading;
std::list<Point*> points;
ARDOUR::AutomationList normative_curve; /* 0 - 1.0, linear */

View File

@ -21,7 +21,6 @@
#define __gtk_ardour_crossfade_view_h__
#include <vector>
#include <libgnomecanvasmm.h>
#include "pbd/signals.h"
#include "ardour/crossfade.h"
@ -30,13 +29,17 @@
class RouteTimeAxisView;
class AudioRegionView;
namespace ArdourCanvas {
class PolyLine;
}
class CrossfadeView : public TimeAxisViewItem
{
public:
CrossfadeView (ArdourCanvas::Group*,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::Crossfade>,
double initial_samples_per_unit,
double initial_frames_per_pixel,
Gdk::Color& basic_color,
AudioRegionView& leftview,
AudioRegionView& rightview);
@ -70,8 +73,8 @@ private:
bool _all_in_view;
double _child_height;
ArdourCanvas::Line *fade_in;
ArdourCanvas::Line *fade_out;
ArdourCanvas::PolyLine *fade_in;
ArdourCanvas::PolyLine *fade_out;
void crossfade_changed (const PBD::PropertyChange&);
void crossfade_fades_changed ();

View File

@ -1,84 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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 "diamond.h"
using namespace Gnome::Canvas;
using namespace Gnome::Art;
Diamond::Diamond(Group& group, double height)
: Polygon(group)
, _x (0)
, _y (0)
, _h (height)
{
points = gnome_canvas_points_new (4);
move_to (0, 0);
}
Diamond::~Diamond ()
{
gnome_canvas_points_free (points);
}
void
Diamond::set_height (double height)
{
_h = height;
move_to (_x, _y);
}
void
Diamond::move_to (double x, double y)
{
_x = x;
_y = y;
points->coords[0] = _x;
points->coords[1] = _y + (_h * 2.0);
points->coords[2] = _x + _h;
points->coords[3] = _y + _h;
points->coords[4] = _x;
points->coords[5] = _y;
points->coords[6] = _x - _h;
points->coords[7] = _y + _h;
g_object_set (gobj(), "points", points, NULL);
}
void
Diamond::move_by (double dx, double dy)
{
points->coords[0] += dx;
points->coords[1] += dy;
points->coords[2] += dx;
points->coords[3] += dy;
points->coords[4] += dx;
points->coords[5] += dy;
points->coords[6] += dx;
points->coords[7] += dy;
g_object_set (gobj(), "points", points, NULL);
}

View File

@ -1,52 +0,0 @@
/*
Copyright (C) 2007 Paul Davis
Author: David Robillard
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.
*/
#ifndef __ardour_diamond_h__
#define __ardour_diamond_h__
#include <libgnomecanvasmm/polygon.h>
#include "canvas-note-event.h"
#include "canvas.h"
namespace Gnome {
namespace Canvas {
class Diamond : public Polygon
{
public:
Diamond(Group& group, double height);
~Diamond ();
void move_to (double x, double y);
void move_by (double dx, double dy);
void set_height(double height);
protected:
double _x;
double _y;
double _h;
GnomeCanvasPoints* points;
};
} // namespace Canvas
} // namespace Gnome
#endif /* __ardour_diamond_h__ */

View File

@ -22,9 +22,9 @@
#include "gtkmm2ext/utils.h"
#include "canvas-note-event.h"
#include "edit_note_dialog.h"
#include "midi_region_view.h"
#include "note_base.h"
#include "i18n.h"
@ -38,7 +38,7 @@ using namespace Gtkmm2ext;
* @param n Notes to edit.
*/
EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<ArdourCanvas::CanvasNoteEvent*> n)
EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
: ArdourDialog (_("Note"))
, _region_view (rv)
, _events (n)

View File

@ -23,23 +23,18 @@
#include "audio_clock.h"
class MidiRegionView;
namespace Gnome {
namespace Canvas {
class CanvasNoteEvent;
}
}
class NoteBase;
class EditNoteDialog : public ArdourDialog
{
public:
EditNoteDialog (MidiRegionView *, std::set<Gnome::Canvas::CanvasNoteEvent*>);
EditNoteDialog (MidiRegionView *, std::set<NoteBase*>);
int run ();
private:
MidiRegionView* _region_view;
std::set<Gnome::Canvas::CanvasNoteEvent*> _events;
std::set<NoteBase*> _events;
Gtk::SpinButton _channel;
Gtk::CheckButton _channel_all;
Gtk::SpinButton _pitch;

View File

@ -70,6 +70,9 @@
#include "ardour/tempo.h"
#include "ardour/utils.h"
#include "canvas/debug.h"
#include "canvas/text.h"
#include "control_protocol/control_protocol.h"
#include "actions.h"
@ -81,8 +84,6 @@
#include "audio_time_axis.h"
#include "automation_time_axis.h"
#include "bundle_manager.h"
#include "canvas-noevent-text.h"
#include "canvas_impl.h"
#include "crossfade_edit.h"
#include "debug.h"
#include "editing.h"
@ -112,7 +113,6 @@
#include "rhythm_ferret.h"
#include "selection.h"
#include "sfdb_ui.h"
#include "simpleline.h"
#include "tempo_lines.h"
#include "time_axis_view.h"
#include "utils.h"
@ -316,8 +316,8 @@ Editor::Editor ()
snap_threshold = 5.0;
bbt_beat_subdivision = 4;
_canvas_width = 0;
_canvas_height = 0;
_visible_canvas_width = 0;
_visible_canvas_height = 0;
last_autoscroll_x = 0;
last_autoscroll_y = 0;
autoscroll_active = false;
@ -379,7 +379,7 @@ Editor::Editor ()
_internal_editing = false;
current_canvas_cursor = 0;
frames_per_unit = 2048; /* too early to use reset_zoom () */
frames_per_pixel = 2048; /* too early to use reset_zoom () */
_scroll_callbacks = 0;
@ -479,7 +479,7 @@ Editor::Editor ()
edit_controls_vbox.set_spacing (0);
vertical_adjustment.signal_value_changed().connect (sigc::mem_fun(*this, &Editor::tie_vertical_scrolling), true);
track_canvas->signal_map_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_map_handler));
_track_canvas->signal_map_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_map_handler));
HBox* h = manage (new HBox);
_group_tabs = new EditorGroupTabs (this);
@ -496,11 +496,11 @@ Editor::Editor ()
_cursors = new MouseCursors;
ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(),
0.0, 1.0, 100.0, 1.0));
ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::GtkCanvas());
ArdourCanvas::Line* pad_line_1 = manage(new ArdourCanvas::Line(time_pad->root()));
pad_line_1->set (ArdourCanvas::Duple (0.0, 1.0), ArdourCanvas::Duple (100.0, 1.0));
pad_line_1->property_color_rgba() = 0xFF0000FF;
pad_line_1->set_outline_color (0xFF0000FF);
pad_line_1->show();
time_pad->show();
@ -512,15 +512,15 @@ Editor::Editor ()
ruler_label_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
ruler_label_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
time_button_event_box.add (time_button_vbox);
time_button_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
time_button_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
time_bars_event_box.add (time_bars_vbox);
time_bars_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
time_bars_event_box.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::ruler_label_button_release));
/* these enable us to have a dedicated window (for cursor setting, etc.)
for the canvas areas.
*/
track_canvas_event_box.add (*track_canvas);
track_canvas_event_box.add (*_track_canvas_viewport);
time_canvas_event_box.add (time_canvas_vbox);
time_canvas_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
@ -533,14 +533,16 @@ Editor::Editor ()
/* labels for the rulers */
edit_packer.attach (ruler_label_event_box, 1, 2, 0, 1, FILL, SHRINK, 0, 0);
/* labels for the marker "tracks" */
edit_packer.attach (time_button_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
/* labels for the marker "tracks" (time bars) */
edit_packer.attach (time_bars_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
/* the rulers */
edit_packer.attach (time_canvas_event_box, 2, 3, 0, 1, FILL|EXPAND, FILL, 0, 0);
/* track controls */
edit_packer.attach (controls_layout, 0, 2, 2, 3, FILL, FILL|EXPAND, 0, 0);
/* main canvas */
edit_packer.attach (track_canvas_event_box, 2, 3, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
/* time bars canvas */
edit_packer.attach (*_time_bars_canvas_viewport, 2, 3, 1, 2, FILL, FILL, 0, 0);
/* track canvas */
edit_packer.attach (track_canvas_event_box, 2, 3, 2, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
bottom_hbox.set_border_width (2);
bottom_hbox.set_spacing (3);
@ -785,7 +787,7 @@ Editor::~Editor()
delete button_bindings;
delete _routes;
delete _route_groups;
delete track_canvas;
delete _track_canvas_viewport;
delete _drags;
}
@ -934,11 +936,11 @@ Editor::zoom_adjustment_changed ()
return;
}
double fpu = zoom_range_clock->current_duration() / _canvas_width;
bool clamped = clamp_frames_per_unit (fpu);
double fpu = zoom_range_clock->current_duration() / _visible_canvas_width;
bool clamped = clamp_frames_per_pixel (fpu);
if (clamped) {
zoom_range_clock->set ((framepos_t) floor (fpu * _canvas_width));
zoom_range_clock->set ((framepos_t) floor (fpu * _visible_canvas_width));
}
temporal_zoom (fpu);
@ -1145,7 +1147,7 @@ Editor::map_position_change (framepos_t frame)
void
Editor::center_screen (framepos_t frame)
{
double page = _canvas_width * frames_per_unit;
double const page = _visible_canvas_width * frames_per_pixel;
/* if we're off the page, then scroll.
*/
@ -1275,7 +1277,7 @@ Editor::set_session (Session *t)
/* catch up with the playhead */
_session->request_locate (playhead_cursor->current_frame);
_session->request_locate (playhead_cursor->current_frame ());
_pending_initial_locate = true;
update_title ();
@ -1300,7 +1302,7 @@ Editor::set_session (Session *t)
_session->locations()->StateChanged.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context());
_session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
playhead_cursor->canvas_item.show ();
playhead_cursor->show ();
boost::function<void (string)> pc (boost::bind (&Editor::parameter_changed, this, _1));
Config->map_parameters (pc);
@ -1311,7 +1313,7 @@ Editor::set_session (Session *t)
_session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
(static_cast<TimeAxisView*>(*i))->set_frames_per_pixel (frames_per_pixel);
}
super_rapid_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
@ -2287,7 +2289,7 @@ Editor::set_state (const XMLNode& node, int /*version*/)
if ((prop = node.property ("zoom"))) {
reset_zoom (PBD::atof (prop->value()));
} else {
reset_zoom (frames_per_unit);
reset_zoom (frames_per_pixel);
}
if ((prop = node.property ("snap-to"))) {
@ -2507,7 +2509,7 @@ Editor::get_state ()
maybe_add_mixer_strip_width (*node);
node->add_property ("zoom-focus", enum_2_string (zoom_focus));
snprintf (buf, sizeof(buf), "%f", frames_per_unit);
snprintf (buf, sizeof(buf), "%f", frames_per_pixel);
node->add_property ("zoom", buf);
node->add_property ("snap-to", enum_2_string (_snap_type));
node->add_property ("snap-mode", enum_2_string (_snap_mode));
@ -2517,7 +2519,7 @@ Editor::get_state ()
node->add_property ("pre-internal-snap-mode", enum_2_string (pre_internal_snap_mode));
node->add_property ("edit-point", enum_2_string (_edit_point));
snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame);
snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame ());
node->add_property ("playhead", buf);
snprintf (buf, sizeof (buf), "%" PRIi64, leftmost_frame);
node->add_property ("left-frame", buf);
@ -4133,16 +4135,16 @@ Editor::reset_y_origin (double y)
}
void
Editor::reset_zoom (double fpu)
Editor::reset_zoom (double fpp)
{
clamp_frames_per_unit (fpu);
clamp_frames_per_pixel (fpp);
if (fpu == frames_per_unit) {
if (fpp == frames_per_pixel) {
return;
}
pending_visual_change.add (VisualChange::ZoomLevel);
pending_visual_change.frames_per_unit = fpu;
pending_visual_change.frames_per_pixel = fpp;
ensure_visual_change_idle_handler ();
}
@ -4172,7 +4174,7 @@ Editor::current_visual_state (bool with_tracks)
{
VisualState* vs = new VisualState (with_tracks);
vs->y_position = vertical_adjustment.get_value();
vs->frames_per_unit = frames_per_unit;
vs->frames_per_pixel = frames_per_pixel;
vs->leftmost_frame = leftmost_frame;
vs->zoom_focus = zoom_focus;
@ -4234,7 +4236,7 @@ Editor::use_visual_state (VisualState& vs)
vertical_adjustment.set_value (vs.y_position);
set_zoom_focus (vs.zoom_focus);
reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit);
reposition_and_zoom (vs.leftmost_frame, vs.frames_per_pixel);
if (vs.gui_state) {
*ARDOUR_UI::instance()->gui_object_state = *vs.gui_state;
@ -4253,19 +4255,19 @@ Editor::use_visual_state (VisualState& vs)
* @param fpu New frames per unit; should already have been clamped so that it is sensible.
*/
void
Editor::set_frames_per_unit (double fpu)
Editor::set_frames_per_pixel (double fpp)
{
if (tempo_lines) {
tempo_lines->tempo_map_changed();
}
frames_per_unit = fpu;
frames_per_pixel = fpp;
/* convert fpu to frame count */
framepos_t frames = (framepos_t) floor (frames_per_unit * _canvas_width);
framepos_t frames = (framepos_t) floor (frames_per_pixel * _visible_canvas_width);
if (frames_per_unit != zoom_range_clock->current_duration()) {
if (frames_per_pixel != zoom_range_clock->current_duration()) {
zoom_range_clock->set (frames);
}
@ -4282,7 +4284,7 @@ Editor::set_frames_per_unit (double fpu)
//reset_scrolling_region ();
if (playhead_cursor) {
playhead_cursor->set_position (playhead_cursor->current_frame);
playhead_cursor->set_position (playhead_cursor->current_frame ());
}
refresh_location_display();
@ -4313,6 +4315,7 @@ Editor::ensure_visual_change_idle_handler ()
{
if (pending_visual_change.idle_handler_id < 0) {
pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
pending_visual_change.executing = false;
}
}
@ -4344,7 +4347,7 @@ Editor::idle_visual_changer ()
double const last_time_origin = horizontal_position ();
if (p & VisualChange::ZoomLevel) {
set_frames_per_unit (pending_visual_change.frames_per_unit);
set_frames_per_pixel (pending_visual_change.frames_per_pixel);
compute_fixed_ruler_scale ();
@ -4365,7 +4368,7 @@ Editor::idle_visual_changer ()
#endif
if (p & VisualChange::TimeOrigin) {
set_horizontal_position (pending_visual_change.time_origin / frames_per_unit);
set_horizontal_position (pending_visual_change.time_origin / frames_per_pixel);
}
if (p & VisualChange::YOrigin) {
@ -4913,10 +4916,10 @@ Editor::add_routes (RouteList& routes)
DataType dt = route->input()->default_type();
if (dt == ARDOUR::DataType::AUDIO) {
rtv = new AudioTimeAxisView (*this, _session, *track_canvas);
rtv = new AudioTimeAxisView (*this, _session, *_track_canvas);
rtv->set_route (route);
} else if (dt == ARDOUR::DataType::MIDI) {
rtv = new MidiTimeAxisView (*this, _session, *track_canvas);
rtv = new MidiTimeAxisView (*this, _session, *_track_canvas);
rtv->set_route (route);
} else {
throw unknown_type();
@ -5219,7 +5222,7 @@ Editor::scroll_release ()
void
Editor::reset_x_origin_to_follow_playhead ()
{
framepos_t const frame = playhead_cursor->current_frame;
framepos_t const frame = playhead_cursor->current_frame ();
if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
@ -5330,11 +5333,11 @@ Editor::super_rapid_screen_update ()
*/
#if 0
// FIXME DO SOMETHING THAT WORKS HERE - this is 2.X code
double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_unit;
double target = ((double)frame - (double)current_page_frames()/2.0) / frames_per_pixel;
if (target <= 0.0) {
target = 0.0;
}
if (fabs(target - current) < current_page_frames() / frames_per_unit) {
if (fabs(target - current) < current_page_frames() / frames_per_pixel) {
target = (target * 0.15) + (current * 0.85);
} else {
/* relax */
@ -5369,7 +5372,7 @@ Editor::session_going_away ()
last_update_frame = 0;
_drags->abort ();
playhead_cursor->canvas_item.hide ();
playhead_cursor->hide ();
/* rip everything out of the list displays */
@ -5574,3 +5577,12 @@ Editor::shift_key_released ()
{
_stepping_axis_view = 0;
}
void
Editor::save_canvas_state ()
{
XMLTree* tree = static_cast<ArdourCanvas::Canvas*>(_track_canvas)->get_state ();
string path = string_compose ("%1/canvas-state.xml", _session->path());
tree->write (path);
}

View File

@ -28,10 +28,6 @@
#include <boost/optional.hpp>
#include <libgnomecanvasmm/canvas.h>
#include <libgnomecanvasmm/group.h>
#include <libgnomecanvasmm/line.h>
#include <libgnomecanvasmm/pixbuf.h>
#include <cmath>
@ -60,15 +56,9 @@
#include "enums.h"
#include "editor_items.h"
#include "region_selection.h"
#include "canvas.h"
#include "window_proxy.h"
namespace Gnome {
namespace Canvas {
class NoEventText;
class CanvasNoteEvent;
}
}
#include "canvas/fwd.h"
namespace Gtkmm2ext {
class TearOff;
@ -161,11 +151,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
framepos_t leftmost_position() const { return leftmost_frame; }
framecnt_t current_page_frames() const {
return (framecnt_t) floor (_canvas_width * frames_per_unit);
return (framecnt_t) floor (_visible_canvas_width * frames_per_pixel);
}
double canvas_height () const {
return _canvas_height;
double visible_canvas_height () const {
return _visible_canvas_height;
}
void cycle_snap_mode ();
@ -234,19 +224,19 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* undo related */
framepos_t unit_to_frame (double unit) const {
return (framepos_t) rint (unit * frames_per_unit);
return (framepos_t) rint (unit * frames_per_pixel);
}
double frame_to_unit (framepos_t frame) const {
return rint ((double) frame / (double) frames_per_unit);
return rint ((double) frame / (double) frames_per_pixel);
}
double frame_to_unit_unrounded (framepos_t frame) const {
return frame / frames_per_unit;
return frame / frames_per_pixel;
}
double frame_to_unit (double frame) const {
return rint (frame / frames_per_unit);
return rint (frame / frames_per_pixel);
}
/* NOTE: these functions assume that the "pixel" coordinate is
@ -265,14 +255,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
*/
if (pixel >= 0) {
return (framepos_t) rint (pixel * frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit);
return (framepos_t) rint (pixel * frames_per_pixel);
} else {
return 0;
}
}
gulong frame_to_pixel (framepos_t frame) const {
return (gulong) rint ((frame / (frames_per_unit * GNOME_CANVAS(track_canvas->gobj())->pixels_per_unit)));
return (gulong) rint (frame / frames_per_pixel);
}
void flush_canvas ();
@ -321,7 +311,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_zoom_focus (Editing::ZoomFocus);
Editing::ZoomFocus get_zoom_focus () const { return zoom_focus; }
double get_current_zoom () const { return frames_per_unit; }
double get_current_zoom () const { return frames_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool coarser);
void tav_zoom_step (bool coarser);
@ -480,6 +470,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
_stepping_axis_view = v;
}
void save_canvas_state ();
protected:
void map_transport_state ();
void map_position_change (framepos_t);
@ -503,7 +495,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
VisualState (bool with_tracks);
~VisualState ();
double y_position;
double frames_per_unit;
double frames_per_pixel;
framepos_t leftmost_frame;
Editing::ZoomFocus zoom_focus;
GUIObjectState* gui_state;
@ -523,11 +515,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void cancel_visual_state_op (uint32_t n);
framepos_t leftmost_frame;
double frames_per_unit;
double frames_per_pixel;
Editing::ZoomFocus zoom_focus;
void set_frames_per_unit (double);
bool clamp_frames_per_unit (double &) const;
void set_frames_per_pixel (double);
bool clamp_frames_per_pixel (double &) const;
Editing::MouseMode mouse_mode;
Editing::MouseMode pre_internal_mouse_mode;
@ -718,7 +710,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gdk::Cursor* which_grabber_cursor ();
void set_canvas_cursor ();
ArdourCanvas::Canvas* track_canvas;
ArdourCanvas::GtkCanvas* _track_canvas;
ArdourCanvas::GtkCanvasViewPort* _track_canvas_viewport;
Gtk::Adjustment* _track_canvas_hadj;
Gtk::Adjustment* _track_canvas_vadj;
ArdourCanvas::GtkCanvas* _time_bars_canvas;
ArdourCanvas::GtkCanvasViewport* _time_bars_canvas_viewport;
Gtk::Adjustment* _time_bars_canvas_hadj;
Gtk::Adjustment* _time_bars_canvas_vadj;
bool within_track_canvas;
friend class VerboseCursor;
@ -730,7 +731,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::EventBox time_canvas_event_box;
Gtk::EventBox track_canvas_event_box;
Gtk::EventBox time_button_event_box;
Gtk::EventBox time_bars_event_box;
Gtk::EventBox ruler_label_event_box;
ArdourCanvas::Group *minsec_group;
@ -745,9 +746,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
ArdourCanvas::Group *transport_marker_group;
ArdourCanvas::Group* cd_marker_group;
ArdourCanvas::Group* timebar_group;
/* parent for groups which themselves contain time markers */
ArdourCanvas::Group* _time_markers_group;
/* These bars never need to be scrolled */
ArdourCanvas::Group* meter_bar_group;
ArdourCanvas::Group* tempo_bar_group;
ArdourCanvas::Group* marker_bar_group;
@ -899,16 +900,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
static const double timebar_height;
guint32 visible_timebars;
gdouble canvas_timebars_vsize;
gdouble get_canvas_timebars_vsize () const { return canvas_timebars_vsize; }
Gtk::Menu *editor_ruler_menu;
ArdourCanvas::SimpleRect* tempo_bar;
ArdourCanvas::SimpleRect* meter_bar;
ArdourCanvas::SimpleRect* marker_bar;
ArdourCanvas::SimpleRect* range_marker_bar;
ArdourCanvas::SimpleRect* transport_marker_bar;
ArdourCanvas::SimpleRect* cd_marker_bar;
ArdourCanvas::Rectangle* tempo_bar;
ArdourCanvas::Rectangle* meter_bar;
ArdourCanvas::Rectangle* marker_bar;
ArdourCanvas::Rectangle* range_marker_bar;
ArdourCanvas::Rectangle* transport_marker_bar;
ArdourCanvas::Rectangle* cd_marker_bar;
Gtk::Label minsec_label;
Gtk::Label bbt_label;
@ -922,7 +921,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Label cd_mark_label;
#ifdef WITH_VIDEOTIMELINE
ArdourCanvas::SimpleRect* videotl_bar;
ArdourCanvas::Rectangle* videotl_bar;
Gtk::Label videotl_label;
ArdourCanvas::Group* videotl_bar_group;
ArdourCanvas::Group* videotl_group;
@ -938,13 +937,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void toggle_region_video_lock ();
#endif
Gtk::VBox time_button_vbox;
Gtk::HBox time_button_hbox;
Gtk::VBox time_bars_vbox;
friend class EditorCursor;
EditorCursor* playhead_cursor;
ArdourCanvas::Group* cursor_group;
framepos_t get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, bool only_onscreen);
@ -982,6 +979,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Table edit_packer;
/** the adjustment that controls the overall editor vertical scroll position */
Gtk::Adjustment vertical_adjustment;
Gtk::Layout controls_layout;
@ -1001,9 +999,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
sigc::connection _scroll_connection;
int _scroll_callbacks;
double _canvas_width;
double _canvas_height; ///< height of the visible area of the track canvas
double full_canvas_height; ///< full height of the canvas
double _visible_canvas_width;
double _visible_canvas_height; ///< height of the visible area of the track canvas
double _full_canvas_height; ///< full height of the canvas
bool track_canvas_map_handler (GdkEventAny*);
@ -1031,15 +1029,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool deferred_control_scroll (framepos_t);
sigc::connection control_scroll_connection;
gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value () - canvas_timebars_vsize;}
gdouble get_trackview_group_vertical_offset () const { return vertical_adjustment.get_value (); }
ArdourCanvas::Group* get_background_group () const { return _background_group; }
ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
double last_trackview_group_vertical_offset;
void tie_vertical_scrolling ();
void set_horizontal_position (double);
double horizontal_position () const;
void scroll_canvas_vertically ();
struct VisualChange {
enum Type {
@ -1050,14 +1046,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Type pending;
framepos_t time_origin;
double frames_per_unit;
double frames_per_pixel;
double y_origin;
int idle_handler_id;
/** true if we are currently in the idle handler */
bool being_handled;
VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_unit (0), idle_handler_id (-1), being_handled (false) {}
VisualChange() : pending ((VisualChange::Type) 0), time_origin (0), frames_per_pixel (0), idle_handler_id (-1), being_handled (false) {}
void add (Type t) {
pending = Type (pending | t);
}
@ -1438,8 +1434,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool canvas_zoom_rect_event (GdkEvent* event,ArdourCanvas::Item*);
bool canvas_tempo_marker_event (GdkEvent* event,ArdourCanvas::Item*, TempoMarker*);
bool canvas_meter_marker_event (GdkEvent* event,ArdourCanvas::Item*, MeterMarker*);
bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) ;
bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*);
bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item *);
bool canvas_tempo_bar_event (GdkEvent* event, ArdourCanvas::Item*);
bool canvas_meter_bar_event (GdkEvent* event, ArdourCanvas::Item*);
@ -1488,9 +1484,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool track_canvas_button_release_event (GdkEventButton* event);
bool track_canvas_motion_notify_event (GdkEventMotion* event);
Gtk::Allocation canvas_allocation;
void track_canvas_allocate (Gtk::Allocation alloc);
bool track_canvas_size_allocated ();
Gtk::Allocation _canvas_viewport_allocation;
void track_canvas_viewport_allocate (Gtk::Allocation alloc);
bool track_canvas_viewport_size_allocated ();
bool track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const &, int, int, guint);
bool track_canvas_key_press (GdkEventKey *);
bool track_canvas_key_release (GdkEventKey *);
@ -1719,22 +1715,22 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
/* transport range select process */
ArdourCanvas::SimpleRect* cd_marker_bar_drag_rect;
ArdourCanvas::SimpleRect* range_bar_drag_rect;
ArdourCanvas::SimpleRect* transport_bar_drag_rect;
ArdourCanvas::Rectangle* cd_marker_bar_drag_rect;
ArdourCanvas::Rectangle* range_bar_drag_rect;
ArdourCanvas::Rectangle* transport_bar_drag_rect;
#ifdef GTKOSX
ArdourCanvas::SimpleRect *bogus_background_rect;
ArdourCanvas::Rectangle *bogus_background_rect;
#endif
ArdourCanvas::SimpleRect *transport_bar_range_rect;
ArdourCanvas::SimpleRect *transport_bar_preroll_rect;
ArdourCanvas::SimpleRect *transport_bar_postroll_rect;
ArdourCanvas::SimpleRect *transport_loop_range_rect;
ArdourCanvas::SimpleRect *transport_punch_range_rect;
ArdourCanvas::SimpleLine *transport_punchin_line;
ArdourCanvas::SimpleLine *transport_punchout_line;
ArdourCanvas::SimpleRect *transport_preroll_rect;
ArdourCanvas::SimpleRect *transport_postroll_rect;
ArdourCanvas::Rectangle *transport_bar_range_rect;
ArdourCanvas::Rectangle *transport_bar_preroll_rect;
ArdourCanvas::Rectangle *transport_bar_postroll_rect;
ArdourCanvas::Rectangle *transport_loop_range_rect;
ArdourCanvas::Rectangle *transport_punch_range_rect;
ArdourCanvas::Line *transport_punchin_line;
ArdourCanvas::Line *transport_punchout_line;
ArdourCanvas::Rectangle *transport_preroll_rect;
ArdourCanvas::Rectangle *transport_postroll_rect;
ARDOUR::Location* transport_loop_location();
ARDOUR::Location* transport_punch_location();
@ -1745,11 +1741,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void select_all_within (framepos_t, framepos_t, double, double, TrackViewList const &, Selection::Operation, bool);
ArdourCanvas::SimpleRect *rubberband_rect;
ArdourCanvas::Rectangle *rubberband_rect;
/* mouse zoom process */
ArdourCanvas::SimpleRect *zoom_rect;
ArdourCanvas::Rectangle *zoom_rect;
void reposition_zoom_rect (framepos_t start, framepos_t end);
EditorRouteGroups* _route_groups;

View File

@ -30,6 +30,9 @@
#include "ardour/session.h"
#include "ardour/types.h"
#include "canvas/canvas.h"
#include "canvas/pixbuf.h"
#include "actions.h"
#include "ardour_ui.h"
#include "editing.h"
@ -1566,7 +1569,7 @@ Editor::parameter_changed (std::string p)
void
Editor::reset_focus ()
{
track_canvas->grab_focus();
_track_canvas->grab_focus();
}
void

View File

@ -19,6 +19,8 @@
#include "ardour/rc_configuration.h"
#include "canvas/canvas.h"
#include "ardour_ui.h"
#include "editor.h"
#include "editing.h"
@ -73,6 +75,6 @@ Editor::toggle_meter_updating()
stop_updating_meters ();
}
track_canvas_allocate (track_canvas->get_allocation());
track_canvas_viewport_allocate (track_canvas->get_allocation());
}

View File

@ -21,8 +21,6 @@
#include "gtk2ardour-config.h"
#endif
#include <libgnomecanvasmm/init.h>
#include <libgnomecanvasmm/pixbuf.h>
#include <jack/types.h>
#include "gtkmm2ext/utils.h"
@ -31,19 +29,14 @@
#include "ardour/rc_configuration.h"
#include "ardour/smf_source.h"
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "canvas/pixbuf.h"
#include "canvas/text.h"
#include "ardour_ui.h"
#include "editor.h"
#include "global_signals.h"
#include "waveview.h"
#include "simplerect.h"
#include "simpleline.h"
#include "imageframe.h"
#include "waveview_p.h"
#include "simplerect_p.h"
#include "simpleline_p.h"
#include "imageframe_p.h"
#include "canvas_impl.h"
#include "canvas-noevent-text.h"
#include "editing.h"
#include "rgb_macros.h"
#include "utils.h"
@ -72,63 +65,28 @@ using namespace Editing;
const double max_canvas_coordinate = (double) JACK_MAX_FRAMES;
extern "C"
{
GType gnome_canvas_simpleline_get_type(void);
GType gnome_canvas_simplerect_get_type(void);
GType gnome_canvas_waveview_get_type(void);
GType gnome_canvas_imageframe_get_type(void);
}
static void ardour_canvas_type_init()
{
// Map gtypes to gtkmm wrapper-creation functions:
Glib::wrap_register(gnome_canvas_simpleline_get_type(), &Gnome::Canvas::SimpleLine_Class::wrap_new);
Glib::wrap_register(gnome_canvas_simplerect_get_type(), &Gnome::Canvas::SimpleRect_Class::wrap_new);
Glib::wrap_register(gnome_canvas_waveview_get_type(), &Gnome::Canvas::WaveView_Class::wrap_new);
// Glib::wrap_register(gnome_canvas_imageframe_get_type(), &Gnome::Canvas::ImageFrame_Class::wrap_new);
// Register the gtkmm gtypes:
(void) Gnome::Canvas::WaveView::get_type();
(void) Gnome::Canvas::SimpleLine::get_type();
(void) Gnome::Canvas::SimpleRect::get_type();
(void) Gnome::Canvas::ImageFrame::get_type();
}
void
Editor::initialize_canvas ()
{
if (getenv ("ARDOUR_NON_AA_CANVAS")) {
track_canvas = new ArdourCanvas::Canvas ();
} else {
track_canvas = new ArdourCanvas::CanvasAA ();
}
/* XXX */
track_canvas->set_can_default (true);
set_default (*track_canvas);
ArdourCanvas::init ();
ardour_canvas_type_init ();
/* don't try to center the canvas */
track_canvas->set_center_scroll_region (false);
track_canvas->set_dither (Gdk::RGB_DITHER_NONE);
gint phys_width = physical_screen_width (Glib::RefPtr<Gdk::Window>());
gint phys_height = physical_screen_height (Glib::RefPtr<Gdk::Window>());
_track_canvas_hadj = new Adjustment (0, 0, 1e16);
_track_canvas_vadj = new Adjustment (0, 0, 1e16);
_track_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (*_track_canvas_hadj, *_track_canvas_vadj);
_track_canvas = _track_canvas_viewport->canvas ();
_time_bars_canvas_hadj = new Adjustment (0, 0, 1e16);
_time_bars_canvas_vadj = new Adjustment (0, 0, 1e16);
_time_bars_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (*_time_bars_canvas_hadj, *_time_bars_canvas_vadj);
_time_bars_canvas = _time_bars_canvas_viewport->canvas ();
_verbose_cursor = new VerboseCursor (this);
/* on the bottom, an image */
if (Profile->get_sae()) {
Image img (::get_icon (X_("saelogo")));
logo_item = new ArdourCanvas::Pixbuf (*track_canvas->root(), 0.0, 0.0, img.get_pixbuf());
// logo_item = new ArdourCanvas::Pixbuf (_track_canvas->root(), 0.0, 0.0, img.get_pixbuf());
// logo_item->property_height_in_pixels() = true;
// logo_item->property_width_in_pixels() = true;
// logo_item->property_height_set() = true;
@ -137,64 +95,70 @@ Editor::initialize_canvas ()
}
/* a group to hold time (measure) lines */
time_line_group = new ArdourCanvas::Group (*track_canvas->root());
time_line_group = new ArdourCanvas::Group (track_canvas->root());
#ifdef GTKOSX
/*XXX please don't laugh. this actually improves canvas performance on osx */
bogus_background_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, max_canvas_coordinate/3, phys_height);
bogus_background_rect->property_outline_pixels() = 0;
#endif
transport_loop_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, phys_height);
transport_loop_range_rect->property_outline_pixels() = 1;
transport_loop_range_rect = new ArdourCanvas::Rectangle (*time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
transport_loop_range_rect->set_outline_width (1);
transport_loop_range_rect->hide();
transport_punch_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, phys_height);
transport_punch_range_rect->property_outline_pixels() = 0;
transport_punch_range_rect = new ArdourCanvas::Rectangle (*time_line_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
transport_punch_range_rect->set_outline_width (0);
transport_punch_range_rect->hide();
_background_group = new ArdourCanvas::Group (*track_canvas->root());
_master_group = new ArdourCanvas::Group (*track_canvas->root());
_trackview_group = new ArdourCanvas::Group (*_master_group);
_region_motion_group = new ArdourCanvas::Group (*_trackview_group);
_background_group = new ArdourCanvas::Group (_track_canvas->root());
_master_group = new ArdourCanvas::Group (_track_canvas->root());
meter_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, phys_width, timebar_height - 1);
meter_bar->property_outline_pixels() = 1;
meter_bar->property_outline_what() = 0x8;
_trackview_group = new ArdourCanvas::Group (_master_group);
_region_motion_group = new ArdourCanvas::Group (_trackview_group);
tempo_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1));
tempo_bar->property_outline_pixels() = 1;
tempo_bar->property_outline_what() = 0x8;
meter_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
meter_bar = new ArdourCanvas::Rectangle (meter_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
meter_bar->set_outline_width (1);
meter_bar->set_outline_what (0x8);
range_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1));
range_marker_bar->property_outline_pixels() = 1;
range_marker_bar->property_outline_what() = 0x8;
tempo_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
tempo_bar = new ArdourCanvas::Rectangle (tempo_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
tempo_bar->set_outline_width (1);
tempo_bar->set_outline_what (0x8);
transport_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1));
transport_marker_bar->property_outline_pixels() = 1;
transport_marker_bar->property_outline_what() = 0x8;
range_marker_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
range_marker_bar = new ArdourCanvas::Rectangle (range_marker_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
range_marker_bar->set_outline_width (1);
range_marker_bar->set_outline_what (0x8);
marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1));
marker_bar->property_outline_pixels() = 1;
marker_bar->property_outline_what() = 0x8;
transport_marker_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
transport_marker_bar = new ArdourCanvas::Rectangle (transport_marker_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
transport_marker_bar->set_outline_width (1);
transport_marker_bar->set_outline_what (0x8);
marker_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
marker_bar = new ArdourCanvas::Rectangle (marker_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
marker_bar->set_outline_width (1);
marker_bar->set_outline_what (0x8);
cd_marker_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
cd_marker_bar = new ArdourCanvas::Rectangle (cd_marker_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
cd_marker_bar->set_outline_width (1);
cd_marker_bar->set_outline_what (0x8);
_time_markers_group = new ArdourCanvas::Group (_time_bars_canvas->root());
meter_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 5.0));
tempo_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 4.0));
range_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 3.0));
transport_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 2.0));
marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height));
cd_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0));
cd_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, phys_width, (timebar_height - 1));
cd_marker_bar->property_outline_pixels() = 1;
cd_marker_bar->property_outline_what() = 0x8;
#ifdef WITH_VIDEOTIMELINE
videotl_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
if (Profile->get_sae()) {
videotl_bar = new ArdourCanvas::SimpleRect (*videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height - 1));
videotl_bar = new ArdourCanvas::Rectangle (*videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height - 1));
videotl_bar->property_outline_pixels() = 1;
} else {
videotl_bar = new ArdourCanvas::SimpleRect (*videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height));
videotl_bar = new ArdourCanvas::Rectangle (*videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height));
videotl_bar->property_outline_pixels() = 0;
}
videotl_bar->property_outline_what() = (0x1 | 0x8);
@ -214,55 +178,55 @@ Editor::initialize_canvas ()
videotl_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0);
#endif
cd_marker_bar_drag_rect = new ArdourCanvas::SimpleRect (*cd_marker_group, 0.0, 0.0, 100, timebar_height);
cd_marker_bar_drag_rect->property_outline_pixels() = 0;
cd_marker_bar_drag_rect = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height));
cd_marker_bar_drag_rect->set_outline (false);
cd_marker_bar_drag_rect->hide ();
range_bar_drag_rect = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, 100, timebar_height);
range_bar_drag_rect->property_outline_pixels() = 0;
range_bar_drag_rect = new ArdourCanvas::Rectangle (range_marker_group, Ardour::Rect (0.0, 0.0, 100, timebar_height));
range_bar_drag_rect->set_outline (false);
range_bar_drag_rect->hide ();
transport_bar_drag_rect = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, 100, timebar_height);
transport_bar_drag_rect->property_outline_pixels() = 0;
transport_bar_drag_rect = new ArdourCanvas::Rectangle (transport_marker_group, Ardour::Rect (0.0, 0.0, 100, timebar_height));
transport_bar_drag_rect->set_outline (false);
transport_bar_drag_rect->hide ();
transport_punchin_line = new ArdourCanvas::SimpleLine (*_master_group);
transport_punchin_line->property_x1() = 0.0;
transport_punchin_line->property_y1() = 0.0;
transport_punchin_line->property_x2() = 0.0;
transport_punchin_line->property_y2() = phys_height;
transport_punchin_line = new ArdourCanvas::Line (_master_group);
transport_punchin_line->set_x1 (0);
transport_punchin_line->set_y1 (0);
transport_punchin_line->set_x2 (0);
transport_punchin_line->set_y2 (ArdourCanvas::COORD_MAX);
transport_punchin_line->hide ();
transport_punchout_line = new ArdourCanvas::SimpleLine (*_master_group);
transport_punchout_line->property_x1() = 0.0;
transport_punchout_line->property_y1() = 0.0;
transport_punchout_line->property_x2() = 0.0;
transport_punchout_line->property_y2() = phys_height;
transport_punchout_line = new ArdourCanvas::Line (_master_group);
transport_punchout_line->set_x1 (0);
transport_punchout_line->set_y1 (0);
transport_punchout_line->set_x2 (0);
transport_punchout_line->set_y2 (ArdourCanvas::COORD_MAX);
transport_punchout_line->hide();
// used to show zoom mode active zooming
zoom_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0);
zoom_rect->property_outline_pixels() = 1;
zoom_rect = new ArdourCanvas::Rectangle (_master_group, 0.0, 0.0, 0.0, 0.0);
zoom_rect->set_outline_width (1);
zoom_rect->hide();
zoom_rect->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
zoom_rect->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
// used as rubberband rect
rubberband_rect = new ArdourCanvas::SimpleRect (*_trackview_group, 0.0, 0.0, 0.0, 0.0);
rubberband_rect = new ArdourCanvas::Rectangle (_trackview_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
rubberband_rect->property_outline_pixels() = 1;
rubberband_rect->set_outline_width (1);
rubberband_rect->hide();
tempo_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
meter_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
marker_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
cd_marker_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cd_marker_bar_event), cd_marker_bar));
tempo_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
meter_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
cd_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_cd_marker_bar_event), cd_marker_bar));
#ifdef WITH_VIDEOTIMELINE
videotl_bar_group->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
//videotl_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
videotl_bar_group->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
//videotl_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
#endif
range_marker_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar));
transport_marker_bar->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
range_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar));
transport_marker_bar->Event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
playhead_cursor = new EditorCursor (*this, &Editor::canvas_playhead_cursor_event);
@ -271,19 +235,19 @@ Editor::initialize_canvas ()
}
/* need to handle 4 specific types of events as catch-alls */
track_canvas->signal_scroll_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_scroll_event));
track_canvas->signal_motion_notify_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_motion_notify_event));
track_canvas->signal_button_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_press_event));
track_canvas->signal_button_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_release_event));
track_canvas->signal_drag_motion().connect (sigc::mem_fun (*this, &Editor::track_canvas_drag_motion));
track_canvas->signal_key_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_key_press));
track_canvas->signal_key_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_key_release));
_track_canvas->signal_scroll_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_scroll_event));
_track_canvas->signal_motion_notify_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_motion_notify_event));
_track_canvas->signal_button_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_press_event));
_track_canvas->signal_button_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_button_release_event));
_track_canvas->signal_drag_motion().connect (sigc::mem_fun (*this, &Editor::track_canvas_drag_motion));
_track_canvas->signal_key_press_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_key_press));
_track_canvas->signal_key_release_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_key_release));
track_canvas->set_name ("EditorMainCanvas");
track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK | Gdk::SCROLL_MASK | Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
track_canvas->signal_leave_notify_event().connect (sigc::mem_fun(*this, &Editor::left_track_canvas), false);
track_canvas->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::entered_track_canvas), false);
track_canvas->set_flags (CAN_FOCUS);
_track_canvas->set_name ("EditorMainCanvas");
_track_canvas->add_events (Gdk::POINTER_MOTION_HINT_MASK | Gdk::SCROLL_MASK | Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
_track_canvas->signal_leave_notify_event().connect (sigc::mem_fun(*this, &Editor::left_track_canvas), false);
_track_canvas->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::entered_track_canvas), false);
_track_canvas->set_flags (CAN_FOCUS);
/* set up drag-n-drop */
@ -296,10 +260,10 @@ Editor::initialize_canvas ()
target_table.push_back (TargetEntry ("text/uri-list"));
target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
track_canvas->drag_dest_set (target_table);
track_canvas->signal_drag_data_received().connect (sigc::mem_fun(*this, &Editor::track_canvas_drag_data_received));
_track_canvas->drag_dest_set (target_table);
_track_canvas->signal_drag_data_received().connect (sigc::mem_fun(*this, &Editor::track_canvas_drag_data_received));
track_canvas->signal_size_allocate().connect (sigc::mem_fun(*this, &Editor::track_canvas_allocate));
_track_canvas_viewport->signal_size_allocate().connect (sigc::mem_fun(*this, &Editor::track_canvas_viewport_allocate));
ColorsChanged.connect (sigc::mem_fun (*this, &Editor::color_handler));
color_handler();
@ -307,19 +271,19 @@ Editor::initialize_canvas ()
}
void
Editor::track_canvas_allocate (Gtk::Allocation alloc)
Editor::track_canvas_viewport_allocate (Gtk::Allocation alloc)
{
canvas_allocation = alloc;
track_canvas_size_allocated ();
_canvas_viewport_allocation = alloc;
track_canvas_viewport_size_allocated ();
}
bool
Editor::track_canvas_size_allocated ()
Editor::track_canvas_viewport_size_allocated ()
{
bool height_changed = _canvas_height != canvas_allocation.get_height();
bool height_changed = _visible_canvas_height != _canvas_viewport_allocation.get_height();
_canvas_width = canvas_allocation.get_width();
_canvas_height = canvas_allocation.get_height();
_visible_canvas_width = _canvas_viewport_allocation.get_width ();
_visible_canvas_height = _canvas_viewport_allocation.get_height ();
if (_session) {
TrackViewList::iterator i;
@ -330,22 +294,18 @@ Editor::track_canvas_size_allocated ()
}
if (height_changed) {
if (playhead_cursor) {
playhead_cursor->set_length (_canvas_height);
}
for (LocationMarkerMap::iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
i->second->canvas_height_set (_canvas_height);
i->second->canvas_height_set (_visible_canvas_height);
}
vertical_adjustment.set_page_size (_canvas_height);
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
if ((vertical_adjustment.get_value() + _canvas_height) >= vertical_adjustment.get_upper()) {
vertical_adjustment.set_page_size (_visible_canvas_height);
if ((vertical_adjustment.get_value() + _visible_canvas_height) >= vertical_adjustment.get_upper()) {
/*
We're increasing the size of the canvas while the bottom is visible.
We scroll down to keep in step with the controls layout.
*/
vertical_adjustment.set_value (full_canvas_height - _canvas_height);
vertical_adjustment.set_value (_full_canvas_height - _visible_canvas_height);
}
}
@ -493,7 +453,7 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
/* D-n-D coordinates are window-relative, so convert to "world" coordinates
*/
track_canvas->window_to_world (x, y, wx, wy);
_track_canvas_viewport->window_to_canvas (x, y, wx, wy);
ev.type = GDK_BUTTON_RELEASE;
ev.button.x = wx;
@ -571,10 +531,10 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool moving_left, b
autoscroll_y = 0;
autoscroll_x = 0;
if (ty < canvas_timebars_vsize && moving_up && allow_vert) {
if (ty < 0 && moving_up && allow_vert) {
autoscroll_y = -1;
startit = true;
} else if (ty > _canvas_height && !moving_up && allow_vert) {
} else if (ty > _visible_canvas_height && !moving_up && allow_vert) {
autoscroll_y = 1;
startit = true;
}
@ -638,7 +598,7 @@ Editor::autoscroll_canvas ()
if (autoscroll_y_distance != 0) {
if (autoscroll_y > 0) {
autoscroll_y_distance = (_drags->current_pointer_y() - (get_trackview_group_vertical_offset() + _canvas_height)) / 3;
autoscroll_y_distance = (_drags->current_pointer_y() - (get_trackview_group_vertical_offset() + _visible_canvas_height)) / 3;
} else if (autoscroll_y < 0) {
autoscroll_y_distance = (vertical_adjustment.get_value () - _drags->current_pointer_y()) / 3;
@ -676,10 +636,10 @@ Editor::autoscroll_canvas ()
} else if (autoscroll_y > 0) {
double top_of_bottom_of_canvas = full_canvas_height - _canvas_height;
double const top_of_bottom_of_canvas = _full_canvas_height - _visible_canvas_height;
if (vertical_pos > full_canvas_height - autoscroll_y_distance) {
new_pixel = full_canvas_height;
if (vertical_pos > _full_canvas_height - autoscroll_y_distance) {
new_pixel = _full_canvas_height;
} else {
new_pixel = vertical_pos + autoscroll_y_distance;
}
@ -692,7 +652,7 @@ Editor::autoscroll_canvas ()
(its top edge will line up with the bottom of the visible canvas.
*/
target_pixel = min (target_pixel, full_canvas_height - 10);
target_pixel = min (target_pixel, _full_canvas_height - 10);
} else {
target_pixel = _drags->current_pointer_y();
@ -712,7 +672,7 @@ Editor::autoscroll_canvas ()
/* fake an event. */
Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->track_canvas->get_window();
Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->_track_canvas->get_window();
gint x, y;
Gdk::ModifierType mask;
canvas_window->get_pointer (x, y, mask);
@ -806,10 +766,19 @@ Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
}
}
/** Called when the main vertical_adjustment has changed */
void
Editor::tie_vertical_scrolling ()
{
scroll_canvas_vertically ();
_track_canvas_vadj->set_value (vertical_adjustment.get_value ());
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->clip_to_viewport ();
}
/* required to keep the controls_layout in lock step with the canvas group */
update_canvas_now ();
/* this will do an immediate redraw */
@ -823,18 +792,10 @@ Editor::tie_vertical_scrolling ()
void
Editor::set_horizontal_position (double p)
{
/* horizontal scrolling only */
double x1, y1, x2, y2, x_delta;
_master_group->get_bounds (x1, y1, x2, y2);
_track_canvas_hadj->set_value (p);
_time_bars_canvas_hadj->set_value (p);
x_delta = - (x1 + p);
_master_group->move (x_delta, 0);
timebar_group->move (x_delta, 0);
time_line_group->move (x_delta, 0);
cursor_group->move (x_delta, 0);
leftmost_frame = (framepos_t) floor (p * frames_per_unit);
leftmost_frame = (framepos_t) floor (p * frames_per_pixel);
update_fixed_rulers ();
redisplay_tempo (true);
@ -881,55 +842,55 @@ Editor::scroll_canvas_vertically ()
void
Editor::color_handler()
{
playhead_cursor->canvas_item.property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_PlayHead.get();
playhead_cursor->canvas_item.set_fill_color (ARDOUR_UI::config()->canvasvar_PlayHead.get());
_verbose_cursor->set_color (ARDOUR_UI::config()->canvasvar_VerboseCanvasCursor.get());
meter_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MeterBar.get();
meter_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
meter_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_MeterBar.get());
meter_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
tempo_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TempoBar.get();
tempo_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
tempo_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_TempoBar.get());
tempo_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBar.get();
marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
marker_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_MarkerBar.get());
marker_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
cd_marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_CDMarkerBar.get();
cd_marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
cd_marker_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_CDMarkerBar.get());
cd_marker_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
#ifdef WITH_VIDEOTIMELINE
videotl_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VideoBar.get();
videotl_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
videotl_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_VideoBar.get());
videotl_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
#endif
range_marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeMarkerBar.get();
range_marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
range_marker_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_RangeMarkerBar.get());
range_marker_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
transport_marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportMarkerBar.get();
transport_marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
transport_marker_bar->set_fill_color (ARDOUR_UI::config()->canvasvar_TransportMarkerBar.get());
transport_marker_bar->set_outline_color (ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get());
cd_marker_bar_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get();
cd_marker_bar_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get();
cd_marker_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get());
cd_marker_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get());
range_bar_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get();
range_bar_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get();
range_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get());
range_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_RangeDragBarRect.get());
transport_bar_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportDragRect.get();
transport_bar_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportDragRect.get();
transport_bar_drag_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_TransportDragRect.get());
transport_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TransportDragRect.get());
transport_loop_range_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportLoopRect.get();
transport_loop_range_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportLoopRect.get();
transport_loop_range_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_TransportLoopRect.get());
transport_loop_range_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TransportLoopRect.get());
transport_punch_range_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportPunchRect.get();
transport_punch_range_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TransportPunchRect.get();
transport_punch_range_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_TransportPunchRect.get());
transport_punch_range_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TransportPunchRect.get());
transport_punchin_line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_PunchLine.get();
transport_punchout_line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_PunchLine.get();
transport_punchin_line->set_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
transport_punchout_line->set_color (ARDOUR_UI::config()->canvasvar_PunchLine.get());
zoom_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ZoomRect.get();
zoom_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_ZoomRect.get();
zoom_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_ZoomRect.get());
zoom_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_ZoomRect.get());
rubberband_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RubberBandRect.get();
rubberband_rect->property_fill_color_rgba() = (guint32) ARDOUR_UI::config()->canvasvar_RubberBandRect.get();
rubberband_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_RubberBandRect.get());
rubberband_rect->set_fill_color ((guint32) ARDOUR_UI::config()->canvasvar_RubberBandRect.get());
location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
@ -967,10 +928,11 @@ Editor::update_canvas_now ()
If one is scheduled, GC should probably remove it.
*/
GnomeCanvas* c = track_canvas->gobj ();
if (c->need_update || c->need_redraw) {
track_canvas->update_now ();
}
/* XXX: CANVAS */
// GnomeCanvas* c = track_canvas->gobj ();
// if (c->need_update || c->need_redraw) {
// track_canvas->update_now ();
// }
}
double

View File

@ -28,20 +28,20 @@
#include "ardour/region_factory.h"
#include "ardour/profile.h"
#include "canvas/canvas.h"
#include "canvas/text.h"
#include "editor.h"
#include "keyboard.h"
#include "public_editor.h"
#include "audio_region_view.h"
#include "audio_streamview.h"
#include "canvas-noevent-text.h"
#include "audio_time_axis.h"
#include "region_gain_line.h"
#include "automation_line.h"
#include "automation_time_axis.h"
#include "automation_line.h"
#include "control_point.h"
#include "canvas_impl.h"
#include "simplerect.h"
#include "editor_drag.h"
#include "midi_time_axis.h"
#include "editor_regions.h"
@ -79,7 +79,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
if (!current_stepping_trackview) {
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize);
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value());
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;
@ -108,7 +108,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
if (!current_stepping_trackview) {
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value() - canvas_timebars_vsize);
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value());
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;
@ -152,7 +152,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
bool
Editor::track_canvas_scroll_event (GdkEventScroll *event)
{
track_canvas->grab_focus();
_track_canvas->grab_focus();
return track_canvas_scroll (event);
}
@ -160,7 +160,7 @@ bool
Editor::track_canvas_button_press_event (GdkEventButton */*event*/)
{
selection->clear ();
track_canvas->grab_focus();
_track_canvas->grab_focus();
return false;
}
@ -178,7 +178,7 @@ Editor::track_canvas_motion_notify_event (GdkEventMotion */*event*/)
{
int x, y;
/* keep those motion events coming */
track_canvas->get_pointer (x, y);
_track_canvas->get_pointer (x, y);
return false;
}
@ -1005,8 +1005,8 @@ Editor::canvas_note_event (GdkEvent *event, ArdourCanvas::Item* item)
bool
Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int x, int y, guint time)
{
double wx;
double wy;
ArdourCanvas::Coord wx;
ArdourCanvas::Coord wy;
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> region_copy;
RouteTimeAxisView* rtav;
@ -1020,7 +1020,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
return false;
}
track_canvas->window_to_world (x, y, wx, wy);
_track_canvas_viewport->window_to_canvas (x, y, wx, wy);
event.type = GDK_MOTION_NOTIFY;
event.button.x = wx;

View File

@ -20,7 +20,7 @@
#include <cstdlib>
#include <cmath>
#include <libgnomecanvas/libgnomecanvas.h>
#include "canvas/canvas.h"
#include "utils.h"
#include "editor_cursors.h"
@ -31,29 +31,36 @@ using namespace PBD;
using namespace Gtk;
EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanvas::Item*))
: editor (ed),
canvas_item (*editor.cursor_group),
length(1.0)
: _editor (ed)
, _time_bars_canvas_item (_editor._time_bars_canvas->root ())
, _track_canvas_item (_editor._track_canvas->root ())
, _length (1.0)
{
points.push_back(Gnome::Art::Point(-1.0, 0.0)); // first x-coord needs to be a non-normal value
points.push_back(Gnome::Art::Point(1.0, 1.0));
_time_bars_canvas_item.set_outline_width (1);
_track_canvas_item.set_outline_width (1);
canvas_item.property_points() = points;
canvas_item.property_width_pixels() = 1;
canvas_item.property_first_arrowhead() = TRUE;
canvas_item.property_last_arrowhead() = TRUE;
canvas_item.property_arrow_shape_a() = 11.0;
canvas_item.property_arrow_shape_b() = 0.0;
canvas_item.property_arrow_shape_c() = 9.0;
for (int i = 0; i < 2; ++i) {
_time_bars_canvas_item.set_show_head (i, true);
_time_bars_canvas_item.set_head_height (i, 18);
_time_bars_canvas_item.set_head_width (i, 15);
_time_bars_canvas_item.set_head_outward (i, false);
}
canvas_item.set_data ("cursor", this);
canvas_item.signal_event().connect (sigc::bind (sigc::mem_fun (ed, callbck), &canvas_item));
current_frame = 1; /* force redraw at 0 */
_time_bars_canvas_item.set_data ("cursor", this);
_track_canvas_item.set_data ("cursor", this);
_time_bars_canvas_item.Event.connect (sigc::bind (sigc::mem_fun (ed, callbck), &_time_bars_canvas_item));
_track_canvas_item.Event.connect (sigc::bind (sigc::mem_fun (ed, callbck), &_track_canvas_item));
_time_bars_canvas_item.set_y1 (ArdourCanvas::COORD_MAX);
_track_canvas_item.set_y1 (ArdourCanvas::COORD_MAX);
_current_frame = 1; /* force redraw at 0 */
}
EditorCursor::~EditorCursor ()
{
}
void
@ -61,30 +68,37 @@ EditorCursor::set_position (framepos_t frame)
{
PositionChanged (frame);
double new_pos = editor.frame_to_unit (frame);
double const new_pos = _editor.frame_to_unit (frame);
if (new_pos != points.front().get_x()) {
points.front().set_x (new_pos);
points.back().set_x (new_pos);
canvas_item.property_points() = points;
if (new_pos != _time_bars_canvas_item.x ()) {
_time_bars_canvas_item.set_x (new_pos);
}
current_frame = frame;
if (new_pos != _track_canvas_item.x0 ()) {
_track_canvas_item.set_x0 (new_pos);
_track_canvas_item.set_x1 (new_pos);
}
_current_frame = frame;
}
void
EditorCursor::set_length (double units)
EditorCursor::show ()
{
length = units;
points.back().set_y (points.front().get_y() + length);
canvas_item.property_points() = points;
_time_bars_canvas_item.show ();
_track_canvas_item.show ();
}
void
EditorCursor::set_y_axis (double position)
EditorCursor::hide ()
{
points.front().set_y (position);
points.back().set_y (position + length);
canvas_item.property_points() = points;
_time_bars_canvas_item.hide ();
_track_canvas_item.hide ();
}
void
EditorCursor::set_color (ArdourCanvas::Color color)
{
_time_bars_canvas_item.set_color (color);
_track_canvas_item.set_outline_color (color);
}

View File

@ -22,19 +22,31 @@
class Editor;
class EditorCursor {
public:
Editor& editor;
ArdourCanvas::Points points;
ArdourCanvas::Line canvas_item;
framepos_t current_frame;
double length;
EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
~EditorCursor ();
public:
EditorCursor (Editor&, bool (Editor::*)(GdkEvent*,ArdourCanvas::Item*));
~EditorCursor ();
void set_position (framepos_t);
void set_length (double units);
void set_y_axis (double position);
void show ();
void hide ();
void set_color (ArdourCanvas::Color);
framepos_t current_frame () const {
return _current_frame;
}
ArdourCanvas::Line& track_canvas_item () {
return _track_canvas_item;
}
PBD::Signal1<void, framepos_t> PositionChanged;
private:
Editor& _editor;
ArdourCanvas::Arrow _time_bars_canvas_item;
ArdourCanvas::Line _track_canvas_item;
framepos_t _current_frame;
double _length;
};

View File

@ -51,13 +51,14 @@
#include "editor_drag.h"
#include "audio_time_axis.h"
#include "midi_time_axis.h"
#include "canvas-note.h"
#include "selection.h"
#include "midi_selection.h"
#include "automation_time_axis.h"
#include "debug.h"
#include "editor_cursors.h"
#include "mouse_cursors.h"
#include "note_base.h"
#include "patch_change.h"
#include "verbose_cursor.h"
using namespace std;
@ -203,13 +204,13 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i)
void
Drag::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t time)
{
_item->ungrab (0);
_item->ungrab ();
_item = new_item;
if (cursor == 0) {
_item->grab (Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK, time);
_item->grab ();
} else {
_item->grab (Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK, *cursor, time);
_item->grab ();
}
}
@ -239,12 +240,12 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
_last_pointer_y = _grab_y;
if (cursor == 0) {
_item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK,
event->button.time);
_item->grab ();
} else {
_item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK,
*cursor,
event->button.time);
/* CAIROCANVAS need a variant here that passes *cursor */
_item->grab ();
}
if (_editor->session() && _editor->session()->transport_rolling()) {
@ -276,7 +277,7 @@ Drag::end_grab (GdkEvent* event)
{
_editor->stop_canvas_autoscroll ();
_item->ungrab (event ? event->button.time : 0);
_item->ungrab ();
finished (event, _move_threshold_passed);
@ -355,7 +356,7 @@ void
Drag::abort ()
{
if (_item) {
_item->ungrab (0);
_item->ungrab ();
}
aborted (_move_threshold_passed);
@ -551,7 +552,7 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r
if ((*pending_region_position != _last_frame_position) && x_move_allowed) {
/* x movement since last time (in pixels) */
dx = (static_cast<double> (*pending_region_position) - _last_frame_position) / _editor->frames_per_unit;
dx = (static_cast<double> (*pending_region_position) - _last_frame_position) / _editor->frames_per_pixel;
/* total x movement */
framecnt_t total_dx = *pending_region_position;
@ -733,7 +734,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
double y = 0;
/* Get the y coordinate of the top of the track that this region is now on */
tv->canvas_display()->i2w (x, y);
tv->canvas_display()->item_to_canvas (x, y);
y += _editor->get_trackview_group_vertical_offset();
/* And adjust for the layer that it should be on */
@ -750,17 +751,13 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
}
/* Now move the region view */
rv->move (x_delta, y - rv->get_canvas_group()->property_y());
rv->move (Ardour::Duple (x_delta, y - rv->get_canvas_group()->property_y()));
}
} /* foreach region */
_total_x_delta += x_delta;
if (first_move) {
_editor->cursor_group->raise_to_top();
}
if (x_delta != 0 && !_brushing) {
show_verbose_cursor_time (_last_frame_position);
}
@ -1073,8 +1070,8 @@ RegionMoveDrag::finished_no_copy (
No need to do anything for copies as they are fake regions which will be deleted.
*/
rv->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item());
rv->get_canvas_group()->property_y() = i->initial_y;
rv->get_canvas_group()->reparent (dest_rtv->view()->canvas_item());
rv->get_canvas_group()->set_y_position (i->initial_y);
rv->drag_end ();
/* just change the model */
@ -1287,8 +1284,8 @@ RegionMotionDrag::aborted (bool)
TimeAxisView* tv = &(rv->get_time_axis_view ());
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
assert (rtv);
rv->get_canvas_group()->reparent (*rtv->view()->canvas_item());
rv->get_canvas_group()->property_y() = 0;
rv->get_canvas_group()->reparent (rtv->view()->canvas_item());
rv->get_canvas_group()->set_y_position (0);
rv->drag_end ();
rv->fake_set_opaque (false);
rv->move (-_total_x_delta, 0);
@ -1348,8 +1345,8 @@ RegionInsertDrag::finished (GdkEvent *, bool)
RouteTimeAxisView* dest_rtv = dynamic_cast<RouteTimeAxisView*> (_time_axis_views[_views.front().time_axis_view]);
_primary->get_canvas_group()->reparent (*dest_rtv->view()->canvas_item());
_primary->get_canvas_group()->property_y() = 0;
_primary->get_canvas_group()->reparent (dest_rtv->view()->canvas_item());
_primary->get_canvas_group()->set_y_position (0);
boost::shared_ptr<Playlist> playlist = dest_rtv->playlist();
@ -1530,7 +1527,8 @@ void
NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
{
Gdk::Cursor* cursor;
ArdourCanvas::CanvasNoteEvent* cnote = dynamic_cast<ArdourCanvas::CanvasNoteEvent*>(_item);
NoteBase* cnote = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (cnote);
float x_fraction = cnote->mouse_x_fraction ();
if (x_fraction > 0.0 && x_fraction < 0.25) {
@ -1544,7 +1542,7 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
region = &cnote->region_view();
double const region_start = region->get_position_pixels();
double const middle_point = region_start + cnote->x1() + (cnote->x2() - cnote->x1()) / 2.0L;
double const middle_point = region_start + cnote->x0() + (cnote->x1() - cnote->x0()) / 2.0L;
if (grab_x() <= middle_point) {
cursor = _editor->cursors()->left_side_trim;
@ -1554,7 +1552,7 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
at_front = false;
}
_item->grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, *cursor, event->motion.time);
_item->grab ();
if (event->motion.state & Keyboard::PrimaryModifier) {
relative = false;
@ -1588,7 +1586,9 @@ NoteResizeDrag::motion (GdkEvent* /*event*/, bool /*first_move*/)
{
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
(*r)->update_resizing (dynamic_cast<ArdourCanvas::CanvasNoteEvent*>(_item), at_front, _drags->current_pointer_x() - grab_x(), relative);
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (nb);
(*r)->update_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
}
}
@ -1597,7 +1597,9 @@ NoteResizeDrag::finished (GdkEvent*, bool /*movement_occurred*/)
{
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
(*r)->commit_resizing (dynamic_cast<ArdourCanvas::CanvasNoteEvent*>(_item), at_front, _drags->current_pointer_x() - grab_x(), relative);
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (nb);
(*r)->commit_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
}
}
@ -2389,7 +2391,7 @@ CursorDrag::fake_locate (framepos_t t)
Session* s = _editor->session ();
if (s->timecode_transmission_suspended ()) {
framepos_t const f = _editor->playhead_cursor->current_frame;
framepos_t const f = _editor->playhead_cursor->current_frame ();
s->send_mmc_locate (f);
s->send_full_time_code (f);
}
@ -2466,7 +2468,7 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
Session* s = _editor->session ();
if (s) {
s->request_locate (_editor->playhead_cursor->current_frame, _was_rolling);
s->request_locate (_editor->playhead_cursor->current_frame (), _was_rolling);
_editor->_pending_locate_request = true;
s->request_resume_timecode_transmission ();
}
@ -2723,8 +2725,8 @@ MarkerDrag::MarkerDrag (Editor* e, ArdourCanvas::Item* i)
_marker = reinterpret_cast<Marker*> (_item->get_data ("marker"));
assert (_marker);
_points.push_back (Gnome::Art::Point (0, 0));
_points.push_back (Gnome::Art::Point (0, physical_screen_height (_editor->get_window())));
_points.push_back (ArdourCanvas::Duple (0, 0));
_points.push_back (ArdourCanvas::Duple (0, physical_screen_height (_editor->get_window())));
}
MarkerDrag::~MarkerDrag ()
@ -3233,9 +3235,9 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
double cx = event->button.x;
double cy = event->button.y;
_line->parent_group().w2i (cx, cy);
_line->parent_group().canvas_to_item (cx, cy);
framecnt_t const frame_within_region = (framecnt_t) floor (cx * _editor->frames_per_unit);
framecnt_t const frame_within_region = (framecnt_t) floor (cx * _editor->frames_per_pixel);
uint32_t before;
uint32_t after;
@ -3322,7 +3324,7 @@ FeatureLineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
double cx = event->button.x;
double cy = event->button.y;
_item->property_parent().get_value()->w2i(cx, cy);
_item->parent()->canvas_to_item (cx, cy);
/* store grab start in parent frame */
_region_view_grab_x = cx;
@ -3352,16 +3354,9 @@ FeatureLineDrag::motion (GdkEvent*, bool)
cx = 0;
}
ArdourCanvas::Points points;
double x1 = 0, x2 = 0, y1 = 0, y2 = 0;
_line->get_bounds(x1, y2, x2, y2);
points.push_back(Gnome::Art::Point(cx, 2.0)); // first x-coord needs to be a non-normal value
points.push_back(Gnome::Art::Point(cx, y2 - y1));
_line->property_points() = points;
boost::optional<Rect> bbox = _line->bounding_box ();
assert (bbox);
_line->set (ArdourCanvas::Duple (cx, 2.0), ArdourCanvas::Duple (cx, bbox.get().height ()));
float *pos = new float;
*pos = cx;
@ -3437,16 +3432,16 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool)
double x1 = _editor->frame_to_pixel (start);
double x2 = _editor->frame_to_pixel (end);
_editor->rubberband_rect->property_x1() = x1;
_editor->rubberband_rect->set_x0 (x1);
if (_vertical_only) {
/* fixed 10 pixel width */
_editor->rubberband_rect->property_x2() = x1 + 10;
_editor->rubberband_rect->set_x1 (x1 + 10);
} else {
_editor->rubberband_rect->property_x2() = x2;
_editor->rubberband_rect->set_x1 (x2);
}
_editor->rubberband_rect->property_y1() = y1;
_editor->rubberband_rect->property_y2() = y2;
_editor->rubberband_rect->set_y0 (y1);
_editor->rubberband_rect->set_y1 (y2);
_editor->rubberband_rect->show();
_editor->rubberband_rect->raise_to_top();
@ -3872,7 +3867,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
break;
}
if (event->button.x >= _editor->horizontal_position() + _editor->_canvas_width) {
if (event->button.x >= _editor->horizontal_position() + _editor->_visible_canvas_width) {
_editor->start_canvas_autoscroll (1, 0);
}
@ -3968,12 +3963,12 @@ RangeMarkerBarDrag::RangeMarkerBarDrag (Editor* e, ArdourCanvas::Item* i, Operat
{
DEBUG_TRACE (DEBUG::Drags, "New RangeMarkerBarDrag\n");
_drag_rect = new ArdourCanvas::SimpleRect (*_editor->time_line_group, 0.0, 0.0, 0.0,
_drag_rect = new ArdourCanvas::Rectangle (*_editor->time_line_group, 0.0, 0.0, 0.0,
physical_screen_height (_editor->get_window()));
_drag_rect->hide ();
_drag_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragRect.get();
_drag_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RangeDragRect.get();
_drag_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_RangeDragRect.get());
_drag_rect->set_outline_color() (ARDOUR_UI::config()->canvasvar_RangeDragRect.get());
}
void
@ -4013,7 +4008,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
{
framepos_t start = 0;
framepos_t end = 0;
ArdourCanvas::SimpleRect *crect;
ArdourCanvas::Rectangle *crect;
switch (_operation) {
case CreateRangeMarker:
@ -4062,7 +4057,7 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
}
}
if (event->button.x >= _editor->horizontal_position() + _editor->_canvas_width) {
if (event->button.x >= _editor->horizontal_position() + _editor->_visible_canvas_width) {
_editor->start_canvas_autoscroll (1, 0);
}
@ -4071,8 +4066,8 @@ RangeMarkerBarDrag::motion (GdkEvent* event, bool first_move)
double x1 = _editor->frame_to_pixel (start);
double x2 = _editor->frame_to_pixel (end);
crect->property_x1() = x1;
crect->property_x2() = x2;
crect->set_x0 (x1);
crect->set_x1 (x2);
update_item (_editor->temp_location);
}
@ -4173,8 +4168,8 @@ RangeMarkerBarDrag::update_item (Location* location)
double const x1 = _editor->frame_to_pixel (location->start());
double const x2 = _editor->frame_to_pixel (location->end());
_drag_rect->property_x1() = x1;
_drag_rect->property_x2() = x2;
_drag_rect->set_x0 (x1);
_drag_rect->set_x1 (x2);
}
MouseZoomDrag::MouseZoomDrag (Editor* e, ArdourCanvas::Item* i)
@ -4266,7 +4261,8 @@ NoteDrag::NoteDrag (Editor* e, ArdourCanvas::Item* i)
{
DEBUG_TRACE (DEBUG::Drags, "New NoteDrag\n");
_primary = dynamic_cast<CanvasNoteEvent*> (_item);
_primary = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (_primary);
_region = &_primary->region_view ();
_note_height = _region->midi_stream_view()->note_height ();
}
@ -4638,14 +4634,14 @@ DraggingView::DraggingView (RegionView* v, RegionDrag* parent)
{
time_axis_view = parent->find_time_axis_view (&v->get_time_axis_view ());
layer = v->region()->layer ();
initial_y = v->get_canvas_group()->property_y ();
initial_y = v->get_canvas_group()->position().y;
initial_playlist = v->region()->playlist ();
initial_position = v->region()->position ();
initial_end = v->region()->position () + v->region()->length ();
}
PatchChangeDrag::PatchChangeDrag (Editor* e, CanvasPatchChange* i, MidiRegionView* r)
: Drag (e, i)
PatchChangeDrag::PatchChangeDrag (Editor* e, PatchChange* i, MidiRegionView* r)
: Drag (e, i->canvas_item ())
, _region_view (r)
, _patch_change (i)
, _cumulative_dx (0)
@ -4665,7 +4661,7 @@ PatchChangeDrag::motion (GdkEvent* ev, bool)
framecnt_t const dxf = f - grab_frame(); // permitted dx in frames
double const dxu = _editor->frame_to_unit (dxf); // permitted fx in units
_patch_change->move (dxu - _cumulative_dx, 0);
_patch_change->move (ArdourCanvas::Duple (dxu - _cumulative_dx, 0));
_cumulative_dx = dxu;
}
@ -4690,7 +4686,7 @@ PatchChangeDrag::finished (GdkEvent* ev, bool movement_occurred)
void
PatchChangeDrag::aborted (bool)
{
_patch_change->move (-_cumulative_dx, 0);
_patch_change->move (ArdourCanvas::Duple (-_cumulative_dx, 0));
}
void
@ -4823,7 +4819,7 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
Drag::start_grab (event, cursor);
_drag_rect = new ArdourCanvas::SimpleRect (*_region_view->get_canvas_group ());
_drag_rect = new ArdourCanvas::Rectangle (*_region_view->get_canvas_group ());
framepos_t pf = _drags->current_pointer_frame ();
framecnt_t const g = grid_frames (pf);

View File

@ -27,7 +27,6 @@
#include "ardour/types.h"
#include "canvas.h"
#include "editor_items.h"
namespace ARDOUR {
@ -38,18 +37,13 @@ namespace PBD {
class StatefulDiffCommand;
}
namespace Gnome {
namespace Canvas {
class CanvasNoteEvent;
class CanvasPatchChange;
}
}
class PatchChange;
class Editor;
class EditorCursor;
class TimeAxisView;
class MidiTimeAxisView;
class Drag;
class NoteBase;
/** Class to manage current drags */
class DragManager
@ -456,7 +450,7 @@ class NoteDrag : public Drag
int8_t total_dy () const;
MidiRegionView* _region;
Gnome::Canvas::CanvasNoteEvent* _primary;
NoteBase* _primary;
double _cumulative_dx;
double _cumulative_dy;
bool _was_selected;
@ -479,7 +473,7 @@ private:
framecnt_t grid_frames (framepos_t) const;
MidiRegionView* _region_view;
ArdourCanvas::SimpleRect* _drag_rect;
ArdourCanvas::Rectangle* _drag_rect;
framepos_t _note[2];
};
@ -487,7 +481,7 @@ private:
class PatchChangeDrag : public Drag
{
public:
PatchChangeDrag (Editor *, ArdourCanvas::CanvasPatchChange *, MidiRegionView *);
PatchChangeDrag (Editor *, PatchChange *, MidiRegionView *);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
@ -501,7 +495,7 @@ public:
private:
MidiRegionView* _region_view;
ArdourCanvas::CanvasPatchChange* _patch_change;
PatchChange* _patch_change;
double _cumulative_dx;
};
@ -968,7 +962,7 @@ private:
void update_item (ARDOUR::Location *);
Operation _operation;
ArdourCanvas::SimpleRect* _drag_rect;
ArdourCanvas::Rectangle* _drag_rect;
bool _copy;
};

View File

@ -27,7 +27,6 @@
#include "marker_view.h"
#include "editor.h"
#include "i18n.h"
#include "canvas_impl.h"
#include <gtkmm2ext/gtk_ui.h>
#include "pbd/error.h"

View File

@ -21,7 +21,6 @@
#include <cstdlib>
#include <cmath>
#include <libgnomecanvas/libgnomecanvas.h>
#include <gtkmm2ext/gtk_ui.h>
#include "ardour/session.h"
@ -29,12 +28,15 @@
#include "ardour/profile.h"
#include "pbd/memento_command.h"
#include "canvas/canvas.h"
#include "canvas/item.h"
#include "canvas/rectangle.h"
#include "editor.h"
#include "marker.h"
#include "selection.h"
#include "editing.h"
#include "gui_thread.h"
#include "simplerect.h"
#include "actions.h"
#include "prompter.h"
#include "editor_drag.h"
@ -172,7 +174,7 @@ Editor::add_new_location_internal (Location* location)
select_new_marker = false;
}
lam->canvas_height_set (_canvas_height);
lam->canvas_height_set (_visible_canvas_height);
lam->set_show_lines (_show_marker_lines);
/* Add these markers to the appropriate sorted marker lists, which will render
@ -1420,8 +1422,8 @@ Editor::update_loop_range_view (bool visibility)
double x1 = frame_to_pixel (tll->start());
double x2 = frame_to_pixel (tll->end());
transport_loop_range_rect->property_x1() = x1;
transport_loop_range_rect->property_x2() = x2;
transport_loop_range_rect->set_x0 (x1);
transport_loop_range_rect->set_x1 (x2);
if (visibility) {
transport_loop_range_rect->show();
@ -1442,14 +1444,13 @@ Editor::update_punch_range_view (bool visibility)
Location* tpl;
if ((_session->config.get_punch_in() || _session->config.get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
guint track_canvas_width,track_canvas_height;
track_canvas->get_size(track_canvas_width,track_canvas_height);
ArdourCanvas::Rect const v = _track_canvas_viewport->visible_area ();
if (_session->config.get_punch_in()) {
transport_punch_range_rect->property_x1() = frame_to_pixel (tpl->start());
transport_punch_range_rect->property_x2() = (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
transport_punch_range_rect->set_x0 (frame_to_pixel (tpl->start()));
transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
} else {
transport_punch_range_rect->property_x1() = 0;
transport_punch_range_rect->property_x2() = (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
transport_punch_range_rect->set_x0 (0);
transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? frame_to_pixel (tpl->end()) : v.width ());
}
if (visibility) {

View File

@ -165,7 +165,7 @@ Editor::ensure_all_elements_drawn ()
{
controls_layout.queue_draw ();
ruler_label_event_box.queue_draw ();
time_button_event_box.queue_draw ();
time_bars_event_box.queue_draw ();
}
#endif

View File

@ -24,6 +24,7 @@
#include <set>
#include <string>
#include <algorithm>
#include <bitset>
#include "pbd/error.h"
#include "pbd/enumwriter.h"
@ -35,9 +36,19 @@
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/tearoff.h"
#include "canvas/canvas.h"
#include "ardour/audioregion.h"
#include "ardour/operations.h"
#include "ardour/playlist.h"
#include "ardour/profile.h"
#include "ardour/region_factory.h"
#include "ardour/route.h"
#include "ardour/session.h"
#include "ardour/types.h"
#include "ardour_ui.h"
#include "actions.h"
#include "canvas-note.h"
#include "editor.h"
#include "time_axis_view.h"
#include "audio_time_axis.h"
@ -61,17 +72,7 @@
#include "mouse_cursors.h"
#include "editor_cursors.h"
#include "verbose_cursor.h"
#include "ardour/audioregion.h"
#include "ardour/operations.h"
#include "ardour/playlist.h"
#include "ardour/profile.h"
#include "ardour/region_factory.h"
#include "ardour/route.h"
#include "ardour/session.h"
#include "ardour/types.h"
#include <bitset>
#include "note.h"
#include "i18n.h"
@ -103,7 +104,7 @@ Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const
int x, y;
double wx, wy;
Gdk::ModifierType mask;
Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->track_canvas->get_window();
Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->_track_canvas_viewport->get_bin_window();
Glib::RefPtr<const Gdk::Window> pointer_window;
if (!canvas_window) {
@ -112,14 +113,13 @@ Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const
pointer_window = canvas_window->get_pointer (x, y, mask);
if (pointer_window == track_canvas->get_bin_window()) {
if (pointer_window == _track_canvas->get_window()) {
wx = x;
wy = y;
in_track_canvas = true;
} else {
in_track_canvas = false;
return false;
return false;
}
GdkEvent event;
@ -146,6 +146,8 @@ Editor::event_frame (GdkEvent const * event, double* pcx, double* pcy) const
*pcx = 0;
*pcy = 0;
/* The event coordinates will be canvas coordinates */
switch (event->type) {
case GDK_BUTTON_RELEASE:
case GDK_BUTTON_PRESS:
@ -153,16 +155,19 @@ Editor::event_frame (GdkEvent const * event, double* pcx, double* pcy) const
case GDK_3BUTTON_PRESS:
*pcx = event->button.x;
*pcy = event->button.y;
_trackview_group->w2i(*pcx, *pcy);
_trackview_group->canvas_to_item (*pcx, *pcy);
break;
case GDK_MOTION_NOTIFY:
*pcx = event->motion.x;
*pcy = event->motion.y;
_trackview_group->w2i(*pcx, *pcy);
_trackview_group->canvas_to_item (*pcx, *pcy);
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
track_canvas->w2c(event->crossing.x, event->crossing.y, *pcx, *pcy);
*pcx = event->crossing.x;
*pcy = event->crossing.y;
/* XXX: CANVAS */
// track_canvas->w2c(event->crossing.x, event->crossing.y, *pcx, *pcy);
break;
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
@ -307,7 +312,7 @@ Editor::set_canvas_cursor ()
get_pointer_position (x, y);
ArdourCanvas::Item* i = track_canvas->get_item_at (x, y);
if (i && i->property_parent() && (*i->property_parent()).get_data (X_("timeselection"))) {
pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value() - canvas_timebars_vsize);
pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value());
if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
current_canvas_cursor = _cursors->up_down;
}
@ -748,7 +753,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case TempoBarItem:
case MeterBarItem:
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), event);
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
}
return true;
break;
@ -756,7 +761,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case RangeMarkerBarItem:
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), event);
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
} else {
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker), event);
}
@ -765,7 +770,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case CdMarkerBarItem:
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), event);
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
} else {
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateCDMarker), event);
}
@ -774,7 +779,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case TransportMarkerBarItem:
if (!Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
_drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), event);
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), event);
} else {
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateTransportMarker), event);
}
@ -825,11 +830,12 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case SelectionItem:
if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
start_selection_grab (item, event);
return true;
} else if (Keyboard::modifier_state_equals (event->button.state, Keyboard::SecondaryModifier)) {
/* grab selection for moving */
_drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionMove), event);
} else {
double const y = event->button.y + vertical_adjustment.get_value() - canvas_timebars_vsize;
double const y = event->button.y + vertical_adjustment.get_value();
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
if (tvp.first) {
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
@ -886,7 +892,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case NoteItem:
if (internal_editing()) {
/* trim notes if we're in internal edit mode and near the ends of the note */
ArdourCanvas::CanvasNote* cn = dynamic_cast<ArdourCanvas::CanvasNote*> (item);
Notebase* cn = reinterpret_cast<NoteBase*>(item->get_data ("notebase"));
assert (cn);
if (cn && cn->big_enough_to_trim() && cn->mouse_near_ends()) {
_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
} else {
@ -913,7 +920,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
switch (item_type) {
case NoteItem:
if (internal_editing()) {
ArdourCanvas::CanvasNoteEvent* cn = dynamic_cast<ArdourCanvas::CanvasNoteEvent*> (item);
NoteBase* cn = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
assert (cn);
if (cn->mouse_near_ends()) {
_drags->set (new NoteResizeDrag (this, item), event, current_canvas_cursor);
} else {
@ -1002,6 +1010,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
// }
_drags->start_grab (event);
return true;
break;
case RegionViewNameHighlight:
@ -1078,7 +1087,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
{
if ( get_smart_mode() ) {
/* we're in "smart" joined mode, and we've clicked on a Selection */
double const y = event->button.y + vertical_adjustment.get_value() - canvas_timebars_vsize;
double const y = event->button.y + vertical_adjustment.get_value();
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
if (tvp.first) {
/* if we're over an automation track, start a drag of its data */
@ -1107,6 +1116,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
rvs.push_back (rv);
_drags->add (new RegionMoveDrag (this, item, rv, rvs, false, false));
_drags->start_grab (event);
return true;
}
}
}
@ -1326,7 +1336,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
pre_press_cursor = current_canvas_cursor;
track_canvas->grab_focus();
_track_canvas->grab_focus();
if (_session && _session->actively_recording()) {
return true;
@ -1489,7 +1499,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case NoteItem:
{
ArdourCanvas::CanvasNoteEvent* e = dynamic_cast<ArdourCanvas::CanvasNoteEvent*> (item);
NoteBase* e = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
assert (e);
edit_notes (e->region_view().selection ());
break;
@ -1838,8 +1848,9 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case GainLineItem:
if (mouse_mode == MouseGain) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredGainLine.get();
if (line) {
line->set_outline_color (ARDOUR_UI::config()->canvasvar_EnteredGainLine.get());
}
if (is_drawable()) {
set_canvas_cursor (_cursors->fader);
}
@ -1850,7 +1861,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
if (mouse_mode == MouseGain || mouse_mode == MouseObject) {
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line) {
line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get();
line->set_fill_color (ARDOUR_UI::config()->canvasvar_EnteredAutomationLine.get());
}
if (is_drawable()) {
set_canvas_cursor (_cursors->fader);
@ -1969,9 +1980,9 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case FadeInHandleItem:
if (mouse_mode == MouseObject && !internal_editing()) {
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
if (rect) {
rect->property_fill_color_rgba() = 0xBBBBBBAA;
rect->set_fill_color (0xBBBBBBAA);
}
set_canvas_cursor (_cursors->fade_in);
}
@ -1979,19 +1990,20 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
case FadeOutHandleItem:
if (mouse_mode == MouseObject && !internal_editing()) {
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
if (rect) {
rect->property_fill_color_rgba() = 0xBBBBBBAA;
rect->set_fill_color (0xBBBBBBAA);
}
set_canvas_cursor (_cursors->fade_out);
}
break;
case FeatureLineItem:
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
line->property_fill_color_rgba() = 0xFF0000FF;
}
break;
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
line->set_outline_color (0xFF0000FF);
}
break;
case SelectionItem:
if ( get_smart_mode() ) {
set_canvas_cursor ();
@ -2078,8 +2090,9 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
al = reinterpret_cast<AutomationLine*> (item->get_data ("line"));
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
if (line)
line->property_fill_color_rgba() = al->get_line_color();
if (line) {
line->set_outline_color (al->get_line_color());
}
}
if (is_drawable()) {
set_canvas_cursor (current_canvas_cursor);
@ -2130,9 +2143,9 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
case FadeOutHandleItem:
rv = static_cast<RegionView*>(item->get_data ("regionview"));
{
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
if (rect) {
rect->property_fill_color_rgba() = rv->get_fill_color();
rect->set_fill_color (rv->get_fill_color());
}
}
set_canvas_cursor (current_canvas_cursor);
@ -2148,7 +2161,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
case FeatureLineItem:
{
ArdourCanvas::Line *line = dynamic_cast<ArdourCanvas::Line *> (item);
line->property_fill_color_rgba() = (guint) ARDOUR_UI::config()->canvasvar_ZeroLine.get();;
line->set_outline_color (ARDOUR_UI::config()->canvasvar_ZeroLine.get());
}
break;
@ -2265,7 +2278,7 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from
event might do, its a good tradeoff.
*/
track_canvas->get_pointer (x, y);
_track_canvas->get_pointer (x, y);
}
if (current_stepping_trackview) {
@ -2553,12 +2566,9 @@ Editor::reposition_zoom_rect (framepos_t start, framepos_t end)
{
double x1 = frame_to_pixel (start);
double x2 = frame_to_pixel (end);
double y2 = full_canvas_height - 1.0;
double y2 = _full_canvas_height - 1.0;
zoom_rect->property_x1() = x1;
zoom_rect->property_y1() = 1.0;
zoom_rect->property_x2() = x2;
zoom_rect->property_y2() = y2;
zoom_rect->set (ArdourCanvas::Rect (x1, 1, x2, y2);
}
@ -2839,7 +2849,7 @@ Editor::update_join_object_range_location (double /*x*/, double y)
}
/* XXX: maybe we should make entered_track work in all cases, rather than resorting to this */
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y + vertical_adjustment.get_value() - canvas_timebars_vsize);
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y + vertical_adjustment.get_value());
if (tvp.first) {
@ -2848,7 +2858,7 @@ Editor::update_join_object_range_location (double /*x*/, double y)
double cx = 0;
double cy = y;
rtv->canvas_display()->w2i (cx, cy);
rtv->canvas_display()->canvas_to_item (cx, cy);
double const c = cy / (rtv->view()->child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE);
@ -2872,7 +2882,7 @@ Editor::effective_mouse_mode () const
void
Editor::remove_midi_note (ArdourCanvas::Item* item, GdkEvent *)
{
ArdourCanvas::CanvasNoteEvent* e = dynamic_cast<ArdourCanvas::CanvasNoteEvent*> (item);
NoteBase* e = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
assert (e);
e->region_view().delete_note (e->note ());
@ -2881,20 +2891,26 @@ Editor::remove_midi_note (ArdourCanvas::Item* item, GdkEvent *)
void
Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv)
{
/* XXX: this check should not be necessary */
if (rv == 0) {
return;
}
assert (rv);
ArdourCanvas::Group* g = rv->get_canvas_group ();
ArdourCanvas::Group* p = g->get_parent_group ();
ArdourCanvas::Group* g = rv->get_parent_group ();
ArdourCanvas::Group* p = g->parent ();
/* Compute x in region view parent coordinates */
double dy = 0;
p->w2i (x, dy);
p->canvas_to_item (x, dy);
double x1, x2, y1, y2;
g->get_bounds (x1, y1, x2, y2);
boost::optional<ArdourCanvas::Rect> item_bbox = g->bounding_box ();
assert (item_bbox);
ArdourCanvas::Rect parent_bbox = g->item_to_parent (item_bbox.get ());
/* Halfway across the region */
double const h = (x1 + x2) / 2;
double const h = (parent_bbox.x0 + parent_bbox.x1) / 2;
Trimmable::CanTrim ct = rv->region()->can_trim ();
if (x <= h) {

View File

@ -55,6 +55,8 @@
#include "ardour/strip_silence.h"
#include "ardour/transient_detector.h"
#include "canvas/canvas.h"
#include "ardour_ui.h"
#include "debug.h"
#include "editor.h"
@ -357,8 +359,8 @@ Editor::nudge_forward (bool next, bool force_playhead)
commit_reversible_command ();
} else {
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
_session->request_locate (playhead_cursor->current_frame + distance);
distance = get_nudge_distance (playhead_cursor->current_frame (), next_distance);
_session->request_locate (playhead_cursor->current_frame () + distance);
}
}
@ -446,10 +448,10 @@ Editor::nudge_backward (bool next, bool force_playhead)
} else {
distance = get_nudge_distance (playhead_cursor->current_frame, next_distance);
distance = get_nudge_distance (playhead_cursor->current_frame (), next_distance);
if (playhead_cursor->current_frame > distance) {
_session->request_locate (playhead_cursor->current_frame - distance);
if (playhead_cursor->current_frame () > distance) {
_session->request_locate (playhead_cursor->current_frame () - distance);
} else {
_session->goto_start();
}
@ -772,7 +774,7 @@ Editor::get_region_boundary (framepos_t pos, int32_t dir, bool with_selection, b
void
Editor::cursor_to_region_boundary (bool with_selection, int32_t dir)
{
framepos_t pos = playhead_cursor->current_frame;
framepos_t pos = playhead_cursor->current_frame ();
framepos_t target;
if (!_session) {
@ -807,7 +809,7 @@ void
Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t dir)
{
boost::shared_ptr<Region> r;
framepos_t pos = cursor->current_frame;
framepos_t pos = cursor->current_frame ();
if (!_session) {
return;
@ -1143,7 +1145,7 @@ Editor::selected_marker_to_selection_end ()
void
Editor::scroll_playhead (bool forward)
{
framepos_t pos = playhead_cursor->current_frame;
framepos_t pos = playhead_cursor->current_frame ();
framecnt_t delta = (framecnt_t) floor (current_page_frames() / 0.8);
if (forward) {
@ -1197,10 +1199,10 @@ Editor::cursor_align (bool playhead_to_edit)
Location* loc = find_location_from_marker (*i, ignored);
if (loc->is_mark()) {
loc->set_start (playhead_cursor->current_frame);
loc->set_start (playhead_cursor->current_frame ());
} else {
loc->set (playhead_cursor->current_frame,
playhead_cursor->current_frame + loc->length());
loc->set (playhead_cursor->current_frame (),
playhead_cursor->current_frame () + loc->length());
}
}
}
@ -1209,7 +1211,7 @@ Editor::cursor_align (bool playhead_to_edit)
void
Editor::scroll_backward (float pages)
{
framepos_t const one_page = (framepos_t) rint (_canvas_width * frames_per_unit);
framepos_t const one_page = (framepos_t) rint (_visible_canvas_width * frames_per_pixel);
framepos_t const cnt = (framepos_t) floor (pages * one_page);
framepos_t frame;
@ -1225,7 +1227,7 @@ Editor::scroll_backward (float pages)
void
Editor::scroll_forward (float pages)
{
framepos_t const one_page = (framepos_t) rint (_canvas_width * frames_per_unit);
framepos_t const one_page = (framepos_t) rint (_visible_canvas_width * frames_per_pixel);
framepos_t const cnt = (framepos_t) floor (pages * one_page);
framepos_t frame;
@ -1242,8 +1244,8 @@ void
Editor::scroll_tracks_down ()
{
double vert_value = vertical_adjustment.get_value() + vertical_adjustment.get_page_size();
if (vert_value > vertical_adjustment.get_upper() - _canvas_height) {
vert_value = vertical_adjustment.get_upper() - _canvas_height;
if (vert_value > vertical_adjustment.get_upper() - _visible_canvas_height) {
vert_value = vertical_adjustment.get_upper() - _visible_canvas_height;
}
vertical_adjustment.set_value (vert_value);
@ -1260,8 +1262,8 @@ Editor::scroll_tracks_down_line ()
{
double vert_value = vertical_adjustment.get_value() + 60;
if (vert_value > vertical_adjustment.get_upper() - _canvas_height) {
vert_value = vertical_adjustment.get_upper() - _canvas_height;
if (vert_value > vertical_adjustment.get_upper() - _visible_canvas_height) {
vert_value = vertical_adjustment.get_upper() - _visible_canvas_height;
}
vertical_adjustment.set_value (vert_value);
@ -1329,17 +1331,17 @@ Editor::tav_zoom_smooth (bool coarser, bool force_all)
}
bool
Editor::clamp_frames_per_unit (double& fpu) const
Editor::clamp_frames_per_pixel (double& fpp) const
{
bool clamped = false;
if (fpu < 2.0) {
fpu = 2.0;
if (fpp < 2.0) {
fpp = 2.0;
clamped = true;
}
if (max_framepos / fpu < 800) {
fpu = max_framepos / 800.0;
if (max_framepos / fpp < 800) {
fpp = max_framepos / 800.0;
clamped = true;
}
@ -1351,19 +1353,19 @@ Editor::temporal_zoom_step (bool coarser)
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, coarser)
double nfpu = frames_per_unit;
double nfpp = frames_per_pixel;
if (coarser) {
nfpu = min (9e6, nfpu * 1.61803399);
nfpp = min (9e6, nfpp * 1.61803399);
} else {
nfpu = max (1.0, nfpu / 1.61803399);
nfpp = max (1.0, nfpp / 1.61803399);
}
temporal_zoom (nfpu);
temporal_zoom (nfpp);
}
void
Editor::temporal_zoom (double fpu)
Editor::temporal_zoom (double fpp)
{
if (!_session) {
return;
@ -1378,24 +1380,24 @@ Editor::temporal_zoom (double fpu)
framepos_t leftmost_after_zoom = 0;
framepos_t where;
bool in_track_canvas;
double nfpu;
double nfpp;
double l;
clamp_frames_per_unit (fpu);
if (fpu == frames_per_unit) {
clamp_frames_per_pixel (fpp);
if (fpp == frames_per_pixel) {
return;
}
nfpu = fpu;
nfpp = fpp;
// Imposing an arbitrary limit to zoom out as too much zoom out produces
// segfaults for lack of memory. If somebody decides this is not high enough I
// believe it can be raisen to higher values but some limit must be in place.
if (nfpu > 8e+08) {
nfpu = 8e+08;
if (nfpp > 8e+08) {
nfpp = 8e+08;
}
new_page_size = (framepos_t) floor (_canvas_width * nfpu);
new_page_size = (framepos_t) floor (_canvas_width * nfpp);
half_page_size = new_page_size / 2;
switch (zoom_focus) {
@ -1423,7 +1425,7 @@ Editor::temporal_zoom (double fpu)
case ZoomFocusPlayhead:
/* centre playhead */
l = playhead_cursor->current_frame - (new_page_size * 0.5);
l = playhead_cursor->current_frame () - (new_page_size * 0.5);
if (l < 0) {
leftmost_after_zoom = 0;
@ -1439,7 +1441,7 @@ Editor::temporal_zoom (double fpu)
if (!mouse_frame (where, in_track_canvas)) {
/* use playhead instead */
where = playhead_cursor->current_frame;
where = playhead_cursor->current_frame ();
if (where < half_page_size) {
leftmost_after_zoom = 0;
@ -1488,7 +1490,7 @@ Editor::temporal_zoom (double fpu)
// leftmost_after_zoom = min (leftmost_after_zoom, _session->current_end_frame());
reposition_and_zoom (leftmost_after_zoom, nfpu);
reposition_and_zoom (leftmost_after_zoom, nfpp);
}
void
@ -1533,8 +1535,8 @@ Editor::temporal_zoom_region (bool both_axes)
}
framepos_t range = end - start;
double new_fpu = (double)range / (double)_canvas_width;
framepos_t extra_samples = (framepos_t) floor (one_centimeter_in_pixels * new_fpu);
double new_fpp = (double) range / (double) _visible_canvas_width;
framepos_t extra_samples = (framepos_t) floor (one_centimeter_in_pixels * new_fpp);
if (start > extra_samples) {
start -= extra_samples;
@ -1558,7 +1560,7 @@ Editor::temporal_zoom_region (bool both_axes)
temporal_zoom_by_frame (start, end);
if (both_axes) {
uint32_t per_track_height = (uint32_t) floor ((_canvas_height - canvas_timebars_vsize - 10.0) / tracks.size());
uint32_t per_track_height = (uint32_t) floor ((_visible_canvas_height - 10.0) / tracks.size());
/* set visible track heights appropriately */
@ -1632,11 +1634,11 @@ Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
framepos_t range = end - start;
double new_fpu = (double)range / (double)_canvas_width;
double const new_fpp = (double) range / (double) _visible_canvas_width;
framepos_t new_page = (framepos_t) floor (_canvas_width * new_fpu);
framepos_t middle = (framepos_t) floor( (double)start + ((double)range / 2.0f ));
framepos_t new_leftmost = (framepos_t) floor( (double)middle - ((double)new_page/2.0f));
framepos_t new_page = (framepos_t) floor (_visible_canvas_width * new_fpp);
framepos_t middle = (framepos_t) floor ((double) start + ((double) range / 2.0f));
framepos_t new_leftmost = (framepos_t) floor ((double) middle - ((double) new_page / 2.0f));
if (new_leftmost > middle) {
new_leftmost = 0;
@ -1646,7 +1648,7 @@ Editor::temporal_zoom_by_frame (framepos_t start, framepos_t end)
new_leftmost = 0;
}
reposition_and_zoom (new_leftmost, new_fpu);
reposition_and_zoom (new_leftmost, new_fpp);
}
void
@ -1656,19 +1658,19 @@ Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame)
return;
}
double range_before = frame - leftmost_frame;
double new_fpu;
double new_fpp;
new_fpu = frames_per_unit;
new_fpp = frames_per_pixel;
if (coarser) {
new_fpu *= 1.61803399;
new_fpp *= 1.61803399;
range_before *= 1.61803399;
} else {
new_fpu = max(1.0,(new_fpu/1.61803399));
new_fpp = max(1.0,(new_fpp/1.61803399));
range_before /= 1.61803399;
}
if (new_fpu == frames_per_unit) {
if (new_fpp == frames_per_pixel) {
return;
}
@ -1682,7 +1684,7 @@ Editor::temporal_zoom_to_frame (bool coarser, framepos_t frame)
new_leftmost = 0;
}
reposition_and_zoom (new_leftmost, new_fpu);
reposition_and_zoom (new_leftmost, new_fpp);
}
@ -1847,7 +1849,7 @@ Editor::jump_forward_to_mark ()
return;
}
framepos_t pos = _session->locations()->first_mark_after (playhead_cursor->current_frame);
framepos_t pos = _session->locations()->first_mark_after (playhead_cursor->current_frame());
if (pos < 0) {
return;
@ -1863,7 +1865,7 @@ Editor::jump_backward_to_mark ()
return;
}
framepos_t pos = _session->locations()->first_mark_before (playhead_cursor->current_frame);
framepos_t pos = _session->locations()->first_mark_before (playhead_cursor->current_frame());
if (pos < 0) {
return;
@ -1968,7 +1970,7 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y)
RouteTimeAxisView *rtv = 0;
boost::shared_ptr<Playlist> playlist;
track_canvas->window_to_world (x, y, wx, wy);
_track_canvas_viewport->window_to_canvas (x, y, wx, wy);
GdkEvent event;
event.type = GDK_BUTTON_RELEASE;
@ -2012,9 +2014,7 @@ Editor::insert_route_list_drag (boost::shared_ptr<Route> route, int x, int y)
RouteTimeAxisView *dest_rtv = 0;
RouteTimeAxisView *source_rtv = 0;
track_canvas->window_to_world (x, y, wx, wy);
wx += horizontal_position ();
wy += vertical_adjustment.get_value();
_track_canvas_viewport->window_to_canvas (x, y, wx, wy);
GdkEvent event;
event.type = GDK_BUTTON_RELEASE;
@ -4425,14 +4425,14 @@ Editor::reset_point_selection ()
void
Editor::center_playhead ()
{
float page = _canvas_width * frames_per_unit;
center_screen_internal (playhead_cursor->current_frame, page);
float const page = _visible_canvas_width * frames_per_pixel;
center_screen_internal (playhead_cursor->current_frame (), page);
}
void
Editor::center_edit_point ()
{
float page = _canvas_width * frames_per_unit;
float const page = _visible_canvas_width * frames_per_pixel;
center_screen_internal (get_preferred_edit_position(), page);
}
@ -5606,7 +5606,7 @@ Editor::ensure_track_visible(TimeAxisView *track)
return;
double const current_view_min_y = vertical_adjustment.get_value();
double const current_view_max_y = vertical_adjustment.get_value() + vertical_adjustment.get_page_size() - canvas_timebars_vsize;
double const current_view_max_y = vertical_adjustment.get_value() + vertical_adjustment.get_page_size();
double const track_min_y = track->y_position ();
double const track_max_y = track->y_position () + track->effective_height ();
@ -5623,7 +5623,7 @@ Editor::ensure_track_visible(TimeAxisView *track)
new_value = track_min_y;
} else {
// Track is below the current view
new_value = track->y_position () + track->effective_height() + canvas_timebars_vsize - vertical_adjustment.get_page_size();
new_value = track->y_position () + track->effective_height() - vertical_adjustment.get_page_size();
}
vertical_adjustment.set_value(new_value);
@ -6371,8 +6371,11 @@ Editor::tab_to_transient (bool forward)
void
Editor::playhead_forward_to_grid ()
{
if (!_session) return;
framepos_t pos = playhead_cursor->current_frame;
if (!_session) {
return;
}
framepos_t pos = playhead_cursor->current_frame ();
if (pos < max_framepos - 1) {
pos += 2;
snap_to_internal (pos, 1, false);
@ -6384,8 +6387,11 @@ Editor::playhead_forward_to_grid ()
void
Editor::playhead_backward_to_grid ()
{
if (!_session) return;
framepos_t pos = playhead_cursor->current_frame;
if (!_session) {
return;
}
framepos_t pos = playhead_cursor->current_frame ();
if (pos > 2) {
pos -= 2;
snap_to_internal (pos, -1, false);
@ -6736,7 +6742,7 @@ Editor::fit_tracks (TrackViewList & tracks)
++visible_tracks;
}
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize) / visible_tracks);
uint32_t h = (uint32_t) floor ((_visible_canvas_height - child_heights) / visible_tracks);
double first_y_pos = DBL_MAX;
if (h < TimeAxisView::preset_height (HeightSmall)) {
@ -6798,7 +6804,7 @@ Editor::fit_tracks (TrackViewList & tracks)
request signal handler will cause the vertical adjustment setting to fail
*/
controls_layout.property_height () = full_canvas_height - canvas_timebars_vsize;
controls_layout.property_height () = _full_canvas_height;
vertical_adjustment.set_value (first_y_pos);
redo_visual_stack.push_back (current_visual_state (true));

View File

@ -534,15 +534,15 @@ EditorRoutes::redisplay ()
_editor->reset_controls_layout_height (position);
_editor->reset_controls_layout_width ();
_editor->full_canvas_height = position + _editor->canvas_timebars_vsize;
_editor->vertical_adjustment.set_upper (_editor->full_canvas_height);
_editor->_full_canvas_height = position;
_editor->vertical_adjustment.set_upper (_editor->_full_canvas_height);
if ((_editor->vertical_adjustment.get_value() + _editor->_canvas_height) > _editor->vertical_adjustment.get_upper()) {
if ((_editor->vertical_adjustment.get_value() + _editor->_visible_canvas_height) > _editor->vertical_adjustment.get_upper()) {
/*
We're increasing the size of the canvas while the bottom is visible.
We scroll down to keep in step with the controls layout.
*/
_editor->vertical_adjustment.set_value (_editor->full_canvas_height - _editor->_canvas_height);
_editor->vertical_adjustment.set_value (_editor->_full_canvas_height - _editor->_visible_canvas_height);
}
}
@ -1305,8 +1305,8 @@ EditorRoutes::button_press (GdkEventButton* ev)
int y_pos = tv->y_position();
//Clamp the y pos so that we do not extend beyond the canvas full height.
if (_editor->full_canvas_height - y_pos < _editor->_canvas_height){
y_pos = _editor->full_canvas_height - _editor->_canvas_height;
if (_editor->full_canvas_height - y_pos < _editor->_visible_canvas_height){
y_pos = _editor->full_canvas_height - _editor->_visible_canvas_height;
}
//Only scroll to if the track is visible

View File

@ -29,6 +29,8 @@
#include <gtk/gtkaction.h>
#include "canvas/group.h"
#include "ardour/session.h"
#include "ardour/tempo.h"
#include "ardour/profile.h"
@ -121,7 +123,7 @@ Editor::initialize_rulers ()
using namespace Box_Helpers;
BoxList & ruler_lab_children = ruler_label_vbox.children();
BoxList & ruler_children = time_canvas_vbox.children();
BoxList & lab_children = time_button_vbox.children();
BoxList & lab_children = time_bars_vbox.children();
BoxList::iterator canvaspos = ruler_children.begin();
@ -170,7 +172,6 @@ Editor::initialize_rulers ()
minsec_ruler->signal_scroll_event().connect (sigc::mem_fun(*this, &Editor::ruler_scroll));
visible_timebars = 0; /*this will be changed below */
canvas_timebars_vsize = 0;
}
bool
@ -252,7 +253,7 @@ Editor::ruler_button_press (GdkEventButton* ev)
}
/* playhead cursor */
_drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), reinterpret_cast<GdkEvent *> (ev));
_drags->set (new CursorDrag (this, &playhead_cursor->track_canvas_item (), false), reinterpret_cast<GdkEvent *> (ev));
_dragging_playhead = true;
}
@ -657,13 +658,13 @@ Editor::update_ruler_visibility ()
#endif
#endif
if (ruler_meter_action->get_active()) {
old_unit_pos = meter_group->property_y();
old_unit_pos = meter_group->position().y;
if (tbpos != old_unit_pos) {
meter_group->move ( 0.0, tbpos - old_unit_pos);
meter_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = meter_bar_group->property_y();
old_unit_pos = meter_bar_group->position().y;
if (tbgpos != old_unit_pos) {
meter_bar_group->move ( 0.0, tbgpos - old_unit_pos);
meter_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
meter_bar_group->show();
meter_group->show();
@ -678,13 +679,13 @@ Editor::update_ruler_visibility ()
}
if (ruler_tempo_action->get_active()) {
old_unit_pos = tempo_group->property_y();
old_unit_pos = tempo_group->position().y;
if (tbpos != old_unit_pos) {
tempo_group->move(0.0, tbpos - old_unit_pos);
tempo_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = tempo_bar_group->property_y();
old_unit_pos = tempo_bar_group->position().y;
if (tbgpos != old_unit_pos) {
tempo_bar_group->move ( 0.0, tbgpos - old_unit_pos);
tempo_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
tempo_bar_group->show();
tempo_group->show();
@ -699,13 +700,13 @@ Editor::update_ruler_visibility ()
}
if (!Profile->get_sae() && ruler_range_action->get_active()) {
old_unit_pos = range_marker_group->property_y();
old_unit_pos = range_marker_group->position().y;
if (tbpos != old_unit_pos) {
range_marker_group->move (0.0, tbpos - old_unit_pos);
range_marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = range_marker_bar_group->property_y();
old_unit_pos = range_marker_bar_group->position().y;
if (tbgpos != old_unit_pos) {
range_marker_bar_group->move (0.0, tbgpos - old_unit_pos);
range_marker_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
range_marker_bar_group->show();
range_marker_group->show();
@ -721,13 +722,13 @@ Editor::update_ruler_visibility ()
}
if (ruler_loop_punch_action->get_active()) {
old_unit_pos = transport_marker_group->property_y();
old_unit_pos = transport_marker_group->position().y;
if (tbpos != old_unit_pos) {
transport_marker_group->move ( 0.0, tbpos - old_unit_pos);
transport_marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = transport_marker_bar_group->property_y();
old_unit_pos = transport_marker_bar_group->position().y;
if (tbgpos != old_unit_pos) {
transport_marker_bar_group->move ( 0.0, tbgpos - old_unit_pos);
transport_marker_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
transport_marker_bar_group->show();
transport_marker_group->show();
@ -742,13 +743,13 @@ Editor::update_ruler_visibility ()
}
if (ruler_cd_marker_action->get_active()) {
old_unit_pos = cd_marker_group->property_y();
old_unit_pos = cd_marker_group->position().y;
if (tbpos != old_unit_pos) {
cd_marker_group->move (0.0, tbpos - old_unit_pos);
cd_marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = cd_marker_bar_group->property_y();
old_unit_pos = cd_marker_bar_group->position().y;
if (tbgpos != old_unit_pos) {
cd_marker_bar_group->move (0.0, tbgpos - old_unit_pos);
cd_marker_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
cd_marker_bar_group->show();
cd_marker_group->show();
@ -767,13 +768,13 @@ Editor::update_ruler_visibility ()
}
if (ruler_marker_action->get_active()) {
old_unit_pos = marker_group->property_y();
old_unit_pos = marker_group->position().y;
if (tbpos != old_unit_pos) {
marker_group->move ( 0.0, tbpos - old_unit_pos);
marker_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
old_unit_pos = marker_bar_group->property_y();
old_unit_pos = marker_bar_group->position().y;
if (tbgpos != old_unit_pos) {
marker_bar_group->move ( 0.0, tbgpos - old_unit_pos);
marker_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
marker_bar_group->show();
marker_group->show();
@ -813,29 +814,6 @@ Editor::update_ruler_visibility ()
}
#endif
gdouble old_canvas_timebars_vsize = canvas_timebars_vsize;
canvas_timebars_vsize = (timebar_height * visible_timebars) - 1;
gdouble vertical_pos_delta = canvas_timebars_vsize - old_canvas_timebars_vsize;
vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta);
full_canvas_height += vertical_pos_delta;
if (vertical_adjustment.get_value() != 0 && (vertical_adjustment.get_value() + _canvas_height >= full_canvas_height)) {
/*if we're at the bottom of the canvas, don't move the _trackview_group*/
vertical_adjustment.set_value (full_canvas_height - _canvas_height + 1);
} else {
_trackview_group->property_y () = - get_trackview_group_vertical_offset ();
_background_group->property_y () = - get_trackview_group_vertical_offset ();
_trackview_group->move (0, 0);
_background_group->move (0, 0);
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
}
gdouble bottom_track_pos = vertical_adjustment.get_value() + _canvas_height - canvas_timebars_vsize;
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (bottom_track_pos);
if (p.first) {
p.first->clip_to_viewport ();
}
ruler_label_vbox.set_size_request (-1, (int)(timebar_height * visible_rulers));
time_canvas_vbox.set_size_request (-1,-1);
@ -897,9 +875,9 @@ Editor::update_fixed_rulers ()
compute_fixed_ruler_scale ();
ruler_metrics[ruler_metric_timecode].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_samples].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_timecode].units_per_pixel = frames_per_pixel;
ruler_metrics[ruler_metric_samples].units_per_pixel = frames_per_pixel;
ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_pixel;
rightmost_frame = leftmost_frame + current_page_frames();
@ -934,7 +912,7 @@ Editor::update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterato
compute_bbt_ruler_scale (leftmost_frame, leftmost_frame+current_page_frames(),
begin, end);
ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_pixel;
if (ruler_bbt_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(),

View File

@ -364,7 +364,7 @@ void
Editor::get_onscreen_tracks (TrackViewList& tvl)
{
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if ((*i)->y_position() < _canvas_height) {
if ((*i)->y_position() < _visible_canvas_height) {
tvl.push_back (*i);
}
}
@ -1682,12 +1682,12 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
list<Selectable *> touched;
if (after) {
start = cursor->current_frame;
start = cursor->current_frame();
end = _session->current_end_frame();
} else {
if (cursor->current_frame > 0) {
if (cursor->current_frame() > 0) {
start = 0;
end = cursor->current_frame - 1;
end = cursor->current_frame() - 1;
} else {
return;
}

View File

@ -19,6 +19,8 @@
#include "ardour/session.h"
#include "canvas/debug.h"
#include "time_axis_view.h"
#include "streamview.h"
#include "editor_summary.h"
@ -200,7 +202,7 @@ EditorSummary::render (cairo_t* cr)
/* XXX: colour should be set from configuration file */
cairo_set_source_rgba (cr, 1, 0, 0, 1);
const double ph= playhead_frame_to_position (_editor->playhead_cursor->current_frame);
const double ph= playhead_frame_to_position (_editor->playhead_cursor->current_frame());
cairo_move_to (cr, ph, 0);
cairo_line_to (cr, ph, get_height());
cairo_stroke (cr);
@ -397,6 +399,8 @@ EditorSummary::on_button_press_event (GdkEventButton* ev)
_moved = false;
_editor->_dragging_playhead = true;
_editor->set_follow_playhead (false);
ArdourCanvas::checkpoint ("sum", "------------------ summary move drag starts.\n");
}
}
@ -436,7 +440,7 @@ EditorSummary::get_editor (pair<double, double>* x, pair<double, double>* y) con
x->second = x->first + _editor->current_page_frames() * _x_scale;
y->first = editor_y_to_summary (_editor->vertical_adjustment.get_value ());
y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->canvas_height() - _editor->get_canvas_timebars_vsize());
y->second = editor_y_to_summary (_editor->vertical_adjustment.get_value () + _editor->visible_canvas_height())
}
}
@ -676,7 +680,8 @@ EditorSummary::on_scroll_event (GdkEventScroll* ev)
void
EditorSummary::set_editor (double const x, double const y)
{
if (_editor->pending_visual_change.idle_handler_id >= 0) {
ArdourCanvas::checkpoint ("editor", "-> set editor");
if (_editor->pending_visual_change.idle_handler_id >= 0 && _editor->pending_visual_change.executing == true) {
/* As a side-effect, the Editor's visual change idle handler processes
pending GTK events. Hence this motion notify handler can be called
@ -791,10 +796,10 @@ void
EditorSummary::set_editor_y (double const y)
{
double y1 = summary_y_to_editor (y);
double const eh = _editor->canvas_height() - _editor->get_canvas_timebars_vsize ();
double const eh = _editor->visible_canvas_height()
double y2 = y1 + eh;
double const full_editor_height = _editor->full_canvas_height - _editor->get_canvas_timebars_vsize();
double const full_editor_height = _editor->_full_canvas_height;
if (y2 > full_editor_height) {
y1 -= y2 - full_editor_height;
@ -871,7 +876,7 @@ EditorSummary::set_editor_y (pair<double, double> const y)
/* Height that we will use for scaling; use the whole editor height unless there are not
enough tracks to fill it.
*/
double const ch = min (total_height, _editor->canvas_height() - _editor->get_canvas_timebars_vsize());
double const ch = min (total_height, _editor->visible_canvas_height());
/* hence required scale factor of the complete tracks to fit the required y range;
the amount of space they should take up divided by the amount they currently take up.

View File

@ -27,8 +27,6 @@
#include <string>
#include <climits>
#include <libgnomecanvasmm.h>
#include "pbd/error.h"
#include "pbd/memento_command.h"
@ -40,9 +38,11 @@
#include <gtkmm2ext/doi.h>
#include <gtkmm2ext/utils.h>
#include "canvas/canvas.h"
#include "canvas/item.h"
#include "editor.h"
#include "marker.h"
#include "simpleline.h"
#include "tempo_dialog.h"
#include "rgb_macros.h"
#include "gui_thread.h"
@ -191,10 +191,11 @@ Editor::draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
}
if (tempo_lines == 0) {
tempo_lines = new TempoLines(*track_canvas, time_line_group, physical_screen_height(get_window()));
tempo_lines = new TempoLines (*_track_canvas, time_line_group, physical_screen_height(get_window()));
}
tempo_lines->draw (begin, end, frames_per_unit);
// CAIROCANVAS
// tempo_lines->draw (begin, end, frames_per_unit);
}
void

View File

@ -27,10 +27,8 @@ enum Width {
Narrow,
};
namespace Gnome {
namespace Canvas {
class SimpleRect;
}
namespace ArdourCanvas {
class Rectangle;
}
enum LayerDisplay {
@ -40,9 +38,9 @@ enum LayerDisplay {
};
struct SelectionRect {
Gnome::Canvas::SimpleRect *rect;
Gnome::Canvas::SimpleRect *end_trim;
Gnome::Canvas::SimpleRect *start_trim;
ArdourCanvas::Rectangle *rect;
ArdourCanvas::Rectangle *end_trim;
ArdourCanvas::Rectangle *start_trim;
uint32_t id;
};

View File

@ -18,15 +18,16 @@
*/
#include "evoral/Note.hpp"
#include "canvas/group.h"
#include "canvas/rectangle.h"
#include "canvas/wave_view.h"
#include "ardour_ui.h"
#include "automation_time_axis.h"
#include "canvas-note.h"
#include "ghostregion.h"
#include "midi_streamview.h"
#include "midi_time_axis.h"
#include "rgb_macros.h"
#include "simplerect.h"
#include "waveview.h"
#include "note.h"
using namespace std;
using namespace Editing;
@ -39,15 +40,14 @@ GhostRegion::GhostRegion (ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxi
: trackview (tv)
, source_trackview (source_tv)
{
group = new ArdourCanvas::Group (*parent);
group->property_x() = initial_pos;
group->property_y() = 0.0;
group = new ArdourCanvas::Group (parent);
group->set_position (ArdourCanvas::Duple (initial_pos, 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 = new ArdourCanvas::Rectangle (group);
base_rect->set_x0 (0);
base_rect->set_y0 (0);
base_rect->set_y1 (trackview.current_height());
base_rect->set_outline_what (0);
if (!is_automation_ghost()) {
base_rect->hide();
@ -70,21 +70,21 @@ GhostRegion::~GhostRegion ()
void
GhostRegion::set_duration (double units)
{
base_rect->property_x2() = units;
base_rect->set_x1 (units);
}
void
GhostRegion::set_height ()
{
base_rect->property_y2() = (double) trackview.current_height();
base_rect->set_y1 (trackview.current_height());
}
void
GhostRegion::set_colors ()
{
if (is_automation_ghost()) {
base_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
base_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackBase.get();
base_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_GhostTrackBase.get());
base_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_GhostTrackBase.get());
}
}
@ -107,29 +107,27 @@ AudioGhostRegion::AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, do
}
void
AudioGhostRegion::set_samples_per_unit (double spu)
ovoid
AudioGhostRegion::set_frames_per_pixel (double fpp)
{
for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
(*i)->property_samples_per_unit() = spu;
(*i)->set_frames_per_pixel (fpp);
}
}
void
AudioGhostRegion::set_height ()
{
gdouble ht;
vector<WaveView*>::iterator i;
uint32_t n;
GhostRegion::set_height();
ht = ((trackview.current_height()) / (double) waves.size());
double const ht = ((trackview.current_height()) / (double) waves.size());
for (n = 0, i = waves.begin(); i != waves.end(); ++i, ++n) {
gdouble yoff = n * ht;
(*i)->property_height() = ht;
(*i)->property_y() = yoff;
(*i)->set_height (ht);
(*i)->set_y_position (n * ht);
}
}
@ -147,8 +145,8 @@ AudioGhostRegion::set_colors ()
}
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() = fill_color;
waves[n]->set_outline_color (ARDOUR_UI::config()->canvasvar_GhostTrackWave.get());
waves[n]->set_fill_color (fill_color);
waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get();
waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get();
}
@ -189,10 +187,10 @@ MidiGhostRegion::~MidiGhostRegion()
clear_events ();
}
MidiGhostRegion::Event::Event (ArdourCanvas::CanvasNoteEvent* e, ArdourCanvas::Group* g)
MidiGhostRegion::Event::Event (NoteBase* e, ArdourCanvas::Group* g)
: event (e)
{
rect = new ArdourCanvas::SimpleRect (*g, e->x1(), e->y1(), e->x2(), e->y2());
rect = new ArdourCanvas::Rectangle (*g, e->x1(), e->y1(), e->x2(), e->y2());
}
MidiGhostRegion::Event::~Event ()
@ -202,7 +200,7 @@ MidiGhostRegion::Event::~Event ()
}
void
MidiGhostRegion::set_samples_per_unit (double /*spu*/)
MidiGhostRegion::set_frames_per_pixel (double /*spu*/)
{
}
@ -264,7 +262,7 @@ MidiGhostRegion::update_range ()
}
void
MidiGhostRegion::add_note(ArdourCanvas::CanvasNote* n)
MidiGhostRegion::add_note(NoteBase* n)
{
Event* event = new Event (n, group);
events.push_back (event);
@ -302,17 +300,17 @@ MidiGhostRegion::clear_events()
* @param parent The CanvasNote from the parent MidiRegionView.
*/
void
MidiGhostRegion::update_note (ArdourCanvas::CanvasNote* parent)
MidiGhostRegion::update_note (Note* parent)
{
Event* ev = find_event (parent);
if (!ev) {
return;
}
double const x1 = parent->property_x1 ();
double const x2 = parent->property_x2 ();
ev->rect->property_x1 () = x1;
ev->rect->property_x2 () = x2;
double const x1 = parent->x0 ();
double const x2 = parent->x1 ();
ev->rect->set_x0 (x1);
ev->rect->set_x1 (x2);
}
void
@ -334,7 +332,7 @@ MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
*/
MidiGhostRegion::Event *
MidiGhostRegion::find_event (ArdourCanvas::CanvasNoteEvent* parent)
MidiGhostRegion::find_event (Note* parent)
{
/* we are using _optimization_iterator to speed up the common case where a caller
is going through our notes in order.

View File

@ -21,19 +21,15 @@
#define __ardour_gtk_ghost_region_h__
#include <vector>
#include <libgnomecanvasmm.h>
#include "pbd/signals.h"
#include "canvas.h"
namespace Gnome {
namespace Canvas {
class CanvasNoteEvent;
class CanvasNote;
class CanvasHit;
class Diamond;
}
namespace ArdourCanvas {
class WaveView;
}
class NoteBase;
class Note;
class Hit;
class MidiStreamView;
class TimeAxisView;
@ -43,7 +39,7 @@ public:
GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
virtual ~GhostRegion();
virtual void set_samples_per_unit(double spu) = 0;
virtual void set_frames_per_pixel (double) = 0;
virtual void set_height();
virtual void set_colors();
@ -57,7 +53,7 @@ public:
/** TimeAxisView that we are a ghost for */
TimeAxisView& source_trackview;
ArdourCanvas::Group* group;
ArdourCanvas::SimpleRect* base_rect;
ArdourCanvas::Rectangle* base_rect;
static PBD::Signal1<void,GhostRegion*> CatchDeletion;
};
@ -66,7 +62,7 @@ class AudioGhostRegion : public GhostRegion {
public:
AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
void set_samples_per_unit(double spu);
void set_frames_per_pixel (double);
void set_height();
void set_colors();
@ -75,13 +71,13 @@ public:
class MidiGhostRegion : public GhostRegion {
public:
class Event : public sigc::trackable {
class GhostEvent : public sigc::trackable {
public:
Event(ArdourCanvas::CanvasNoteEvent *, ArdourCanvas::Group *);
~Event ();
GhostEvent(::NoteBase *, ArdourCanvas::Group *);
virtual ~GhostEvent () {}
ArdourCanvas::CanvasNoteEvent* event;
ArdourCanvas::SimpleRect* rect;
NoteBase* event;
ArdourCanvas::Rectangle* rect;
};
MidiGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos);
@ -91,22 +87,22 @@ public:
MidiStreamView* midi_view();
void set_height();
void set_samples_per_unit(double spu);
void set_frames_per_pixel (double spu);
void set_colors();
void update_range();
void add_note(ArdourCanvas::CanvasNote*);
void update_note (ArdourCanvas::CanvasNote *);
void remove_note (ArdourCanvas::CanvasNoteEvent *);
void add_note(Note*);
void update_note (Note*);
void remove_note (Note*);
void clear_events();
private:
MidiGhostRegion::Event* find_event (ArdourCanvas::CanvasNoteEvent *);
MidiGhostRegion::Event* find_event (Note*);
typedef std::list<MidiGhostRegion::Event*> EventList;
typedef std::list<MidiGhostRegion::GhostEvent*> EventList;
EventList events;
EventList::iterator _optimization_iterator;
};

View File

@ -1,190 +0,0 @@
// Generated by gtkmmproc -- DO NOT MODIFY!
#include "imageframe.h"
#include "imageframe_p.h"
#include <libgnomecanvasmm/private/shape_p.h>
/* rect.c
*
* Copyright (C) 1998 EMC Capital Management Inc.
* Developed by Havoc Pennington <hp@pobox.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
namespace Gnome
{
namespace Canvas
{
ImageFrame::ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h)
: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
{
item_construct(parentx);
set("pixbuf", pbuf, "x", x,"y", y,"width", w,"height", h, 0);
}
ImageFrame::ImageFrame(Group& parentx)
: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
{
item_construct(parentx);
}
} /* namespace Canvas */
} /* namespace Gnome */
namespace
{
} // anonymous namespace
namespace Glib
{
Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy)
{
return dynamic_cast<Gnome::Canvas::ImageFrame *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}
} /* namespace Glib */
namespace Gnome
{
namespace Canvas
{
/* The *_Class implementation: */
const Glib::Class& ImageFrame_Class::init()
{
if(!gtype_) // create the GType if necessary
{
// Glib::Class has to know the class init function to clone custom types.
class_init_func_ = &ImageFrame_Class::class_init_function;
// This is actually just optimized away, apparently with no harm.
// Make sure that the parent type has been created.
//CppClassParent::CppObjectType::get_type();
// Create the wrapper type, with the same class/instance size as the base type.
register_derived_type(gnome_canvas_imageframe_get_type());
// Add derived versions of interfaces, if the C type implements any interfaces:
}
return *this;
}
void ImageFrame_Class::class_init_function(void* g_class, void* class_data)
{
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
CppClassParent::class_init_function(klass, class_data);
}
Glib::ObjectBase* ImageFrame_Class::wrap_new(GObject* o)
{
return manage(new ImageFrame((GnomeCanvasImageFrame*)(o)));
}
/* The implementation: */
ImageFrame::ImageFrame(const Glib::ConstructParams& construct_params)
: Item(construct_params)
{
}
ImageFrame::ImageFrame(GnomeCanvasImageFrame* castitem)
: Item ((GnomeCanvasItem*)(castitem))
{
}
ImageFrame::~ImageFrame()
{
destroy_();
}
ImageFrame::CppClassType ImageFrame::rect_class_; // initialize static member
GType ImageFrame::get_type()
{
return rect_class_.init().get_type();
}
GType ImageFrame::get_base_type()
{
return gnome_canvas_imageframe_get_type();
}
Glib::PropertyProxy<double> ImageFrame::property_x()
{
return Glib::PropertyProxy<double> (this, "x");
}
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_x() const
{
return Glib::PropertyProxy_ReadOnly<double> (this, "x");
}
Glib::PropertyProxy<double> ImageFrame::property_y()
{
return Glib::PropertyProxy<double> (this, "y");
}
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_y() const
{
return Glib::PropertyProxy_ReadOnly<double> (this, "y");
}
Glib::PropertyProxy<double> ImageFrame::property_width()
{
return Glib::PropertyProxy<double> (this, "width");
}
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_width() const
{
return Glib::PropertyProxy_ReadOnly<double> (this, "width");
}
Glib::PropertyProxy<double> ImageFrame::property_drawwidth()
{
return Glib::PropertyProxy<double> (this, "drawwidth");
}
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_drawwidth() const
{
return Glib::PropertyProxy_ReadOnly<double> (this, "drawwidth");
}
Glib::PropertyProxy<double> ImageFrame::property_height()
{
return Glib::PropertyProxy<double> (this, "height");
}
Glib::PropertyProxy_ReadOnly<double> ImageFrame::property_height() const
{
return Glib::PropertyProxy_ReadOnly<double> (this, "height");
}
Glib::PropertyProxy<Gtk::AnchorType> ImageFrame::property_anchor()
{
return Glib::PropertyProxy<Gtk::AnchorType>(this, "anchor");
}
Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> ImageFrame::property_anchor() const
{
return Glib::PropertyProxy_ReadOnly<Gtk::AnchorType>(this, "anchor");
}
} // namespace Canvas
} // namespace Gnome

View File

@ -1,143 +0,0 @@
// -*- c++ -*-
#ifndef _LIBGNOMECANVASMM_IMAGEFRAME_H
#define _LIBGNOMECANVASMM_IMAGEFRAME_H
#include <glibmm.h>
/* rect.h
*
* Copyright (C) 1998 EMC Capital Management Inc.
* Developed by Havoc Pennington <hp@pobox.com>
*
* Copyright (C) 1999 The Gtk-- Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <libgnomecanvasmm/item.h>
#include <libgnomecanvasmm/group.h>
#include <libgnomecanvasmm/shape.h>
#include "canvas-imageframe.h"
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GnomeCanvasImageFrame GnomeCanvasImageFrame;
typedef struct _GnomeCanvasImageFrameClass GnomeCanvasImageFrameClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gnome
{
namespace Canvas
{ class ImageFrame_Class; } // namespace Canvas
} // namespace Gnome
namespace Gnome
{
namespace Canvas
{
//class Group;
class ImageFrame : public Item
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef ImageFrame CppObjectType;
typedef ImageFrame_Class CppClassType;
typedef GnomeCanvasImageFrame BaseObjectType;
typedef GnomeCanvasImageFrameClass BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
virtual ~ImageFrame();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
friend class ImageFrame_Class;
static CppClassType rect_class_;
// noncopyable
ImageFrame(const ImageFrame&);
ImageFrame& operator=(const ImageFrame&);
protected:
explicit ImageFrame(const Glib::ConstructParams& construct_params);
explicit ImageFrame(GnomeCanvasImageFrame* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_type() G_GNUC_CONST;
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GtkObject.
GnomeCanvasImageFrame* gobj() { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); }
///Provides access to the underlying C GtkObject.
const GnomeCanvasImageFrame* gobj() const { return reinterpret_cast<GnomeCanvasImageFrame*>(gobject_); }
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
private:
public:
ImageFrame(Group& parentx, ArtPixBuf* pbuf, double x, double y, Gtk::AnchorType anchor, double w, double h);
explicit ImageFrame(Group& parent);
Glib::PropertyProxy<double> property_x();
Glib::PropertyProxy_ReadOnly<double> property_x() const;
Glib::PropertyProxy<double> property_y();
Glib::PropertyProxy_ReadOnly<double> property_y() const;
Glib::PropertyProxy<double> property_width();
Glib::PropertyProxy_ReadOnly<double> property_width() const;
Glib::PropertyProxy<double> property_drawwidth();
Glib::PropertyProxy_ReadOnly<double> property_drawwidth() const;
Glib::PropertyProxy<double> property_height();
Glib::PropertyProxy_ReadOnly<double> property_height() const;
Glib::PropertyProxy<Gtk::AnchorType> property_anchor() ;
Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> property_anchor() const;
};
} /* namespace Canvas */
} /* namespace Gnome */
namespace Glib
{
/** @relates Gnome::Canvas::ImageFrame
* @param object The C instance
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*/
Gnome::Canvas::ImageFrame* wrap(GnomeCanvasImageFrame* object, bool take_copy = false);
}
#endif /* _LIBGNOMECANVASMM_IMAGEFRAME_H */

View File

@ -32,7 +32,6 @@
#include "public_editor.h"
#include "imageframe_time_axis.h"
#include "simplerect.h"
#include "enums.h"
#include "imageframe_time_axis_view.h"
#include "imageframe_time_axis_group.h"
@ -41,7 +40,6 @@
#include "marker_time_axis.h"
#include "marker_view.h"
#include "gui_thread.h"
#include "canvas_impl.h"
#include "i18n.h"
@ -142,18 +140,18 @@ ImageFrameTimeAxis::set_height (uint32_t h)
}
/**
* Sets the number of samples per unit that are used.
* Sets the number of frames per pixel that are used.
* This is used to determine the siezes of items upon this time axis
*
* @param spu the number of samples per unit
* @param fpp the number of frames per pixel
*/
void
ImageFrameTimeAxis::set_samples_per_unit(double spu)
ImageFrameTimeAxis::set_frames_per_pixel (double fpp)
{
TimeAxisView::set_samples_per_unit (editor.get_current_zoom());
TimeAxisView::set_frames_per_pixel (editor.get_current_zoom ());
if(view) {
view->set_samples_per_unit(spu) ;
if (view) {
view->set_frames_per_pixel (fpp);
}
}

View File

@ -22,12 +22,10 @@
#include <list>
//#include <libgnomecanvas.h>
#include "ardour_dialog.h"
#include "enums.h"
#include "time_axis_view.h"
#include "canvas.h"
#include "visual_time_axis.h"
namespace ARDOUR
@ -80,13 +78,7 @@ class ImageFrameTimeAxis : public VisualTimeAxis
*/
virtual void set_height(uint32_t h) ;
/**
* Sets the number of samples per unit that are used.
* This is used to determine the siezes of items upon this time axis
*
* @param spu the number of samples per unit
*/
virtual void set_samples_per_unit(double spu) ;
virtual void set_frames_per_pixel (double);
/**
* Returns the available height for images to be drawn onto

View File

@ -26,7 +26,6 @@
#include "imageframe_time_axis_view.h"
#include "imageframe_view.h"
#include "imageframe_time_axis.h"
#include "canvas-simplerect.h"
#include "region_selection.h"
#include "public_editor.h"
#include "gui_thread.h"
@ -148,19 +147,17 @@ ImageFrameTimeAxisGroup::set_item_heights(gdouble h)
* @param spu the new samples per canvas unit value
*/
int
ImageFrameTimeAxisGroup::set_item_samples_per_units(gdouble spp)
ImageFrameTimeAxisGroup::set_item_frames_per_pixel (double fpp)
{
if(spp < 1.0)
{
return(-1);
if (fpp < 1.0) {
return -1;
}
for(ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer)
{
(*citer)->set_samples_per_unit(spp);
for (ImageFrameViewList::const_iterator citer = imageframe_views.begin(); citer != imageframe_views.end(); ++citer) {
(*citer)->set_frames_per_pixel (fpp);
}
return(0);
return 0;
}
/**

View File

@ -25,7 +25,6 @@
#include <gdkmm/color.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include <jack/jack.h>
#include "ardour/types.h"
#include "imageframe_time_axis_view.h"
@ -105,13 +104,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
*/
int set_item_heights(gdouble) ;
/**
* Sets the current samples per unit.
* this method tells each item upon the time axis of the change
*
* @param spu the new samples per canvas unit value
*/
int set_item_samples_per_units(gdouble spu) ;
int set_item_frames_per_pixel (double);
/**
* Sets the color of the items contained uopn this view helper
@ -263,7 +256,7 @@ class ImageFrameTimeAxisGroup : public sigc::trackable
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void reset_samples_per_unit() ;
void reset_frames_per_pixel ();
/**
* Callback used to remove this group during the gtk idle loop

View File

@ -27,7 +27,6 @@
#include "imageframe_time_axis_group.h"
#include "imageframe_view.h"
#include "imageframe_time_axis.h"
#include "canvas-simplerect.h"
#include "region_selection.h"
#include "public_editor.h"
#include "rgb_macros.h"
@ -60,9 +59,9 @@ ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv)
canvas_rect.signal_event().connect (sigc::bind (sigc::mem_fun (_trackview.editor, &PublicEditor::canvas_imageframe_view_event), (ArdourCanvas::Item*) &canvas_rect, &tv));
_samples_per_unit = _trackview.editor.get_current_zoom() ;
_frames_per_pixel = _trackview.editor.get_current_zoom() ;
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &ImageFrameTimeAxisView::reset_samples_per_unit)) ;
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &ImageFrameTimeAxisView::reset_frames_per_pixel)) ;
selected_imageframe_group = 0 ;
selected_imageframe_view = 0 ;
@ -147,20 +146,19 @@ ImageFrameTimeAxisView::set_position (gdouble x, gdouble y)
* @param spu the new samples per canvas unit value
*/
int
ImageFrameTimeAxisView::set_samples_per_unit (gdouble spp)
ImageFrameTimeAxisView::set_frames_per_pixel (double fpp)
{
if (spp < 1.0) {
return(-1) ;
if (fpp < 1.0) {
return -1;
}
_samples_per_unit = spp;
_frames_per_pixel = fpp;
for(ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer)
{
(*citer)->set_item_samples_per_units(spp) ;
for (ImageFrameGroupList::const_iterator citer = imageframe_groups.begin(); citer != imageframe_groups.end(); ++citer) {
(*citer)->set_item_frames_per_pixels (fpp);
}
return(0) ;
return 0;
}
/**
@ -184,9 +182,9 @@ ImageFrameTimeAxisView::apply_color(Gdk::Color& color)
*
*/
void
ImageFrameTimeAxisView::reset_samples_per_unit ()
ImageFrameTimeAxisView::reset_frames_per_pixel ()
{
set_samples_per_unit (_trackview.editor.get_current_zoom());
set_frames_per_pixel (_trackview.editor.get_current_zoom());
}

View File

@ -27,9 +27,6 @@
#include <jack/jack.h>
#include <libgnomecanvasmm.h>
#include "canvas.h"
#include "simplerect.h"
class PublicEditor ;
@ -96,20 +93,8 @@ class ImageFrameTimeAxisView : public sigc::trackable
*/
int set_position(gdouble x, gdouble y) ;
/**
* Sets the current samples per unit.
* this method tells each item upon the time axis of the change
*
* @param spu the new samples per canvas unit value
*/
int set_samples_per_unit(gdouble spu) ;
/**
* Returns the current samples per unit of this time axis view helper
*
* @return the current samples per unit of this time axis view helper
*/
gdouble get_samples_per_unit() { return _samples_per_unit; }
int set_frames_per_pixel (double);
double get_frames_per_pixel () { return _frames_per_pixel; }
/**
* Sets the color of the items contained uopn this view helper
@ -237,9 +222,8 @@ class ImageFrameTimeAxisView : public sigc::trackable
private:
/**
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void reset_samples_per_unit() ;
void reset_frames_per_pixel ();
/**
* The list of ImageFrameViews held by this view helper */
@ -261,10 +245,10 @@ class ImageFrameTimeAxisView : public sigc::trackable
ImageFrameTimeAxis& _trackview ;
ArdourCanvas::Group canvas_group ;
ArdourCanvas::SimpleRect canvas_rect; /* frame around the whole thing */
ArdourCanvas::Rectangle canvas_rect; /* frame around the whole thing */
/** the current samples per unit */
double _samples_per_unit ;
/** the current frames per pixel */
double _frames_per_pixel;
/* XXX why are these different? */
Gdk::Color region_color ;

View File

@ -31,7 +31,6 @@
#include "utils.h"
#include "imageframe_view.h"
#include "imageframe.h"
#include "canvas_impl.h"
#include "gui_thread.h"
using namespace ARDOUR;

View File

@ -22,11 +22,9 @@
#include <string>
#include <gdkmm/color.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include <sigc++/signal.h>
#include <list>
#include "canvas.h"
#include "enums.h"
#include "time_axis_view_item.h"
#include "marker_view.h"

View File

@ -1,803 +0,0 @@
/*
Copyright (C) 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 "lineset.h"
#include "rgb_macros.h"
#include <libgnomecanvas/libgnomecanvas.h>
#include <libgnomecanvasmm/group.h>
#include <libgnomecanvasmm/canvas.h>
#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;
namespace Gnome {
namespace Canvas {
LineSetClass LineSet::lineset_class;
//static const char* overlap_error_str = "LineSet error: Line overlap";
LineSet::Line::Line(double c, double w, uint32_t color)
: coord(c)
, width(w)
{
UINT_TO_RGBA (color, &r, &g, &b, &a);
}
/* Constructor for dummy lines that are used only with the coordinate */
LineSet::Line::Line(double c)
: coord(c)
{
}
void
LineSet::Line::set_color(uint32_t color)
{
UINT_TO_RGBA (color, &r, &g, &b, &a);
}
const Glib::Class&
LineSetClass::init()
{
if (!gtype_) {
class_init_func_ = &LineSetClass::class_init_function;
register_derived_type(Item::get_type());
}
return *this;
}
void
LineSetClass::class_init_function(void* /*g_class*/, void* /*class_data*/)
{
}
LineSet::LineSet(Group& parent, Orientation o)
: Glib::ObjectBase("GnomeCanvasLineSet")
, Item(Glib::ConstructParams(lineset_class.init()))
, cached_pos(lines.end())
, orientation(o)
, x1(*this, "x1", 0.0)
, y1(*this, "y1", 0.0)
, x2(*this, "x2", 0.0)
, y2(*this, "y2", 0.0)
, in_update(false)
, update_region1(1.0)
, update_region2(0.0)
, bounds_changed(false)
, covered1(1.0) // covered1 > covered2 ==> nothing's covered
, covered2(0.0)
{
item_construct(parent);
property_x1().signal_changed().connect(sigc::mem_fun(*this, &LineSet::bounds_need_update));
property_y1().signal_changed().connect(sigc::mem_fun(*this, &LineSet::bounds_need_update));
property_x2().signal_changed().connect(sigc::mem_fun(*this, &LineSet::bounds_need_update));
property_y2().signal_changed().connect(sigc::mem_fun(*this, &LineSet::bounds_need_update));
}
LineSet::~LineSet()
{
}
bool
LineSet::line_compare(const Line& a, const Line& b)
{
return a.coord < b.coord;
}
void
LineSet::print_lines()
{
for (Lines::iterator it = lines.begin(); it != lines.end(); ++it) {
cerr << " " << it->coord << " " << it->width << " " << (int)it->r << " " << (int)it->g << " " << (int)it->b << " " << (int)it->a << endl;
}
}
void
LineSet::move_line(double coord, double dest)
{
if (coord == dest) {
return;
}
Lines::iterator it = line_at(coord);
if (it != lines.end()) {
double width = it->width;
it->coord = dest;
Lines::iterator ins = lower_bound(lines.begin(), lines.end(), *it, line_compare);
lines.insert(ins, *it);
lines.erase(it);
if (coord > dest) {
region_needs_update(dest, coord + width);
} else {
region_needs_update(coord, dest + width);
}
}
}
void
LineSet::change_line_width(double coord, double width)
{
Lines::iterator it = line_at(coord);
if (it != lines.end()) {
Line& l = *it;
++it;
if (it != lines.end()) {
if (l.coord + width > it->coord) {
//cerr << overlap_error_str << endl;
return;
}
}
l.width = width;
region_needs_update(coord, coord + width);
}
}
void
LineSet::change_line_color(double coord, uint32_t color)
{
Lines::iterator it = line_at(coord);
if (it != lines.end()) {
it->set_color(color);
region_needs_update(it->coord, it->coord + it->width);
}
}
void
LineSet::add_line(double coord, double width, uint32_t color)
{
Line l(coord, width, color);
Lines::iterator it = std::lower_bound(lines.begin(), lines.end(), l, line_compare);
/* overlap checking */
if (it != lines.end()) {
if (l.coord + l.width > it->coord) {
//cerr << overlap_error_str << endl;
return;
}
}
if (it != lines.begin()) {
--it;
if (l.coord < it->coord + it->width) {
//cerr << overlap_error_str << endl;
return;
}
++it;
}
lines.insert(it, l);
region_needs_update(coord, coord + width);
}
void
LineSet::remove_line(double coord)
{
Lines::iterator it = line_at(coord);
if (it != lines.end()) {
double start = it->coord;
double end = start + it->width;
lines.erase(it);
region_needs_update(start, end);
}
}
void
LineSet::remove_lines(double c1, double c2)
{
if (!lines.empty()) {
region_needs_update(c1, c2);
}
}
void
LineSet::remove_until(double coord)
{
if (!lines.empty()) {
double first = lines.front().coord;
// code
region_needs_update(first, coord);
}
}
void
LineSet::remove_from(double coord)
{
if (!lines.empty()) {
double last = lines.back().coord + lines.back().width;
// code
region_needs_update(coord, last);
}
}
void
LineSet::clear()
{
if (!lines.empty()) {
double coord1 = lines.front().coord;
double coord2 = lines.back().coord + lines.back().width;
lines.clear();
region_needs_update(coord1, coord2);
}
}
/*
* this function is optimized to work faster if we access elements that are adjacent to each other.
* so if a large number of lines are modified, it is wise to modify them in sorted order.
*/
LineSet::Lines::iterator
LineSet::line_at(double coord)
{
if (cached_pos != lines.end()) {
if (coord < cached_pos->coord) {
/* backward search */
while (--cached_pos != lines.end()) {
if (cached_pos->coord <= coord) {
if (cached_pos->coord + cached_pos->width < coord) {
/* coord is between two lines */
return lines.end();
} else {
return cached_pos;
}
}
}
} else {
/* forward search */
while (cached_pos != lines.end()) {
if (cached_pos->coord > coord) {
/* we searched past the line that we want, so now see
if the previous line includes the coordinate */
--cached_pos;
if (cached_pos->coord + cached_pos->width >= coord) {
return cached_pos;
} else {
return lines.end();
}
}
++cached_pos;
}
}
} else {
/* initialize the cached position */
Line dummy(coord);
cached_pos = lower_bound(lines.begin(), lines.end(), dummy, line_compare);
/* The iterator found should point to the element after the one we want. */
--cached_pos;
if (cached_pos != lines.end()) {
if (cached_pos->coord <= coord) {
if (cached_pos->coord + cached_pos->width >= coord) {
return cached_pos;
} else {
return lines.end();
}
} else {
return lines.end();
}
} else {
return lines.end();
}
}
return lines.end();
}
void
LineSet::redraw_request (ArtDRect const & r)
{
int x0, y0, x1, y1;
Canvas& cv = *get_canvas();
//cerr << "redraw request: " << r.x0 << " " << r.y0 << " " << r.x1 << " " << r.y1 << endl;
double fx0 = r.x0;
if (fx0 > INT_MAX) {
fx0 = INT_MAX;
}
double fx1 = r.x1;
if (fx1 > INT_MAX) {
fx1 = INT_MAX;
}
cv.w2c (fx0, r.y0, x0, y0);
cv.w2c (fx1, r.y1, x1, y1);
cv.request_redraw(x0, y0, x1, y1);
}
void
LineSet::update_lines(bool need_redraw)
{
//cerr << "update_lines need_redraw=" << need_redraw << endl;
if (!need_redraw) {
update_region1 = 1.0;
update_region2 = 0.0;
return;
}
if (update_region2 > update_region1) {
ArtDRect redraw;
LineSet::bounds_vfunc(&redraw.x0, &redraw.y0, &redraw.x1, &redraw.y1);
i2w(redraw.x0, redraw.y0);
i2w(redraw.x1, redraw.y1);
if (orientation == Vertical) {
redraw.x1 = redraw.x0 + update_region2;
redraw.x0 += update_region1;
} else {
redraw.y1 = redraw.y0 + update_region2;
redraw.y0 += update_region1;
}
redraw_request(redraw);
update_region1 = 1.0;
update_region2 = 0.0;
}
// if we need to calculate what becomes visible, use some of this
//cv.c2w (0, 0, world_v[X1], world_v[Y1]);
//cv.c2w (cv.get_width(), cv.get_height(), world_v[X2], world_v[Y2]);
}
/*
* return false if a full redraw request has been made.
* return true if nothing or only parts of the rect area has been requested for redraw
*/
bool
LineSet::update_bounds()
{
GnomeCanvasItem* item = GNOME_CANVAS_ITEM(gobj());
ArtDRect old_b;
ArtDRect new_b;
ArtDRect redraw;
Canvas& cv = *get_canvas();
/* store the old bounding box */
old_b.x0 = item->x1;
old_b.y0 = item->y1;
old_b.x1 = item->x2;
old_b.y1 = item->y2;
LineSet::bounds_vfunc(&new_b.x0, &new_b.y0, &new_b.x1, &new_b.y1);
i2w(new_b.x0, new_b.y0);
i2w(new_b.x1, new_b.y1);
item->x1 = new_b.x0;
item->y1 = new_b.y0;
item->x2 = new_b.x1;
item->y2 = new_b.y1;
/* Update bounding box used in rendering function */
double fx0 = new_b.x0;
if (fx0 > INT_MAX) {
fx0 = INT_MAX;
}
double fx1 = new_b.x1;
if (fx1 > INT_MAX) {
fx1 = INT_MAX;
}
cv.w2c (fx0, new_b.y0, bbox.x0, bbox.y0);
cv.w2c (fx1, new_b.y1, bbox.x1, bbox.y1);
/*
* if the first primary axis property (x1 for Vertical, y1 for Horizontal) changed, we must redraw everything,
* because lines are positioned relative to this coordinate. Please excuse the confusion resulting from
* gnome canvas coordinate numbering (1, 2) and libart's (0, 1).
*/
if (orientation == Vertical) {
if (new_b.x0 == old_b.x0) {
/* No need to update everything */
if (new_b.y0 != old_b.y0) {
redraw.x0 = old_b.x0;
redraw.y0 = min(old_b.y0, new_b.y0);
redraw.x1 = old_b.x1;
redraw.y1 = max(old_b.y0, new_b.y0);
redraw_request(redraw);
}
if (new_b.y1 != old_b.y1) {
redraw.x0 = old_b.x0;
redraw.y0 = min(old_b.y1, new_b.y1);
redraw.x1 = old_b.x1;
redraw.y1 = max(old_b.y1, new_b.y1);
redraw_request(redraw);
}
if (new_b.x1 > old_b.x1) {
// we have a larger area ==> possibly more lines
request_lines(old_b.x1, new_b.x1);
redraw.x0 = old_b.x1;
redraw.y0 = min(old_b.y0, new_b.y0);
redraw.x1 = new_b.x1;
redraw.y1 = max(old_b.y1, new_b.y1);
redraw_request(redraw);
} else if (new_b.x1 < old_b.x1) {
remove_lines(new_b.x1, old_b.x1);
redraw.x0 = new_b.x1;
redraw.y0 = min(old_b.y0, new_b.y0);
redraw.x1 = old_b.x1;
redraw.y1 = max(old_b.y1, new_b.y1);
redraw_request(redraw);
}
return true;
} else {
/* update everything */
//cerr << "update everything" << endl;
art_drect_union(&redraw, &old_b, &new_b);
redraw_request(redraw);
return false;
}
} else {
if (new_b.y0 == old_b.y0) {
/* No need to update everything */
if (new_b.x0 != old_b.x0) {
redraw.y0 = old_b.y0;
redraw.x0 = min(old_b.x0, new_b.x0);
redraw.y1 = old_b.y1;
redraw.x1 = max(old_b.x0, new_b.x0);
redraw_request(redraw);
}
if (new_b.x1 != old_b.x1) {
redraw.y0 = old_b.y0;
redraw.x0 = min(old_b.x1, new_b.x1);
redraw.y1 = old_b.y1;
redraw.x1 = max(old_b.x1, new_b.x1);
redraw_request(redraw);
}
if (new_b.y1 > old_b.y1) {
// we have a larger area ==> possibly more lines
request_lines(old_b.y1, new_b.y1);
redraw.y0 = old_b.y1;
redraw.x0 = min(old_b.x0, new_b.x0);
redraw.y1 = new_b.y1;
redraw.x1 = max(old_b.x1, new_b.x1);
redraw_request(redraw);
} else if (new_b.y1 < old_b.y1) {
remove_lines(new_b.y1, old_b.y1);
redraw.y0 = new_b.y1;
redraw.x0 = min(old_b.x0, new_b.x0);
redraw.y1 = old_b.y1;
redraw.x1 = max(old_b.x1, new_b.x1);
redraw_request(redraw);
}
return true;
} else {
/* update everything */
art_drect_union(&redraw, &old_b, &new_b);
redraw_request(redraw);
return false;
}
}
}
/*
* what to do here?
* 1. find out if any line data has been modified since last update.
* N. find out if the item moved. if it moved, the old bbox and the new bbox need to be updated.
*/
void
LineSet::update_vfunc(double* /*affine*/, ArtSVP* /*clip_path*/, int /*flags*/)
{
GnomeCanvasItem* item = GNOME_CANVAS_ITEM(gobj());
bool lines_need_redraw = true;
/*
* need to call gnome_canvas_item_update here, to unset the need_update flag.
* but a call to Gnome::Canvas::Item::update_vfunc results in infinite recursion.
* that function is declared in gnome_canvas.c so no way to call it directly:
* Item::update_vfunc(affine, clip_path, flags);
* So just copy the code from that function. This has to be a bug or
* something I haven't figured out.
*/
GTK_OBJECT_UNSET_FLAGS (item, GNOME_CANVAS_ITEM_NEED_UPDATE);
GTK_OBJECT_UNSET_FLAGS (item, GNOME_CANVAS_ITEM_NEED_AFFINE);
GTK_OBJECT_UNSET_FLAGS (item, GNOME_CANVAS_ITEM_NEED_CLIP);
GTK_OBJECT_UNSET_FLAGS (item, GNOME_CANVAS_ITEM_NEED_VIS);
//cerr << "update {" << endl;
in_update = true;
// ahh. We must update bounds no matter what. If the group position changed,
// there is no way that we are notified of that.
//if (bounds_changed) {
lines_need_redraw = update_bounds();
bounds_changed = false;
//}
update_lines(lines_need_redraw);
in_update = false;
//cerr << "}" << endl;
}
void
LineSet::draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& /*drawable*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/)
{
cerr << "please don't use the GnomeCanvasLineSet item in a non-aa Canvas" << endl;
abort();
}
inline void
LineSet::paint_vert(GnomeCanvasBuf* buf, LineSet::Line& line, int x1, int y1, int x2, int y2)
{
if (line.width == 1.0) {
PAINT_VERTA(buf, line.r, line.g, line.b, line.a, x1, y1, y2);
} else {
PAINT_BOX(buf, line.r, line.g, line.b, line.a, x1, y1, x2, y2);
}
}
inline void
LineSet::paint_horiz(GnomeCanvasBuf* buf, LineSet::Line& line, int x1, int y1, int x2, int y2)
{
if (line.width == 1.0) {
PAINT_HORIZA(buf, line.r, line.g, line.b, line.a, x1, x2, y1);
} else {
PAINT_BOX(buf, line.r, line.g, line.b, line.a, x1, y1, x2, y2);
}
}
void
LineSet::render_vfunc(GnomeCanvasBuf* buf)
{
ArtIRect rect;
int pos0, pos1, offset;
if (buf->is_bg) {
gnome_canvas_buf_ensure_buf (buf);
buf->is_bg = FALSE;
}
/* get the rect that we are rendering to */
art_irect_intersect(&rect, &bbox, &buf->rect);
#if 0
/* DEBUG render bounding box for this region. should result in the full
bounding box when all rendering regions are finished */
PAINT_BOX(buf, 0xaa, 0xaa, 0xff, 0xbb, rect.x0, rect.y0, rect.x1, rect.y1);
#endif
#if 0
/* harlequin debugging, shows the rect that is actually drawn, distinct from
rects from other render cycles */
gint r, g, b, a;
r = random() % 0xff;
g = random() % 0xff;
b = random() % 0xff;
PAINT_BOX(buf, r, g, b, 0x33, rect.x0, rect.y0, rect.x1, rect.y1);
#endif
if (lines.empty()) {
return;
}
Lines::iterator it = lines.begin();
Lines::iterator end = --lines.end();
/**
* The first and the last line in this render have to be handled separately from those in between, because those lines
* may be cut off at the ends.
*/
if (orientation == Vertical) {
offset = bbox.x0;
// skip parts of lines that are to the right of the buffer, and paint the last line visible
for (; end != lines.end(); --end) {
pos0 = ((int) floor(end->coord)) + offset;
if (pos0 < rect.x1) {
pos1 = min((pos0 + (int) floor(end->width)), rect.x1);
if (pos0 < rect.x0 && pos1 < rect.x0) {
return;
}
paint_vert(buf, *end, pos0, rect.y0, pos1, rect.y1);
break;
}
}
if (end == lines.end()) {
return;
}
// skip parts of lines that are to the left of the buffer
for (; it != end; ++it) {
pos0 = ((int) floor(it->coord)) + offset;
pos1 = pos0 + ((int) floor(it->width));
if (pos1 > rect.x0) {
pos0 = max(pos0, rect.x0);
paint_vert(buf, *it, pos0, rect.y0, pos1, rect.y1);
++it;
break;
}
}
// render what's between the first and last lines
for (; it != end; ++it) {
pos0 = ((int) floor(it->coord)) + offset;
pos1 = pos0 + ((int) floor(it->width));
paint_vert(buf, *it, pos0, rect.y0, pos1, rect.y1);
}
} else {
offset = bbox.y0;
// skip parts of lines that are to the right of the buffer, and paint the last line visible
for (; end != lines.end(); --end) {
pos0 = ((int) floor(end->coord)) + offset;
if (pos0 < rect.y1) {
pos1 = min((pos0 + (int) floor(end->width)), rect.y1);
if (pos0 < rect.y0 && pos1 < rect.y0) {
return;
}
paint_horiz(buf, *end, rect.x0, pos0, rect.x1, pos1);
break;
}
}
if (end == lines.end()) {
return;
}
// skip parts of lines that are to the left of the buffer
for (; it != end; ++it) {
pos0 = ((int) floor(it->coord)) + offset;
pos1 = pos0 + ((int) floor(it->width));
if (pos1 > rect.y0) {
pos0 = max(pos0, rect.y0);
paint_horiz(buf, *it, rect.x0, pos0, rect.x1, pos1);
++it;
break;
}
}
// render what's between the first and last lines
for (; it != end; ++it) {
pos0 = ((int) floor(it->coord)) + offset;
pos1 = pos0 + ((int) floor(it->width));
paint_horiz(buf, *it, rect.x0, pos0, rect.x1, pos1);
}
}
}
void
LineSet::bounds_vfunc(double* _x1, double* _y1, double* _x2, double* _y2)
{
*_x1 = x1;
*_y1 = y1;
*_x2 = x2 + 1;
*_y2 = y2 + 1;
}
double
LineSet::point_vfunc(double x, double y, int /*cx*/, int /*cy*/, GnomeCanvasItem** actual_item)
{
double x1, y1, x2, y2;
double dx, dy;
LineSet::bounds_vfunc(&x1, &y1, &x2, &y2);
*actual_item = gobj();
if (x < x1) {
dx = x1 - x;
} else if (x > x2) {
dx = x - x2;
} else {
dx = 0.0;
}
if (y < y1) {
dy = y1 - y;
} else if (y > y2) {
dy = y - y2;
} else {
if (dx == 0.0) {
// point is inside
return 0.0;
} else {
dy = 0.0;
}
}
return sqrt (dx * dx + dy * dy);
}
/* If not overrided emit the signal */
void
LineSet::request_lines(double c1, double c2)
{
signal_request_lines(*this, c1, c2);
}
void
LineSet::bounds_need_update()
{
bounds_changed = true;
if (!in_update) {
request_update();
}
}
void
LineSet::region_needs_update(double coord1, double coord2)
{
if (update_region1 > update_region2) {
update_region1 = coord1;
update_region2 = coord2;
} else {
update_region1 = min(update_region1, coord1);
update_region2 = max(update_region2, coord2);
}
if (!in_update) {
request_update();
}
}
/*
* These have been defined to avoid endless recursion with gnomecanvasmm.
* Don't know why this happens
*/
bool LineSet::on_event(GdkEvent* /*p1*/)
{
return false;
}
void LineSet::realize_vfunc() { }
void LineSet::unrealize_vfunc() { }
void LineSet::map_vfunc() { }
void LineSet::unmap_vfunc() { }
} /* namespace Canvas */
} /* namespace Gnome */

View File

@ -1,194 +0,0 @@
/*
Copyright (C) 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.
*/
#ifndef __gnome_canvas_lineset_h__
#define __gnome_canvas_lineset_h__
#include <stdint.h>
#include <libgnomecanvasmm/item.h>
namespace Gnome {
namespace Canvas {
class LineSetClass : public Glib::Class {
public:
const Glib::Class& init();
static void class_init_function(void* g_class, void* class_data);
};
/** A canvas item that displays a set of vertical or horizontal lines,
* spanning the entire size of the item.
*/
class LineSet : public Item {
public:
enum Orientation {
Vertical,
Horizontal
};
LineSet(Group& parent, Orientation);
virtual ~LineSet();
Glib::PropertyProxy<double> property_x1() { return x1.get_proxy(); }
Glib::PropertyProxy<double> property_y1() { return y1.get_proxy(); }
Glib::PropertyProxy<double> property_x2() { return x2.get_proxy(); }
Glib::PropertyProxy<double> property_y2() { return y2.get_proxy(); }
/* Note: every line operation takes a coord parameter, as an index to
* the line it modifies. The index will identify a line if it is between
* line.coord and line.coord + line.width.
*/
/** Move a line to a new position.
* For this to work (to move the desired line) it is important that
* lines have unique coordinates. This also applies to every line
* accessing functions below
*/
void move_line(double coord, double dest);
/** Change the width of a line.
* Only allow if the new width doesn't overlap the next line (see below)
*/
void change_line_width(double coord, double width);
/** Change the color of a line.
*/
void change_line_color(double coord, uint32_t color);
/** Add a line to draw.
* width is an offset, so that coord + width specifies the end of the line.
* lines should not overlap, as no layering information is provided.
* however, line_coord[i] + line_width[i] == line_coord[i+1] is
* be legal, as the coordinates are real numbers and represents
* real world coordinates. Two real world object sharing coordinates for start
* and end are not overlapping.
*/
void add_line(double coord, double width, uint32_t color);
/** Remove the line at coord
*/
void remove_line(double coord);
/** Remove all lines in a coordinate range
*/
void remove_lines(double c1, double c2);
/** Remove all lines with a coordinate lower than coord
*/
void remove_until(double coord);
/** Remove all lines with a coordinate equal to or higher than coord.
*/
void remove_from(double coord);
/** Remove all lines.
*/
void clear();
/** Add a set of lines in the given range.
* For every line visible in the provided coordinate range, call add_line().
* This is called when the area between c1 and c2 becomes visible, when
* previously outside any possible view.
* The number of calls to this function should be kept at a minimum.
*/
virtual void request_lines(double c1, double c2);
/** Instead of overriding the update_lines function one can connect to this
* and add lines externally instead.
* If add_lines() is overrided, this signal will not be emitted.
*/
sigc::signal<void, LineSet&, double, double> signal_request_lines;
/* overridden from Gnome::Canvas::Item */
void update_vfunc(double* affine, ArtSVP* clip_path, int flags);
void realize_vfunc();
void unrealize_vfunc();
void map_vfunc();
void unmap_vfunc();
void draw_vfunc(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);
void render_vfunc(GnomeCanvasBuf* buf);
double point_vfunc(double x, double y, int cx, int cy, GnomeCanvasItem** actual_item);
void bounds_vfunc(double* x1, double* y1, double* x2, double* y2);
bool on_event(GdkEvent* p1);
/* debug */
void print_lines();
protected:
struct Line {
Line(double c, double w, uint32_t color);
Line(double c);
void set_color(uint32_t color);
double coord;
double width;
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
};
static inline void paint_vert(GnomeCanvasBuf* buf, LineSet::Line& line, int x1, int y1, int x2, int y2);
static inline void paint_horiz(GnomeCanvasBuf* buf, LineSet::Line& line, int x1, int y1, int x2, int y2);
static bool line_compare(const Line& a, const Line& b);
typedef std::list<Line> Lines;
void bounds_need_update();
void region_needs_update(double coord1, double coord2);
bool update_bounds();
void update_lines(bool need_redraw);
void redraw_request (ArtDRect const &);
Lines::iterator line_at(double coord);
/** Stores last accessed line so adjacent lines are found faster */
Lines::iterator cached_pos;
static LineSetClass lineset_class;
Orientation orientation;
Lines lines;
/* properties */
Glib::Property<double> x1;
Glib::Property<double> y1;
Glib::Property<double> x2;
Glib::Property<double> y2;
/** Cached bounding box in canvas coordinates */
ArtIRect bbox;
private:
LineSet();
LineSet(const LineSet&);
bool in_update;
/* a range that needs update update1 > update2 ==> no update needed */
double update_region1;
double update_region2;
bool bounds_changed;
double covered1;
double covered2;
};
} /* namespace Canvas */
} /* namespace Gnome */
#endif /* __gnome_canvas_lineset_h__ */

0
gtk2_ardour/lxvst_plugin_ui.h Executable file → Normal file
View File

View File

@ -19,6 +19,11 @@
#include <sigc++/bind.h>
#include "ardour/tempo.h"
#include "canvas/rectangle.h"
#include "canvas/group.h"
#include "canvas/line.h"
#include "canvas/polygon.h"
#include "canvas/pixbuf.h"
#include "ardour_ui.h"
/*
@ -30,9 +35,6 @@
#include "marker.h"
#include "public_editor.h"
#include "utils.h"
#include "canvas_impl.h"
#include "simpleline.h"
#include "simplerect.h"
#include "rgb_macros.h"
#include <gtkmm2ext/utils.h>
@ -134,12 +136,12 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case Mark:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (Gnome::Art::Point (6.0, 0.0));
points->push_back (Gnome::Art::Point (6.0, 5.0));
points->push_back (Gnome::Art::Point (3.0, 13.0));
points->push_back (Gnome::Art::Point (0.0, 5.0));
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (6.0, 0.0));
points->push_back (ArdourCanvas::Duple (6.0, 5.0));
points->push_back (ArdourCanvas::Duple (3.0, 13.0));
points->push_back (ArdourCanvas::Duple (0.0, 5.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
_shift = 3;
_label_offset = 8.0;
@ -149,12 +151,12 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case Meter:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (3.0, 0.0));
points->push_back (Gnome::Art::Point (6.0, 5.0));
points->push_back (Gnome::Art::Point (6.0, 10.0));
points->push_back (Gnome::Art::Point (0.0, 10.0));
points->push_back (Gnome::Art::Point (0.0, 5.0));
points->push_back (Gnome::Art::Point (3.0, 0.0));
points->push_back (ArdourCanvas::Duple (3.0, 0.0));
points->push_back (ArdourCanvas::Duple (6.0, 5.0));
points->push_back (ArdourCanvas::Duple (6.0, 10.0));
points->push_back (ArdourCanvas::Duple (0.0, 10.0));
points->push_back (ArdourCanvas::Duple (0.0, 5.0));
points->push_back (ArdourCanvas::Duple (3.0, 0.0));
_shift = 3;
_label_offset = 8.0;
@ -164,10 +166,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case RangeStart:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (Gnome::Art::Point (6.5, 6.5));
points->push_back (Gnome::Art::Point (0.0, 13.0));
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (6.5, 6.5));
points->push_back (ArdourCanvas::Duple (0.0, 13.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
_shift = 0;
_label_offset = 13.0;
@ -176,10 +178,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case SessionEnd:
case RangeEnd:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (6.5, 6.5));
points->push_back (Gnome::Art::Point (13.0, 0.0));
points->push_back (Gnome::Art::Point (13.0, 13.0));
points->push_back (Gnome::Art::Point (6.5, 6.5));
points->push_back (ArdourCanvas::Duple (6.5, 6.5));
points->push_back (ArdourCanvas::Duple (13.0, 0.0));
points->push_back (ArdourCanvas::Duple (13.0, 13.0));
points->push_back (ArdourCanvas::Duple (6.5, 6.5));
_shift = 13;
_label_offset = 6.0;
@ -187,10 +189,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case LoopStart:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (Gnome::Art::Point (13.0, 13.0));
points->push_back (Gnome::Art::Point (0.0, 13.0));
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (13.0, 13.0));
points->push_back (ArdourCanvas::Duple (0.0, 13.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
_shift = 0;
_label_offset = 12.0;
@ -198,10 +200,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case LoopEnd:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (13.0, 0.0));
points->push_back (Gnome::Art::Point (13.0, 13.0));
points->push_back (Gnome::Art::Point (0.0, 13.0));
points->push_back (Gnome::Art::Point (13.0, 0.0));
points->push_back (ArdourCanvas::Duple (13.0, 0.0));
points->push_back (ArdourCanvas::Duple (13.0, 13.0));
points->push_back (ArdourCanvas::Duple (0.0, 13.0));
points->push_back (ArdourCanvas::Duple (13.0, 0.0));
_shift = 13;
_label_offset = 0.0;
@ -209,10 +211,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case PunchIn:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (Gnome::Art::Point (13.0, 0.0));
points->push_back (Gnome::Art::Point (0.0, 13.0));
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (13.0, 0.0));
points->push_back (ArdourCanvas::Duple (0.0, 13.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
_shift = 0;
_label_offset = 13.0;
@ -220,10 +222,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
case PunchOut:
points = new ArdourCanvas::Points ();
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (Gnome::Art::Point (12.0, 0.0));
points->push_back (Gnome::Art::Point (12.0, 12.0));
points->push_back (Gnome::Art::Point (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
points->push_back (ArdourCanvas::Duple (12.0, 0.0));
points->push_back (ArdourCanvas::Duple (12.0, 12.0));
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
_shift = 13;
_label_offset = 0.0;
@ -235,17 +237,26 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
unit_position = editor.frame_to_unit (frame);
unit_position -= _shift;
group = new Group (parent, unit_position, 0);
group = new ArdourCanvas::Group (&parent, ArdourCanvas::Duple (unit_position, 0));
#ifdef CANVAS_DEBUG
group->name = string_compose ("Marker::group for %1", annotation);
#endif
_name_background = new ArdourCanvas::SimpleRect (*group);
_name_background->property_outline_pixels() = 1;
_name_background = new ArdourCanvas::Rectangle (group);
#ifdef CANVAS_DEBUG
_name_background->name = string_compose ("Marker::_name_background for %1", annotation);
#endif
_name_background->set_outline_width (1);
/* adjust to properly locate the tip */
mark = new Polygon (*group);
mark->property_points() = *points;
mark = new ArdourCanvas::Polygon (group);
#ifdef CANVAS_DEBUG
mark->name = string_compose ("Marker::mark for %1", annotation);
#endif
mark->set (*points);
set_color_rgba (rgba);
mark->property_width_pixels() = 1;
mark->set_outline_width (1);
/* setup name pixbuf sizes */
name_font = get_font_for_style (N_("MarkerText"));
@ -258,19 +269,20 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
layout->set_font_description (name_font);
Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
name_pixbuf = new ArdourCanvas::Pixbuf(*group);
name_pixbuf->property_x() = _label_offset;
name_pixbuf->property_y() = (13/2) - (name_height/2);
name_pixbuf = new ArdourCanvas::Pixbuf (group);
#ifdef CANVAS_DEBUG
name_pixbuf->name = string_compose ("Marker::name_pixbuf for %1", annotation);
#endif
name_pixbuf->set_position (ArdourCanvas::Duple (_label_offset, 13 / 2 - name_height / 2));
set_name (annotation.c_str());
editor.ZoomChanged.connect (sigc::mem_fun (*this, &Marker::reposition));
mark->set_data ("marker", this);
_name_background->set_data ("marker", this);
group->set_data ("marker", this);
if (handle_events) {
group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
}
}
@ -287,7 +299,7 @@ Marker::~Marker ()
void Marker::reparent(ArdourCanvas::Group & parent)
{
group->reparent (parent);
group->reparent (&parent);
_parent = &parent;
}
@ -312,8 +324,8 @@ Marker::setup_line ()
if (_line == 0) {
_line = new ArdourCanvas::SimpleLine (*group);
_line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
_line = new ArdourCanvas::Line (*group);
_line->set_outline_color (ARDOUR_UI::config()->canvasvar_EditPoint.get());
_line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
}
@ -322,14 +334,14 @@ Marker::setup_line ()
double yo = 0;
double xo = 0;
_line->i2w (xo, yo);
_line->item_to_canvas (xo, yo);
_line->property_x1() = _shift;
_line->property_x2() = _shift;
_line->property_y1() = -yo; // zero in world coordinates, negative in item/parent coordinate space
_line->property_y2() = -yo + _canvas_height;
_line->set_x0 (_shift);
_line->set_x1 (_shift);
_line->set_y0 (-yo); // zero in world coordinates, negative in item/parent coordinate space
_line->set_y1 (-yo + _canvas_height);
_line->property_color_rgba() = _selected ? ARDOUR_UI::config()->canvasvar_EditPoint.get() : _color;
_line->set_outline_color (_selected ? ARDOUR_UI::config()->canvasvar_EditPoint.get() : _color);
_line->raise_to_top ();
_line->show ();
@ -386,31 +398,29 @@ Marker::setup_name_display ()
}
if (label_on_left ()) {
name_pixbuf->property_x() = -name_width;
name_pixbuf->set_x_position (-name_width);
}
name_pixbuf->property_pixbuf() = pixbuf_from_string (_name, name_font, name_width, name_height, Gdk::Color ("#000000"));
name_pixbuf->set (pixbuf_from_string (_name, name_font, name_width, name_height, Gdk::Color ("#000000")));
if (label_on_left ()) {
_name_background->property_x1() = name_pixbuf->property_x() - 2;
_name_background->property_x2() = name_pixbuf->property_x() + name_width + _shift;
_name_background->set_x0 (name_pixbuf->position().x - 2);
_name_background->property_x1() = name_pixbuf->position().x + name_width + _shift;
} else {
_name_background->property_x1() = name_pixbuf->property_x() - _label_offset + 2;
_name_background->property_x2() = name_pixbuf->property_x() + name_width;
_name_background->x0 (name_pixbuf->position().x - _label_offset + 2);
_name_background->property_x1() = name_pixbuf->position().x + name_width;
}
_name_background->property_y1() = 0;
_name_background->property_y2() = 13;
_name_background->set_y0 (0);
_name_background->set_y1 (13);
}
void
Marker::set_position (framepos_t frame)
{
double new_unit_position = editor.frame_to_unit (frame);
new_unit_position -= _shift;
group->move (new_unit_position - unit_position, 0.0);
unit_position = editor.frame_to_unit (frame) - _shift;
group->set_x_position (unit_position);
frame_position = frame;
unit_position = new_unit_position;
}
void
@ -441,16 +451,16 @@ void
Marker::set_color_rgba (uint32_t c)
{
_color = c;
mark->property_fill_color_rgba() = _color;
mark->property_outline_color_rgba() = _color;
mark->set_fill_color (_color);
mark->set_outline_color (_color);
if (_line && !_selected) {
_line->property_color_rgba() = _color;
_line->set_outline_color (_color);
}
_name_background->property_fill() = true;
_name_background->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (_color, 0x70);
_name_background->property_outline_color_rgba() = _color;
_name_background->set_fill (true);
_name_background->set_fill_color (UINT_RGBA_CHANGE_A (_color, 0x70));
_name_background->set_outline_color (_color);
}
/** Set the number of pixels that are available for a label to the left of the centre of this marker */
@ -491,7 +501,7 @@ TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, gui
_tempo (temp)
{
set_position (_tempo.frame());
group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), mark, this));
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), mark, this));
}
TempoMarker::~TempoMarker ()
@ -506,7 +516,7 @@ MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, gui
_meter (m)
{
set_position (_meter.frame());
group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_meter_marker_event), mark, this));
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_meter_marker_event), mark, this));
}
MeterMarker::~MeterMarker ()

View File

@ -23,19 +23,26 @@
#include <string>
#include <glib.h>
#include <libgnomecanvasmm/pixbuf.h>
#include <sigc++/signal.h>
#include "ardour/ardour.h"
#include "pbd/signals.h"
#include "canvas.h"
#include "canvas/types.h"
namespace ARDOUR {
class TempoSection;
class MeterSection;
}
namespace ArdourCanvas {
class Polygon;
class Line;
class Rectangle;
class Group;
class Pixbuf;
class Item;
}
class PublicEditor;
class Marker : public sigc::trackable
@ -103,9 +110,9 @@ class Marker : public sigc::trackable
ArdourCanvas::Polygon *mark;
ArdourCanvas::Pixbuf *name_pixbuf;
ArdourCanvas::Points *points;
ArdourCanvas::SimpleLine* _line;
ArdourCanvas::Line* _line;
ArdourCanvas::Points *line_points;
ArdourCanvas::SimpleRect* _name_background;
ArdourCanvas::Rectangle* _name_background;
std::string _name;
double unit_position;

View File

@ -36,7 +36,6 @@
#include "marker_time_axis_view.h"
#include "imageframe_view.h"
#include "marker_time_axis.h"
#include "canvas_impl.h"
#include "i18n.h"
@ -121,18 +120,18 @@ MarkerTimeAxis::set_height (uint32_t h)
}
/**
* Sets the number of samples per unit that are used.
* Sets the number of frames per pixel that are used.
* This is used to determine the sizes of items upon this time axis
*
* @param spu the number of samples per unit
* @param spu the number of frames per pixel
*/
void
MarkerTimeAxis::set_samples_per_unit(double spu)
MarkerTimeAxis::set_frames_per_pixel (double fpp)
{
TimeAxisView::set_samples_per_unit (editor.get_current_zoom());
TimeAxisView::set_frames_per_pixel (editor.get_current_zoom());
if (view) {
view->set_samples_per_unit(spu) ;
view->set_frames_per_pixel (fpp);
}
}

View File

@ -21,13 +21,11 @@
#define __ardour_marker_time_axis_h__
#include <string>
#include <libgnomecanvas/libgnomecanvas.h>
#include "ardour_dialog.h"
#include "route_ui.h"
#include "enums.h"
#include "time_axis_view.h"
#include "canvas.h"
#include "visual_time_axis.h"
namespace ARDOUR {
@ -81,13 +79,7 @@ class MarkerTimeAxis : public VisualTimeAxis
*/
virtual void set_height(uint32_t h) ;
/**
* Sets the number of samples per unit that are used.
* This is used to determine the sizes of items upon this time axis
*
* @param spu the number of samples per unit
*/
virtual void set_samples_per_unit(double spu) ;
virtual void set_frames_per_pixel (double);
/**

View File

@ -27,7 +27,6 @@
#include "marker_view.h"
#include "imageframe_view.h"
#include "imageframe_time_axis.h"
#include "canvas-simplerect.h"
#include "public_editor.h"
#include "rgb_macros.h"
#include "gui_thread.h"
@ -54,7 +53,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
canvas_group = new ArdourCanvas::Group (*_trackview.canvas_display);
canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
canvas_rect = new ArdourCanvas::Rectangle (*canvas_group);
canvas_rect->property_x1() = 0.0;
canvas_rect->property_y1() = 0.0;
canvas_rect->property_x2() = max_framepos;
@ -64,9 +63,9 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
canvas_rect->signal_event().connect (sigc::bind (sigc::mem_fun (_trackview.editor, &PublicEditor::canvas_marker_time_axis_view_event), canvas_rect, &_trackview));
_samples_per_unit = _trackview.editor.get_current_zoom() ;
_frames_per_pixel = _trackview.editor.get_current_zoom() ;
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit));
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_frames_per_pixel));
MarkerView::CatchDeletion.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, _1), gui_context());
}
@ -139,25 +138,25 @@ MarkerTimeAxisView::set_position(gdouble x, gdouble y)
}
/**
* Sets the current samples per unit.
* Sets the current frames per pixel.
* this method tells each item upon the time axis of the change
*
* @param spu the new samples per canvas unit value
* @param fpp the new frames per pixel value
*/
int
MarkerTimeAxisView::set_samples_per_unit(gdouble spp)
MarkerTimeAxisView::set_frames_per_pixel (double fpp)
{
if(spp < 1.0) {
return -1 ;
if (spp < 1.0) {
return -1;
}
_samples_per_unit = spp ;
_frames_per_pixel = fpp;
for(MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i)
{
(*i)->set_samples_per_unit(spp) ;
for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) {
(*i)->set_frames_per_pixel (spp);
}
return(0) ;
return 0;
}
/**
@ -383,7 +382,7 @@ MarkerTimeAxisView::get_selected_time_axis_item()
*
*/
void
MarkerTimeAxisView::reset_samples_per_unit ()
MarkerTimeAxisView::reset_frames_per_pixel ()
{
set_samples_per_unit(_trackview.editor.get_current_zoom()) ;
set_frames_per_pixel (_trackview.editor.get_current_zoom());
}

View File

@ -22,11 +22,8 @@
#include <list>
#include <gdkmm/color.h>
#include <libgnomecanvasmm/group.h>
#include "ardour/location.h"
#include "simplerect.h"
#include "canvas.h"
class PublicEditor;
class MarkerTimeAxis;
@ -94,20 +91,14 @@ class MarkerTimeAxisView : public sigc::trackable
*/
int set_position(gdouble x, gdouble y) ;
/**
* Sets the current samples per unit.
* this method tells each item upon the time axis of the change
*
* @param spu the new samples per canvas unit value
*/
int set_samples_per_unit(gdouble spu) ;
int set_frames_per_pixel (double);
/**
* Returns the current samples per unit of this time axis view helper
*
* @return the current samples per unit of this time axis view helper
*/
gdouble get_samples_per_unit() { return _samples_per_unit; }
gdouble get_frames_per_pixel() { return _frames_per_pixel; }
/**
* Sets the color of the items contained upon this view helper
@ -212,7 +203,7 @@ class MarkerTimeAxisView : public sigc::trackable
* convenience method to re-get the samples per unit and tell items upon this view
*
*/
void reset_samples_per_unit() ;
void reset_frames_per_pixel() ;
/** The list of items held by this time axis view helper */
typedef std::list<MarkerView *> MarkerViewList ;
@ -225,10 +216,10 @@ class MarkerTimeAxisView : public sigc::trackable
MarkerTimeAxis& _trackview ;
ArdourCanvas::Group *canvas_group ;
ArdourCanvas::SimpleRect *canvas_rect ; /* frame around the whole thing */
ArdourCanvas::Rectangle *canvas_rect; /* frame around the whole thing */
/** the current samples per unit */
double _samples_per_unit;
/** the current frames per pixel */
double _frames_per_pixel;
/* XXX why are these different? */
Gdk::Color region_color;

View File

@ -21,7 +21,6 @@
#include "imageframe_time_axis.h"
#include "imageframe_view.h"
#include "canvas-simplerect.h"
#include "public_editor.h"
#include "marker_view.h"

View File

@ -23,7 +23,6 @@
#include <string>
#include "time_axis_view_item.h"
#include "canvas.h"
namespace Gdk {
class Color;

0
gtk2_ardour/midi_automation_line.cc Executable file → Normal file
View File

0
gtk2_ardour/midi_automation_line.h Executable file → Normal file
View File

View File

@ -43,12 +43,10 @@
#include "evoral/Control.hpp"
#include "evoral/midi_util.h"
#include "canvas/pixbuf.h"
#include "automation_region_view.h"
#include "automation_time_axis.h"
#include "canvas-hit.h"
#include "canvas-note.h"
#include "canvas_patch_change.h"
#include "canvas-sysex.h"
#include "debug.h"
#include "editor.h"
#include "editor_drag.h"
@ -69,11 +67,15 @@
#include "route_time_axis.h"
#include "rgb_macros.h"
#include "selection.h"
#include "simpleline.h"
#include "streamview.h"
#include "utils.h"
#include "patch_change_dialog.h"
#include "verbose_cursor.h"
#include "ardour_ui.h"
#include "note.h"
#include "hit.h"
#include "patch_change.h"
#include "sys_ex.h"
#include "i18n.h"
@ -93,7 +95,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
, _current_range_min(0)
, _current_range_max(0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*group))
, _note_group (new ArdourCanvas::Group (group))
, _note_diff_command (0)
, _ghost_note(0)
, _step_edit_cursor (0)
@ -129,7 +131,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
, _current_range_min(0)
, _current_range_max(0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*parent))
, _note_group (new ArdourCanvas::Group (parent))
, _note_diff_command (0)
, _ghost_note(0)
, _step_edit_cursor (0)
@ -173,7 +175,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other)
, _current_range_min(0)
, _current_range_max(0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
, _note_group (new ArdourCanvas::Group (get_canvas_group()))
, _note_diff_command (0)
, _ghost_note(0)
, _step_edit_cursor (0)
@ -207,7 +209,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
, _current_range_min(0)
, _current_range_max(0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*get_canvas_group()))
, _note_group (new ArdourCanvas::Group (get_canvas_group()))
, _note_diff_command (0)
, _ghost_note(0)
, _step_edit_cursor (0)
@ -241,9 +243,9 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
{
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
CanvasNoteEvent::CanvasNoteEventDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
gui_context());
NoteBase::CanvasNoteEventDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
boost::bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
gui_context());
if (wfd) {
midi_region()->midi_source(0)->load_model();
@ -275,7 +277,7 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
reset_width_dependent_items (_pixel_width);
group->raise_to_top();
group->signal_event().connect (sigc::mem_fun (this, &MidiRegionView::canvas_event), false);
group->Event.connect (sigc::mem_fun (this, &MidiRegionView::canvas_event));
midi_view()->midi_track()->PlaybackChannelModeChanged.connect (_channel_mode_changed_connection, invalidator (*this),
@ -496,8 +498,8 @@ MidiRegionView::button_release (GdkEventButton* ev)
event_x = ev->x;
event_y = ev->y;
group->w2i(event_x, event_y);
group->ungrab(ev->time);
group->canvas_to_item (event_x, event_y);
group->ungrab ();
PublicEditor& editor = trackview.editor ();
@ -526,7 +528,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
event_x = ev->x;
event_y = ev->y;
group->w2i(event_x, event_y);
group->canvas_to_item (event_x, event_y);
bool success;
Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_frame (event_x));
@ -995,7 +997,7 @@ MidiRegionView::note_diff_add_note (const boost::shared_ptr<NoteType> note, bool
}
void
MidiRegionView::note_diff_remove_note (ArdourCanvas::CanvasNoteEvent* ev)
MidiRegionView::note_diff_remove_note (NoteBase* ev)
{
if (_note_diff_command && ev->note()) {
_note_diff_command->remove(ev->note());
@ -1062,7 +1064,7 @@ MidiRegionView::abort_command()
clear_selection();
}
CanvasNoteEvent*
NoteBase*
MidiRegionView::find_canvas_note (boost::shared_ptr<NoteType> note)
{
if (_optimization_iterator != _events.end()) {
@ -1120,7 +1122,7 @@ MidiRegionView::redisplay_model()
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n);
CanvasNoteEvent* cne;
NoteBase* cne;
bool visible;
if (note_in_region_range (note, visible)) {
@ -1129,12 +1131,12 @@ MidiRegionView::redisplay_model()
cne->validate ();
CanvasNote* cn;
CanvasHit* ch;
Note* cn;
Hit* ch;
if ((cn = dynamic_cast<CanvasNote*>(cne)) != 0) {
if ((cn = dynamic_cast<Note*>(cne)) != 0) {
update_note (cn);
} else if ((ch = dynamic_cast<CanvasHit*>(cne)) != 0) {
} else if ((ch = dynamic_cast<Hit*>(cne)) != 0) {
update_hit (ch);
}
@ -1389,7 +1391,7 @@ MidiRegionView::set_height (double height)
}
if (_step_edit_cursor) {
_step_edit_cursor->property_y2() = midi_stream_view()->contents_height();
_step_edit_cursor->set_y1 (midi_stream_view()->contents_height());
}
}
@ -1412,7 +1414,7 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force)
_current_range_max = max;
for (Events::const_iterator i = _events.begin(); i != _events.end(); ++i) {
CanvasNoteEvent* event = *i;
NoteBase* event = *i;
boost::shared_ptr<NoteType> note (event->note());
if (note->note() < _current_range_min ||
@ -1422,15 +1424,15 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force)
event->show();
}
if (CanvasNote* cnote = dynamic_cast<CanvasNote*>(event)) {
if (Note* cnote = dynamic_cast<Note*>(event)) {
const double y1 = midi_stream_view()->note_to_y(note->note());
const double y2 = y1 + floor(midi_stream_view()->note_height());
const double y0 = midi_stream_view()->note_to_y(note->note());
const double y1 = y0 + floor(midi_stream_view()->note_height());
cnote->property_y1() = y1;
cnote->property_y2() = y2;
cnote->set_y0 (y0);
cnote->set_y1 (y1);
} else if (CanvasHit* chit = dynamic_cast<CanvasHit*>(event)) {
} else if (Hit* chit = dynamic_cast<Hit*>(event)) {
const double diamond_size = update_hit (chit);
@ -1442,9 +1444,9 @@ MidiRegionView::apply_note_range (uint8_t min, uint8_t max, bool force)
GhostRegion*
MidiRegionView::add_ghost (TimeAxisView& tv)
{
CanvasNote* note;
Note* note;
double unit_position = _region->position () / samples_per_unit;
double unit_position = _region->position () / frames_per_pixel;
MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(&tv);
MidiGhostRegion* ghost;
@ -1458,13 +1460,13 @@ MidiRegionView::add_ghost (TimeAxisView& tv)
}
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
if ((note = dynamic_cast<CanvasNote*>(*i)) != 0) {
if ((note = dynamic_cast<Note*>(*i)) != 0) {
ghost->add_note(note);
}
}
ghost->set_height ();
ghost->set_duration (_region->length() / samples_per_unit);
ghost->set_duration (_region->length() / frames_per_pixel);
ghosts.push_back (ghost);
GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RegionView::remove_ghost, this, _1), gui_context());
@ -1481,7 +1483,7 @@ MidiRegionView::begin_write()
if (_active_notes) {
delete[] _active_notes;
}
_active_notes = new CanvasNote*[128];
_active_notes = new Note*[128];
for (unsigned i = 0; i < 128; ++i) {
_active_notes[i] = 0;
}
@ -1517,8 +1519,8 @@ MidiRegionView::resolve_note(uint8_t note, double end_time)
*/
const framepos_t end_time_frames = region_beats_to_region_frames(end_time);
_active_notes[note]->property_x2() = trackview.editor().frame_to_pixel(end_time_frames);
_active_notes[note]->property_outline_what() = (guint32) 0xF; // all edges
_active_notes[note]->set_x1 (trackview.editor().frame_to_pixel(end_time_frames));
_active_notes[note]->set_outline_what (0xf);
_active_notes[note] = 0;
}
}
@ -1535,7 +1537,7 @@ MidiRegionView::extend_active_notes()
for (unsigned i=0; i < 128; ++i) {
if (_active_notes[i]) {
_active_notes[i]->property_x2() = trackview.editor().frame_to_pixel(_region->length());
_active_notes[i]->set_x1 (trackview.editor().frame_to_pixel(_region->length()));
}
}
}
@ -1621,43 +1623,43 @@ MidiRegionView::note_in_region_range (const boost::shared_ptr<NoteType> note, bo
* @param update_ghost_regions true to update the note in any ghost regions that we have, otherwise false.
*/
void
MidiRegionView::update_note (CanvasNote* ev, bool update_ghost_regions)
MidiRegionView::update_note (Note* ev, bool update_ghost_regions)
{
boost::shared_ptr<NoteType> note = ev->note();
const double x = trackview.editor().frame_to_pixel (source_beats_to_region_frames (note->time()));
const double y1 = midi_stream_view()->note_to_y(note->note());
const double y0 = midi_stream_view()->note_to_y(note->note());
ev->property_x1() = x;
ev->property_y1() = y1;
ev->set_x0 (x);
ev->set_y0 (y0);
/* trim note display to not overlap the end of its region */
if (note->length() > 0) {
const framepos_t note_end_frames = min (source_beats_to_region_frames (note->end_time()), _region->length());
ev->property_x2() = trackview.editor().frame_to_pixel (note_end_frames);
ev->set_x1 (trackview.editor().frame_to_pixel (note_end_frames));
} else {
ev->property_x2() = trackview.editor().frame_to_pixel (_region->length());
ev->set_x1 (trackview.editor().frame_to_pixel (_region->length()));
}
ev->property_y2() = y1 + floor(midi_stream_view()->note_height());
ev->set_y1 (y0 + floor(midi_stream_view()->note_height()));
if (note->length() == 0) {
if (_active_notes && note->note() < 128) {
// If this note is already active there's a stuck note,
// finish the old note rectangle
if (_active_notes[note->note()]) {
CanvasNote* const old_rect = _active_notes[note->note()];
Note* const old_rect = _active_notes[note->note()];
boost::shared_ptr<NoteType> old_note = old_rect->note();
old_rect->property_x2() = x;
old_rect->property_outline_what() = (guint32) 0xF;
old_rect->set_x1 (x);
old_rect->set_outline_what (0xF);
}
_active_notes[note->note()] = ev;
}
/* outline all but right edge */
ev->property_outline_what() = (guint32) (0x1 & 0x4 & 0x8);
ev->set_outline_what (0x1 & 0x4 & 0x8);
} else {
/* outline all edges */
ev->property_outline_what() = (guint32) 0xF;
ev->set_outline_what (0xF);
}
if (update_ghost_regions) {
@ -1671,7 +1673,7 @@ MidiRegionView::update_note (CanvasNote* ev, bool update_ghost_regions)
}
double
MidiRegionView::update_hit (CanvasHit* ev)
MidiRegionView::update_hit (Hit* ev)
{
boost::shared_ptr<NoteType> note = ev->note();
@ -1680,7 +1682,7 @@ MidiRegionView::update_hit (CanvasHit* ev)
const double diamond_size = midi_stream_view()->note_height() / 2.0;
const double y = midi_stream_view()->note_to_y(note->note()) + ((diamond_size-2) / 4.0);
ev->move_to (x, y);
ev->set_position (ArdourCanvas::Duple (x, y));
return diamond_size;
}
@ -1694,13 +1696,13 @@ MidiRegionView::update_hit (CanvasHit* ev)
void
MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible)
{
CanvasNoteEvent* event = 0;
NoteBase* event = 0;
//ArdourCanvas::Group* const group = (ArdourCanvas::Group*) get_canvas_group();
if (midi_view()->note_mode() == Sustained) {
CanvasNote* ev_rect = new CanvasNote(*this, *_note_group, note);
Note* ev_rect = new Note (*this, _note_group, note);
update_note (ev_rect);
@ -1718,7 +1720,7 @@ MidiRegionView::add_note(const boost::shared_ptr<NoteType> note, bool visible)
const double diamond_size = midi_stream_view()->note_height() / 2.0;
CanvasHit* ev_diamond = new CanvasHit (*this, *_note_group, diamond_size, note);
Hit* ev_diamond = new CanvasHit (*this, _note_group, diamond_size, note);
update_hit (ev_diamond);
@ -1803,7 +1805,7 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const
double const height = midi_stream_view()->contents_height();
boost::shared_ptr<CanvasPatchChange> patch_change = boost::shared_ptr<CanvasPatchChange>(
new CanvasPatchChange(*this, *group,
new CanvasPatchChange(*this, group,
displaytext,
height,
x, 1.0,
@ -1865,7 +1867,7 @@ MidiRegionView::get_patch_key_at (double time, uint8_t channel, MIDI::Name::Patc
}
void
MidiRegionView::change_patch_change (CanvasPatchChange& pc, const MIDI::Name::PatchPrimaryKey& new_patch)
MidiRegionView::change_patch_change (PatchChange& pc, const MIDI::Name::PatchPrimaryKey& new_patch)
{
MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("alter patch change"));
@ -1937,7 +1939,7 @@ MidiRegionView::add_patch_change (framecnt_t t, Evoral::PatchChange<Evoral::Musi
}
void
MidiRegionView::move_patch_change (CanvasPatchChange& pc, Evoral::MusicalTime t)
MidiRegionView::move_patch_change (PatchChange& pc, Evoral::MusicalTime t)
{
MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("move patch change"));
c->change_time (pc.patch (), t);
@ -1948,7 +1950,7 @@ MidiRegionView::move_patch_change (CanvasPatchChange& pc, Evoral::MusicalTime t)
}
void
MidiRegionView::delete_patch_change (CanvasPatchChange* pc)
MidiRegionView::delete_patch_change (PatchChange* pc)
{
MidiModel::PatchChangeDiffCommand* c = _model->new_patch_change_diff_command (_("delete patch change"));
c->remove (pc->patch ());
@ -1959,7 +1961,7 @@ MidiRegionView::delete_patch_change (CanvasPatchChange* pc)
}
void
MidiRegionView::previous_patch (CanvasPatchChange& patch)
MidiRegionView::previous_patch (PatchChange& patch)
{
if (patch.patch()->program() < 127) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@ -1969,7 +1971,7 @@ MidiRegionView::previous_patch (CanvasPatchChange& patch)
}
void
MidiRegionView::next_patch (CanvasPatchChange& patch)
MidiRegionView::next_patch (PatchChange& patch)
{
if (patch.patch()->program() > 0) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@ -2003,7 +2005,7 @@ MidiRegionView::previous_bank (CanvasPatchChange& patch)
}
void
MidiRegionView::maybe_remove_deleted_note_from_selection (CanvasNoteEvent* cne)
MidiRegionView::maybe_remove_deleted_note_from_selection (NoteBase* cne)
{
if (_selection.empty()) {
return;
@ -2043,7 +2045,7 @@ MidiRegionView::delete_note (boost::shared_ptr<NoteType> n)
}
void
MidiRegionView::clear_selection_except (ArdourCanvas::CanvasNoteEvent* ev, bool signal)
MidiRegionView::clear_selection_except (NoteBase* ev, bool signal)
{
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ) {
if ((*i) != ev) {
@ -2070,7 +2072,7 @@ MidiRegionView::clear_selection_except (ArdourCanvas::CanvasNoteEvent* ev, bool
}
void
MidiRegionView::unique_select(ArdourCanvas::CanvasNoteEvent* ev)
MidiRegionView::unique_select(NoteBase* ev)
{
clear_selection_except (ev);
@ -2158,7 +2160,7 @@ MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, b
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n);
CanvasNoteEvent* cne;
NoteBase* cne;
bool select = false;
if (((1 << note->channel()) & channel_mask) != 0) {
@ -2195,7 +2197,7 @@ MidiRegionView::toggle_matching_notes (uint8_t notenum, uint16_t channel_mask)
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
boost::shared_ptr<NoteType> note (*n);
CanvasNoteEvent* cne;
NoteBase* cne;
if (note->note() == notenum && (((0x0001 << note->channel()) & channel_mask) != 0)) {
if ((cne = find_canvas_note (note)) != 0) {
@ -2210,7 +2212,7 @@ MidiRegionView::toggle_matching_notes (uint8_t notenum, uint16_t channel_mask)
}
void
MidiRegionView::note_selected (ArdourCanvas::CanvasNoteEvent* ev, bool add, bool extend)
MidiRegionView::note_selected (NoteBase* ev, bool add, bool extend)
{
if (!add) {
clear_selection_except (ev);
@ -2263,7 +2265,7 @@ MidiRegionView::note_selected (ArdourCanvas::CanvasNoteEvent* ev, bool add, bool
}
void
MidiRegionView::note_deselected(ArdourCanvas::CanvasNoteEvent* ev)
MidiRegionView::note_deselected(NoteBase* ev)
{
remove_from_selection (ev);
}
@ -2312,7 +2314,7 @@ MidiRegionView::update_vertical_drag_selection (double y1, double y2, bool exten
}
void
MidiRegionView::remove_from_selection (CanvasNoteEvent* ev)
MidiRegionView::remove_from_selection (NoteBase* ev)
{
Selection::iterator i = _selection.find (ev);
@ -2330,7 +2332,7 @@ MidiRegionView::remove_from_selection (CanvasNoteEvent* ev)
}
void
MidiRegionView::add_to_selection (CanvasNoteEvent* ev)
MidiRegionView::add_to_selection (NoteBase* ev)
{
bool add_mrv_selection = false;
@ -2393,7 +2395,7 @@ MidiRegionView::move_selection(double dx, double dy, double cumulative_dy)
}
void
MidiRegionView::note_dropped(CanvasNoteEvent *, frameoffset_t dt, int8_t dnote)
MidiRegionView::note_dropped(NoteBase *, frameoffset_t dt, int8_t dnote)
{
uint8_t lowest_note_in_selection = 127;
uint8_t highest_note_in_selection = 0;
@ -2529,16 +2531,15 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
_resize_data.clear();
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
CanvasNote *note = dynamic_cast<CanvasNote *> (*i);
Note *note = dynamic_cast<Note**> (*i);
// only insert CanvasNotes into the map
if (note) {
NoteResizeData *resize_data = new NoteResizeData();
resize_data->canvas_note = note;
resize_data->note = note;
// create a new SimpleRect from the note which will be the resize preview
SimpleRect *resize_rect = new SimpleRect(
*_note_group, note->x1(), note->y1(), note->x2(), note->y2());
Rectangle *resize_rect = new SimpleRect (_note_group, note->x1(), note->y1(), note->x2(), note->y2());
// calculate the colors: get the color settings
uint32_t fill_color = UINT_RGBA_CHANGE_A(
@ -2549,13 +2550,13 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
fill_color = UINT_INTERPOLATE(fill_color, 0xFFFFFF40, 0.5);
// calculate color based on note velocity
resize_rect->property_fill_color_rgba() = UINT_INTERPOLATE(
resize_rect->set_fill_color (UINT_INTERPOLATE(
CanvasNoteEvent::meter_style_fill_color(note->note()->velocity(), note->selected()),
fill_color,
0.85);
0.85));
resize_rect->property_outline_color_rgba() = CanvasNoteEvent::calculate_outline(
ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get());
resize_rect->set_outline_color (NoteBase::calculate_outline (
ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
resize_data->resize_rect = resize_rect;
_resize_data.push_back(resize_data);
@ -2573,35 +2574,35 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
* as the \a primary note.
*/
void
MidiRegionView::update_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at_front, double delta_x, bool relative)
MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_x, bool relative)
{
bool cursor_set = false;
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
SimpleRect* resize_rect = (*i)->resize_rect;
CanvasNote* canvas_note = (*i)->canvas_note;
Rectangle* resize_rect = (*i)->resize_rect;
Note* canvas_note = (*i)->note;
double current_x;
if (at_front) {
if (relative) {
current_x = canvas_note->x1() + delta_x;
current_x = note->x0() + delta_x;
} else {
current_x = primary->x1() + delta_x;
current_x = primary->x0() + delta_x;
}
} else {
if (relative) {
current_x = canvas_note->x2() + delta_x;
current_x = note->x1() + delta_x;
} else {
current_x = primary->x2() + delta_x;
current_x = primary->x1() + delta_x;
}
}
if (at_front) {
resize_rect->property_x1() = snap_to_pixel(current_x);
resize_rect->property_x2() = canvas_note->x2();
resize_rect->set_x0 (snap_to_pixel(current_x));
resize_rect->set_x1 (canvas_note->x1());
} else {
resize_rect->property_x2() = snap_to_pixel(current_x);
resize_rect->property_x1() = canvas_note->x1();
resize_rect->set_x1 (snap_to_pixel(current_x));
resize_rect->set_x0 (canvas_note->x0());
}
if (!cursor_set) {
@ -2642,13 +2643,13 @@ MidiRegionView::update_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at
* Parameters the same as for \a update_resizing().
*/
void
MidiRegionView::commit_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at_front, double delta_x, bool relative)
MidiRegionView::commit_resizing (NoteBase* primary, bool at_front, double delta_x, bool relative)
{
start_note_diff_command (_("resize notes"));
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
CanvasNote* canvas_note = (*i)->canvas_note;
SimpleRect* resize_rect = (*i)->resize_rect;
Note* canvas_note = (*i)->note;
Rectangle* resize_rect = (*i)->resize_rect;
/* Get the new x position for this resize, which is in pixels relative
* to the region position.
@ -2658,15 +2659,15 @@ MidiRegionView::commit_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at
if (at_front) {
if (relative) {
current_x = canvas_note->x1() + delta_x;
current_x = note->x0() + delta_x;
} else {
current_x = primary->x1() + delta_x;
current_x = primary->x0() + delta_x;
}
} else {
if (relative) {
current_x = canvas_note->x2() + delta_x;
current_x = note->x1() + delta_x;
} else {
current_x = primary->x2() + delta_x;
current_x = primary->x1() + delta_x;
}
}
@ -2717,7 +2718,7 @@ MidiRegionView::abort_resizing ()
}
void
MidiRegionView::change_note_velocity(CanvasNoteEvent* event, int8_t velocity, bool relative)
MidiRegionView::change_note_velocity(NoteBase* event, int8_t velocity, bool relative)
{
uint8_t new_velocity;
@ -2734,7 +2735,7 @@ MidiRegionView::change_note_velocity(CanvasNoteEvent* event, int8_t velocity, bo
}
void
MidiRegionView::change_note_note (CanvasNoteEvent* event, int8_t note, bool relative)
MidiRegionView::change_note_note (NoteBase* event, int8_t note, bool relative)
{
uint8_t new_note;
@ -2749,7 +2750,7 @@ MidiRegionView::change_note_note (CanvasNoteEvent* event, int8_t note, bool rela
}
void
MidiRegionView::trim_note (CanvasNoteEvent* event, Evoral::MusicalTime front_delta, Evoral::MusicalTime end_delta)
MidiRegionView::trim_note (NoteBase* event, Evoral::MusicalTime front_delta, Evoral::MusicalTime end_delta)
{
bool change_start = false;
bool change_length = false;
@ -2821,7 +2822,7 @@ MidiRegionView::trim_note (CanvasNoteEvent* event, Evoral::MusicalTime front_del
}
void
MidiRegionView::change_note_channel (CanvasNoteEvent* event, int8_t chn, bool relative)
MidiRegionView::change_note_channel (NoteBse* event, int8_t chn, bool relative)
{
uint8_t new_channel;
@ -2843,7 +2844,7 @@ MidiRegionView::change_note_channel (CanvasNoteEvent* event, int8_t chn, bool re
}
void
MidiRegionView::change_note_time (CanvasNoteEvent* event, Evoral::MusicalTime delta, bool relative)
MidiRegionView::change_note_time (NoteBase* event, Evoral::MusicalTime delta, bool relative)
{
Evoral::MusicalTime new_time;
@ -2865,7 +2866,7 @@ MidiRegionView::change_note_time (CanvasNoteEvent* event, Evoral::MusicalTime de
}
void
MidiRegionView::change_note_length (CanvasNoteEvent* event, Evoral::MusicalTime t)
MidiRegionView::change_note_length (NoteBase* event, Evoral::MusicalTime t)
{
note_diff_add_change (event, MidiModel::NoteDiffCommand::Length, t);
}
@ -3092,7 +3093,7 @@ MidiRegionView::change_channel(uint8_t channel)
void
MidiRegionView::note_entered(ArdourCanvas::CanvasNoteEvent* ev)
MidiRegionView::note_entered(NoteBase* ev)
{
Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
@ -3106,7 +3107,7 @@ MidiRegionView::note_entered(ArdourCanvas::CanvasNoteEvent* ev)
}
void
MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent*)
MidiRegionView::note_left (NoteBase*)
{
Editor* editor = dynamic_cast<Editor*>(&trackview.editor());
@ -3123,7 +3124,7 @@ MidiRegionView::note_left (ArdourCanvas::CanvasNoteEvent*)
}
void
MidiRegionView::patch_entered (ArdourCanvas::CanvasPatchChange* p)
MidiRegionView::patch_entered (PatchChange* p)
{
ostringstream s;
/* XXX should get patch name if we can */
@ -3135,7 +3136,7 @@ MidiRegionView::patch_entered (ArdourCanvas::CanvasPatchChange* p)
}
void
MidiRegionView::patch_left (ArdourCanvas::CanvasPatchChange *)
MidiRegionView::patch_left (PatchChange *)
{
trackview.editor().verbose_cursor()->hide ();
/* focus will transfer back via the enter-notify event sent to this
@ -3202,7 +3203,7 @@ MidiRegionView::set_frame_color()
f = UINT_RGBA_CHANGE_A (f, 0);
}
frame->property_fill_color_rgba() = f;
frame->set_fill_color (f);
}
void
@ -3477,7 +3478,7 @@ MidiRegionView::update_ghost_note (double x, double y)
_last_ghost_x = x;
_last_ghost_y = y;
_note_group->w2i (x, y);
_note_group->canvas_to_item (x, y);
PublicEditor& editor = trackview.editor ();
@ -3515,8 +3516,9 @@ MidiRegionView::create_ghost_note (double x, double y)
remove_ghost_note ();
boost::shared_ptr<NoteType> g (new NoteType);
_ghost_note = new NoEventCanvasNote (*this, *_note_group, g);
_ghost_note->property_outline_color_rgba() = 0x000000aa;
_ghost_note = new Note (*this, _note_group, g);
_ghost_note->set_ignore_events (true);
_ghost_note->set_outline_color (0x000000aa);
update_ghost_note (x, y);
_ghost_note->show ();
@ -3604,11 +3606,11 @@ MidiRegionView::show_step_edit_cursor (Evoral::MusicalTime pos)
if (_step_edit_cursor == 0) {
ArdourCanvas::Group* const group = (ArdourCanvas::Group*)get_canvas_group();
_step_edit_cursor = new ArdourCanvas::SimpleRect (*group);
_step_edit_cursor->property_y1() = 0;
_step_edit_cursor->property_y2() = midi_stream_view()->contents_height();
_step_edit_cursor->property_fill_color_rgba() = RGBA_TO_UINT (45,0,0,90);
_step_edit_cursor->property_outline_color_rgba() = RGBA_TO_UINT (85,0,0,90);
_step_edit_cursor = new ArdourCanvas::Rectangle (*group);
_step_edit_cursor->set_y0 (0);
_step_edit_cursor->set_y1 (midi_stream_view()->contents_height());
_step_edit_cursor->set_fill_color (RGBA_TO_UINT (45,0,0,90));
_step_edit_cursor->set_outline_color (RGBA_TO_UINT (85,0,0,90));
}
move_step_edit_cursor (pos);
@ -3622,7 +3624,7 @@ MidiRegionView::move_step_edit_cursor (Evoral::MusicalTime pos)
if (_step_edit_cursor) {
double pixel = trackview.editor().frame_to_pixel (region_beats_to_region_frames (pos));
_step_edit_cursor->property_x1() = pixel;
_step_edit_cursor->set_x0 (pixel);
set_step_edit_cursor_width (_step_edit_cursor_width);
}
}
@ -3641,7 +3643,7 @@ MidiRegionView::set_step_edit_cursor_width (Evoral::MusicalTime beats)
_step_edit_cursor_width = beats;
if (_step_edit_cursor) {
_step_edit_cursor->property_x2() = _step_edit_cursor->property_x1() + trackview.editor().frame_to_pixel (region_beats_to_region_frames (beats));
_step_edit_cursor->set_x1 (_step_edit_cursor->x0() + trackview.editor().frame_to_pixel (region_beats_to_region_frames (beats)));
}
}
@ -3717,15 +3719,15 @@ MidiRegionView::trim_front_starting ()
/* Reparent the note group to the region view's parent, so that it doesn't change
when the region view is trimmed.
*/
_temporary_note_group = new ArdourCanvas::Group (*group->property_parent ());
_temporary_note_group->move (group->property_x(), group->property_y());
_note_group->reparent (*_temporary_note_group);
_temporary_note_group = new ArdourCanvas::Group (group->parent ());
_temporary_note_group->move (group->position ());
_note_group->reparent (_temporary_note_group);
}
void
MidiRegionView::trim_front_ending ()
{
_note_group->reparent (*group);
_note_group->reparent (group);
delete _temporary_note_group;
_temporary_note_group = 0;
@ -3736,7 +3738,7 @@ MidiRegionView::trim_front_ending ()
}
void
MidiRegionView::edit_patch_change (ArdourCanvas::CanvasPatchChange* pc)
MidiRegionView::edit_patch_change (PatchChange* pc)
{
PatchChangeDialog d (&_source_relative_time_converter, trackview.session(), *pc->patch (), instrument_info(), Gtk::Stock::APPLY, true);

View File

@ -22,8 +22,6 @@
#include <string>
#include <vector>
#include <libgnomecanvasmm.h>
#include <libgnomecanvasmm/polygon.h>
#include "pbd/signals.h"
@ -36,12 +34,6 @@
#include "time_axis_view_item.h"
#include "automation_line.h"
#include "enums.h"
#include "canvas.h"
#include "canvas-hit.h"
#include "canvas-note.h"
#include "canvas-note-event.h"
#include "canvas_patch_change.h"
#include "canvas-sysex.h"
namespace ARDOUR {
class MidiRegion;
@ -55,6 +47,10 @@ namespace MIDI {
};
};
class SysEx;
class NoteBase;
class Note;
class Hit;
class MidiTimeAxisView;
class GhostRegion;
class AutomationTimeAxisView;
@ -73,7 +69,7 @@ public:
MidiRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::MidiRegion>,
double initial_samples_per_unit,
double initial_frames_per_pixel,
Gdk::Color const & basic_color);
MidiRegionView (const MidiRegionView& other);
@ -135,26 +131,26 @@ public:
* @param old_patch the canvas patch change which is to be altered
* @param new_patch new patch
*/
void change_patch_change (ArdourCanvas::CanvasPatchChange& old_patch, const MIDI::Name::PatchPrimaryKey& new_patch);
void change_patch_change (PatchChange& old_patch, const MIDI::Name::PatchPrimaryKey& new_patch);
void change_patch_change (ARDOUR::MidiModel::PatchChangePtr, Evoral::PatchChange<Evoral::MusicalTime> const &);
void add_patch_change (framecnt_t, Evoral::PatchChange<Evoral::MusicalTime> const &);
void move_patch_change (ArdourCanvas::CanvasPatchChange &, Evoral::MusicalTime);
void delete_patch_change (ArdourCanvas::CanvasPatchChange *);
void edit_patch_change (ArdourCanvas::CanvasPatchChange *);
void move_patch_change (PatchChange &, Evoral::MusicalTime);
void delete_patch_change (PatchChange *);
void edit_patch_change (PatchChange *);
void delete_sysex (ArdourCanvas::CanvasSysEx*);
/** Alter a given patch to be its predecessor in the MIDNAM file.
*/
void previous_patch (ArdourCanvas::CanvasPatchChange &);
void previous_patch (PatchChange &);
/** Alters a given patch to be its successor in the MIDNAM file.
*/
void next_patch (ArdourCanvas::CanvasPatchChange &);
void next_patch (PatchChange &);
void previous_bank (ArdourCanvas::CanvasPatchChange &);
void next_bank (ArdourCanvas::CanvasPatchChange &);
void previous_bank (PatchChange &);
void next_bank (PatchChange &);
/** Displays all patch change events in the region as flags on the canvas.
*/
@ -181,8 +177,8 @@ public:
void note_entered(ArdourCanvas::CanvasNoteEvent* ev);
void note_left(ArdourCanvas::CanvasNoteEvent* ev);
void patch_entered (ArdourCanvas::CanvasPatchChange *);
void patch_left (ArdourCanvas::CanvasPatchChange *);
void patch_entered (PatchChange *);
void patch_left (PatchChange *);
void sysex_entered (ArdourCanvas::CanvasSysEx* p);
void sysex_left (ArdourCanvas::CanvasSysEx* p);
void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true);
@ -242,8 +238,8 @@ public:
void note_button_release ();
struct NoteResizeData {
ArdourCanvas::CanvasNote *canvas_note;
ArdourCanvas::SimpleRect *resize_rect;
Note *note;
ArdourCanvas::Rectangle *resize_rect;
};
/** Snap a region relative pixel coordinate to pixel units.
@ -315,7 +311,7 @@ protected:
MidiRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::MidiRegion>,
double samples_per_unit,
double frames_per_pixel,
Gdk::Color& basic_color,
TimeAxisViewItem::Visibility);
@ -382,7 +378,7 @@ private:
uint8_t _current_range_max;
typedef std::list<ArdourCanvas::CanvasNoteEvent*> Events;
typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasPatchChange> > PatchChanges;
typedef std::vector< boost::shared_ptr<PatchChange> > PatchChanges;
typedef std::vector< boost::shared_ptr<ArdourCanvas::CanvasSysEx> > SysExes;
boost::shared_ptr<ARDOUR::MidiModel> _model;
@ -395,7 +391,7 @@ private:
ArdourCanvas::CanvasNote* _ghost_note;
double _last_ghost_x;
double _last_ghost_y;
ArdourCanvas::SimpleRect* _step_edit_cursor;
ArdourCanvas::Rectangle* _step_edit_cursor;
Evoral::MusicalTime _step_edit_cursor_width;
Evoral::MusicalTime _step_edit_cursor_position;
ArdourCanvas::CanvasNoteEvent* _channel_selection_scoped_note;
@ -430,11 +426,11 @@ private:
/** connection used to connect to model's ContentChanged signal */
PBD::ScopedConnection content_connection;
ArdourCanvas::CanvasNoteEvent* find_canvas_note (boost::shared_ptr<NoteType>);
NoteBase* find_canvas_note (boost::shared_ptr<NoteType>);
Events::iterator _optimization_iterator;
void update_note (ArdourCanvas::CanvasNote *, bool update_ghost_regions = true);
double update_hit (ArdourCanvas::CanvasHit *);
void update_note (Note *, bool update_ghost_regions = true);
double update_hit (Hit *);
void create_ghost_note (double, double);
void update_ghost_note (double, double);
@ -442,7 +438,7 @@ private:
bool _no_sound_notes;
PBD::ScopedConnection note_delete_connection;
void maybe_remove_deleted_note_from_selection (ArdourCanvas::CanvasNoteEvent*);
void maybe_remove_deleted_note_from_selection (NoteBase*);
void snap_changed ();
PBD::ScopedConnection snap_changed_connection;

View File

@ -23,6 +23,9 @@
#include <gtkmm2ext/gtk_ui.h>
#include "canvas/line_set.h"
#include "canvas/rectangle.h"
#include "ardour/midi_region.h"
#include "ardour/midi_source.h"
#include "ardour/midi_track.h"
@ -32,10 +35,8 @@
#include "ardour/smf_source.h"
#include "ardour_ui.h"
#include "canvas-simplerect.h"
#include "global_signals.h"
#include "gui_thread.h"
#include "lineset.h"
#include "midi_region_view.h"
#include "midi_streamview.h"
#include "midi_time_axis.h"
@ -45,7 +46,6 @@
#include "region_view.h"
#include "rgb_macros.h"
#include "selection.h"
#include "simplerect.h"
#include "utils.h"
#include "i18n.h"
@ -68,20 +68,15 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
, _updates_suspended (false)
{
/* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */
midi_underlay_group = new ArdourCanvas::Group (*_canvas_group);
midi_underlay_group = new ArdourCanvas::Group (_canvas_group);
midi_underlay_group->lower_to_bottom();
/* put the note lines in the timeaxisview's group, so it
can be put below ghost regions from MIDI underlays*/
_note_lines = new ArdourCanvas::LineSet(*_canvas_group,
ArdourCanvas::LineSet::Horizontal);
can be put below ghost regions from MIDI underlays
*/
_note_lines = new ArdourCanvas::LineSet (_canvas_group);
_note_lines->property_x1() = 0;
_note_lines->property_y1() = 0;
_note_lines->property_x2() = DBL_MAX;
_note_lines->property_y2() = 0;
_note_lines->signal_event().connect(
_note_lines->Event().connect(
sigc::bind(sigc::mem_fun(_trackview.editor(),
&PublicEditor::canvas_stream_view_event),
_note_lines, &_trackview));
@ -113,7 +108,7 @@ MidiStreamView::create_region_view (boost::shared_ptr<Region> r, bool /*wfd*/, b
}
RegionView* region_view = new MidiRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color);
_frames_per_pixel, region_color);
region_view->init (region_color, false);
@ -277,7 +272,7 @@ void
MidiStreamView::update_contents_height ()
{
StreamView::update_contents_height();
_note_lines->property_y2() = child_height ();
_note_lines->set_height (child_height ());
apply_note_range (lowest_note(), highest_note(), true);
}
@ -303,7 +298,7 @@ MidiStreamView::draw_note_lines()
for (int i = lowest_note(); i <= highest_note(); ++i) {
y = floor(note_to_y(i));
_note_lines->add_line(prev_y, 1.0, ARDOUR_UI::config()->canvasvar_PianoRollBlackOutline.get());
_note_lines->add (prev_y, 1.0, ARDOUR_UI::config()->canvasvar_PianoRollBlackOutline.get());
switch (i % 12) {
case 1:
@ -319,9 +314,9 @@ MidiStreamView::draw_note_lines()
}
if (i == highest_note()) {
_note_lines->add_line(y, prev_y - y, color);
_note_lines->add (y, prev_y - y, color);
} else {
_note_lines->add_line(y + 1.0, prev_y - y - 1.0, color);
_note_lines->add (y + 1.0, prev_y - y - 1.0, color);
}
prev_y = y;
@ -490,13 +485,10 @@ MidiStreamView::setup_rec_box ()
fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
ArdourCanvas::SimpleRect * rec_rect = new Gnome::Canvas::SimpleRect (*_canvas_group);
rec_rect->property_x1() = xstart;
rec_rect->property_y1() = 1.0;
rec_rect->property_x2() = xend;
rec_rect->property_y2() = (double) _trackview.current_height() - 1;
rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
rec_rect->property_fill_color_rgba() = fill_color;
ArdourCanvas::Rectangle * rec_rect = new ArdourCanvas::Rectangle (_canvas_group);
rec_rect->set (ArdourCanvas::Rect (xstart, 1, xend, _trackview.current_height() - 1));
rec_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_RecordingRect.get());
rec_rect->set_fill_color (fill_color);
rec_rect->lower_to_bottom();
RecBoxInfo recbox;
@ -568,9 +560,9 @@ MidiStreamView::color_handler ()
draw_note_lines ();
if (_trackview.is_midi_track()) {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get();
canvas_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_MidiTrackBase.get());
} else {
canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiBusBase.get();;
canvas_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_MidiBusBase.get());
}
}

View File

@ -27,7 +27,6 @@
#include "streamview.h"
#include "time_axis_view_item.h"
#include "route_time_axis.h"
#include "canvas.h"
namespace Gdk {
class Color;
@ -42,6 +41,10 @@ namespace ARDOUR {
struct PeakData;
}
namespace ArdourCanvas {
class LineSet;
}
class PublicEditor;
class Selectable;
class MidiTimeAxisView;

View File

@ -61,8 +61,6 @@
#include "ardour_button.h"
#include "automation_line.h"
#include "automation_time_axis.h"
#include "canvas-note-event.h"
#include "canvas_impl.h"
#include "editor.h"
#include "enums.h"
#include "ghostregion.h"
@ -83,8 +81,8 @@
#include "rgb_macros.h"
#include "selection.h"
#include "step_editor.h"
#include "simplerect.h"
#include "utils.h"
#include "note_base.h"
#include "ardour/midi_track.h"
@ -100,7 +98,7 @@ using namespace Editing;
static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 140;
static const uint32_t KEYBOARD_MIN_HEIGHT = 130;
MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
: AxisView(sess) // virtually inherited
, RouteTimeAxisView(ed, sess, canvas)
, _ignore_signals(false)
@ -315,7 +313,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
if (!color_mode.empty()) {
_color_mode = ColorMode (string_2_enum(color_mode, _color_mode));
if (_channel_selector && _color_mode == ChannelColors) {
_channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors);
_channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
}
}
@ -512,7 +510,7 @@ MidiTimeAxisView::toggle_channel_selector ()
_channel_selector = new MidiChannelSelectorWindow (midi_track());
if (_color_mode == ChannelColors) {
_channel_selector->set_channel_colors(CanvasNoteEvent::midi_channel_colors);
_channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
} else {
_channel_selector->set_default_channel_color ();
}

View File

@ -37,7 +37,6 @@
#include "route_ui.h"
#include "enums.h"
#include "route_time_axis.h"
#include "canvas.h"
#include "midi_streamview.h"
namespace MIDI {

Some files were not shown because too many files have changed in this diff Show More