summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardev_common.sh.in2
-rw-r--r--gtk2_ardour/ardour_ui.cc1
-rw-r--r--gtk2_ardour/ardour_ui.h1
-rw-r--r--gtk2_ardour/audio_region_editor.h1
-rw-r--r--gtk2_ardour/audio_region_view.cc291
-rw-r--r--gtk2_ardour/audio_region_view.h24
-rw-r--r--gtk2_ardour/audio_streamview.cc32
-rw-r--r--gtk2_ardour/audio_streamview.h1
-rw-r--r--gtk2_ardour/audio_time_axis.cc4
-rw-r--r--gtk2_ardour/audio_time_axis.h1
-rw-r--r--gtk2_ardour/automation_line.cc30
-rw-r--r--gtk2_ardour/automation_line.h15
-rw-r--r--gtk2_ardour/automation_region_view.cc6
-rw-r--r--gtk2_ardour/automation_region_view.h3
-rw-r--r--gtk2_ardour/automation_streamview.cc11
-rw-r--r--gtk2_ardour/automation_streamview.h1
-rw-r--r--gtk2_ardour/automation_time_axis.cc31
-rw-r--r--gtk2_ardour/automation_time_axis.h8
-rw-r--r--gtk2_ardour/canvas-curve.h65
-rw-r--r--gtk2_ardour/canvas-flag.cc105
-rw-r--r--gtk2_ardour/canvas-flag.h74
-rw-r--r--gtk2_ardour/canvas-hit.cc60
-rw-r--r--gtk2_ardour/canvas-hit.h59
-rw-r--r--gtk2_ardour/canvas-imageframe.c586
-rw-r--r--gtk2_ardour/canvas-imageframe.h87
-rw-r--r--gtk2_ardour/canvas-noevent-pixbuf.h41
-rw-r--r--gtk2_ardour/canvas-noevent-rect.h44
-rw-r--r--gtk2_ardour/canvas-noevent-text.h44
-rw-r--r--gtk2_ardour/canvas-note-event.cc375
-rw-r--r--gtk2_ardour/canvas-note-event.h169
-rw-r--r--gtk2_ardour/canvas-note.cc75
-rw-r--r--gtk2_ardour/canvas-note.h74
-rw-r--r--gtk2_ardour/canvas-simpleline.h64
-rw-r--r--gtk2_ardour/canvas-simplerect.h72
-rw-r--r--gtk2_ardour/canvas-sysex.cc102
-rw-r--r--gtk2_ardour/canvas-sysex.h61
-rw-r--r--gtk2_ardour/canvas-waveview.h143
-rw-r--r--gtk2_ardour/canvas.h44
-rw-r--r--gtk2_ardour/canvas_impl.h34
-rw-r--r--gtk2_ardour/control_point.cc35
-rw-r--r--gtk2_ardour/control_point.h13
-rw-r--r--gtk2_ardour/crossfade_edit.cc200
-rw-r--r--gtk2_ardour/crossfade_edit.h20
-rw-r--r--gtk2_ardour/crossfade_view.h11
-rw-r--r--gtk2_ardour/diamond.cc84
-rw-r--r--gtk2_ardour/diamond.h52
-rw-r--r--gtk2_ardour/edit_note_dialog.cc4
-rw-r--r--gtk2_ardour/edit_note_dialog.h11
-rw-r--r--gtk2_ardour/editor.cc110
-rw-r--r--gtk2_ardour/editor.h134
-rw-r--r--gtk2_ardour/editor_actions.cc5
-rw-r--r--gtk2_ardour/editor_audiotrack.cc4
-rw-r--r--gtk2_ardour/editor_canvas.cc388
-rw-r--r--gtk2_ardour/editor_canvas_events.cc22
-rw-r--r--gtk2_ardour/editor_cursors.cc82
-rw-r--r--gtk2_ardour/editor_cursors.h34
-rw-r--r--gtk2_ardour/editor_drag.cc132
-rw-r--r--gtk2_ardour/editor_drag.h20
-rw-r--r--gtk2_ardour/editor_imageframe.cc1
-rw-r--r--gtk2_ardour/editor_markers.cc23
-rw-r--r--gtk2_ardour/editor_mixer.cc2
-rw-r--r--gtk2_ardour/editor_mouse.cc140
-rw-r--r--gtk2_ardour/editor_ops.cc142
-rw-r--r--gtk2_ardour/editor_routes.cc12
-rw-r--r--gtk2_ardour/editor_rulers.cc86
-rw-r--r--gtk2_ardour/editor_selection.cc8
-rw-r--r--gtk2_ardour/editor_summary.cc17
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc11
-rw-r--r--gtk2_ardour/enums.h12
-rw-r--r--gtk2_ardour/ghostregion.cc68
-rw-r--r--gtk2_ardour/ghostregion.h44
-rw-r--r--gtk2_ardour/imageframe.cc190
-rw-r--r--gtk2_ardour/imageframe.h143
-rw-r--r--gtk2_ardour/imageframe_time_axis.cc14
-rw-r--r--gtk2_ardour/imageframe_time_axis.h10
-rw-r--r--gtk2_ardour/imageframe_time_axis_group.cc15
-rw-r--r--gtk2_ardour/imageframe_time_axis_group.h11
-rw-r--r--gtk2_ardour/imageframe_time_axis_view.cc24
-rw-r--r--gtk2_ardour/imageframe_time_axis_view.h28
-rw-r--r--gtk2_ardour/imageframe_view.cc1
-rw-r--r--gtk2_ardour/imageframe_view.h2
-rw-r--r--gtk2_ardour/lineset.cc803
-rw-r--r--gtk2_ardour/lineset.h194
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/lxvst_plugin_ui.h0
-rw-r--r--gtk2_ardour/marker.cc170
-rw-r--r--gtk2_ardour/marker.h17
-rw-r--r--gtk2_ardour/marker_time_axis.cc11
-rw-r--r--gtk2_ardour/marker_time_axis.h10
-rw-r--r--gtk2_ardour/marker_time_axis_view.cc31
-rw-r--r--gtk2_ardour/marker_time_axis_view.h21
-rw-r--r--gtk2_ardour/marker_view.cc1
-rw-r--r--gtk2_ardour/marker_view.h1
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/midi_automation_line.cc0
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/midi_automation_line.h0
-rw-r--r--gtk2_ardour/midi_region_view.cc250
-rw-r--r--gtk2_ardour/midi_region_view.h52
-rw-r--r--gtk2_ardour/midi_streamview.cc46
-rw-r--r--gtk2_ardour/midi_streamview.h5
-rw-r--r--gtk2_ardour/midi_time_axis.cc10
-rw-r--r--gtk2_ardour/midi_time_axis.h1
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/missing_plugin_dialog.cc0
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/missing_plugin_dialog.h0
-rw-r--r--gtk2_ardour/note.cc144
-rw-r--r--gtk2_ardour/note.h70
-rw-r--r--gtk2_ardour/patch_change.cc226
-rw-r--r--gtk2_ardour/patch_change.h (renamed from gtk2_ardour/canvas_patch_change.h)52
-rw-r--r--gtk2_ardour/public_editor.h4
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/region_editor.cc0
-rw-r--r--gtk2_ardour/region_editor.h1
-rw-r--r--gtk2_ardour/region_gain_line.cc2
-rw-r--r--gtk2_ardour/region_gain_line.h1
-rw-r--r--gtk2_ardour/region_view.cc145
-rw-r--r--gtk2_ardour/region_view.h24
-rw-r--r--gtk2_ardour/route_time_axis.cc38
-rw-r--r--gtk2_ardour/route_time_axis.h11
-rw-r--r--gtk2_ardour/simpleline.cc191
-rw-r--r--gtk2_ardour/simpleline.h208
-rw-r--r--gtk2_ardour/simpleline_p.h67
-rw-r--r--gtk2_ardour/simplerect.cc224
-rw-r--r--gtk2_ardour/simplerect.h151
-rw-r--r--gtk2_ardour/simplerect_p.h66
-rw-r--r--gtk2_ardour/streamview.cc66
-rw-r--r--gtk2_ardour/streamview.h17
-rw-r--r--gtk2_ardour/strip_silence_dialog.cc4
-rw-r--r--gtk2_ardour/strip_silence_dialog.h1
-rw-r--r--gtk2_ardour/tape_region_view.cc7
-rw-r--r--gtk2_ardour/tape_region_view.h2
-rw-r--r--gtk2_ardour/tempo_lines.cc71
-rw-r--r--gtk2_ardour/tempo_lines.h10
-rw-r--r--gtk2_ardour/time_axis_view.cc117
-rw-r--r--gtk2_ardour/time_axis_view.h9
-rw-r--r--gtk2_ardour/time_axis_view_item.cc148
-rw-r--r--gtk2_ardour/time_axis_view_item.h33
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/track_selection.cc0
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/track_view_list.cc0
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/track_view_list.h0
-rw-r--r--gtk2_ardour/utils.cc10
-rw-r--r--gtk2_ardour/utils.h11
-rw-r--r--gtk2_ardour/verbose_cursor.cc8
-rw-r--r--gtk2_ardour/verbose_cursor.h3
-rw-r--r--gtk2_ardour/video_image_frame.h1
-rw-r--r--gtk2_ardour/visual_time_axis.cc1
-rw-r--r--gtk2_ardour/visual_time_axis.h1
-rw-r--r--gtk2_ardour/waveview.cc323
-rw-r--r--gtk2_ardour/waveview.h177
-rw-r--r--gtk2_ardour/waveview_p.h67
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/window_proxy.cc0
-rw-r--r--[-rwxr-xr-x]gtk2_ardour/window_proxy.h0
-rw-r--r--gtk2_ardour/wscript39
149 files changed, 2259 insertions, 7321 deletions
diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in
index 0d802dfab5..30f3194cf0 100644
--- a/gtk2_ardour/ardev_common.sh.in
+++ b/gtk2_ardour/ardev_common.sh.in
@@ -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
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 931ceadd21..4c1be5f674 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -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;
}
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 40b71cea78..916398ddd8 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -35,7 +35,6 @@
#include <list>
#include <cmath>
-#include <libgnomecanvasmm/canvas.h>
#include "pbd/xml++.h"
#include "pbd/controllable.h"
diff --git a/gtk2_ardour/audio_region_editor.h b/gtk2_ardour/audio_region_editor.h
index dd65a3fb31..b72986ecf1 100644
--- a/gtk2_ardour/audio_region_editor.h
+++ b/gtk2_ardour/audio_region_editor.h
@@ -34,7 +34,6 @@
#include <gtkmm/separator.h>
#include <gtkmm/spinbutton.h>
-#include <libgnomecanvas/libgnomecanvas.h>
#include "pbd/signals.h"
#include "pbd/crossthread.h"
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 4d45d6d837..2ffbfb15e2 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -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);
-
- 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->property_amplitude_above_axis() = _amplitude_above_axis;
+ WaveView *wave = new WaveView (ghost->group, audio_region());
- wave->property_region_start() = _region->start();
+ 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->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));
}
}
@@ -1128,30 +1119,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 ()
{
//case cMutedWaveForm:
@@ -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::Points points;
+ ArdourCanvas::Line* canvas_item = new ArdourCanvas::Line(group);
- 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->set (ArdourCanvas::Duple (-1.0, 2.0),
+ ArdourCanvas::Duple (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();
diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h
index 10159d0cfb..01eb8870c5 100644
--- a/gtk2_ardour/audio_region_view.h
+++ b/gtk2_ardour/audio_region_view.h
@@ -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;
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 6d24dff2ca..9527b63382 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -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());
}
}
}
diff --git a/gtk2_ardour/audio_streamview.h b/gtk2_ardour/audio_streamview.h
index a3f7c63559..8e9b095537 100644
--- a/gtk2_ardour/audio_streamview.h
+++ b/gtk2_ardour/audio_streamview.h
@@ -27,7 +27,6 @@
#include "ardour/location.h"
#include "editing.h"
-#include "simplerect.h"
#include "streamview.h"
namespace Gdk {
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index bf980690aa..d22806a8c0 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -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)
{
diff --git a/gtk2_ardour/audio_time_axis.h b/gtk2_ardour/audio_time_axis.h
index 8a5b6ab0ac..5790080160 100644
--- a/gtk2_ardour/audio_time_axis.h
+++ b/gtk2_ardour/audio_time_axis.h
@@ -38,7 +38,6 @@
#include "enums.h"
#include "editing.h"
#include "route_time_axis.h"
-#include "canvas.h"
namespace ARDOUR {
class Session;
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index 7e60bff2e3..d9cdf1f51f 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -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();
diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h
index cafeeee2ac..2b41647fe0 100644
--- a/gtk2_ardour/automation_line.h
+++ b/gtk2_ardour/automation_line.h
@@ -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 */
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 5c9fc767df..f48fec43b9 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -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);
diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h
index 3e2a9b6bbf..885bf2176c 100644
--- a/gtk2_ardour/automation_region_view.h
+++ b/gtk2_ardour/automation_region_view.h
@@ -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();
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc
index e477b7ce72..fa6a824819 100644
--- a/gtk2_ardour/automation_streamview.cc
+++ b/gtk2_ardour/automation_streamview.cc
@@ -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);
diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h
index 2b8013fefd..d058f02434 100644
--- a/gtk2_ardour/automation_streamview.h
+++ b/gtk2_ardour/automation_streamview.h
@@ -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"
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 848298c8b8..5391e78c63 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -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 */
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index f1a9a8bd57..4de120649b 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -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 */
diff --git a/gtk2_ardour/canvas-curve.h b/gtk2_ardour/canvas-curve.h
deleted file mode 100644
index cad9270454..0000000000
--- a/gtk2_ardour/canvas-curve.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-flag.cc b/gtk2_ardour/canvas-flag.cc
deleted file mode 100644
index fd000f2a85..0000000000
--- a/gtk2_ardour/canvas-flag.cc
+++ /dev/null
@@ -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;
- }
-}
diff --git a/gtk2_ardour/canvas-flag.h b/gtk2_ardour/canvas-flag.h
deleted file mode 100644
index 95c2176e40..0000000000
--- a/gtk2_ardour/canvas-flag.h
+++ /dev/null
@@ -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_*/
diff --git a/gtk2_ardour/canvas-hit.cc b/gtk2_ardour/canvas-hit.cc
deleted file mode 100644
index 8ebd2f2ae4..0000000000
--- a/gtk2_ardour/canvas-hit.cc
+++ /dev/null
@@ -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
diff --git a/gtk2_ardour/canvas-hit.h b/gtk2_ardour/canvas-hit.h
deleted file mode 100644
index f25c49ab10..0000000000
--- a/gtk2_ardour/canvas-hit.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-imageframe.c b/gtk2_ardour/canvas-imageframe.c
deleted file mode 100644
index 3654836c79..0000000000
--- a/gtk2_ardour/canvas-imageframe.c
+++ /dev/null
@@ -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;
-}
diff --git a/gtk2_ardour/canvas-imageframe.h b/gtk2_ardour/canvas-imageframe.h
deleted file mode 100644
index 8cfb6e273a..0000000000
--- a/gtk2_ardour/canvas-imageframe.h
+++ /dev/null
@@ -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
diff --git a/gtk2_ardour/canvas-noevent-pixbuf.h b/gtk2_ardour/canvas-noevent-pixbuf.h
deleted file mode 100644
index 4424a9087e..0000000000
--- a/gtk2_ardour/canvas-noevent-pixbuf.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-noevent-rect.h b/gtk2_ardour/canvas-noevent-rect.h
deleted file mode 100644
index edfeae670d..0000000000
--- a/gtk2_ardour/canvas-noevent-rect.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-noevent-text.h b/gtk2_ardour/canvas-noevent-text.h
deleted file mode 100644
index bb7e8a3eb1..0000000000
--- a/gtk2_ardour/canvas-noevent-text.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-note-event.cc b/gtk2_ardour/canvas-note-event.cc
deleted file mode 100644
index 867e3cdf1c..0000000000
--- a/gtk2_ardour/canvas-note-event.cc
+++ /dev/null
@@ -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
-
diff --git a/gtk2_ardour/canvas-note-event.h b/gtk2_ardour/canvas-note-event.h
deleted file mode 100644
index e5b4896b92..0000000000
--- a/gtk2_ardour/canvas-note-event.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-note.cc b/gtk2_ardour/canvas-note.cc
deleted file mode 100644
index 0246cfe041..0000000000
--- a/gtk2_ardour/canvas-note.cc
+++ /dev/null
@@ -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
diff --git a/gtk2_ardour/canvas-note.h b/gtk2_ardour/canvas-note.h
deleted file mode 100644
index 46b0f1d600..0000000000
--- a/gtk2_ardour/canvas-note.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-simpleline.h b/gtk2_ardour/canvas-simpleline.h
deleted file mode 100644
index 66a4b90682..0000000000
--- a/gtk2_ardour/canvas-simpleline.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-simplerect.h b/gtk2_ardour/canvas-simplerect.h
deleted file mode 100644
index 39151a9935..0000000000
--- a/gtk2_ardour/canvas-simplerect.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas-sysex.cc b/gtk2_ardour/canvas-sysex.cc
deleted file mode 100644
index ca378fb303..0000000000
--- a/gtk2_ardour/canvas-sysex.cc
+++ /dev/null
@@ -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;
-}
-
diff --git a/gtk2_ardour/canvas-sysex.h b/gtk2_ardour/canvas-sysex.h
deleted file mode 100644
index c49fcc6df9..0000000000
--- a/gtk2_ardour/canvas-sysex.h
+++ /dev/null
@@ -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_ */
diff --git a/gtk2_ardour/canvas-waveview.h b/gtk2_ardour/canvas-waveview.h
deleted file mode 100644
index 9ece3f5425..0000000000
--- a/gtk2_ardour/canvas-waveview.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas.h b/gtk2_ardour/canvas.h
deleted file mode 100644
index 1bf3be96d2..0000000000
--- a/gtk2_ardour/canvas.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/canvas_impl.h b/gtk2_ardour/canvas_impl.h
deleted file mode 100644
index d8f9a63ad5..0000000000
--- a/gtk2_ardour/canvas_impl.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc
index d869e094aa..8e05ad0a0b 100644
--- a/gtk2_ardour/control_point.cc
+++ b/gtk2_ardour/control_point.cc
@@ -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);
}
diff --git a/gtk2_ardour/control_point.h b/gtk2_ardour/control_point.h
index 0c2bf1e01d..1a7a1f22b8 100644
--- a/gtk2_ardour/control_point.h
+++ b/gtk2_ardour/control_point.h
@@ -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;
diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc
index 3b50520901..1db0438729 100644
--- a/gtk2_ardour/crossfade_edit.cc
+++ b/gtk2_ardour/crossfade_edit.cc
@@ -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()));
-
- 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;
+ ArdourCanvas::WaveView* waveview = new ArdourCanvas::WaveView (canvas->root(), region);
+
+ 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);
diff --git a/gtk2_ardour/crossfade_edit.h b/gtk2_ardour/crossfade_edit.h
index fab459c54f..5d9e665ba0 100644
--- a/gtk2_ardour/crossfade_edit.h
+++ b/gtk2_ardour/crossfade_edit.h
@@ -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 */
diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h
index af33cb7296..33cd04de11 100644
--- a/gtk2_ardour/crossfade_view.h
+++ b/gtk2_ardour/crossfade_view.h
@@ -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 ();
diff --git a/gtk2_ardour/diamond.cc b/gtk2_ardour/diamond.cc
deleted file mode 100644
index 4ed7fa9ebc..0000000000
--- a/gtk2_ardour/diamond.cc
+++ /dev/null
@@ -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);
-}
diff --git a/gtk2_ardour/diamond.h b/gtk2_ardour/diamond.h
deleted file mode 100644
index a9110d497d..0000000000
--- a/gtk2_ardour/diamond.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/edit_note_dialog.cc b/gtk2_ardour/edit_note_dialog.cc
index 17827693e7..2056b5b18e 100644
--- a/gtk2_ardour/edit_note_dialog.cc
+++ b/gtk2_ardour/edit_note_dialog.cc
@@ -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)
diff --git a/gtk2_ardour/edit_note_dialog.h b/gtk2_ardour/edit_note_dialog.h
index cc92f290c3..11fd70a91c 100644
--- a/gtk2_ardour/edit_note_dialog.h
+++ b/gtk2_ardour/edit_note_dialog.h
@@ -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;
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 4f3390e752..1b9e463c2c 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -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);
+}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 8ecd5cc07d..ed7c3f0791 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -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;
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index a8c381cd5f..0fe99582ca 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -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
diff --git a/gtk2_ardour/editor_audiotrack.cc b/gtk2_ardour/editor_audiotrack.cc
index df88f7b65f..87e85ca687 100644
--- a/gtk2_ardour/editor_audiotrack.cc
+++ b/gtk2_ardour/editor_audiotrack.cc
@@ -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());
}
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 8be0e61a7b..8f85e81867 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -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 ();
- }
-
- track_canvas->set_can_default (true);
- set_default (*track_canvas);
+ /* XXX */
- 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());
+
+ _trackview_group = new ArdourCanvas::Group (_master_group);
+ _region_motion_group = new ArdourCanvas::Group (_trackview_group);
+
+ 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);
+
+ 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);
- 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;
+ 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);
- 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;
+ 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);
- 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;
+ 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);
- 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;
+ 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);
- 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;
+ _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);
-
- x_delta = - (x1 + p);
+ _track_canvas_hadj->set_value (p);
+ _time_bars_canvas_hadj->set_value (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
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index e76b4ce8ee..e9d74ed2dc 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -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;
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index ccacda210f..4a123f1e79 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -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));
-
- 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;
-
- 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_outline_width (1);
+ _track_canvas_item.set_outline_width (1);
+
+ 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);
+ }
+
+ _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);
-
- if (new_pos != points.front().get_x()) {
+ double const new_pos = _editor.frame_to_unit (frame);
- points.front().set_x (new_pos);
- points.back().set_x (new_pos);
+ if (new_pos != _time_bars_canvas_item.x ()) {
+ _time_bars_canvas_item.set_x (new_pos);
+ }
- canvas_item.property_points() = points;
+ if (new_pos != _track_canvas_item.x0 ()) {
+ _track_canvas_item.set_x0 (new_pos);
+ _track_canvas_item.set_x1 (new_pos);
}
- current_frame = frame;
+
+ _current_frame = frame;
+}
+
+void
+EditorCursor::show ()
+{
+ _time_bars_canvas_item.show ();
+ _track_canvas_item.show ();
}
void
-EditorCursor::set_length (double units)
+EditorCursor::hide ()
{
- length = units;
- points.back().set_y (points.front().get_y() + length);
- canvas_item.property_points() = points;
+ _time_bars_canvas_item.hide ();
+ _track_canvas_item.hide ();
}
void
-EditorCursor::set_y_axis (double position)
+EditorCursor::set_color (ArdourCanvas::Color color)
{
- points.front().set_y (position);
- points.back().set_y (position + length);
- canvas_item.property_points() = points;
+ _time_bars_canvas_item.set_color (color);
+ _track_canvas_item.set_outline_color (color);
}
diff --git a/gtk2_ardour/editor_cursors.h b/gtk2_ardour/editor_cursors.h
index 2e2c654bd1..0cc6eae5b8 100644
--- a/gtk2_ardour/editor_cursors.h
+++ b/gtk2_ardour/editor_cursors.h
@@ -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;
};
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 1713fe58c0..20ca13f949 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -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);
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index 9e9f263d76..3cfb38d020 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -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;
};
diff --git a/gtk2_ardour/editor_imageframe.cc b/gtk2_ardour/editor_imageframe.cc
index f4c8f1bb0b..e1c3a5bf4a 100644
--- a/gtk2_ardour/editor_imageframe.cc
+++ b/gtk2_ardour/editor_imageframe.cc
@@ -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"
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index 070ce4bc6e..2a88fd1bfc 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -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) {
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index f63e396ba7..b693cf7e75 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -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
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 8709a0fcfe..2fefdd02ad 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -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) {
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 415614b811..672ae083f6 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -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));
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index d0918a026a..6a60623cb1 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -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
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 76152208c3..5047feb1cb 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -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(),
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index fbe46a1ae9..f6b52799c6 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -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;
}
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index 4e148e2e7b..287b6d1213 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -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.
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index c9147d69db..8342d5eb1f 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -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
diff --git a/gtk2_ardour/enums.h b/gtk2_ardour/enums.h
index 680421e271..aa789a634c 100644
--- a/gtk2_ardour/enums.h
+++ b/gtk2_ardour/enums.h
@@ -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;
};
diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc
index 31e6de390b..e21f77f654 100644
--- a/gtk2_ardour/ghostregion.cc
+++ b/gtk2_ardour/ghostregion.cc
@@ -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.
diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h
index 083f71b3e2..384127150a 100644
--- a/gtk2_ardour/ghostregion.h
+++ b/gtk2_ardour/ghostregion.h
@@ -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;
};
diff --git a/gtk2_ardour/imageframe.cc b/gtk2_ardour/imageframe.cc
deleted file mode 100644
index ac30511864..0000000000
--- a/gtk2_ardour/imageframe.cc
+++ /dev/null
@@ -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
diff --git a/gtk2_ardour/imageframe.h b/gtk2_ardour/imageframe.h
deleted file mode 100644
index 466d0804f5..0000000000
--- a/gtk2_ardour/imageframe.h
+++ /dev/null
@@ -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 */
-
diff --git a/gtk2_ardour/imageframe_time_axis.cc b/gtk2_ardour/imageframe_time_axis.cc
index 3b3d9bffde..9a870a915a 100644
--- a/gtk2_ardour/imageframe_time_axis.cc
+++ b/gtk2_ardour/imageframe_time_axis.cc
@@ -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);
}
}
diff --git a/gtk2_ardour/imageframe_time_axis.h b/gtk2_ardour/imageframe_time_axis.h
index 52c2f73e67..6866261a80 100644
--- a/gtk2_ardour/imageframe_time_axis.h
+++ b/gtk2_ardour/imageframe_time_axis.h
@@ -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
diff --git a/gtk2_ardour/imageframe_time_axis_group.cc b/gtk2_ardour/imageframe_time_axis_group.cc
index c42452bafe..5fb9fc2770 100644
--- a/gtk2_ardour/imageframe_time_axis_group.cc
+++ b/gtk2_ardour/imageframe_time_axis_group.cc
@@ -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;
}
/**
diff --git a/gtk2_ardour/imageframe_time_axis_group.h b/gtk2_ardour/imageframe_time_axis_group.h
index c1ec26e912..9c104b3b74 100644
--- a/gtk2_ardour/imageframe_time_axis_group.h
+++ b/gtk2_ardour/imageframe_time_axis_group.h
@@ -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
diff --git a/gtk2_ardour/imageframe_time_axis_view.cc b/gtk2_ardour/imageframe_time_axis_view.cc
index 8df7a91612..b883ae919d 100644
--- a/gtk2_ardour/imageframe_time_axis_view.cc
+++ b/gtk2_ardour/imageframe_time_axis_view.cc
@@ -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());
}
diff --git a/gtk2_ardour/imageframe_time_axis_view.h b/gtk2_ardour/imageframe_time_axis_view.h
index 1191068c1d..e1d0c6567f 100644
--- a/gtk2_ardour/imageframe_time_axis_view.h
+++ b/gtk2_ardour/imageframe_time_axis_view.h
@@ -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 ;
diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc
index 9b9a8c2bdb..b73db4c0c0 100644
--- a/gtk2_ardour/imageframe_view.cc
+++ b/gtk2_ardour/imageframe_view.cc
@@ -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;
diff --git a/gtk2_ardour/imageframe_view.h b/gtk2_ardour/imageframe_view.h
index 49b29038c4..88641a4b17 100644
--- a/gtk2_ardour/imageframe_view.h
+++ b/gtk2_ardour/imageframe_view.h
@@ -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"
diff --git a/gtk2_ardour/lineset.cc b/gtk2_ardour/lineset.cc
deleted file mode 100644
index c1761c5398..0000000000
--- a/gtk2_ardour/lineset.cc
+++ /dev/null
@@ -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 */
diff --git a/gtk2_ardour/lineset.h b/gtk2_ardour/lineset.h
deleted file mode 100644
index 2f9a61d039..0000000000
--- a/gtk2_ardour/lineset.h
+++ /dev/null
@@ -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__ */
diff --git a/gtk2_ardour/lxvst_plugin_ui.h b/gtk2_ardour/lxvst_plugin_ui.h
index 522f24c2da..522f24c2da 100755..100644
--- a/gtk2_ardour/lxvst_plugin_ui.h
+++ b/gtk2_ardour/lxvst_plugin_ui.h
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 27fa9f5d42..ce21533af6 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -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 ()
diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h
index 6bf6d08f51..02ef3dc478 100644
--- a/gtk2_ardour/marker.h
+++ b/gtk2_ardour/marker.h
@@ -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;
diff --git a/gtk2_ardour/marker_time_axis.cc b/gtk2_ardour/marker_time_axis.cc
index dd827b4c3c..4cc2cec92f 100644
--- a/gtk2_ardour/marker_time_axis.cc
+++ b/gtk2_ardour/marker_time_axis.cc
@@ -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);
}
}
diff --git a/gtk2_ardour/marker_time_axis.h b/gtk2_ardour/marker_time_axis.h
index bb30bc24db..fccb5019fe 100644
--- a/gtk2_ardour/marker_time_axis.h
+++ b/gtk2_ardour/marker_time_axis.h
@@ -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);
/**
diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc
index b1eb7066cd..89d9acd111 100644
--- a/gtk2_ardour/marker_time_axis_view.cc
+++ b/gtk2_ardour/marker_time_axis_view.cc
@@ -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());
}
diff --git a/gtk2_ardour/marker_time_axis_view.h b/gtk2_ardour/marker_time_axis_view.h
index caf022178b..d0cd6007ee 100644
--- a/gtk2_ardour/marker_time_axis_view.h
+++ b/gtk2_ardour/marker_time_axis_view.h
@@ -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;
diff --git a/gtk2_ardour/marker_view.cc b/gtk2_ardour/marker_view.cc
index 4bd842341b..e7a003733e 100644
--- a/gtk2_ardour/marker_view.cc
+++ b/gtk2_ardour/marker_view.cc
@@ -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"
diff --git a/gtk2_ardour/marker_view.h b/gtk2_ardour/marker_view.h
index 38088b078a..487b39c459 100644
--- a/gtk2_ardour/marker_view.h
+++ b/gtk2_ardour/marker_view.h
@@ -23,7 +23,6 @@
#include <string>
#include "time_axis_view_item.h"
-#include "canvas.h"
namespace Gdk {
class Color;
diff --git a/gtk2_ardour/midi_automation_line.cc b/gtk2_ardour/midi_automation_line.cc
index 359c516485..359c516485 100755..100644
--- a/gtk2_ardour/midi_automation_line.cc
+++ b/gtk2_ardour/midi_automation_line.cc
diff --git a/gtk2_ardour/midi_automation_line.h b/gtk2_ardour/midi_automation_line.h
index aafe966028..aafe966028 100755..100644
--- a/gtk2_ardour/midi_automation_line.h
+++ b/gtk2_ardour/midi_automation_line.h
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index d6b6935e11..056665eefd 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -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);
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 5f374da55c..b64ab729b0 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -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;
diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc
index 90e6147763..3ef5bf4870 100644
--- a/gtk2_ardour/midi_streamview.cc
+++ b/gtk2_ardour/midi_streamview.cc
@@ -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);
-
- _note_lines->property_x1() = 0;
- _note_lines->property_y1() = 0;
- _note_lines->property_x2() = DBL_MAX;
- _note_lines->property_y2() = 0;
+ can be put below ghost regions from MIDI underlays
+ */
+ _note_lines = new ArdourCanvas::LineSet (_canvas_group);
- _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());
}
}
diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h
index 1e6289d63c..b3506d4224 100644
--- a/gtk2_ardour/midi_streamview.h
+++ b/gtk2_ardour/midi_streamview.h
@@ -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;
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 09f7b1b113..b1d898c426 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -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 ();
}
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index 25e89fc2e0..e021e38769 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -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 {
diff --git a/gtk2_ardour/missing_plugin_dialog.cc b/gtk2_ardour/missing_plugin_dialog.cc
index ddbca3a5f4..ddbca3a5f4 100755..100644
--- a/gtk2_ardour/missing_plugin_dialog.cc
+++ b/gtk2_ardour/missing_plugin_dialog.cc
diff --git a/gtk2_ardour/missing_plugin_dialog.h b/gtk2_ardour/missing_plugin_dialog.h
index 06df8a7c33..06df8a7c33 100755..100644
--- a/gtk2_ardour/missing_plugin_dialog.h
+++ b/gtk2_ardour/missing_plugin_dialog.h
diff --git a/gtk2_ardour/note.cc b/gtk2_ardour/note.cc
new file mode 100644
index 0000000000..23358130a0
--- /dev/null
+++ b/gtk2_ardour/note.cc
@@ -0,0 +1,144 @@
+/*
+ Copyright (C) 2007 Paul Davis
+ Author: Dave 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.
+*/
+
+#include "evoral/Note.hpp"
+#include "canvas/rectangle.h"
+#include "note.h"
+#include "midi_region_view.h"
+#include "public_editor.h"
+
+using namespace ARDOUR;
+using namespace ArdourCanvas;
+
+Note::Note (
+ MidiRegionView& region,
+ Group* group,
+ const boost::shared_ptr<NoteType> note,
+ bool with_events
+ )
+ : NoteBase (region, with_events, note)
+{
+ _rectangle = new Rectangle (group);
+ _rectangle->name = "note";
+ set_item (_rectangle);
+}
+
+Note::~Note ()
+{
+ delete _rectangle;
+}
+
+void
+Note::move_event (double dx, double dy)
+{
+ _rectangle->move (Duple (dx, dy));
+
+ /* XXX */
+ // if (_text) {
+ // _text->hide();
+ // _text->property_x() = _text->property_x() + dx;
+ // _text->property_y() = _text->property_y() + dy;
+ // _text->show();
+ // }
+}
+
+Coord
+Note::x0 () const
+{
+ return _rectangle->x0 ();
+}
+
+Coord
+Note::x1 () const
+{
+ return _rectangle->x1 ();
+}
+
+Coord
+Note::y0 () const
+{
+ return _rectangle->y0 ();
+}
+
+Coord
+Note::y1 () const
+{
+ return _rectangle->y1 ();
+}
+
+void
+Note::set_outline_color (uint32_t color)
+{
+ _rectangle->set_outline_color (color);
+}
+
+void
+Note::set_fill_color (uint32_t color)
+{
+ _rectangle->set_fill_color (color);
+}
+
+void
+Note::show ()
+{
+ _rectangle->show ();
+}
+
+void
+Note::hide ()
+{
+ _rectangle->hide ();
+}
+
+void
+Note::set_x0 (Coord x0)
+{
+ _rectangle->set_x0 (x0);
+}
+
+void
+Note::set_y0 (Coord y0)
+{
+ _rectangle->set_y0 (y0);
+}
+
+void
+Note::set_x1 (Coord x1)
+{
+ _rectangle->set_x1 (x1);
+}
+
+void
+Note::set_y1 (Coord y1)
+{
+ _rectangle->set_y1 (y1);
+}
+
+void
+Note::set_outline_what (int what)
+{
+ _rectangle->set_outline_what (what);
+}
+
+void
+Note::set_ignore_events (bool ignore)
+{
+ _rectangle->set_ignore_events (ignore);
+}
diff --git a/gtk2_ardour/note.h b/gtk2_ardour/note.h
new file mode 100644
index 0000000000..26c45adda1
--- /dev/null
+++ b/gtk2_ardour/note.h
@@ -0,0 +1,70 @@
+/*
+ Copyright (C) 2007 Paul Davis
+ Author: Dave 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_note_h__
+#define __gtk_ardour_note_h__
+
+#include <iostream>
+#include "note_base.h"
+#include "midi_util.h"
+
+namespace ArdourCanvas {
+ class Group;
+}
+
+class Note : public NoteBase
+{
+public:
+ typedef Evoral::Note<Evoral::MusicalTime> NoteType;
+
+ Note (MidiRegionView& region,
+ ArdourCanvas::Group* group,
+ const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
+ bool with_events = true);
+
+ ~Note ();
+
+ ArdourCanvas::Coord x0 () const;
+ ArdourCanvas::Coord y0 () const;
+ ArdourCanvas::Coord x1 () const;
+ ArdourCanvas::Coord y1 () const;
+
+ void set_x0 (ArdourCanvas::Coord);
+ void set_y0 (ArdourCanvas::Coord);
+ void set_x1 (ArdourCanvas::Coord);
+ void set_y1 (ArdourCanvas::Coord);
+
+ void set_outline_what (int);
+
+ void set_outline_color (uint32_t);
+ void set_fill_color (uint32_t);
+
+ void show ();
+ void hide ();
+
+ void set_ignore_events (bool);
+
+ void move_event (double dx, double dy);
+
+private:
+ ArdourCanvas::Rectangle* _rectangle;
+};
+
+#endif /* __gtk_ardour_note_h__ */
diff --git a/gtk2_ardour/patch_change.cc b/gtk2_ardour/patch_change.cc
new file mode 100644
index 0000000000..b5d9c6c8a7
--- /dev/null
+++ b/gtk2_ardour/patch_change.cc
@@ -0,0 +1,226 @@
+/*
+ Copyright (C) 2000-2010 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 <glibmm/regex.h>
+
+#include "gtkmm2ext/keyboard.h"
+#include "ardour/midi_patch_manager.h"
+#include "ardour_ui.h"
+#include "midi_region_view.h"
+#include "patch_change.h"
+#include "editor.h"
+#include "editor_drag.h"
+
+using namespace MIDI::Name;
+using namespace std;
+
+/** @param x x position in pixels.
+ */
+PatchChange::PatchChange(
+ MidiRegionView& region,
+ ArdourCanvas::Group* parent,
+ const string& text,
+ double height,
+ double x,
+ double y,
+ string& model_name,
+ string& custom_device_mode,
+ ARDOUR::MidiModel::PatchChangePtr patch)
+ : _region (region)
+ , _model_name(model_name)
+ , _custom_device_mode(custom_device_mode)
+ , _patch (patch)
+ , _popup_initialized(false)
+{
+ _flag = new ArdourCanvas::Flag (
+ parent,
+ height,
+ ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get(),
+ ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get(),
+ ArdourCanvas::Duple (x, y)
+ );
+
+ _flag->Event.connect (sigc::mem_fun (*this, &PatchChange::event_handler));
+ _flag->set_text(text);
+}
+
+PatchChange::~PatchChange()
+{
+}
+
+void
+PatchChange::initialize_popup_menus()
+{
+ boost::shared_ptr<ChannelNameSet> channel_name_set =
+ MidiPatchManager::instance()
+ .find_channel_name_set(_model_name, _custom_device_mode, _patch->channel());
+
+ if (!channel_name_set) {
+ return;
+ }
+
+ const ChannelNameSet::PatchBanks& patch_banks = channel_name_set->patch_banks();
+
+ // fill popup menu:
+ Gtk::Menu::MenuList& patch_bank_menus = _popup.items();
+
+ for (ChannelNameSet::PatchBanks::const_iterator bank = patch_banks.begin();
+ bank != patch_banks.end();
+ ++bank) {
+ Glib::RefPtr<Glib::Regex> underscores = Glib::Regex::create("_");
+ std::string replacement(" ");
+
+ Gtk::Menu& patch_bank_menu = *manage(new Gtk::Menu());
+
+ const PatchBank::PatchNameList& patches = (*bank)->patch_name_list();
+ Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items();
+
+ for (PatchBank::PatchNameList::const_iterator patch = patches.begin();
+ patch != patches.end();
+ ++patch) {
+ std::string name = underscores->replace((*patch)->name().c_str(), -1, 0, replacement);
+
+ patch_menus.push_back(
+ Gtk::Menu_Helpers::MenuElem(
+ name,
+ sigc::bind(
+ sigc::mem_fun(*this, &PatchChange::on_patch_menu_selected),
+ (*patch)->patch_primary_key())) );
+ }
+
+
+ std::string name = underscores->replace((*bank)->name().c_str(), -1, 0, replacement);
+
+ patch_bank_menus.push_back(
+ Gtk::Menu_Helpers::MenuElem(
+ name,
+ patch_bank_menu) );
+ }
+}
+
+void
+PatchChange::on_patch_menu_selected(const PatchPrimaryKey& key)
+{
+ _region.change_patch_change (*this, key);
+}
+
+bool
+PatchChange::event_handler (GdkEvent* ev)
+{
+ switch (ev->type) {
+ case GDK_BUTTON_PRESS:
+ {
+ /* XXX: icky dcast */
+ Editor* e = dynamic_cast<Editor*> (&_region.get_time_axis_view().editor());
+ if (e->current_mouse_mode() == Editing::MouseObject && e->internal_editing()) {
+
+ if (Gtkmm2ext::Keyboard::is_delete_event (&ev->button)) {
+
+ _region.delete_patch_change (this);
+ return true;
+
+ } else if (Gtkmm2ext::Keyboard::is_edit_event (&ev->button)) {
+
+ _region.edit_patch_change (this);
+ return true;
+
+ } else if (ev->button.button == 1) {
+ e->drags()->set (new PatchChangeDrag (e, this, &_region), ev);
+ return true;
+ }
+ }
+
+ if (ev->button.button == 3) {
+ if (!_popup_initialized) {
+ initialize_popup_menus();
+ _popup_initialized = true;
+ }
+ _popup.popup(ev->button.button, ev->button.time);
+ return true;
+ }
+ break;
+ }
+
+ case GDK_KEY_PRESS:
+ switch (ev->key.keyval) {
+ case GDK_Up:
+ case GDK_KP_Up:
+ case GDK_uparrow:
+ _region.previous_patch (*this);
+ break;
+ case GDK_Down:
+ case GDK_KP_Down:
+ case GDK_downarrow:
+ _region.next_patch (*this);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case GDK_SCROLL:
+ if (ev->scroll.direction == GDK_SCROLL_UP) {
+ _region.previous_patch (*this);
+ return true;
+ } else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
+ _region.next_patch (*this);
+ return true;
+ }
+ break;
+
+ case GDK_ENTER_NOTIFY:
+ _region.patch_entered (this);
+ break;
+
+ case GDK_LEAVE_NOTIFY:
+ _region.patch_left (this);
+ break;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+void
+PatchChange::move (ArdourCanvas::Duple d)
+{
+ _flag->move (d);
+}
+
+void
+PatchChange::set_height (ArdourCanvas::Distance height)
+{
+ _flag->set_height (height);
+}
+
+void
+PatchChange::hide ()
+{
+ _flag->hide ();
+}
+
+void
+PatchChange::show ()
+{
+ _flag->show ();
+}
diff --git a/gtk2_ardour/canvas_patch_change.h b/gtk2_ardour/patch_change.h
index 2c103173df..fe54426e5f 100644
--- a/gtk2_ardour/canvas_patch_change.h
+++ b/gtk2_ardour/patch_change.h
@@ -17,10 +17,10 @@
*/
-#ifndef CANVAS_PATCH_CHANGE_H_
-#define CANVAS_PATCH_CHANGE_H_
+#ifndef __PATCH_CHANGE_H__
+#define __PATCH_CHANGE_H__
-#include "canvas-flag.h"
+#include "canvas/flag.h"
class MidiRegionView;
@@ -30,46 +30,50 @@ namespace MIDI {
}
}
-namespace ARDOUR {
- class InstrumentInfo;
-}
-
-namespace Gnome {
-namespace Canvas {
-
-class CanvasPatchChange : public CanvasFlag
+class PatchChange
{
public:
- CanvasPatchChange(
+ PatchChange(
MidiRegionView& region,
- Group& parent,
+ ArdourCanvas::Group* parent,
const string& text,
double height,
double x,
double y,
- ARDOUR::InstrumentInfo& info,
- ARDOUR::MidiModel::PatchChangePtr patch,
- bool
+ string& model_name,
+ string& custom_device_mode,
+ ARDOUR::MidiModel::PatchChangePtr patch
);
- virtual ~CanvasPatchChange();
-
- virtual bool on_event(GdkEvent* ev);
+ ~PatchChange();
+ string model_name () const { return _model_name; }
+ string custom_device_mode () const { return _custom_device_mode; }
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
void initialize_popup_menus();
void on_patch_menu_selected(const MIDI::Name::PatchPrimaryKey& key);
+ ArdourCanvas::Item* canvas_item () const {
+ return _flag;
+ }
+
+ void move (ArdourCanvas::Duple);
+ void set_height (ArdourCanvas::Distance);
+ void hide ();
+ void show ();
+
private:
- ARDOUR::InstrumentInfo& _info;
+ bool event_handler (GdkEvent *);
+
+ MidiRegionView& _region;
+ string _model_name;
+ string _custom_device_mode;
ARDOUR::MidiModel::PatchChangePtr _patch;
Gtk::Menu _popup;
bool _popup_initialized;
+ ArdourCanvas::Flag* _flag;
};
-} // namespace Canvas
-} // namespace Gnome
-
-#endif /*CANVASPROGRAMCHANGE_H_*/
+#endif /* __PATCH_CHANGE_H__ */
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 0dabc5f5e8..c921f410fb 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -40,7 +40,6 @@
#include "pbd/statefuldestructible.h"
#include "editing.h"
-#include "canvas.h"
#include "selection.h"
namespace ARDOUR {
@@ -388,7 +387,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
#endif
virtual gdouble get_trackview_group_vertical_offset () const = 0;
- virtual double get_canvas_timebars_vsize () const = 0;
virtual ArdourCanvas::Group* get_trackview_group () const = 0;
virtual ArdourCanvas::Group* get_background_group () const = 0;
@@ -423,6 +421,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
virtual void get_regions_at (RegionSelection &, framepos_t where, TrackViewList const &) const = 0;
+ virtual void save_canvas_state () = 0;
+
/// Singleton instance, set up by Editor::Editor()
static PublicEditor* _instance;
diff --git a/gtk2_ardour/region_editor.cc b/gtk2_ardour/region_editor.cc
index 51e4deddc8..51e4deddc8 100755..100644
--- a/gtk2_ardour/region_editor.cc
+++ b/gtk2_ardour/region_editor.cc
diff --git a/gtk2_ardour/region_editor.h b/gtk2_ardour/region_editor.h
index 6579182282..b584a9b0b8 100644
--- a/gtk2_ardour/region_editor.h
+++ b/gtk2_ardour/region_editor.h
@@ -35,7 +35,6 @@
#include <gtkmm/spinbutton.h>
#include <gtkmm/listviewtext.h>
-#include <libgnomecanvas/libgnomecanvas.h>
#include "pbd/signals.h"
diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc
index 8dfbdeeff4..827ebde12d 100644
--- a/gtk2_ardour/region_gain_line.cc
+++ b/gtk2_ardour/region_gain_line.cc
@@ -48,7 +48,7 @@ AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView&
_time_converter->set_origin_b (r.region()->position() - r.region()->start());
group->raise_to_top ();
- group->property_y() = 2;
+ group->set_y_position (2);
set_uses_gain_mapping (true);
terminal_points_can_slide = false;
}
diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h
index c0b843acd0..1eae91bc27 100644
--- a/gtk2_ardour/region_gain_line.h
+++ b/gtk2_ardour/region_gain_line.h
@@ -22,7 +22,6 @@
#include "ardour/ardour.h"
-#include <libgnomecanvasmm.h>
#include "automation_line.h"
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index dd99a5237b..4bddc117eb 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -28,17 +28,17 @@
#include "ardour/playlist.h"
#include "ardour/session.h"
+#include "canvas/polygon.h"
+#include "canvas/debug.h"
+#include "canvas/pixbuf.h"
+#include "canvas/text.h"
+
#include "ardour_ui.h"
#include "global_signals.h"
-#include "canvas-noevent-text.h"
-#include "canvas-noevent-rect.h"
#include "streamview.h"
#include "region_view.h"
#include "automation_region_view.h"
#include "route_time_axis.h"
-#include "simplerect.h"
-#include "simpleline.h"
-#include "waveview.h"
#include "public_editor.h"
#include "region_editor.h"
#include "ghostregion.h"
@@ -165,26 +165,26 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
if (name_highlight) {
name_highlight->set_data ("regionview", this);
- name_highlight->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
+ name_highlight->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
if (frame_handle_start) {
frame_handle_start->set_data ("regionview", this);
frame_handle_start->set_data ("isleft", (void*) 1);
- frame_handle_start->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_start, this));
+ frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_start, this));
frame_handle_start->raise_to_top();
}
if (frame_handle_end) {
frame_handle_end->set_data ("regionview", this);
frame_handle_end->set_data ("isleft", (void*) 0);
- frame_handle_end->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_end, this));
+ frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_frame_handle_event), frame_handle_end, this));
frame_handle_end->raise_to_top();
}
}
if (name_pixbuf) {
name_pixbuf->set_data ("regionview", this);
- name_pixbuf->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_event), name_pixbuf, this));
+ name_pixbuf->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_event), name_pixbuf, this));
}
if (wfd) {
@@ -195,7 +195,7 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
_region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
- group->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
+ group->Event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
set_colors ();
@@ -212,7 +212,7 @@ RegionView::~RegionView ()
delete *g;
}
- for (list<ArdourCanvas::SimpleRect*>::iterator i = _coverage_frames.begin (); i != _coverage_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin (); i != _coverage_frames.end (); ++i) {
delete *i;
}
@@ -237,17 +237,17 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
- ArdourCanvas::SimpleRect* cr = new ArdourCanvas::NoEventSimpleRect (*group);
+ ArdourCanvas::Rectangle* cr = new ArdourCanvas::NoEventSimpleRect (group);
_silent_frames.push_back (cr);
/* coordinates for the rect are relative to the regionview origin */
- cr->property_x1() = trackview.editor().frame_to_pixel (i->first - _region->start());
- cr->property_x2() = trackview.editor().frame_to_pixel (i->second - _region->start());
- cr->property_y1() = 1;
- cr->property_y2() = _height - 2;
- cr->property_outline_pixels() = 0;
- cr->property_fill_color_rgba () = color;
+ cr->set_x0 (trackview.editor().frame_to_pixel (i->first - _region->start()));
+ cr->set_x1 (trackview.editor().frame_to_pixel (i->second - _region->start()));
+ cr->set_y0 (1);
+ cr->set_y1 (_height - 2);
+ cr->set_outline (false);
+ cr->set_fill_color (color);
shortest = min (shortest, i->second - i->first);
}
@@ -270,15 +270,15 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
shortest_audible = min (shortest_audible, dur);
}
- _silence_text = new ArdourCanvas::NoEventText (*group);
- _silence_text->property_font_desc() = get_font_for_style (N_("SilenceText"));
- _silence_text->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SilenceText.get();
- _silence_text->property_anchor() = ANCHOR_NW;
+ _silence_text = new ArdourCanvas::Text (group);
+ _silence_text->set_ignore_events (true);
+ _silence_text->set_font_description() = get_font_for_style (N_("SilenceText"));
+ _silence_text->set_fill_color (ARDOUR_UI::config()->canvasvar_SilenceText.get());
/* both positions are relative to the region start offset in source */
- _silence_text->property_x() = trackview.editor().frame_to_pixel (silences.front().first - _region->start()) + 10.0;
- _silence_text->property_y() = 20.0;
+ _silence_text->set_x_position (trackview.editor().frame_to_pixel (silences.front().first - _region->start()) + 10.0);
+ _silence_text->set_y_position (20.0);
double ms = (float) shortest/_region->session().frame_rate();
@@ -318,13 +318,13 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
text += string_compose (_("\n (shortest audible segment = %1 %2)"), ma, aunits);
}
- _silence_text->property_text() = text.c_str ();
+ _silence_text->set_text (text.c_str ());
}
void
RegionView::hide_silent_frames ()
{
- for (list<ArdourCanvas::SimpleRect*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
(*i)->hide ();
}
_silence_text->hide();
@@ -333,7 +333,7 @@ RegionView::hide_silent_frames ()
void
RegionView::drop_silent_frames ()
{
- for (list<ArdourCanvas::SimpleRect*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
delete *i;
}
_silent_frames.clear ();
@@ -423,7 +423,7 @@ RegionView::region_resized (const PropertyChange& what_changed)
set_duration (_region->length(), 0);
- unit_length = _region->length() / samples_per_unit;
+ unit_length = _region->length() / frames_per_pixel;
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@@ -481,7 +481,7 @@ RegionView::set_position (framepos_t pos, void* /*src*/, double* ignored)
if (delta) {
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- (*i)->group->move (delta, 0.0);
+ (*i)->group->move (ArdourCanvas::Duple (delta, 0.0));
}
}
@@ -489,13 +489,13 @@ RegionView::set_position (framepos_t pos, void* /*src*/, double* ignored)
}
void
-RegionView::set_samples_per_unit (gdouble spu)
+RegionView::set_frames_per_pixel (double fpp)
{
- TimeAxisViewItem::set_samples_per_unit (spu);
+ TimeAxisViewItem::set_frames_per_pixel (fpp);
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- (*i)->set_samples_per_unit (spu);
- (*i)->set_duration (_region->length() / samples_per_unit);
+ (*i)->set_frames_per_pixel (fpp);
+ (*i)->set_duration (_region->length() / fpp);
}
region_sync_changed ();
@@ -509,7 +509,7 @@ RegionView::set_duration (framecnt_t frames, void *src)
}
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- (*i)->set_duration (_region->length() / samples_per_unit);
+ (*i)->set_duration (_region->length() / frames_per_pixel);
}
return true;
@@ -521,8 +521,9 @@ RegionView::set_colors ()
TimeAxisViewItem::set_colors ();
if (sync_mark) {
- sync_mark->property_fill_color_rgba() = RGBA_TO_UINT(0,255,0,255); // fill_color; // FIXME make a themeable colour
- sync_line->property_fill_color_rgba() = RGBA_TO_UINT(0,255,0,255); // fill_color; // FIXME make a themeable colour
+ /* XXX: make these colours themable */
+ sync_mark->set_fill_color (RGBA_TO_UINT (0, 255, 0, 255));
+ sync_line->set_outline_color (RGBA_TO_UINT (0, 255, 0, 255));
}
}
@@ -632,15 +633,15 @@ RegionView::region_sync_changed ()
/* points set below */
- sync_mark = new ArdourCanvas::Polygon (*group);
- sync_mark->property_fill_color_rgba() = RGBA_TO_UINT(0,255,0,255); // fill_color; // FIXME make a themeable colour
+ sync_mark = new ArdourCanvas::Polygon (group);
+ sync_mark->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // fill_color; // FIXME make a themeable colour
- sync_line = new ArdourCanvas::Line (*group);
- sync_line->property_fill_color_rgba() = RGBA_TO_UINT(0,255,0,255); // fill_color; // FIXME make a themeable colour
- sync_line->property_width_pixels() = 1;
+ sync_line = new ArdourCanvas::Line (group);
+ sync_line->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // fill_color // FIXME make a themeable colour
+ sync_line->set_outline_width (1);
}
- /* this has to handle both a genuine change of position, a change of samples_per_unit,
+ /* this has to handle both a genuine change of position, a change of frames_per_pixel
and a change in the bounds of the _region->
*/
@@ -668,19 +669,15 @@ RegionView::region_sync_changed ()
//points = sync_mark->property_points().get_value();
- double offset = sync_offset / samples_per_unit;
- points.push_back (Gnome::Art::Point (offset - ((sync_mark_width-1)/2), 1));
- points.push_back (Gnome::Art::Point (offset + ((sync_mark_width-1)/2), 1));
- points.push_back (Gnome::Art::Point (offset, sync_mark_width - 1));
- points.push_back (Gnome::Art::Point (offset - ((sync_mark_width-1)/2), 1));
- sync_mark->property_points().set_value (points);
+ double offset = sync_offset / frames_per_pixel;
+ points.push_back (ArdourCanvas::Duple (offset - ((sync_mark_width-1)/2), 1));
+ points.push_back (ArdourCanvas::Duple (offset + ((sync_mark_width-1)/2), 1));
+ points.push_back (ArdourCanvas::Duple (offset, sync_mark_width - 1));
+ points.push_back (ArdourCanvas::Duple (offset - ((sync_mark_width-1)/2), 1));
+ sync_mark->set (points);
sync_mark->show ();
- points.clear ();
- points.push_back (Gnome::Art::Point (offset, 0));
- points.push_back (Gnome::Art::Point (offset, trackview.current_height() - NAME_HIGHLIGHT_SIZE));
-
- sync_line->property_points().set_value (points);
+ sync_line->set (ArdourCanvas::Duple (offset, 0), ArdourCanvas::Duple (offset, trackview.current_height() - NAME_HIGHLIGHT_SIZE));
sync_line->show ();
}
}
@@ -693,12 +690,12 @@ RegionView::move (double x_delta, double y_delta)
return;
}
- get_canvas_group()->move (x_delta, y_delta);
+ get_canvas_group()->move (ArdourCanvas::Duple (x_delta, y_delta));
/* note: ghosts never leave their tracks so y_delta for them is always zero */
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
- (*i)->group->move (x_delta, 0.0);
+ (*i)->group->move (ArdourCanvas::Duple (x_delta, 0.0));
}
}
@@ -744,19 +741,20 @@ RegionView::set_height (double h)
int sync_dir;
framecnt_t sync_offset;
sync_offset = _region->sync_offset (sync_dir);
- double offset = sync_offset / samples_per_unit;
+ double offset = sync_offset / frames_per_pixel;
- points.push_back (Gnome::Art::Point (offset, 0));
- points.push_back (Gnome::Art::Point (offset, h - NAME_HIGHLIGHT_SIZE));
- sync_line->property_points().set_value (points);
+ sync_line->set (
+ ArdourCanvas::Duple (offset, 0),
+ ArdourCanvas::Duple (offset, h - NAME_HIGHLIGHT_SIZE)
+ );
}
- for (list<ArdourCanvas::SimpleRect*>::iterator i = _coverage_frames.begin(); i != _coverage_frames.end(); ++i) {
- (*i)->property_y2() = h + 1;
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin(); i != _coverage_frames.end(); ++i) {
+ (*i)->set_y1 (h + 1);
}
- for (list<ArdourCanvas::SimpleRect*>::iterator i = _silent_frames.begin(); i != _silent_frames.end(); ++i) {
- (*i)->property_y2() = h + 1;
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin(); i != _silent_frames.end(); ++i) {
+ (*i)->set_y1 (h + 1);
}
}
@@ -767,7 +765,7 @@ void
RegionView::update_coverage_frames (LayerDisplay d)
{
/* remove old coverage frames */
- for (list<ArdourCanvas::SimpleRect*>::iterator i = _coverage_frames.begin (); i != _coverage_frames.end (); ++i) {
+ for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin (); i != _coverage_frames.end (); ++i) {
delete *i;
}
@@ -787,7 +785,7 @@ RegionView::update_coverage_frames (LayerDisplay d)
framepos_t t = position;
framepos_t const end = _region->last_frame ();
- ArdourCanvas::SimpleRect* cr = 0;
+ ArdourCanvas::Rectangle* cr = 0;
bool me = false;
/* the color that will be used to show parts of regions that will not be heard */
@@ -807,16 +805,17 @@ RegionView::update_coverage_frames (LayerDisplay d)
/* start off any new rect, if required */
if (cr == 0 || me != new_me) {
- cr = new ArdourCanvas::NoEventSimpleRect (*group);
+ cr = new ArdourCanvas::Rectangle (group);
_coverage_frames.push_back (cr);
- cr->property_x1() = trackview.editor().frame_to_pixel (t - position);
- cr->property_y1() = 1;
- cr->property_y2() = _height + 1;
- cr->property_outline_pixels() = 0;
+ cr->set_x0 (trackview.editor().frame_to_pixel (t - position));
+ cr->set_y0 (1);
+ cr->set_y1 (_height + 1);
+ cr->set_outline (false);
+ cr->set_ignore_events (true);
if (new_me) {
- cr->property_fill_color_rgba () = UINT_RGBA_CHANGE_A (non_playing_color, 0);
+ cr->set_fill_color (UINT_RGBA_CHANGE_A (non_playing_color, 0));
} else {
- cr->property_fill_color_rgba () = non_playing_color;
+ cr->set_fill_color (non_playing_color);
}
}
@@ -826,7 +825,7 @@ RegionView::update_coverage_frames (LayerDisplay d)
if (cr) {
/* finish off the last rectangle */
- cr->property_x2() = trackview.editor().frame_to_pixel (end - position);
+ cr->set_x1 (trackview.editor().frame_to_pixel (end - position));
}
if (frame_handle_start) {
diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h
index 1eda8fd360..5b1c57044e 100644
--- a/gtk2_ardour/region_view.h
+++ b/gtk2_ardour/region_view.h
@@ -21,8 +21,6 @@
#include <vector>
-#include <libgnomecanvasmm.h>
-#include <libgnomecanvasmm/polygon.h>
#include <sigc++/signal.h>
#include "ardour/region.h"
#include "ardour/beats_frames_converter.h"
@@ -30,7 +28,6 @@
#include "time_axis_view_item.h"
#include "automation_line.h"
#include "enums.h"
-#include "canvas.h"
class TimeAxisView;
class RegionEditor;
@@ -38,9 +35,10 @@ class GhostRegion;
class AutomationTimeAxisView;
class AutomationRegionView;
-namespace Gnome { namespace Canvas {
- class NoEventText;
-} }
+namespace ArdourCanvas {
+ class Polygon;
+ class Text;
+}
class RegionView : public TimeAxisViewItem
{
@@ -48,7 +46,7 @@ class RegionView : public TimeAxisViewItem
RegionView (ArdourCanvas::Group* parent,
TimeAxisView& time_view,
boost::shared_ptr<ARDOUR::Region> region,
- double samples_per_unit,
+ double frames_per_pixel,
Gdk::Color const & basic_color,
bool automation = false);
@@ -66,7 +64,7 @@ class RegionView : public TimeAxisViewItem
void set_valid (bool yn) { valid = yn; }
virtual void set_height (double);
- virtual void set_samples_per_unit (double);
+ virtual void set_frames_per_pixel (double);
virtual bool set_duration (framecnt_t, void*);
void move (double xdelta, double ydelta);
@@ -130,7 +128,7 @@ class RegionView : public TimeAxisViewItem
RegionView (ArdourCanvas::Group *,
TimeAxisView&,
boost::shared_ptr<ARDOUR::Region>,
- double samples_per_unit,
+ double frames_per_pixel,
Gdk::Color const & basic_color,
bool recording,
TimeAxisViewItem::Visibility);
@@ -176,17 +174,17 @@ class RegionView : public TimeAxisViewItem
different bits of regions according to whether or not they are the one
that will be played at any given time.
*/
- std::list<ArdourCanvas::SimpleRect*> _coverage_frames;
+ std::list<ArdourCanvas::Rectangle*> _coverage_frames;
/** a list of rectangles used to show silent segments
*/
- std::list<ArdourCanvas::SimpleRect*> _silent_frames;
+ std::list<ArdourCanvas::Rectangle*> _silent_frames;
/** a list of rectangles used to show the current silence threshold
*/
- std::list<ArdourCanvas::SimpleRect*> _silent_threshold_frames;
+ std::list<ArdourCanvas::Rectangle*> _silent_threshold_frames;
/** a text item to display strip silence statistics
*/
- ArdourCanvas::NoEventText* _silence_text;
+ ArdourCanvas::Text* _silence_text;
ARDOUR::BeatsFramesConverter _region_relative_time_converter;
ARDOUR::BeatsFramesConverter _source_relative_time_converter;
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 8fb01370b7..35d306cc64 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -57,7 +57,6 @@
#include "global_signals.h"
#include "route_time_axis.h"
#include "automation_time_axis.h"
-#include "canvas_impl.h"
#include "enums.h"
#include "gui_thread.h"
#include "keyboard.h"
@@ -68,7 +67,6 @@
#include "region_view.h"
#include "rgb_macros.h"
#include "selection.h"
-#include "simplerect.h"
#include "streamview.h"
#include "utils.h"
#include "route_group_menu.h"
@@ -85,7 +83,7 @@ using namespace Editing;
using namespace std;
using std::list;
-RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
+RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
: AxisView(sess)
, RouteUI(sess)
, TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas)
@@ -234,7 +232,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
}
- _editor.ZoomChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
+ _editor.ZoomChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::reset_frames_per_pixel));
_editor.HorizontalPositionChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::horizontal_position_changed));
ColorsChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::color_handler));
@@ -775,13 +773,9 @@ RouteTimeAxisView::show_timestretch (framepos_t start, framepos_t end, int layer
#endif
if (timestretch_rect == 0) {
- timestretch_rect = new SimpleRect (*canvas_display ());
- timestretch_rect->property_x1() = 0.0;
- timestretch_rect->property_y1() = 0.0;
- timestretch_rect->property_x2() = 0.0;
- timestretch_rect->property_y2() = 0.0;
- timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
- timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
+ timestretch_rect = new ArdourCanvas::Rectangle (canvas_display ());
+ timestretch_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_TimeStretchFill.get());
+ timestretch_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get());
}
timestretch_rect->show ();
@@ -790,10 +784,8 @@ RouteTimeAxisView::show_timestretch (framepos_t start, framepos_t end, int layer
double const x1 = start / _editor.get_current_zoom();
double const x2 = (end - 1) / _editor.get_current_zoom();
- timestretch_rect->property_x1() = x1;
- timestretch_rect->property_y1() = current_height() * (layers - layer - 1) / layers;
- timestretch_rect->property_x2() = x2;
- timestretch_rect->property_y2() = current_height() * (layers - layer) / layers;
+ timestretch_rect->set (ArdourCanvas::Rect (x1, current_height() * (layers - layer - 1) / layers,
+ x2, current_height() * (layers - layer) / layers));
}
void
@@ -898,9 +890,9 @@ RouteTimeAxisView::route_color_changed ()
}
void
-RouteTimeAxisView::reset_samples_per_unit ()
+RouteTimeAxisView::reset_frames_per_pixel ()
{
- set_samples_per_unit (_editor.get_current_zoom());
+ set_frames_per_pixel (_editor.get_current_zoom());
}
void
@@ -912,7 +904,7 @@ RouteTimeAxisView::horizontal_position_changed ()
}
void
-RouteTimeAxisView::set_samples_per_unit (double spu)
+RouteTimeAxisView::set_frames_per_pixel (double fpp)
{
double speed = 1.0;
@@ -921,10 +913,10 @@ RouteTimeAxisView::set_samples_per_unit (double spu)
}
if (_view) {
- _view->set_samples_per_unit (spu * speed);
+ _view->set_frames_per_pixel (fpp * speed);
}
- TimeAxisView::set_samples_per_unit (spu * speed);
+ TimeAxisView::set_frames_per_pixel (fpp * speed);
}
void
@@ -1142,7 +1134,7 @@ RouteTimeAxisView::clear_playlist ()
void
RouteTimeAxisView::speed_changed ()
{
- Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&RouteTimeAxisView::reset_samples_per_unit, this));
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&RouteTimeAxisView::reset_frames_per_pixel, this));
}
void
@@ -1620,11 +1612,11 @@ RouteTimeAxisView::color_handler ()
{
//case cTimeStretchOutline:
if (timestretch_rect) {
- timestretch_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get();
+ timestretch_rect->set_outline_color (ARDOUR_UI::config()->canvasvar_TimeStretchOutline.get());
}
//case cTimeStretchFill:
if (timestretch_rect) {
- timestretch_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeStretchFill.get();
+ timestretch_rect->set_fill_color (ARDOUR_UI::config()->canvasvar_TimeStretchFill.get());
}
reset_meter();
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 3a5bc34250..d6ea6f4124 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -43,7 +43,6 @@
#include "route_ui.h"
#include "enums.h"
#include "time_axis_view.h"
-#include "canvas.h"
#include "gain_meter.h"
namespace ARDOUR {
@@ -56,6 +55,10 @@ namespace ARDOUR {
class Playlist;
}
+namespace ArdourCanvas {
+ class Rectangle;
+}
+
class PublicEditor;
class RegionView;
class StreamView;
@@ -79,7 +82,7 @@ public:
void show_selection (TimeSelection&);
void set_button_names ();
- void set_samples_per_unit (double);
+ void set_frames_per_pixel (double);
void set_height (uint32_t h);
void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
void hide_timestretch ();
@@ -208,7 +211,7 @@ protected:
virtual void label_view ();
- void reset_samples_per_unit ();
+ void reset_frames_per_pixel ();
void horizontal_position_changed ();
virtual void build_automation_action_menu (bool);
@@ -264,7 +267,7 @@ protected:
void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
- ArdourCanvas::SimpleRect* timestretch_rect;
+ ArdourCanvas::Rectangle* timestretch_rect;
void set_track_mode (ARDOUR::TrackMode, bool apply_to_selection = false);
diff --git a/gtk2_ardour/simpleline.cc b/gtk2_ardour/simpleline.cc
deleted file mode 100644
index 6c8c4ceb10..0000000000
--- a/gtk2_ardour/simpleline.cc
+++ /dev/null
@@ -1,191 +0,0 @@
-// Generated by gtkmmproc -- DO NOT MODIFY!
-
-#include "simpleline.h"
-#include "simpleline_p.h"
-
-
-/* line.ccg
- *
- * 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.
- */
-
-//#include <libgnomecanvasmm/group.h>
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-SimpleLine::SimpleLine(Group& parentx)
- : Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
-{
- item_construct(parentx);
-}
-
- SimpleLine::SimpleLine(Group& parentx, double x1, double y1, double x2, double y2)
- : Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
-{
- item_construct(parentx);
- set ("x1", x1, "y1", y1, "x2", x2, "y2", y2, 0);
-}
-
-} /* namespace Canvas */
-} /* namespace Gnome */
-
-
-namespace Glib
-{
-
-Gnome::Canvas::SimpleLine* wrap(GnomeCanvasSimpleLine* object, bool take_copy)
-{
- return dynamic_cast<Gnome::Canvas::SimpleLine *> (Glib::wrap_auto ((GObject*)(object), take_copy));
-}
-
-} /* namespace Glib */
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& SimpleLine_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_ = &SimpleLine_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_simpleline_get_type());
-
- // Add derived versions of interfaces, if the C type implements any interfaces:
- }
-
- return *this;
-}
-
-void SimpleLine_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* SimpleLine_Class::wrap_new(GObject* o)
-{
- return manage(new SimpleLine((GnomeCanvasSimpleLine*)(o)));
-
-}
-
-
-/* The implementation: */
-
-SimpleLine::SimpleLine(const Glib::ConstructParams& construct_params)
-:
- Item(construct_params)
-{
- }
-
-SimpleLine::SimpleLine(GnomeCanvasSimpleLine* castitem)
-:
- Item((GnomeCanvasItem*)(castitem))
-{
- }
-
-SimpleLine::~SimpleLine()
-{
- destroy_();
-}
-
-SimpleLine::CppClassType SimpleLine::line_class_; // initialize static member
-
-GType SimpleLine::get_type()
-{
- return line_class_.init().get_type();
-}
-
-GType SimpleLine::get_base_type()
-{
- return gnome_canvas_line_get_type();
-}
-
-Glib::PropertyProxy<guint> SimpleLine::property_color_rgba()
-{
- return Glib::PropertyProxy<guint>(this, "color_rgba");
-}
-
-Glib::PropertyProxy_ReadOnly<guint> SimpleLine::property_color_rgba() const
-{
- return Glib::PropertyProxy_ReadOnly<guint>(this, "color_rgba");
-}
-
-Glib::PropertyProxy<double> SimpleLine::property_x1()
-{
- return Glib::PropertyProxy<double>(this, "x1");
-}
-
-Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_x1() const
-{
- return Glib::PropertyProxy_ReadOnly<double>(this, "x1");
-}
-
-Glib::PropertyProxy<double> SimpleLine::property_x2()
-{
- return Glib::PropertyProxy<double>(this, "x2");
-}
-
-Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_x2() const
-{
- return Glib::PropertyProxy_ReadOnly<double>(this, "x2");
-}
-
-Glib::PropertyProxy<double> SimpleLine::property_y1()
-{
- return Glib::PropertyProxy<double>(this, "y1");
-}
-
-Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_y1() const
-{
- return Glib::PropertyProxy_ReadOnly<double>(this, "y1");
-}
-
-Glib::PropertyProxy<double> SimpleLine::property_y2()
-{
- return Glib::PropertyProxy<double>(this, "y2");
-}
-
-Glib::PropertyProxy_ReadOnly<double> SimpleLine::property_y2() const
-{
- return Glib::PropertyProxy_ReadOnly<double>(this, "y2");
-}
-
-} // namespace Canvas
-
-} // namespace Gnome
-
-
diff --git a/gtk2_ardour/simpleline.h b/gtk2_ardour/simpleline.h
deleted file mode 100644
index 3aea5a4aa4..0000000000
--- a/gtk2_ardour/simpleline.h
+++ /dev/null
@@ -1,208 +0,0 @@
-// -*- c++ -*-
-#ifndef _LIBGNOMECANVASMM_SIMPLELINE_H
-#define _LIBGNOMECANVASMM_SIMPLELINE_H
-
-#include <glibmm.h>
-
-
-/* line.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 <libgnomecanvas/gnome-canvas-util.h>
-#include <libgnomecanvas/libgnomecanvas.h>
-#include "canvas-simpleline.h"
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-typedef struct _GnomeCanvasSimpleLine GnomeCanvasSimpleLine;
-typedef struct _GnomeCanvasSimpleLineClass GnomeCanvasSimpleLineClass;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-
-namespace Gnome
-{
-
-namespace Canvas
-{ class SimpleLine_Class; } // namespace Canvas
-
-} // namespace Gnome
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-class GnomeGroup;
-
-class SimpleLine : public Item
-{
- public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- typedef SimpleLine CppObjectType;
- typedef SimpleLine_Class CppClassType;
- typedef GnomeCanvasSimpleLine BaseObjectType;
- typedef GnomeCanvasSimpleLineClass BaseClassType;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- virtual ~SimpleLine();
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-private:
- friend class SimpleLine_Class;
- static CppClassType line_class_;
-
- // noncopyable
- SimpleLine(const SimpleLine&);
- SimpleLine& operator=(const SimpleLine&);
-
-protected:
- explicit SimpleLine(const Glib::ConstructParams& construct_params);
- explicit SimpleLine(GnomeCanvasSimpleLine* 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.
- GnomeCanvasSimpleLine* gobj() { return reinterpret_cast<GnomeCanvasSimpleLine*>(gobject_); }
-
- ///Provides access to the underlying C GtkObject.
- const GnomeCanvasSimpleLine* gobj() const { return reinterpret_cast<GnomeCanvasSimpleLine*>(gobject_); }
-
-
-public:
- //C++ methods used to invoke GTK+ virtual functions:
-
-protected:
- //GTK+ Virtual Functions (override these to change behaviour):
-
- //Default Signal Handlers::
-
-
-private:
-
-public:
- explicit SimpleLine(Group& parent);
- SimpleLine(Group& parent, double x1, double y1, double x2, double y2);
-
- /**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy<double> property_x1() ;
-
-/**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy_ReadOnly<double> property_x1() const;
-
- /**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy<double> property_x2() ;
-
-/**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy_ReadOnly<double> property_x2() const;
-
-
- /**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy<double> property_y1() ;
-
-/**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy_ReadOnly<double> property_y1() const;
-
- /**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy<double> property_y2() ;
-
-/**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy_ReadOnly<double> property_y2() const;
-
- /**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy<guint> property_color_rgba() ;
-
-/**
- *
- * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
- * the value of the property changes.
- */
- Glib::PropertyProxy_ReadOnly<guint> property_color_rgba() const;
-};
-
-} /* namespace Canvas */
-} /* namespace Gnome */
-
-
-namespace Glib
-{
- /** @relates Gnome::Canvas::SimpleLine
- * @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::SimpleLine* wrap(GnomeCanvasSimpleLine* object, bool take_copy = false);
-}
-#endif /* _LIBGNOMECANVASMM_LINE_H */
-
diff --git a/gtk2_ardour/simpleline_p.h b/gtk2_ardour/simpleline_p.h
deleted file mode 100644
index 0a2e3061fd..0000000000
--- a/gtk2_ardour/simpleline_p.h
+++ /dev/null
@@ -1,67 +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.
-
-*/
-
-// -*- c++ -*-
-#ifndef _LIBGNOMECANVASMM_SIMPLELINE_P_H
-#define _LIBGNOMECANVASMM_SIMPLELINE_P_H
-#include <libgnomecanvasmm/private/item_p.h>
-
-#include <glibmm/class.h>
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-class SimpleLine_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- typedef SimpleLine CppObjectType;
- typedef GnomeCanvasSimpleLine BaseObjectType;
- typedef GnomeCanvasSimpleLineClass BaseClassType;
- typedef Item_Class CppClassParent;
- typedef GnomeCanvasItemClass BaseClassParent;
-
- friend class SimpleLine;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- const Glib::Class& init();
-
- static void class_init_function(void* g_class, void* class_data);
-
- static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
- //Callbacks (default signal handlers):
- //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
- //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
- //Callbacks (virtual functions):
-};
-
-
-} // namespace Canvas
-
-} // namespace Gnome
-
-#endif /* _LIBGNOMECANVASMM_SIMPLELINE_P_H */
-
diff --git a/gtk2_ardour/simplerect.cc b/gtk2_ardour/simplerect.cc
deleted file mode 100644
index bb69fc34ca..0000000000
--- a/gtk2_ardour/simplerect.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-// Generated by gtkmmproc -- DO NOT MODIFY!
-
-#include "simplerect.h"
-#include "simplerect_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
-{
-
-SimpleRect::SimpleRect(Group& parentx, double x1, double y1, double x2, double y2)
-: Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
-{
- item_construct(parentx);
- set("x1",x1,"y1",y1,"x2",x2,"y2",y2,0);
-}
-
-SimpleRect::SimpleRect(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::SimpleRect* wrap(GnomeCanvasSimpleRect* object, bool take_copy)
-{
- return dynamic_cast<Gnome::Canvas::SimpleRect *> (Glib::wrap_auto ((GObject*)(object), take_copy));
-}
-
-} /* namespace Glib */
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& SimpleRect_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_ = &SimpleRect_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_simplerect_get_type());
-
- // Add derived versions of interfaces, if the C type implements any interfaces:
- }
-
- return *this;
-}
-
-void SimpleRect_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* SimpleRect_Class::wrap_new(GObject* o)
-{
- return manage(new SimpleRect((GnomeCanvasSimpleRect*)(o)));
-
-}
-
-/* The implementation: */
-
-SimpleRect::SimpleRect(const Glib::ConstructParams& construct_params)
-: Item(construct_params)
-{
- }
-
-SimpleRect::SimpleRect(GnomeCanvasSimpleRect* castitem)
-: Item ((GnomeCanvasItem*)(castitem))
-{
-}
-
-SimpleRect::~SimpleRect()
-{
- destroy_();
-}
-
-SimpleRect::CppClassType SimpleRect::rect_class_; // initialize static member
-
-GType SimpleRect::get_type()
-{
- return rect_class_.init().get_type();
-}
-
-GType SimpleRect::get_base_type()
-{
- return gnome_canvas_simplerect_get_type();
-}
-
-Glib::PropertyProxy<double> SimpleRect::property_x1()
-{
- return Glib::PropertyProxy<double> (this, "x1");
-}
-Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_x1() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "x1");
-}
-Glib::PropertyProxy<double> SimpleRect::property_y1()
-{
- return Glib::PropertyProxy<double> (this, "y1");
-}
-Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_y1() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "y1");
-}
-Glib::PropertyProxy<double> SimpleRect::property_x2()
-{
- return Glib::PropertyProxy<double> (this, "x2");
-}
-Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_x2() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "x2");
-}
-Glib::PropertyProxy<double> SimpleRect::property_y2()
-{
- return Glib::PropertyProxy<double> (this, "y2");
-}
-Glib::PropertyProxy_ReadOnly<double> SimpleRect::property_y2() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "y2");
-}
-Glib::PropertyProxy<guint> SimpleRect::property_outline_pixels()
-{
- return Glib::PropertyProxy<guint> (this, "outline_pixels");
-}
-Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_outline_pixels() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "outline_pixels");
-}
-Glib::PropertyProxy<guint> SimpleRect::property_outline_what()
-{
- return Glib::PropertyProxy<guint> (this, "outline_what");
-}
-Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_outline_what() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "outline_what");
-}
-Glib::PropertyProxy<bool> SimpleRect::property_fill()
-{
- return Glib::PropertyProxy<bool> (this, "fill");
-}
-Glib::PropertyProxy_ReadOnly<bool> SimpleRect::property_fill() const
-{
- return Glib::PropertyProxy_ReadOnly<bool> (this, "fill");
-}
-Glib::PropertyProxy<guint> SimpleRect::property_fill_color_rgba()
-{
- return Glib::PropertyProxy<guint> (this, "fill_color_rgba");
-}
-Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_fill_color_rgba() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "fill_color_rgba");
-}
-Glib::PropertyProxy<guint> SimpleRect::property_outline_color_rgba()
-{
- return Glib::PropertyProxy<guint> (this, "outline_color_rgba");
-}
-Glib::PropertyProxy_ReadOnly<guint> SimpleRect::property_outline_color_rgba() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "outline_color_rgba");
-}
-Glib::PropertyProxy<bool> SimpleRect::property_draw()
-{
- return Glib::PropertyProxy<bool> (this, "draw");
-}
-Glib::PropertyProxy_ReadOnly<bool> SimpleRect::property_draw() const
-{
- return Glib::PropertyProxy_ReadOnly<bool> (this, "draw");
-}
-
-
-
-} // namespace Canvas
-
-} // namespace Gnome
-
-
diff --git a/gtk2_ardour/simplerect.h b/gtk2_ardour/simplerect.h
deleted file mode 100644
index d102d91792..0000000000
--- a/gtk2_ardour/simplerect.h
+++ /dev/null
@@ -1,151 +0,0 @@
-// -*- c++ -*-
-#ifndef _LIBGNOMECANVASMM_SIMPLERECT_H
-#define _LIBGNOMECANVASMM_SIMPLERECT_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-simplerect.h"
-
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-typedef struct _GnomeCanvasSimpleRect GnomeCanvasSimpleRect;
-typedef struct _GnomeCanvasSimpleRectClass GnomeCanvasSimpleRectClass;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-
-namespace Gnome
-{
-
-namespace Canvas
-{ class SimpleRect_Class; } // namespace Canvas
-
-} // namespace Gnome
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-//class Group;
-
-
-class SimpleRect : public Item
-{
- public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- typedef SimpleRect CppObjectType;
- typedef SimpleRect_Class CppClassType;
- typedef GnomeCanvasSimpleRect BaseObjectType;
- typedef GnomeCanvasSimpleRectClass BaseClassType;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- virtual ~SimpleRect();
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-private:
- friend class SimpleRect_Class;
- static CppClassType rect_class_;
-
- // noncopyable
- SimpleRect(const SimpleRect&);
- SimpleRect& operator=(const SimpleRect&);
-
-protected:
- explicit SimpleRect(const Glib::ConstructParams& construct_params);
- explicit SimpleRect(GnomeCanvasSimpleRect* 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.
- GnomeCanvasSimpleRect* gobj() { return reinterpret_cast<GnomeCanvasSimpleRect*>(gobject_); }
-
- ///Provides access to the underlying C GtkObject.
- const GnomeCanvasSimpleRect* gobj() const { return reinterpret_cast<GnomeCanvasSimpleRect*>(gobject_); }
-
-
-public:
- //C++ methods used to invoke GTK+ virtual functions:
-
-protected:
- //GTK+ Virtual Functions (override these to change behaviour):
-
- //Default Signal Handlers::
-
-
-private:
-
-
-public:
- SimpleRect(Group& parent, double x1, double y1, double x2, double y2);
- explicit SimpleRect(Group& parent);
-
- Glib::PropertyProxy<double> property_x1();
- Glib::PropertyProxy_ReadOnly<double> property_x1() const;
- Glib::PropertyProxy<double> property_y1();
- Glib::PropertyProxy_ReadOnly<double> property_y1() const;
- Glib::PropertyProxy<double> property_x2();
- Glib::PropertyProxy_ReadOnly<double> property_x2() const;
- Glib::PropertyProxy<double> property_y2();
- Glib::PropertyProxy_ReadOnly<double> property_y2() const;
- Glib::PropertyProxy<guint> property_outline_pixels();
- Glib::PropertyProxy_ReadOnly<guint> property_outline_pixels() const;
- Glib::PropertyProxy<guint> property_outline_what();
- Glib::PropertyProxy_ReadOnly<guint> property_outline_what() const;
- Glib::PropertyProxy<bool> property_fill();
- Glib::PropertyProxy_ReadOnly<bool> property_fill() const;
- Glib::PropertyProxy<guint> property_fill_color_rgba();
- Glib::PropertyProxy_ReadOnly<guint> property_fill_color_rgba() const;
- Glib::PropertyProxy<guint> property_outline_color_rgba();
- Glib::PropertyProxy_ReadOnly<guint> property_outline_color_rgba() const;
- Glib::PropertyProxy<bool> property_draw();
- Glib::PropertyProxy_ReadOnly<bool> property_draw() const;
-
-};
-
-} /* namespace Canvas */
-} /* namespace Gnome */
-
-namespace Glib
-{
- /** @relates Gnome::Canvas::SimpleRect
- * @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::SimpleRect* wrap(GnomeCanvasSimpleRect* object, bool take_copy = false);
-}
-#endif /* _LIBGNOMECANVASMM_RECT_H */
-
diff --git a/gtk2_ardour/simplerect_p.h b/gtk2_ardour/simplerect_p.h
deleted file mode 100644
index 4338d1029d..0000000000
--- a/gtk2_ardour/simplerect_p.h
+++ /dev/null
@@ -1,66 +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.
-
-*/
-
-// -*- c++ -*-
-#ifndef _LIBGNOMECANVASMM_SIMPLERECT_P_H
-#define _LIBGNOMECANVASMM_SIMPLERECT_P_H
-
-#include <glibmm/class.h>
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-class SimpleRect_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- typedef SimpleRect CppObjectType;
- typedef GnomeCanvasSimpleRect BaseObjectType;
- typedef GnomeCanvasSimpleRectClass BaseClassType;
- typedef Shape_Class CppClassParent;
- typedef GnomeCanvasItemClass BaseClassParent;
-
- friend class SimpleRect;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- const Glib::Class& init();
-
- static void class_init_function(void* g_class, void* class_data);
-
- static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
- //Callbacks (default signal handlers):
- //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
- //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
- //Callbacks (virtual functions):
-};
-
-
-} // namespace Canvas
-
-} // namespace Gnome
-
-#endif /* _LIBGNOMECANVASMM_SIMPLERECT_P_H */
-
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 19f6ee65bb..db6f60f3b0 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -28,12 +28,13 @@
#include "ardour/track.h"
#include "ardour/session.h"
+#include "canvas/rectangle.h"
+#include "canvas/debug.h"
+
#include "streamview.h"
#include "global_signals.h"
#include "region_view.h"
#include "route_time_axis.h"
-#include "canvas-waveview.h"
-#include "canvas-simplerect.h"
#include "region_selection.h"
#include "selection.h"
#include "public_editor.h"
@@ -51,9 +52,9 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_g
: _trackview (tv)
, owns_background_group (background_group == 0)
, owns_canvas_group (canvas_group == 0)
- , _background_group (background_group ? background_group : new ArdourCanvas::Group (*_trackview.canvas_background()))
- , _canvas_group (canvas_group ? canvas_group : new ArdourCanvas::Group(*_trackview.canvas_display()))
- , _samples_per_unit (_trackview.editor().get_current_zoom ())
+ , _background_group (background_group ? background_group : new ArdourCanvas::Group (_trackview.canvas_background()))
+ , _canvas_group (canvas_group ? canvas_group : new ArdourCanvas::Group (_trackview.canvas_display()))
+ , _frames_per_pixel (_trackview.editor().get_current_zoom ())
, rec_updating(false)
, rec_active(false)
, stream_base_color(0xFFFFFFFF)
@@ -62,19 +63,20 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_g
, height(tv.height)
, last_rec_data_frame(0)
{
+ CANVAS_DEBUG_NAME (_background_group, "SV background group");
+ CANVAS_DEBUG_NAME (_canvas_group, "SV canvas group");
+
/* set_position() will position the group */
- canvas_rect = new ArdourCanvas::SimpleRect (*_background_group);
- canvas_rect->property_x1() = 0.0;
- canvas_rect->property_y1() = 0.0;
- canvas_rect->property_x2() = Gtkmm2ext::physical_screen_width (_trackview.editor().get_window());
- canvas_rect->property_y2() = (double) tv.current_height();
+ canvas_rect = new ArdourCanvas::Rectangle (_background_group);
+ CANVAS_DEBUG_NAME (canvas_rect, "SV canvas rectangle");
+ canvas_rect->set (ArdourCanvas::Rect (0, 0, ArdourCanvas::COORD_MAX, tv.current_height ()));
canvas_rect->raise(1); // raise above tempo lines
- canvas_rect->property_outline_what() = (guint32) (0x2|0x8); // outline RHS and bottom
- canvas_rect->property_outline_color_rgba() = RGBA_TO_UINT (0, 0, 0, 255);
+ canvas_rect->set_outline_what (0x2 | 0x8);
+ canvas_rect->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
- canvas_rect->signal_event().connect (sigc::bind (
+ canvas_rect->Event.connect (sigc::bind (
sigc::mem_fun (_trackview.editor(), &PublicEditor::canvas_stream_view_event),
canvas_rect, &_trackview));
@@ -116,8 +118,7 @@ StreamView::attach ()
int
StreamView::set_position (gdouble x, gdouble y)
{
- _canvas_group->property_x() = x;
- _canvas_group->property_y() = y;
+ _canvas_group->set_position (ArdourCanvas::Duple (x, y));
return 0;
}
@@ -129,40 +130,40 @@ StreamView::set_height (double h)
return -1;
}
- if (canvas_rect->property_y2() == h) {
+ if (canvas_rect->y1() == h) {
return 0;
}
height = h;
- canvas_rect->property_y2() = height;
+ canvas_rect->set_y1 (height);
update_contents_height ();
return 0;
}
int
-StreamView::set_samples_per_unit (gdouble spp)
+StreamView::set_frames_per_pixel (double fpp)
{
RegionViewList::iterator i;
- if (spp < 1.0) {
+ if (fpp < 1.0) {
return -1;
}
- _samples_per_unit = spp;
+ _frames_per_pixel = fpp;
for (i = region_views.begin(); i != region_views.end(); ++i) {
- (*i)->set_samples_per_unit (spp);
+ (*i)->set_frames_per_pixel (fpp);
}
for (vector<RecBoxInfo>::iterator xi = rec_rects.begin(); xi != rec_rects.end(); ++xi) {
RecBoxInfo &recbox = (*xi);
- gdouble xstart = _trackview.editor().frame_to_pixel (recbox.start);
- gdouble xend = _trackview.editor().frame_to_pixel (recbox.start + recbox.length);
+ ArdourCanvas::Coord const xstart = _trackview.editor().frame_to_pixel (recbox.start);
+ ArdourCanvas::Coord const xend = _trackview.editor().frame_to_pixel (recbox.start + recbox.length);
- recbox.rectangle->property_x1() = xstart;
- recbox.rectangle->property_x2() = xend;
+ recbox.rectangle->set_x0 (xstart);
+ recbox.rectangle->set_x1 (xend);
}
update_coverage_frames ();
@@ -367,9 +368,8 @@ StreamView::apply_color (Gdk::Color color, ColorTarget target)
break;
case StreamBaseColor:
- stream_base_color = RGBA_TO_UINT (
- color.get_red_p(), color.get_green_p(), color.get_blue_p(), 255);
- canvas_rect->property_fill_color_rgba() = stream_base_color;
+ stream_base_color = RGBA_TO_UINT (color.get_red_p(), color.get_green_p(), color.get_blue_p(), 255);
+ canvas_rect->set_fill_color (stream_base_color);
break;
}
}
@@ -435,8 +435,8 @@ StreamView::update_rec_box ()
break;
}
- rect.rectangle->property_x1() = xstart;
- rect.rectangle->property_x2() = xend;
+ rect.rectangle->set_x0 (xstart);
+ rect.rectangle->set_x1 (xend);
}
}
@@ -603,13 +603,13 @@ StreamView::update_contents_height ()
for (vector<RecBoxInfo>::iterator i = rec_rects.begin(); i != rec_rects.end(); ++i) {
switch (_layer_display) {
case Overlaid:
- i->rectangle->property_y2() = height;
+ i->rectangle->set_y1 (height);
break;
case Stacked:
case Expanded:
/* In stacked displays, the recregion is always at the top */
- i->rectangle->property_y1() = 0;
- i->rectangle->property_y2() = h;
+ i->rectangle->set_y0 (0);
+ i->rectangle->set_y1 (h)
break;
}
}
diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h
index 49001f57f6..0fe56dd10c 100644
--- a/gtk2_ardour/streamview.h
+++ b/gtk2_ardour/streamview.h
@@ -26,8 +26,6 @@
#include "ardour/location.h"
#include "enums.h"
-#include "simplerect.h"
-#include "canvas.h"
namespace Gdk {
class Color;
@@ -42,8 +40,13 @@ namespace ARDOUR {
struct PeakData;
}
+namespace ArdourCanvas {
+ class Rectangle;
+ class Group;
+}
+
struct RecBoxInfo {
- ArdourCanvas::SimpleRect* rectangle;
+ ArdourCanvas::Rectangle* rectangle;
framepos_t start;
ARDOUR::framecnt_t length;
};
@@ -70,8 +73,8 @@ public:
int set_position (gdouble x, gdouble y);
virtual int set_height (double);
- virtual int set_samples_per_unit (gdouble spp);
- gdouble get_samples_per_unit () { return _samples_per_unit; }
+ virtual int set_frames_per_pixel (double);
+ gdouble get_frames_per_pixel () const { return _frames_per_pixel; }
virtual void horizontal_position_changed () {}
virtual void enter_internal_edit_mode ();
@@ -153,12 +156,12 @@ protected:
bool owns_canvas_group;
ArdourCanvas::Group* _background_group;
ArdourCanvas::Group* _canvas_group;
- ArdourCanvas::SimpleRect* canvas_rect; /* frame around the whole thing */
+ ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
typedef std::list<RegionView* > RegionViewList;
RegionViewList region_views;
- double _samples_per_unit;
+ double _frames_per_pixel;
sigc::connection screen_update_connection;
std::vector<RecBoxInfo> rec_rects;
diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc
index 2fb4b5923f..d37fbb6585 100644
--- a/gtk2_ardour/strip_silence_dialog.cc
+++ b/gtk2_ardour/strip_silence_dialog.cc
@@ -30,11 +30,7 @@
#include "audio_clock.h"
#include "gui_thread.h"
#include "strip_silence_dialog.h"
-#include "canvas_impl.h"
#include "region_view.h"
-#include "simpleline.h"
-#include "waveview.h"
-#include "simplerect.h"
#include "rgb_macros.h"
#include "i18n.h"
#include "logmeter.h"
diff --git a/gtk2_ardour/strip_silence_dialog.h b/gtk2_ardour/strip_silence_dialog.h
index 5ba88812d7..8b2e43ac64 100644
--- a/gtk2_ardour/strip_silence_dialog.h
+++ b/gtk2_ardour/strip_silence_dialog.h
@@ -22,7 +22,6 @@
#include "ardour/types.h"
#include "ardour_dialog.h"
-#include "canvas.h"
#include "progress_reporter.h"
namespace ARDOUR {
diff --git a/gtk2_ardour/tape_region_view.cc b/gtk2_ardour/tape_region_view.cc
index 33731798d7..eb4d8271c9 100644
--- a/gtk2_ardour/tape_region_view.cc
+++ b/gtk2_ardour/tape_region_view.cc
@@ -87,11 +87,8 @@ TapeAudioRegionView::update (uint32_t n)
return;
}
- ENSURE_GUI_THREAD (*this, &TapeAudioRegionView::update, n)
-
- /* this triggers a cache invalidation and redraw in the waveview */
-
- waves[n]->property_data_src() = _region.get();
+ ENSURE_GUI_THREAD (*this, &TapeAudioRegionView::update, n);
+ waves[n]->rebuild ();
}
void
diff --git a/gtk2_ardour/tape_region_view.h b/gtk2_ardour/tape_region_view.h
index a3aa7142ea..dee5e1c3e4 100644
--- a/gtk2_ardour/tape_region_view.h
+++ b/gtk2_ardour/tape_region_view.h
@@ -30,7 +30,7 @@ class TapeAudioRegionView : public AudioRegionView
TapeAudioRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
- double initial_samples_per_unit,
+ double initial_frames_per_pixel,
Gdk::Color const & base_color);
~TapeAudioRegionView ();
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index 962acbd37d..f9899b8712 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -17,8 +17,9 @@
*/
-#include <libgnomecanvasmm/canvas.h>
-#include <libgnomecanvasmm/group.h>
+#include "canvas/line.h"
+#include "canvas/canvas.h"
+#include "canvas/debug.h"
#include "tempo_lines.h"
#include "ardour_ui.h"
@@ -26,8 +27,8 @@ using namespace std;
#define MAX_CACHED_LINES 128
-TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height)
- : _canvas(canvas)
+TempoLines::TempoLines (ArdourCanvas::GtkCanvasViewport& canvas_viewport, ArdourCanvas::Group* group, double screen_height)
+ : _canvas_viewport (canvas_viewport)
, _group(group)
, _clean_left(DBL_MAX)
, _clean_right(0.0)
@@ -46,9 +47,9 @@ TempoLines::tempo_map_changed()
for (Lines::iterator i = _lines.begin(); i != _lines.end(); d += 1.0) {
Lines::iterator next = i;
++next;
- i->second->property_x1() = - d;
- i->second->property_x2() = - d;
- ArdourCanvas::SimpleLine* f = i->second;
+ i->second->set_x0 (-d);
+ i->second->set_x1 (-d);
+ ArdourCanvas::Line* f = i->second;
_lines.erase(i);
_lines.insert(make_pair(- d, f));
i = next;
@@ -74,10 +75,10 @@ TempoLines::hide ()
void
TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
const ARDOUR::TempoMap::BBTPointList::const_iterator& end,
- double frames_per_unit)
+ double frames_per_pixel)
{
ARDOUR::TempoMap::BBTPointList::const_iterator i;
- ArdourCanvas::SimpleLine *line = NULL;
+ ArdourCanvas::Line *line = 0;
gdouble xpos;
double who_cares;
double x1, x2, y1, beat_density;
@@ -88,7 +89,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
const size_t needed = distance (begin, end);
- _canvas.get_scroll_region (x1, y1, x2, who_cares);
+ ArdourCanvas::Rect const visible = _canvas_viewport.visible_area ();
/* get the first bar spacing */
@@ -97,7 +98,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
bars = (*i).bar - (*begin).bar;
beats = distance (begin, end) - bars;
- beat_density = (beats * 10.0f) / _canvas.get_width ();
+ beat_density = (beats * 10.0f) / visible.width ();
if (beat_density > 4.0f) {
/* if the lines are too close together, they become useless */
@@ -105,12 +106,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
return;
}
- xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
+ xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_pixel);
const double needed_right = xpos;
i = begin;
- xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
+ xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_pixel);
const double needed_left = xpos;
Lines::iterator left = _lines.lower_bound(xpos); // first line >= xpos
@@ -143,12 +144,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
color = ARDOUR_UI::config()->canvasvar_MeasureLineBeat.get();
}
- xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
+ xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_pixel);
li = _lines.lower_bound(xpos); // first line >= xpos
- line = (li != _lines.end()) ? li->second : NULL;
- assert(!line || line->property_x1() == li->first);
+ line = (li != _lines.end()) ? li->second : 0;
+ assert(!line || line->x0() == li->first);
Lines::iterator next = li;
if (next != _lines.end())
@@ -157,11 +158,11 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
exhausted = (next == _lines.end());
// Hooray, line is perfect
- if (line && line->property_x1() == xpos) {
+ if (line && line->x0() == xpos) {
if (li != _lines.end())
++li;
- line->property_color_rgba() = color;
+ line->set_outline_color (color);
inserted_last_time = false; // don't search next time
// Use existing line, moving if necessary
} else if (!exhausted) {
@@ -174,9 +175,9 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
double const x = steal->first;
line = steal->second;
_lines.erase(steal);
- line->property_x1() = xpos;
- line->property_x2() = xpos;
- line->property_color_rgba() = color;
+ line->set_x0 (xpos);
+ line->set_x1 (xpos);
+ line->set_outline_color (color);
_lines.insert(make_pair(xpos, line));
inserted_last_time = true; // search next time
invalidated = true;
@@ -191,20 +192,20 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
if (existing != _lines.end()) {
//cout << "*** EXISTING LINE" << endl;
li = existing;
- li->second->property_color_rgba() = color;
+ li->second->set_outline_color (color);
inserted_last_time = false; // don't search next time
} else {
//cout << "*** MOVING LINE" << endl;
- const double x1 = line->property_x1();
+ const double x1 = line->x0();
const bool was_clean = x1 >= _clean_left && x1 <= _clean_right;
invalidated = invalidated || was_clean;
// Invalidate clean portion (XXX: too harsh?)
_clean_left = needed_left;
_clean_right = needed_right;
_lines.erase(li);
- line->property_color_rgba() = color;
- line->property_x1() = xpos;
- line->property_x2() = xpos;
+ line->set_outline_color (color);
+ line->set_x0 (xpos);
+ line->set_x1 (xpos);
_lines.insert(make_pair(xpos, line));
inserted_last_time = true; // search next time
}
@@ -215,12 +216,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
//cout << "*** CREATING LINE" << endl;
/* if we already have a line there ... don't sweat it */
if (_lines.find (xpos) == _lines.end()) {
- line = new ArdourCanvas::SimpleLine (*_group);
- line->property_x1() = xpos;
- line->property_x2() = xpos;
- line->property_y1() = 0.0;
- line->property_y2() = _height;
- line->property_color_rgba() = color;
+ line = new ArdourCanvas::Line (*_group);
+ line->set_x0 (xpos);
+ line->set_x1 (xpos);
+ line->set_y0 (0.0);
+ line->set_y1 (_height);
+ line->set_outline_color (color);
_lines.insert(make_pair(xpos, line));
inserted_last_time = true;
}
@@ -233,9 +234,9 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
double const x = steal->first;
line = steal->second;
_lines.erase(steal);
- line->property_color_rgba() = color;
- line->property_x1() = xpos;
- line->property_x2() = xpos;
+ line->set_outline_color (color);
+ line->set_x0 (xpos);
+ line->set_x1 (xpos);
_lines.insert(make_pair(xpos, line));
inserted_last_time = true; // search next time
invalidated = true;
diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h
index 1ab71e0681..defe07226c 100644
--- a/gtk2_ardour/tempo_lines.h
+++ b/gtk2_ardour/tempo_lines.h
@@ -23,11 +23,9 @@
#include <boost/pool/pool.hpp>
#include <boost/pool/pool_alloc.hpp>
#include "ardour/tempo.h"
-#include "canvas.h"
-#include "simpleline.h"
typedef boost::fast_pool_allocator<
- std::pair<const double, ArdourCanvas::SimpleLine*>,
+ std::pair<const double, ArdourCanvas::Line*>,
boost::default_user_allocator_new_delete,
boost::details::pool::null_mutex,
8192>
@@ -35,7 +33,7 @@ typedef boost::fast_pool_allocator<
class TempoLines {
public:
- TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height);
+ TempoLines(ArdourCanvas::GtkCanvasViewport& canvas, ArdourCanvas::Group* group, double screen_height);
void tempo_map_changed();
@@ -47,10 +45,10 @@ public:
void hide();
private:
- typedef std::map<double, ArdourCanvas::SimpleLine*, std::less<double>, MapAllocator> Lines;
+ typedef std::map<double, ArdourCanvas::Line*, std::less<double>, MapAllocator> Lines;
Lines _lines;
- ArdourCanvas::Canvas& _canvas;
+ ArdourCanvas::GtkCanvasViewport& _canvas_viewport;
ArdourCanvas::Group* _group;
double _clean_left;
double _clean_right;
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 8d2276bfb9..927229d56e 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -23,9 +23,6 @@
#include <string>
#include <list>
-#include <libgnomecanvasmm.h>
-#include <libgnomecanvasmm/canvas.h>
-#include <libgnomecanvasmm/item.h>
#include "pbd/error.h"
#include "pbd/convert.h"
@@ -34,6 +31,8 @@
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/selector.h>
+#include "canvas/rectangle.h"
+
#include "ardour_ui.h"
#include "ardour_dialog.h"
#include "global_signals.h"
@@ -42,8 +41,6 @@
#include "time_axis_view.h"
#include "region_view.h"
#include "ghostregion.h"
-#include "simplerect.h"
-#include "simpleline.h"
#include "selection.h"
#include "keyboard.h"
#include "rgb_macros.h"
@@ -97,15 +94,15 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
compute_heights ();
}
- _canvas_background = new Group (*ed.get_background_group (), 0.0, 0.0);
- _canvas_display = new Group (*ed.get_trackview_group (), 0.0, 0.0);
+ _canvas_background = new Group (ed.get_background_group (), ArdourCanvas::Duple (0.0, 0.0));
+ _canvas_display = new Group (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0));
_canvas_display->hide(); // reveal as needed
- selection_group = new Group (*_canvas_display);
+ selection_group = new Group (_canvas_display);
selection_group->set_data (X_("timeselection"), (void *) 1);
selection_group->hide();
- _ghost_group = new Group (*_canvas_display);
+ _ghost_group = new Group (_canvas_display);
_ghost_group->lower_to_bottom();
_ghost_group->show();
@@ -177,7 +174,7 @@ TimeAxisView::~TimeAxisView()
}
for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
- delete (*i)->rect;
+ delete (*i)->rect;
delete (*i)->start_trim;
delete (*i)->end_trim;
@@ -257,11 +254,8 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
_order = nth;
if (_y_position != y) {
- _canvas_display->property_y () = y;
- _canvas_background->property_y () = y;
- /* silly canvas */
- _canvas_display->move (0.0, 0.0);
- _canvas_background->move (0.0, 0.0);
+ _canvas_display->set_y_position (y);
+ _canvas_background->set_y_position (y);
_y_position = y;
}
@@ -294,7 +288,8 @@ void
TimeAxisView::clip_to_viewport ()
{
if (marked_for_display()) {
- if (_y_position + _effective_height < _editor.get_trackview_group_vertical_offset () || _y_position > _editor.get_trackview_group_vertical_offset () + _canvas_display->get_canvas()->get_height()) {
+ if (_y_position + _effective_height < _editor.get_trackview_group_vertical_offset () ||
+ _y_position > _editor.get_trackview_group_vertical_offset () + _canvas_display->get_canvas()->get_height() {
_canvas_background->hide ();
_canvas_display->hide ();
return;
@@ -543,7 +538,7 @@ TimeAxisView::set_height (uint32_t h)
(*i)->set_height ();
}
- if (canvas_item_visible (selection_group)) {
+ if (selection_group->visible ()) {
/* resize the selection rect */
show_selection (_editor.get_selection().time);
}
@@ -805,14 +800,14 @@ TimeAxisView::build_display_menu ()
}
void
-TimeAxisView::set_samples_per_unit (double spu)
+TimeAxisView::set_frames_per_pixel (double fpp)
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
- (*i)->set_samples_per_unit (spu);
+ (*i)->set_frames_per_pixel (fpp);
}
AnalysisFeatureList::const_iterator i;
- list<ArdourCanvas::SimpleLine*>::iterator l;
+ list<ArdourCanvas::Line*>::iterator l;
}
void
@@ -843,7 +838,7 @@ TimeAxisView::show_selection (TimeSelection& ts)
(*i)->show_selection (ts);
}
- if (canvas_item_visible (selection_group)) {
+ if (selection_group->visible ()) {
while (!used_selection_rects.empty()) {
free_selection_rects.push_front (used_selection_rects.front());
used_selection_rects.pop_front();
@@ -871,23 +866,13 @@ TimeAxisView::show_selection (TimeSelection& ts)
x2 = _editor.frame_to_unit (start + cnt - 1);
y2 = current_height();
- rect->rect->property_x1() = x1;
- rect->rect->property_y1() = 1.0;
- rect->rect->property_x2() = x2;
- rect->rect->property_y2() = y2;
+ rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2));
// trim boxes are at the top for selections
if (x2 > x1) {
- rect->start_trim->property_x1() = x1;
- rect->start_trim->property_y1() = 1.0;
- rect->start_trim->property_x2() = x1 + trim_handle_size;
- rect->start_trim->property_y2() = y2;
-
- rect->end_trim->property_x1() = x2 - trim_handle_size;
- rect->end_trim->property_y1() = 1.0;
- rect->end_trim->property_x2() = x2;
- rect->end_trim->property_y2() = y2;
+ rect->start_trim->set (ArdourCanvas::Rect (x1, 1, x1 + trim_handle_size, y2));
+ rect->end_trim->set (ArdourCanvas::Rect (x2 - trim_handle_size, 1, x2, y2));
rect->start_trim->show();
rect->end_trim->show();
@@ -914,7 +899,7 @@ TimeAxisView::reshow_selection (TimeSelection& ts)
void
TimeAxisView::hide_selection ()
{
- if (canvas_item_visible (selection_group)) {
+ if (selection_group->visible ()) {
while (!used_selection_rects.empty()) {
free_selection_rects.push_front (used_selection_rects.front());
used_selection_rects.pop_front();
@@ -982,29 +967,21 @@ TimeAxisView::get_selection_rect (uint32_t id)
rect = new SelectionRect;
- rect->rect = new SimpleRect (*selection_group);
- rect->rect->property_outline_what() = 0x0;
- rect->rect->property_x1() = 0.0;
- rect->rect->property_y1() = 0.0;
- rect->rect->property_x2() = 0.0;
- rect->rect->property_y2() = 0.0;
- rect->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
+ rect->rect = new SimpleRect (selection_group);
+ rect->rect->set_outline_what (0);
+ rect->rect->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectionRect.get());
- rect->start_trim = new SimpleRect (*selection_group);
- rect->start_trim->property_outline_what() = 0x0;
- rect->start_trim->property_x1() = 0.0;
- rect->start_trim->property_x2() = 0.0;
+ rect->start_trim = new SimpleRect (selection_group);
+ rect->start_trim->set_outline_what (0);
- rect->end_trim = new SimpleRect (*selection_group);
- rect->end_trim->property_outline_what() = 0x0;
- rect->end_trim->property_x1() = 0.0;
- rect->end_trim->property_x2() = 0.0;
+ rect->end_trim = new SimpleRect (selection_group);
+ rect->end_trim->set_outline_what (0);
free_selection_rects.push_front (rect);
- rect->rect->signal_event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
- rect->start_trim->signal_event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
- rect->end_trim->signal_event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
+ rect->rect->Event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
+ rect->start_trim->Event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
+ rect->end_trim->Event().connect (sigc::bind (sigc::mem_fun (_editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
}
rect = free_selection_rects.front();
@@ -1164,26 +1141,26 @@ TimeAxisView::color_handler ()
for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
- (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
- (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
-
- (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
- (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
+ (*i)->rect->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectionRect.get());
+ (*i)->rect->set_outline_color (ARDOUR_UI::config()->canvasvar_Selection.get());
- (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
- (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
+ (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+ (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+
+ (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+ (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->canvasvar_Selection.get());
}
-
+
for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
-
- (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
- (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
-
- (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
- (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
-
- (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
- (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
+
+ (*i)->rect->set_fill_color (ARDOUR_UI::config()->canvasvar_SelectionRect.get());
+ (*i)->rect->set_outline_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+
+ (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+ (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+
+ (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->canvasvar_Selection.get());
+ (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->canvasvar_Selection.get());
}
}
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 17dfec986b..b9cae8cb23 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -44,7 +44,6 @@
#include "axis_view.h"
#include "enums.h"
#include "editing.h"
-#include "canvas.h"
namespace ARDOUR {
class Session;
@@ -58,6 +57,12 @@ namespace Gtk {
class Menu;
}
+namespace ArdourCanvas {
+ class Canvas;
+ class Group;
+ class Item;
+}
+
class PublicEditor;
class RegionSelection;
class TimeSelection;
@@ -149,7 +154,7 @@ class TimeAxisView : public virtual AxisView
virtual ARDOUR::RouteGroup* route_group() const { return 0; }
virtual boost::shared_ptr<ARDOUR::Playlist> playlist() const { return boost::shared_ptr<ARDOUR::Playlist> (); }
- virtual void set_samples_per_unit (double);
+ virtual void set_frames_per_pixel (double);
virtual void show_selection (TimeSelection&);
virtual void hide_selection ();
virtual void reshow_selection (TimeSelection&);
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 2b20b3c45e..a86b8b7561 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -26,6 +26,11 @@
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/gui_thread.h"
+#include "canvas/group.h"
+#include "canvas/rectangle.h"
+#include "canvas/debug.h"
+#include "canvas/pixbuf.h"
+
#include "ardour_ui.h"
/*
* ardour_ui.h was moved up in the include list
@@ -36,9 +41,7 @@
#include "public_editor.h"
#include "time_axis_view_item.h"
#include "time_axis_view.h"
-#include "simplerect.h"
#include "utils.h"
-#include "canvas_impl.h"
#include "rgb_macros.h"
#include "i18n.h"
@@ -105,7 +108,8 @@ TimeAxisViewItem::TimeAxisViewItem(
, _automation (automation)
, _dragging (false)
{
- group = new ArdourCanvas::Group (parent);
+ group = new ArdourCanvas::Group (&parent);
+ CANVAS_DEBUG_NAME (group, "TAVI group");
init (it_name, spu, base_color, start, duration, vis, true, true);
}
@@ -128,22 +132,21 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
/* share the other's parent, but still create a new group */
- Gnome::Canvas::Group* parent = other.group->property_parent();
+ ArdourCanvas::Group* parent = other.group->parent();
- group = new ArdourCanvas::Group (*parent);
+ group = new ArdourCanvas::Group (parent);
_selected = other._selected;
- init (other.item_name, other.samples_per_unit, c, other.frame_position,
+ init (other.item_name, other.frames_per_pixel, c, other.frame_position,
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
}
void
-TimeAxisViewItem::init (
- const string& it_name, double spu, Gdk::Color const & base_color, framepos_t start, framepos_t duration, Visibility vis, bool wide, bool high)
+TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & base_color, framepos_t start, framepos_t duration, Visibility vis, bool wide, bool high)
{
item_name = it_name;
- samples_per_unit = spu;
+ frame_per_pixel = fpp;
frame_position = start;
item_duration = duration;
name_connected = false;
@@ -164,22 +167,22 @@ TimeAxisViewItem::init (
warning << "Time Axis Item Duration == 0" << endl;
}
- vestigial_frame = new ArdourCanvas::SimpleRect (*group, 0.0, 1.0, 2.0, trackview.current_height());
+ vestigial_frame = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height()));
vestigial_frame->hide ();
- vestigial_frame->property_outline_what() = 0xF;
- vestigial_frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_VestigialFrame.get();
- vestigial_frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VestigialFrame.get();
+ vestigial_frame->set_outline_what (0xF);
+ vestigial_frame->set_outline_color (ARDOUR_UI::config()->canvasvar_VestigialFrame.get());
+ vestigial_frame->set_fill_color (ARDOUR_UI::config()->canvasvar_VestigialFrame.get());
if (visibility & ShowFrame) {
- frame = new ArdourCanvas::SimpleRect (*group, 0.0, 1.0, trackview.editor().frame_to_pixel(duration), trackview.current_height());
+ frame = new ArdourCanvas::Rectangle (*group, 0.0, 1.0, trackview.editor().frame_to_pixel(duration), trackview.current_height());
- frame->property_outline_pixels() = 1;
- frame->property_outline_what() = 0xF;
+ frame->set_outline_pixels (1);
+ frame->set_outline_what (0xF);
if (_recregion) {
- frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+ frame->set_outline_color (ARDOUR_UI::config()->canvasvar_RecordingRect.get());
} else {
- frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
+ frame->set_outline_color (ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get());
}
frame->property_outline_what() = 0x1|0x2|0x4|0x8;
@@ -191,24 +194,27 @@ TimeAxisViewItem::init (
if (visibility & ShowNameHighlight) {
if (visibility & FullWidthNameHighlight) {
- name_highlight = new ArdourCanvas::SimpleRect (*group, 0.0, trackview.editor().frame_to_pixel(item_duration), trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height());
+ name_highlight = new ArdourCanvas::Rectangle (group,
+ ArdourCanvas::Rect (0.0, trackview.editor().frame_to_pixel(item_duration),
+ trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height()));
} else {
- name_highlight = new ArdourCanvas::SimpleRect (*group, 1.0, trackview.editor().frame_to_pixel(item_duration) - 1, trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height());
+ name_highlight = new ArdourCanvas::Rectangle (group,
+ ArdourCanvas::Rect (1.0, trackview.editor().frame_to_pixel(item_duration) - 1,
+ trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height()));
}
name_highlight->set_data ("timeaxisviewitem", this);
- name_highlight->property_outline_what() = 0x4;
+ name_highlight->set_outline_what (0x4);
/* we should really use a canvas color property here */
- name_highlight->property_outline_color_rgba() = RGBA_TO_UINT (0,0,0,255);
+ name_highlight->set_outline_color (RGBA_TO_UINT (0,0,0,255));
} else {
name_highlight = 0;
}
if (visibility & ShowNameText) {
- name_pixbuf = new ArdourCanvas::Pixbuf(*group);
- name_pixbuf->property_x() = NAME_X_OFFSET;
- name_pixbuf->property_y() = trackview.current_height() + 1 - NAME_Y_OFFSET;
+ name_pixbuf = new ArdourCanvas::Pixbuf(group);
+ name_pixbuf->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() + 1 - NAME_Y_OFFSET));
} else {
name_pixbuf = 0;
@@ -219,10 +225,10 @@ TimeAxisViewItem::init (
double top = TimeAxisViewItem::GRAB_HANDLE_TOP;
double width = TimeAxisViewItem::GRAB_HANDLE_WIDTH;
- frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, top, width, trackview.current_height());
- frame_handle_start->property_outline_what() = 0x0;
- frame_handle_end = new ArdourCanvas::SimpleRect (*group, 0.0, top, width, trackview.current_height());
- frame_handle_end->property_outline_what() = 0x0;
+ frame_handle_start = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
+ frame_handle_start->set_outline_what (0x0);
+ frame_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
+ frame_handle_end->set_outline_what (0x0);
} else {
frame_handle_start = frame_handle_end = 0;
}
@@ -247,8 +253,8 @@ TimeAxisViewItem::hide_rect ()
set_frame_color ();
if (name_highlight) {
- name_highlight->property_outline_what() = 0x0;
- name_highlight->property_fill_color_rgba() = UINT_RGBA_CHANGE_A(fill_color,64);
+ name_highlight->set_outline_what (0);
+ name_highlight->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 64));
}
}
@@ -259,8 +265,8 @@ TimeAxisViewItem::show_rect ()
set_frame_color ();
if (name_highlight) {
- name_highlight->property_outline_what() = 0x4;
- name_highlight->property_fill_color_rgba() = fill_color;
+ name_highlight->set_outline_what (0x4);
+ name_highlight->set_fill_color (fill_color);
}
}
@@ -292,12 +298,12 @@ TimeAxisViewItem::set_position(framepos_t pos, void* src, double* delta)
*/
double old_unit_pos;
- double new_unit_pos = pos / samples_per_unit;
+ double new_unit_pos = pos / frames_per_pixel;
- old_unit_pos = group->property_x();
+ old_unit_pos = group->position().x;
if (new_unit_pos != old_unit_pos) {
- group->move (new_unit_pos - old_unit_pos, 0.0);
+ group->set_x_position (new_unit_pos);
}
if (delta) {
@@ -516,7 +522,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
last_item_width = trackview.editor().frame_to_pixel(item_duration);
name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2;
- name_pixbuf->property_pixbuf() = pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000"));
+ name_pixbuf->set (pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000")))
}
@@ -541,29 +547,29 @@ TimeAxisViewItem::set_height (double height)
}
if (height > NAME_HIGHLIGHT_SIZE) {
- name_highlight->property_y1() = (double) height - 1 - NAME_HIGHLIGHT_SIZE;
- name_highlight->property_y2() = (double) height - 1;
+ name_highlight->set_y0 ((double) height - 1 - NAME_HIGHLIGHT_SIZE);
+ name_highlight->set_y1 ((double) height - 1);
}
else {
/* it gets hidden now anyway */
- name_highlight->property_y1() = (double) 1.0;
- name_highlight->property_y2() = (double) height;
+ name_highlight->set_y0 (1);
+ name_highlight->set_y1 (height);
}
}
if (visibility & ShowNameText) {
- name_pixbuf->property_y() = height + 1 - NAME_Y_OFFSET;
+ name_pixbuf->set_y_position (height + 1 - NAME_Y_OFFSET);
}
if (frame) {
- frame->property_y2() = height - 1;
+ frame->set_y1 (height - 1);
if (frame_handle_start) {
- frame_handle_start->property_y2() = height - 1;
- frame_handle_end->property_y2() = height - 1;
+ frame_handle_start->set_y1 (height - 1);
+ frame_handle_end->set_y1 (height - 1);
}
}
- vestigial_frame->property_y2() = height - 1;
+ vestigial_frame->set_y1 (height - 1);
update_name_pixbuf_visibility ();
set_colors ();
@@ -703,7 +709,7 @@ TimeAxisViewItem::set_colors()
set_frame_color();
if (name_highlight) {
- name_highlight->property_fill_color_rgba() = fill_color;
+ name_highlight->set_fill_color (fill_color);
}
set_trim_handle_colors();
}
@@ -754,7 +760,7 @@ TimeAxisViewItem::set_frame_color()
}
}
- frame->property_fill_color_rgba() = f;
+ frame->set_fill_color (f);
if (!_recregion) {
if (_selected) {
@@ -767,7 +773,7 @@ TimeAxisViewItem::set_frame_color()
f = UINT_RGBA_CHANGE_A (f, 64);
}
- frame->property_outline_color_rgba() = f;
+ frame->set_outline_color (f);
}
}
@@ -779,35 +785,34 @@ TimeAxisViewItem::set_trim_handle_colors()
{
if (frame_handle_start) {
if (position_locked) {
- frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
- frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
+ frame_handle_start->set_fill_color (ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get());
+ frame_handle_end->set_fill_color (ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get());
} else {
- frame_handle_start->property_fill_color_rgba() = RGBA_TO_UINT(1, 1, 1, 0); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
- frame_handle_end->property_fill_color_rgba() = RGBA_TO_UINT(1, 1, 1, 0); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
+ frame_handle_start->set_fill_color (RGBA_TO_UINT (1, 1, 1, 0)); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
+ frame_handle_end->set_fill_color (RGBA_TO_UINT (1, 1, 1, 0)); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
}
}
}
-/** @return the samples per unit of this item */
+/** @return the frames per pixel */
double
-TimeAxisViewItem::get_samples_per_unit()
+TimeAxisViewItem::get_frames_per_pixel () const
{
- return samples_per_unit;
+ return frames_per_pixel;
}
-/**
- * Set the samples per unit of this item.
- * This item is used to determine the relative visual size and position of this item
- * based upon its duration and start value.
+/** Set the frames per pixel of this item.
+ * This item is used to determine the relative visual size and position of this item
+ * based upon its duration and start value.
*
- * @param spu the new samples per unit value
+ * @param fpp the new frames per pixel
*/
void
-TimeAxisViewItem::set_samples_per_unit (double spu)
+TimeAxisViewItem::set_frames_per_pixel (double fpp)
{
- samples_per_unit = spu;
+ frames_per_pixel = fpp;
set_position (this->get_position(), this);
- reset_width_dependent_items ((double)get_duration() / samples_per_unit);
+ reset_width_dependent_items ((double) get_duration() / frames_per_pixel);
}
void
@@ -851,12 +856,12 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
high_enough_for_name = true;
}
- name_highlight->property_x2() = pixel_width;
+ name_highlight->set_x1 (pixel_width);
}
if (frame) {
frame->show();
- frame->property_x2() = pixel_width;
+ frame->set_x1 (pixel_width);
}
if (frame_handle_start) {
@@ -870,8 +875,8 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
frame_handle_end->hide();
} else {
frame_handle_start->show();
- frame_handle_end->property_x1() = pixel_width - (TimeAxisViewItem::GRAB_HANDLE_WIDTH);
- frame_handle_end->property_x2() = pixel_width;
+ frame_handle_end->set_x0 (pixel_width - (TimeAxisViewItem::GRAB_HANDLE_WIDTH));
+ frame_handle_end->set_x1 (pixel_width);
frame_handle_end->show();
}
}
@@ -923,7 +928,7 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
pb_width = 1;
}
- name_pixbuf->property_pixbuf() = pixbuf_from_string(item_name, NAME_FONT, pb_width, NAME_HEIGHT, Gdk::Color ("#000000"));
+ name_pixbuf->set (pixbuf_from_string(item_name, NAME_FONT, pb_width, NAME_HEIGHT, Gdk::Color ("#000000")));
}
/**
@@ -946,10 +951,7 @@ TimeAxisViewItem::idle_remove_this_item(TimeAxisViewItem* item, void* src)
void
TimeAxisViewItem::set_y (double y)
{
- double const old = group->property_y ();
- if (y != old) {
- group->move (0, y - old);
- }
+ group->set_y_position (y);
}
void
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 3985b8ffd8..0b3e019719 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -21,17 +21,20 @@
#define __gtk_ardour_time_axis_view_item_h__
#include <string>
-
-#include <libgnomecanvasmm/pixbuf.h>
-
+#include <gdkmm/color.h>
+#include <pangomm/fontdescription.h>
#include "pbd/signals.h"
-
#include "selectable.h"
-#include "simplerect.h"
-#include "canvas.h"
class TimeAxisView;
+namespace ArdourCanvas {
+ class Pixbuf;
+ class Rectangle;
+ class Item;
+ class Group;
+}
+
using ARDOUR::framepos_t;
using ARDOUR::framecnt_t;
@@ -74,9 +77,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
ArdourCanvas::Item* get_name_highlight();
ArdourCanvas::Pixbuf* get_name_pixbuf();
- virtual void set_samples_per_unit(double spu);
+ virtual void set_frames_per_pixel (double);
- double get_samples_per_unit();
+ double get_frames_per_pixel () const;
virtual void drag_start() { _dragging = true; }
virtual void drag_end() { _dragging = false; }
@@ -190,8 +193,8 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
/** indicates whether the min duration constraint is active */
bool min_duration_active;
- /** samples per canvas unit */
- double samples_per_unit;
+ /** frames per canvas pixel */
+ double frames_per_pixel;
/** should the item respond to events */
bool _sensitive;
@@ -231,14 +234,14 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
bool rect_visible;
ArdourCanvas::Group* group;
- ArdourCanvas::SimpleRect* vestigial_frame;
- ArdourCanvas::SimpleRect* frame;
+ ArdourCanvas::Rectangle* vestigial_frame;
+ ArdourCanvas::Rectangle* frame;
ArdourCanvas::Pixbuf* name_pixbuf;
- ArdourCanvas::SimpleRect* name_highlight;
+ ArdourCanvas::Rectangle* name_highlight;
/* with these two values, if frame_handle_start == 0 then frame_handle_end will also be 0 */
- ArdourCanvas::SimpleRect* frame_handle_start; ///< `frame' (fade) handle for the start of the item, or 0
- ArdourCanvas::SimpleRect* frame_handle_end; ///< `frame' (fade) handle for the end of the item, or 0
+ ArdourCanvas::Rectangle* frame_handle_start; ///< `frame' (fade) handle for the start of the item, or 0
+ ArdourCanvas::Rectangle* frame_handle_end; ///< `frame' (fade) handle for the end of the item, or 0
double _height;
Visibility visibility;
diff --git a/gtk2_ardour/track_selection.cc b/gtk2_ardour/track_selection.cc
index 92efbd4863..92efbd4863 100755..100644
--- a/gtk2_ardour/track_selection.cc
+++ b/gtk2_ardour/track_selection.cc
diff --git a/gtk2_ardour/track_view_list.cc b/gtk2_ardour/track_view_list.cc
index cc29a57521..cc29a57521 100755..100644
--- a/gtk2_ardour/track_view_list.cc
+++ b/gtk2_ardour/track_view_list.cc
diff --git a/gtk2_ardour/track_view_list.h b/gtk2_ardour/track_view_list.h
index 24f26465ef..24f26465ef 100755..100644
--- a/gtk2_ardour/track_view_list.h
+++ b/gtk2_ardour/track_view_list.h
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 19f93ad2e8..8b07947f63 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -31,7 +31,6 @@
#include <fstream>
#include <list>
#include <sys/stat.h>
-#include <libart_lgpl/art_misc.h>
#include <gtkmm/rc.h>
#include <gtkmm/window.h>
#include <gtkmm/combo.h>
@@ -44,8 +43,8 @@
#include <gtkmm2ext/utils.h>
#include "ardour/rc_configuration.h"
-
#include "ardour/filesystem_paths.h"
+#include "canvas/item.h"
#include "ardour_ui.h"
#include "debug.h"
@@ -54,7 +53,6 @@
#include "utils.h"
#include "i18n.h"
#include "rgb_macros.h"
-#include "canvas_impl.h"
#include "gui_thread.h"
using namespace std;
@@ -301,12 +299,6 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, s
}
}
-bool
-canvas_item_visible (ArdourCanvas::Item* item)
-{
- return (item->gobj()->object.flags & GNOME_CANVAS_ITEM_VISIBLE) ? true : false;
-}
-
void
set_color (Gdk::Color& c, int rgb)
{
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 7137f273c6..6296ea548b 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -23,12 +23,13 @@
#include <string>
#include <cmath>
#include <vector>
+
#include "ardour/types.h"
-#include <libgnomecanvasmm/line.h>
+
#include <gdkmm/types.h>
#include <gtkmm/menushell.h>
-#include "canvas.h"
+#include "canvas/types.h"
namespace PBD {
class Controllable;
@@ -42,6 +43,10 @@ namespace Gtk {
class Adjustment;
}
+namespace ArdourCanvas {
+ class Item;
+}
+
extern sigc::signal<void> DPIReset;
gint just_hide_it (GdkEventAny*, Gtk::Window*);
@@ -58,8 +63,6 @@ uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, s
void decorate (Gtk::Window& w, Gdk::WMDecoration d);
-bool canvas_item_visible (ArdourCanvas::Item* item);
-
void set_color (Gdk::Color&, int);
bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc
index eb73cb91c8..db9721beb4 100644
--- a/gtk2_ardour/verbose_cursor.cc
+++ b/gtk2_ardour/verbose_cursor.cc
@@ -41,7 +41,7 @@ VerboseCursor::VerboseCursor (Editor* editor)
, _xoffset (0)
, _yoffset (0)
{
- _canvas_item = new ArdourCanvas::NoEventText (*_editor->track_canvas->root());
+ _canvas_item = new ArdourCanvas::Text (*_editor->track_canvas->root());
_canvas_item->property_font_desc() = get_font_for_style (N_("VerboseCanvasCursor"));
_canvas_item->property_anchor() = Gtk::ANCHOR_NW;
}
@@ -254,7 +254,7 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double
void
VerboseCursor::set_color (uint32_t color)
{
- _canvas_item->property_fill_color_rgba() = color;
+ _canvas_item->set_fill_color (color);
}
/** Set the position of the verbose cursor. Any x/y offsets
@@ -264,8 +264,8 @@ VerboseCursor::set_color (uint32_t color)
void
VerboseCursor::set_position (double x, double y)
{
- _canvas_item->property_x() = clamp_x (x + _xoffset);
- _canvas_item->property_y() = clamp_y (y + _yoffset);
+ _canvas_item->set_x_position (clamp_x (x + _xoffset));
+ _canvas_item->set_y_position (clamp_y (y + _yoffset));
}
bool
diff --git a/gtk2_ardour/verbose_cursor.h b/gtk2_ardour/verbose_cursor.h
index 20207b1e6e..751a567a80 100644
--- a/gtk2_ardour/verbose_cursor.h
+++ b/gtk2_ardour/verbose_cursor.h
@@ -17,9 +17,8 @@
*/
-#include <libgnomecanvasmm/item.h>
#include "ardour/types.h"
-#include "canvas-noevent-text.h"
+#include "canvas/text.h"
#include "canvas.h"
class Editor;
diff --git a/gtk2_ardour/video_image_frame.h b/gtk2_ardour/video_image_frame.h
index 2f384c3d8e..6988274d7e 100644
--- a/gtk2_ardour/video_image_frame.h
+++ b/gtk2_ardour/video_image_frame.h
@@ -28,7 +28,6 @@
#include <string>
#include <glib.h>
-#include <libgnomecanvasmm/pixbuf.h>
#include <sigc++/signal.h>
#include <pthread.h>
diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc
index 3961bf8be1..393677884f 100644
--- a/gtk2_ardour/visual_time_axis.cc
+++ b/gtk2_ardour/visual_time_axis.cc
@@ -48,7 +48,6 @@
#include "utils.h"
#include "prompter.h"
#include "rgb_macros.h"
-#include "canvas_impl.h"
#include "i18n.h"
diff --git a/gtk2_ardour/visual_time_axis.h b/gtk2_ardour/visual_time_axis.h
index a692482b49..5735248bd2 100644
--- a/gtk2_ardour/visual_time_axis.h
+++ b/gtk2_ardour/visual_time_axis.h
@@ -29,7 +29,6 @@
#include "route_ui.h"
#include "enums.h"
#include "time_axis_view.h"
-#include "canvas.h"
namespace ARDOUR
{
diff --git a/gtk2_ardour/waveview.cc b/gtk2_ardour/waveview.cc
deleted file mode 100644
index 9cc53355be..0000000000
--- a/gtk2_ardour/waveview.cc
+++ /dev/null
@@ -1,323 +0,0 @@
-#include "waveview.h"
-#include "waveview_p.h"
-
-
-/* waveview.cc
- *
- * 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.
- */
-
-//#include <libgnomecanvasmm/group.h>
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-WaveView::WaveView(Group& parentx)
- : Item(GNOME_CANVAS_ITEM(g_object_new(get_type(),0)))
-{
- item_construct(parentx);
-}
-
-} /* namespace Canvas */
-} /* namespace Gnome */
-
-
-namespace Glib
-{
-
-Gnome::Canvas::WaveView* wrap(GnomeCanvasWaveView* object, bool take_copy)
-{
- return dynamic_cast<Gnome::Canvas::WaveView *> (Glib::wrap_auto ((GObject*)(object), take_copy));
-}
-
-} /* namespace Glib */
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-
-/* The *_Class implementation: */
-
-const Glib::Class& WaveView_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_ = &WaveView_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_waveview_get_type());
-
- // Add derived versions of interfaces, if the C type implements any interfaces:
- }
-
- return *this;
-}
-
-void WaveView_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* WaveView_Class::wrap_new(GObject* o)
-{
- return manage(new WaveView((GnomeCanvasWaveView*)(o)));
-
-}
-
-
-/* The implementation: */
-
-WaveView::WaveView(const Glib::ConstructParams& construct_params)
-:
- Item(construct_params)
-{
- }
-
-WaveView::WaveView(GnomeCanvasWaveView* castitem)
-:
- Item((GnomeCanvasItem*)(castitem))
-{
- }
-
-WaveView::~WaveView()
-{
- destroy_();
-}
-
-WaveView::CppClassType WaveView::waveview_class_; // initialize static member
-
-GType WaveView::get_type()
-{
- return waveview_class_.init().get_type();
-}
-
-GType WaveView::get_base_type()
-{
- return gnome_canvas_waveview_get_type();
-}
-
-GnomeCanvasWaveViewCache*
-WaveView::create_cache ()
-{
- return gnome_canvas_waveview_cache_new ();
-}
-
-Glib::PropertyProxy<void*> WaveView::property_data_src()
-{
- return Glib::PropertyProxy<void*> (this, "data_src");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_data_src() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "data_src");
-}
-Glib::PropertyProxy<uint32_t> WaveView::property_channel()
-{
- return Glib::PropertyProxy<uint32_t> (this, "channel");
-}
-Glib::PropertyProxy_ReadOnly<uint32_t> WaveView::property_channel() const
-{
- return Glib::PropertyProxy_ReadOnly<uint32_t> (this, "channel");
-}
-Glib::PropertyProxy<void*> WaveView::property_length_function()
-{
- return Glib::PropertyProxy<void*> (this, "length_function");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_length_function() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "length_function");
-}
-Glib::PropertyProxy<void*> WaveView::property_sourcefile_length_function()
-{
- return Glib::PropertyProxy<void*> (this, "sourcefile_length_function");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_sourcefile_length_function() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "sourcefile_length_function");
-}
-Glib::PropertyProxy<void*> WaveView::property_peak_function()
-{
- return Glib::PropertyProxy<void*> (this, "peak_function");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_peak_function() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "peak_function");
-}
-Glib::PropertyProxy<void*> WaveView::property_gain_function()
-{
- return Glib::PropertyProxy<void*> (this, "gain_function");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_gain_function() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "gain_function");
-}
-Glib::PropertyProxy<void*> WaveView::property_gain_src()
-{
- return Glib::PropertyProxy<void*> (this, "gain_src");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_gain_src() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "gain_src");
-}
-Glib::PropertyProxy<void*> WaveView::property_cache()
-{
- return Glib::PropertyProxy<void*> (this, "cache");
-}
-Glib::PropertyProxy_ReadOnly<void*> WaveView::property_cache() const
-{
- return Glib::PropertyProxy_ReadOnly<void*> (this, "cache");
-}
-Glib::PropertyProxy<bool> WaveView::property_cache_updater()
-{
- return Glib::PropertyProxy<bool> (this, "cache_updater");
-}
-Glib::PropertyProxy_ReadOnly<bool> WaveView::property_cache_updater() const
-{
- return Glib::PropertyProxy_ReadOnly<bool> (this, "cache_updater");
-}
-Glib::PropertyProxy<double> WaveView::property_samples_per_unit()
-{
- return Glib::PropertyProxy<double> (this, "samples_per_unit");
-}
-Glib::PropertyProxy_ReadOnly<double> WaveView::property_samples_per_unit() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "samples_per_unit");
-}
-Glib::PropertyProxy<double> WaveView::property_amplitude_above_axis()
-{
- return Glib::PropertyProxy<double> (this, "amplitude_above_axis");
-}
-Glib::PropertyProxy_ReadOnly<double> WaveView::property_amplitude_above_axis() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "amplitude_above_axis");
-}
-Glib::PropertyProxy<double> WaveView::property_x()
-{
- return Glib::PropertyProxy<double> (this, "x");
-}
-Glib::PropertyProxy_ReadOnly<double> WaveView::property_x() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "x");
-}
-Glib::PropertyProxy<double> WaveView::property_y()
-{
- return Glib::PropertyProxy<double> (this, "y");
-}
-Glib::PropertyProxy_ReadOnly<double> WaveView::property_y() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "y");
-}
-Glib::PropertyProxy<double> WaveView::property_height()
-{
- return Glib::PropertyProxy<double> (this, "height");
-}
-Glib::PropertyProxy_ReadOnly<double> WaveView::property_height() const
-{
- return Glib::PropertyProxy_ReadOnly<double> (this, "height");
-}
-Glib::PropertyProxy<guint> WaveView::property_wave_color()
-{
- return Glib::PropertyProxy<guint> (this, "wave_color");
-}
-Glib::PropertyProxy_ReadOnly<guint> WaveView::property_wave_color() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "wave_color");
-}
-Glib::PropertyProxy<guint> WaveView::property_clip_color()
-{
- return Glib::PropertyProxy<guint> (this, "clip_color");
-}
-Glib::PropertyProxy_ReadOnly<guint> WaveView::property_clip_color() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "clip_color");
-}
-Glib::PropertyProxy<guint> WaveView::property_zero_color()
-{
- return Glib::PropertyProxy<guint> (this, "zero_color");
-}
-Glib::PropertyProxy_ReadOnly<guint> WaveView::property_zero_color() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "zero_color");
-}
-Glib::PropertyProxy<guint> WaveView::property_fill_color()
-{
- return Glib::PropertyProxy<guint> (this, "fill_color");
-}
-Glib::PropertyProxy_ReadOnly<guint> WaveView::property_fill_color() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "fill_color");
-}
-Glib::PropertyProxy<gint> WaveView::property_filled()
-{
- return Glib::PropertyProxy<gint> (this, "filled");
-}
-Glib::PropertyProxy_ReadOnly<gint> WaveView::property_filled() const
-{
- return Glib::PropertyProxy_ReadOnly<gint> (this, "filled");
-}
-Glib::PropertyProxy<gint> WaveView::property_rectified()
-{
- return Glib::PropertyProxy<gint> (this, "rectified");
-}
-Glib::PropertyProxy_ReadOnly<gint> WaveView::property_rectified() const
-{
- return Glib::PropertyProxy_ReadOnly<gint> (this, "rectified");
-}
-Glib::PropertyProxy<gint> WaveView::property_zero_line()
-{
- return Glib::PropertyProxy<gint> (this, "zero_line");
-}
-Glib::PropertyProxy_ReadOnly<gint> WaveView::property_zero_line() const
-{
- return Glib::PropertyProxy_ReadOnly<gint> (this, "zero_line");
-}
-Glib::PropertyProxy<guint> WaveView::property_region_start()
-{
- return Glib::PropertyProxy<guint> (this, "region_start");
-}
-Glib::PropertyProxy_ReadOnly<guint> WaveView::property_region_start() const
-{
- return Glib::PropertyProxy_ReadOnly<guint> (this, "region_start");
-}
-Glib::PropertyProxy<gint> WaveView::property_logscaled()
-{
- return Glib::PropertyProxy<gint> (this, "logscaled");
-}
-Glib::PropertyProxy_ReadOnly<gint> WaveView::property_logscaled() const
-{
- return Glib::PropertyProxy_ReadOnly<gint> (this, "logscaled");
-}
-
-} // namespace Canvas
-
-} // namespace Gnome
-
-
diff --git a/gtk2_ardour/waveview.h b/gtk2_ardour/waveview.h
deleted file mode 100644
index 53472f80d3..0000000000
--- a/gtk2_ardour/waveview.h
+++ /dev/null
@@ -1,177 +0,0 @@
-// -*- c++ -*-
-#ifndef _LIBGNOMECANVASMM_WAVEVIEW_H
-#define _LIBGNOMECANVASMM_WAVEVIEW_H
-
-#include <glibmm.h>
-
-
-/* waveview.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 "canvas-waveview.h"
-#include <libgnomecanvas/gnome-canvas-util.h>
-#include <libgnomecanvas/libgnomecanvas.h>
-#include <vector>
-
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-typedef struct _GnomeCanvasWaveView GnomeCanvasWaveView;
-typedef struct _GnomeCanvasWaveViewClass GnomeCanvasWaveViewClass;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-
-namespace Gnome
-{
-
-namespace Canvas
-{ class WaveView_Class; } // namespace Canvas
-
-} // namespace Gnome
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-class GnomeGroup;
-
-class WaveView : public Item
-{
- public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- typedef WaveView CppObjectType;
- typedef WaveView_Class CppClassType;
- typedef GnomeCanvasWaveView BaseObjectType;
- typedef GnomeCanvasWaveViewClass BaseClassType;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- virtual ~WaveView();
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-private:
- friend class WaveView_Class;
- static CppClassType waveview_class_;
-
- // noncopyable
- WaveView(const WaveView&);
- WaveView& operator=(const WaveView&);
-
-protected:
- explicit WaveView(const Glib::ConstructParams& construct_params);
- explicit WaveView(GnomeCanvasWaveView* 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.
- GnomeCanvasWaveView* gobj() { return reinterpret_cast<GnomeCanvasWaveView*>(gobject_); }
-
- ///Provides access to the underlying C GtkObject.
- const GnomeCanvasWaveView* gobj() const { return reinterpret_cast<GnomeCanvasWaveView*>(gobject_); }
-
-
-public:
- //C++ methods used to invoke GTK+ virtual functions:
-
-protected:
- //GTK+ Virtual Functions (override these to change behaviour):
-
- //Default Signal Handlers::
-
-
-private:
-
-public:
- WaveView(Group& parent);
-
- static GnomeCanvasWaveViewCache* create_cache();
-
- Glib::PropertyProxy<void*> property_data_src();
- Glib::PropertyProxy_ReadOnly<void*> property_data_src() const;
- Glib::PropertyProxy<uint32_t> property_channel();
- Glib::PropertyProxy_ReadOnly<uint32_t> property_channel() const;
- Glib::PropertyProxy<void*> property_length_function();
- Glib::PropertyProxy_ReadOnly<void*> property_length_function() const;
- Glib::PropertyProxy<void*> property_sourcefile_length_function();
- Glib::PropertyProxy_ReadOnly<void*> property_sourcefile_length_function() const;
- Glib::PropertyProxy<void*> property_peak_function();
- Glib::PropertyProxy_ReadOnly<void*> property_peak_function() const;
- Glib::PropertyProxy<void*> property_gain_function();
- Glib::PropertyProxy_ReadOnly<void*> property_gain_function() const;
- Glib::PropertyProxy<void*> property_gain_src();
- Glib::PropertyProxy_ReadOnly<void*> property_gain_src() const;
- Glib::PropertyProxy<void*> property_cache();
- Glib::PropertyProxy_ReadOnly<void*> property_cache() const;
- Glib::PropertyProxy<bool> property_cache_updater();
- Glib::PropertyProxy_ReadOnly<bool> property_cache_updater() const;
- Glib::PropertyProxy<double> property_samples_per_unit();
- Glib::PropertyProxy_ReadOnly<double> property_samples_per_unit() const;
- Glib::PropertyProxy<double> property_amplitude_above_axis();
- Glib::PropertyProxy_ReadOnly<double> property_amplitude_above_axis() const;
- 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_height();
- Glib::PropertyProxy_ReadOnly<double> property_height() const;
- Glib::PropertyProxy<guint> property_wave_color();
- Glib::PropertyProxy_ReadOnly<guint> property_wave_color() const;
- Glib::PropertyProxy<guint> property_clip_color();
- Glib::PropertyProxy_ReadOnly<guint> property_clip_color() const;
- Glib::PropertyProxy<guint> property_fill_color();
- Glib::PropertyProxy_ReadOnly<guint> property_fill_color() const;
- Glib::PropertyProxy<gint> property_filled();
- Glib::PropertyProxy_ReadOnly<gint> property_filled() const;
- Glib::PropertyProxy<gint> property_zero_line();
- Glib::PropertyProxy_ReadOnly<gint> property_zero_line() const;
- Glib::PropertyProxy<guint> property_zero_color();
- Glib::PropertyProxy_ReadOnly<guint> property_zero_color() const;
- Glib::PropertyProxy<gint> property_rectified();
- Glib::PropertyProxy_ReadOnly<gint> property_rectified() const;
- Glib::PropertyProxy<guint> property_region_start();
- Glib::PropertyProxy_ReadOnly<guint> property_region_start() const;
- Glib::PropertyProxy<gint> property_logscaled();
- Glib::PropertyProxy_ReadOnly<gint> property_logscaled() const;
-};
-
-} /* namespace Canvas */
-} /* namespace Gnome */
-
-
-namespace Glib
-{
- /** @relates Gnome::Canvas::WaveView
- * @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::WaveView* wrap(GnomeCanvasWaveView* object, bool take_copy = false);
-}
-#endif /* _LIBGNOMECANVASMM_WAVEVIEW_H */
-
diff --git a/gtk2_ardour/waveview_p.h b/gtk2_ardour/waveview_p.h
deleted file mode 100644
index 5b636a702f..0000000000
--- a/gtk2_ardour/waveview_p.h
+++ /dev/null
@@ -1,67 +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.
-
-*/
-
-// -*- c++ -*-
-#ifndef _LIBGNOMECANVASMM_WAVEVIEW_P_H
-#define _LIBGNOMECANVASMM_WAVEVIEW_P_H
-
-#include <libgnomecanvasmm/private/item_p.h>
-#include <glibmm/class.h>
-
-namespace Gnome
-{
-
-namespace Canvas
-{
-
-class WaveView_Class : public Glib::Class
-{
-public:
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- typedef WaveView CppObjectType;
- typedef GnomeCanvasWaveView BaseObjectType;
- typedef GnomeCanvasWaveViewClass BaseClassType;
- typedef Item_Class CppClassParent;
- typedef GnomeCanvasItemClass BaseClassParent;
-
- friend class WaveView;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- const Glib::Class& init();
-
- static void class_init_function(void* g_class, void* class_data);
-
- static Glib::ObjectBase* wrap_new(GObject*);
-
-protected:
-
- //Callbacks (default signal handlers):
- //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
- //You could prevent the original default signal handlers being called by overriding the *_impl method.
-
- //Callbacks (virtual functions):
-};
-
-
-} // namespace Canvas
-
-} // namespace Gnome
-
-#endif /* _LIBGNOMECANVASMM_WAVEVIEW_P_H */
-
diff --git a/gtk2_ardour/window_proxy.cc b/gtk2_ardour/window_proxy.cc
index 99da166af0..99da166af0 100755..100644
--- a/gtk2_ardour/window_proxy.cc
+++ b/gtk2_ardour/window_proxy.cc
diff --git a/gtk2_ardour/window_proxy.h b/gtk2_ardour/window_proxy.h
index 10ff25ced6..10ff25ced6 100755..100644
--- a/gtk2_ardour/window_proxy.h
+++ b/gtk2_ardour/window_proxy.h
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index d8dcf6d21f..a05a71247f 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -54,22 +54,12 @@ gtk2_ardour_sources = [
'axis_view.cc',
'bundle_manager.cc',
'button_joiner.cc',
- 'canvas-flag.cc',
- 'canvas-hit.cc',
- 'canvas-note-event.cc',
- 'canvas-note.cc',
- 'canvas_patch_change.cc',
- 'canvas-simpleline.c',
- 'canvas-simplerect.c',
- 'canvas-sysex.cc',
- 'canvas-waveview.c',
'clock_group.cc',
'configinfo.cc',
'control_point.cc',
'control_point_dialog.cc',
'curvetest.cc',
'debug.cc',
- 'diamond.cc',
'edit_note_dialog.cc',
'editing.cc',
'editor.cc',
@@ -123,12 +113,12 @@ gtk2_ardour_sources = [
'insert_time_dialog.cc',
'interthread_progress_window.cc',
'io_selector.cc',
+ 'hit.cc',
'keyboard.cc',
'keyeditor.cc',
'latency_gui.cc',
'led.cc',
'level_meter.cc',
- 'lineset.cc',
'location_ui.cc',
'main.cc',
'main_clock.cc',
@@ -160,6 +150,7 @@ gtk2_ardour_sources = [
'nag.cc',
'new_plugin_preset_dialog.cc',
'normalize_dialog.cc',
+ 'note.cc',
'note_player.cc',
'nsm.cc',
'nsmclient.cc',
@@ -169,6 +160,7 @@ gtk2_ardour_sources = [
'panner_editor.cc',
'panner_interface.cc',
'panner_ui.cc',
+ 'patch_change.cc',
'piano_roll_header.cc',
'pingback.cc',
'playlist_selector.cc',
@@ -212,8 +204,6 @@ gtk2_ardour_sources = [
'session_option_editor.cc',
'sfdb_ui.cc',
'shuttle_control.cc',
- 'simpleline.cc',
- 'simplerect.cc',
'splash.cc',
'speaker_dialog.cc',
'startup.cc',
@@ -223,6 +213,7 @@ gtk2_ardour_sources = [
'stereo_panner_editor.cc',
'streamview.cc',
'strip_silence_dialog.cc',
+ 'sys_ex.cc',
'tape_region_view.cc',
'tempo_dialog.cc',
'tempo_lines.cc',
@@ -241,7 +232,6 @@ gtk2_ardour_sources = [
'version.cc',
'visibility_group.cc',
'volume_controller.cc',
- 'waveview.cc',
'window_proxy.cc'
]
@@ -270,10 +260,6 @@ def configure(conf):
atleast_version='2.18')
autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM',
atleast_version='2.18')
- autowaf.check_pkg(conf, 'libgnomecanvas-2.0',
- uselib_store='GNOMECANVAS', atleast_version='2.30')
- autowaf.check_pkg(conf, 'libgnomecanvasmm-2.6',
- uselib_store='GNOMECANVASMM', atleast_version='2.16')
autowaf.check_pkg(conf, 'ogg', uselib_store='OGG', atleast_version='1.1.2')
autowaf.check_pkg(conf, 'x11', uselib_store='X11', atleast_version='1.1', mandatory=False)
autowaf.check_pkg(conf, 'fontconfig', uselib_store='FONTCONFIG')
@@ -371,7 +357,9 @@ def build(bld):
'libardour_cp',
'libgtk2_ardour',
'libgtkmm2ext',
- 'libtaglib']
+ 'libtaglib',
+ 'libcanvas'
+ ]
obj.target = 'ardour-3.0-vst.exe.so'
obj.includes = [ '../libs/fst', '.' ]
obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
@@ -397,18 +385,19 @@ def build(bld):
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
- obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL'
- obj.uselib += ' GTKMM GNOMECANVASMM GNOMECANVAS '
- obj.uselib += ' AUDIOUNITS OSX GTKOSX LO '
+ obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG ALSA CURL DL GTKMM LO'
obj.use = [ 'libpbd',
'libmidipp',
'libtaglib',
- 'ardour',
+ 'libardour',
'libardour_cp',
'libgtkmm2ext',
- 'libtaglib' ]
+ 'libtaglib',
+ 'libcanvas'
+ ]
if sys.platform == 'darwin':
- obj.use += ' libappleutility'
+ obj.uselib += ' AUDIOUNITS OSX GTKOSX'
+ obj.use += ' libappleutility'
obj.defines = [
'PACKAGE="' + I18N_PACKAGE + '"',
'VERSIONSTRING="' + bld.env['VERSION'] + '"',