summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2013-09-21 09:17:25 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2013-09-21 09:17:25 +0100
commit19bb2b33a89a1291451f0740739a36daebe00bae (patch)
treed0cafb4792ec4ff61d04d16c1e86199b2714a36f /gtk2_ardour
parent66aa6dfc8ecdb7591768bc45866a8c2b0d77e767 (diff)
parentfd23ebd0886cd61f8ee68d52d6576d00a16c9032 (diff)
Merge remote-tracking branch 'remotes/origin/cairocanvas' into windows
Conflicts (hopefully resolved): gtk2_ardour/marker.cc gtk2_ardour/midi_region_view.h gtk2_ardour/region_gain_line.h gtk2_ardour/utils.cc gtk2_ardour/video_image_frame.cc gtk2_ardour/wscript libs/backends/jack/wscript
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardev_common.sh.in2
-rw-r--r--gtk2_ardour/ardour3_ui_default.conf6
-rw-r--r--gtk2_ardour/ardour_ui.cc5
-rw-r--r--gtk2_ardour/ardour_ui.h1
-rw-r--r--gtk2_ardour/ardour_ui_options.cc6
-rw-r--r--gtk2_ardour/ardour_window.cc2
-rw-r--r--gtk2_ardour/audio_region_editor.h1
-rw-r--r--gtk2_ardour/audio_region_view.cc1097
-rw-r--r--gtk2_ardour/audio_region_view.h39
-rw-r--r--gtk2_ardour/audio_streamview.cc54
-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.cc42
-rw-r--r--gtk2_ardour/automation_line.h14
-rw-r--r--gtk2_ardour/automation_region_view.cc8
-rw-r--r--gtk2_ardour/automation_region_view.h3
-rw-r--r--gtk2_ardour/automation_streamview.cc15
-rw-r--r--gtk2_ardour/automation_streamview.h1
-rw-r--r--gtk2_ardour/automation_time_axis.cc33
-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-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.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.h43
-rw-r--r--gtk2_ardour/canvas_impl.h34
-rw-r--r--gtk2_ardour/canvas_patch_change.cc8
-rw-r--r--gtk2_ardour/control_point.cc45
-rw-r--r--gtk2_ardour/control_point.h13
-rw-r--r--gtk2_ardour/crossfade_edit.cc199
-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.cc18
-rw-r--r--gtk2_ardour/edit_note_dialog.h13
-rw-r--r--gtk2_ardour/editor.cc181
-rw-r--r--gtk2_ardour/editor.h211
-rw-r--r--gtk2_ardour/editor_actions.cc5
-rw-r--r--gtk2_ardour/editor_audiotrack.cc4
-rw-r--r--gtk2_ardour/editor_canvas.cc586
-rw-r--r--gtk2_ardour/editor_canvas_events.cc50
-rw-r--r--gtk2_ardour/editor_cursors.cc85
-rw-r--r--gtk2_ardour/editor_cursors.h42
-rw-r--r--gtk2_ardour/editor_drag.cc387
-rw-r--r--gtk2_ardour/editor_drag.h42
-rw-r--r--gtk2_ardour/editor_markers.cc37
-rw-r--r--gtk2_ardour/editor_mixer.cc2
-rw-r--r--gtk2_ardour/editor_mouse.cc289
-rw-r--r--gtk2_ardour/editor_ops.cc164
-rw-r--r--gtk2_ardour/editor_routes.cc14
-rw-r--r--gtk2_ardour/editor_rulers.cc148
-rw-r--r--gtk2_ardour/editor_selection.cc8
-rw-r--r--gtk2_ardour/editor_summary.cc22
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc57
-rw-r--r--gtk2_ardour/editor_videotimeline.cc21
-rw-r--r--gtk2_ardour/enums.h12
-rw-r--r--gtk2_ardour/gain_meter.cc2
-rw-r--r--gtk2_ardour/generic_pluginui.cc4
-rw-r--r--gtk2_ardour/ghostregion.cc105
-rw-r--r--gtk2_ardour/ghostregion.h48
-rw-r--r--gtk2_ardour/gtk_pianokeyboard.c10
-rw-r--r--gtk2_ardour/hit.cc114
-rw-r--r--gtk2_ardour/hit.h63
-rw-r--r--gtk2_ardour/level_meter.cc44
-rw-r--r--gtk2_ardour/lineset.cc803
-rw-r--r--gtk2_ardour/lineset.h194
-rw-r--r--gtk2_ardour/marker.cc233
-rw-r--r--gtk2_ardour/marker.h12
-rw-r--r--gtk2_ardour/midi_region_view.cc431
-rw-r--r--gtk2_ardour/midi_region_view.h125
-rw-r--r--gtk2_ardour/midi_streamview.cc54
-rw-r--r--gtk2_ardour/midi_streamview.h5
-rw-r--r--gtk2_ardour/midi_time_axis.cc12
-rw-r--r--gtk2_ardour/midi_time_axis.h1
-rw-r--r--gtk2_ardour/mono_panner.cc12
-rw-r--r--gtk2_ardour/note.cc144
-rw-r--r--gtk2_ardour/note.h70
-rw-r--r--gtk2_ardour/note_base.cc (renamed from gtk2_ardour/canvas-note-event.cc)147
-rw-r--r--gtk2_ardour/note_base.h (renamed from gtk2_ardour/canvas-note-event.h)83
-rw-r--r--gtk2_ardour/patch_change.cc248
-rw-r--r--gtk2_ardour/patch_change.h (renamed from gtk2_ardour/canvas_patch_change.h)48
-rw-r--r--gtk2_ardour/public_editor.h28
-rw-r--r--gtk2_ardour/rc_option_editor.cc8
-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.h5
-rw-r--r--gtk2_ardour/region_view.cc192
-rw-r--r--gtk2_ardour/region_view.h30
-rw-r--r--gtk2_ardour/route_time_axis.cc47
-rw-r--r--gtk2_ardour/route_time_axis.h12
-rw-r--r--gtk2_ardour/shuttle_control.cc2
-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/step_editor.cc4
-rw-r--r--gtk2_ardour/stereo_panner.cc34
-rw-r--r--gtk2_ardour/streamview.cc88
-rw-r--r--gtk2_ardour/streamview.h24
-rw-r--r--gtk2_ardour/strip_silence_dialog.cc4
-rw-r--r--gtk2_ardour/strip_silence_dialog.h1
-rw-r--r--gtk2_ardour/sys_ex.cc (renamed from gtk2_ardour/canvas-sysex.cc)80
-rw-r--r--gtk2_ardour/sys_ex.h (renamed from gtk2_ardour/canvas-sysex.h)43
-rw-r--r--gtk2_ardour/tape_region_view.cc10
-rw-r--r--gtk2_ardour/tape_region_view.h2
-rw-r--r--gtk2_ardour/tempo_lines.cc213
-rw-r--r--gtk2_ardour/tempo_lines.h26
-rw-r--r--gtk2_ardour/theme_manager.cc96
-rw-r--r--gtk2_ardour/theme_manager.h12
-rw-r--r--gtk2_ardour/time_axis_view.cc178
-rw-r--r--gtk2_ardour/time_axis_view.h13
-rw-r--r--gtk2_ardour/time_axis_view_item.cc410
-rw-r--r--gtk2_ardour/time_axis_view_item.h51
-rw-r--r--gtk2_ardour/ui_config.cc9
-rw-r--r--gtk2_ardour/ui_config.h28
-rw-r--r--gtk2_ardour/ui_config_vars.h5
-rw-r--r--gtk2_ardour/utils.cc39
-rw-r--r--gtk2_ardour/utils.h11
-rw-r--r--gtk2_ardour/verbose_cursor.cc29
-rw-r--r--gtk2_ardour/verbose_cursor.h17
-rw-r--r--gtk2_ardour/video_image_frame.cc199
-rw-r--r--gtk2_ardour/video_image_frame.h13
-rw-r--r--gtk2_ardour/video_monitor.cc20
-rw-r--r--gtk2_ardour/video_timeline.cc32
-rw-r--r--gtk2_ardour/video_timeline.h12
-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--gtk2_ardour/wscript40
141 files changed, 4298 insertions, 7285 deletions
diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in
index 850a83c954..dd014f5fd9 100644
--- a/gtk2_ardour/ardev_common.sh.in
+++ b/gtk2_ardour/ardev_common.sh.in
@@ -30,7 +30,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/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf
index 7c33944dbe..f60fa95021 100644
--- a/gtk2_ardour/ardour3_ui_default.conf
+++ b/gtk2_ardour/ardour3_ui_default.conf
@@ -112,7 +112,7 @@
<Option name="selected crossfade editor line" value="00dbdbff"/>
<Option name="selected crossfade editor wave" value="f9ea14a0"/>
<Option name="selected region base" value="51518a97"/>
- <Option name="selected waveform fill" value="51518ac8"/>
+ <Option name="selected waveform fill" value="25e2e9c8"/>
<Option name="selected waveform outline" value="0f0f0fcc"/>
<Option name="selection rect" value="e8f4d377"/>
<Option name="selection" value="636363b2"/>
@@ -155,9 +155,9 @@
<Option name="video timeline bar" value="303030ff"/>
<Option name="region base" value="99a7b5a0"/>
<Option name="region area covered by another region" value="505050b0"/>
- <Option name="waveform outline" value="0f0f0fc8"/>
+ <Option name="waveform fill" value="ffffffff"/>
<Option name="clipped waveform" value="ff0000e5"/>
- <Option name="waveform fill" value="3d4753dc"/>
+ <Option name="waveform fill" value="bde7b9dc"/>
<Option name="zero line" value="b5b5b525"/>
<Option name="zoom rect" value="c6d1b26d"/>
<Option name="monitor knob" value="329edfff"/>
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 5dde7f977e..16d468ea3e 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -217,6 +217,11 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
}
ui_config = new UIConfiguration();
+
+ ui_config->ParameterChanged.connect (sigc::mem_fun (*this, &ARDOUR_UI::parameter_changed));
+ boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
+ ui_config->map_parameters (pc);
+
_audio_midi_setup = new EngineControl;
editor = 0;
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 0ca8cde907..bdc34d35b9 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/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index 6b2c9da6fa..55314037e3 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -33,6 +33,8 @@
#include "ardour/osc.h"
#endif
+#include "canvas/wave_view.h"
+
#include "audio_clock.h"
#include "ardour_ui.h"
#include "actions.h"
@@ -311,8 +313,6 @@ ARDOUR_UI::setup_session_options ()
void
ARDOUR_UI::parameter_changed (std::string p)
{
- ENSURE_GUI_THREAD (*this, &ARDOUR_UI::parameter_changed, p)
-
if (p == "external-sync") {
ActionManager::map_some_state ("Transport", "ToggleExternalSync", sigc::mem_fun (_session->config, &SessionConfiguration::get_external_sync));
@@ -413,6 +413,8 @@ ARDOUR_UI::parameter_changed (std::string p)
} else if (p == "super-rapid-clock-update") {
stop_clocking ();
start_clocking ();
+ } else if (p == "waveform-gradient-depth") {
+ ArdourCanvas::WaveView::set_global_gradient_depth (config()->get_waveform_gradient_depth());
} else if (p == "show-editor-meter") {
bool show = Config->get_show_editor_meter();
if (editor_meter && show) {
diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc
index ab9d72dd53..b50a83c31f 100644
--- a/gtk2_ardour/ardour_window.cc
+++ b/gtk2_ardour/ardour_window.cc
@@ -102,7 +102,7 @@ ArdourWindow::init ()
vice versa.
*/
- if (ARDOUR_UI::instance()->config()->all_floating_windows_are_dialogs.get()) {
+ if (ARDOUR_UI::instance()->config()->get_all_floating_windows_are_dialogs()) {
set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
} else {
set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
diff --git a/gtk2_ardour/audio_region_editor.h b/gtk2_ardour/audio_region_editor.h
index 0d9292b483..2552dfd165 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"
#ifdef WIN32
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index c6e42c0a4b..0159022f87 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -37,12 +37,17 @@
#include "evoral/Curve.hpp"
+#include "canvas/rectangle.h"
+#include "canvas/polygon.h"
+#include "canvas/poly_line.h"
+#include "canvas/line.h"
+#include "canvas/text.h"
+#include "canvas/debug.h"
+#include "canvas/utils.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"
@@ -66,7 +71,7 @@ using namespace Editing;
using namespace ArdourCanvas;
static const int32_t sync_mark_width = 9;
-static double const handle_size = 6; /* height of fade handles */
+static double const handle_size = 15; /* height of fade handles */
AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr<AudioRegion> r, double spu,
Gdk::Color const & basic_color)
@@ -154,24 +159,28 @@ 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);
+ CANVAS_DEBUG_NAME (fade_in_shape, string_compose ("fade in shape for %1", region()->name()));
+ 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);
+ CANVAS_DEBUG_NAME (fade_out_shape, string_compose ("fade out shape for %1", region()->name()));
+ 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);
+ CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in handle for %1", region()->name()));
+ 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);
+ CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out handle for %1", region()->name()));
+ fade_out_handle->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 0));
+ fade_out_handle->set_outline_color (RGBA_TO_UINT (0, 0, 0, 0));
fade_out_handle->set_data ("regionview", this);
}
@@ -197,7 +206,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() / samples_per_pixel);
+ }
+
region_locked ();
envelope_active_changed ();
fade_in_active_changed ();
@@ -205,22 +218,28 @@ 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 ();
setup_waveform_visibility ();
setup_waveform_shape ();
- setup_waveform_scale ();
+
+ if (frame_handle_start) {
+ frame_handle_start->raise_to_top ();
+ }
+ if (frame_handle_end) {
+ frame_handle_end->raise_to_top ();
+ }
/* XXX sync mark drag? */
}
@@ -231,10 +250,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 +314,11 @@ 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));
} 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));
}
}
@@ -311,11 +326,11 @@ 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));
} 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));
}
}
@@ -323,11 +338,8 @@ AudioRegionView::fade_out_active_changed ()
void
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]->gain_changed ();
}
}
@@ -360,16 +372,16 @@ AudioRegionView::region_resized (const PropertyChange& what_changed)
interesting_stuff.add (ARDOUR::Properties::length);
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 ();
}
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 ();
}
}
}
@@ -412,14 +424,15 @@ AudioRegionView::reset_width_dependent_items (double pixel_width)
for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
- float x_pos = trackview.editor().frame_to_pixel (*i);
+ float x_pos = trackview.editor().sample_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 ();
@@ -429,14 +442,7 @@ void
AudioRegionView::region_muted ()
{
RegionView::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);
- } else {
- waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
- }
- }
+ set_waveform_colors ();
}
void
@@ -446,13 +452,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 +480,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) {
@@ -496,18 +502,14 @@ AudioRegionView::set_height (gdouble height)
for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
- float pos_x = trackview.editor().frame_to_pixel((*l).first);
+ float pos_x = trackview.editor().sample_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) {
- name_pixbuf->raise_to_top();
+ if (name_text) {
+ name_text->raise_to_top();
}
}
@@ -537,18 +539,13 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, f
width = std::max ((framecnt_t) 64, width);
- Points* points;
-
/* round here to prevent little visual glitches with sub-pixel placement */
- double const pwidth = rint (width / samples_per_unit);
- uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
- double h;
-
- double const handle_center = pwidth;
+ double const pwidth = rint (width / samples_per_pixel);
+ double const handle_left = 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_left);
+ fade_in_handle->set_x1 (handle_left + handle_size);
if (pwidth < 5) {
hide_start_xfade();
@@ -560,43 +557,57 @@ AudioRegionView::reset_fade_in_shape_width (boost::shared_ptr<AudioRegion> ar, f
fade_in_shape->show();
}
+ uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
+ double effective_height;
float curve[npoints];
- audio_region()->fade_in()->curve().get_vector (0, audio_region()->fade_in()->back()->when, curve, npoints);
- points = get_canvas_points ("fade in shape", npoints + 3);
+ audio_region()->fade_in()->curve().get_vector (0, audio_region()->fade_in()->back()->when, curve, npoints);
if (_height >= NAME_HIGHLIGHT_THRESH) {
- h = _height - NAME_HIGHLIGHT_SIZE - 2;
+ effective_height = _height - NAME_HIGHLIGHT_SIZE - 2;
} else {
- h = _height - 2;
+ effective_height = _height - 2;
}
+ Points points;
+
+ points.assign (npoints, Duple());
+
/* points *MUST* be in anti-clockwise order */
uint32_t pi, pc;
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 + (effective_height - (curve[pc] * effective_height));
}
+ /* draw the line */
+
+ redraw_start_xfade_to (ar, width, points, effective_height);
+
+ /* add 3 more points */
+
+ points.push_back (Duple());
+ points.push_back (Duple());
+ points.push_back (Duple());
+
/* fold back */
- (*points)[pi].set_x(pwidth);
- (*points)[pi++].set_y(2);
+ points[pi].x = pwidth;
+ points[pi].y = 2;
+ pi++;
- (*points)[pi].set_x(1);
- (*points)[pi++].set_y(2);
+ points[pi].x = 1;
+ points[pi].y = 2;
+ pi++;
/* connect the dots ... */
- (*points)[pi] = (*points)[0];
+ points[pi] = points[0];
- fade_in_shape->property_points() = *points;
- delete points;
-
- redraw_start_xfade_to ( ar, width);
+ fade_in_shape->set (points);
/* ensure trim handle stays on top */
if (frame_handle_start) {
@@ -624,20 +635,15 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
width = std::max ((framecnt_t) 64, width);
- Points* points;
-
/* round here to prevent little visual glitches with sub-pixel placement */
- double const pwidth = rint (width / samples_per_unit);
- uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
- double h;
+ double const pwidth = rint (width / samples_per_pixel);
- double const handle_center = (_region->length() - width) / samples_per_unit;
+ double const handle_right = (_region->length() / samples_per_pixel) - pwidth;
/* 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_right - handle_size);
+ fade_out_handle->set_x1 (handle_right);
/* don't show shape if its too small */
@@ -651,43 +657,59 @@ AudioRegionView::reset_fade_out_shape_width (boost::shared_ptr<AudioRegion> ar,
fade_out_shape->show();
}
+ uint32_t npoints = std::min (gdk_screen_width(), (int) pwidth);
+ double effective_height;
float curve[npoints];
+
audio_region()->fade_out()->curve().get_vector (0, audio_region()->fade_out()->back()->when, curve, npoints);
if (_height >= NAME_HIGHLIGHT_THRESH) {
- h = _height - NAME_HIGHLIGHT_SIZE - 2;
+ effective_height = _height - NAME_HIGHLIGHT_SIZE - 2;
} else {
- h = _height - 2;
+ effective_height = _height - 2;
}
/* points *MUST* be in anti-clockwise order */
- points = get_canvas_points ("fade out shape", npoints + 3);
+ Points points;
uint32_t pi, pc;
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.assign (npoints, Duple ());
+
+ for (pi = 0, pc = 0; pc < npoints; ++pc, ++pi) {
+ points[pi].x = _pixel_width - pwidth + (pc * xdelta);
+ points[pi].y = 2 + (effective_height - (curve[pc] * effective_height));
}
+ /* draw the line */
+
+ redraw_end_xfade_to (ar, width, points, effective_height);
+
+ /* fill the polygon*/
+
+ /* add 3 more points */
+
+ points.push_back (Duple());
+ points.push_back (Duple());
+ points.push_back (Duple());
+
/* fold back */
- (*points)[pi].set_x(_pixel_width);
- (*points)[pi++].set_y(h);
+ points[pi].x = _pixel_width;
+ points[pi].y = effective_height;
+ pi++;
- (*points)[pi].set_x(_pixel_width);
- (*points)[pi++].set_y(2);
+ points[pi].x = _pixel_width;
+ points[pi].y = 2;
+ pi++;
/* connect the dots ... */
- (*points)[pi] = (*points)[0];
-
- fade_out_shape->property_points() = *points;
- delete points;
+ points[pi] = points[0];
- redraw_end_xfade_to (ar, width);
+ fade_out_shape->set (points);
/* ensure trim handle stays on top */
if (frame_handle_end) {
@@ -710,13 +732,265 @@ AudioRegionView::get_fade_out_shape_width ()
void
-AudioRegionView::set_samples_per_unit (gdouble spu)
+AudioRegionView::redraw_start_xfade ()
+{
+ boost::shared_ptr<AudioRegion> ar (audio_region());
+
+ if (!ar->fade_in() || ar->fade_in()->empty()) {
+ return;
+ }
+
+ show_start_xfade();
+ reset_fade_in_shape_width (ar, ar->fade_in()->back()->when);
+}
+
+void
+AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t /*width*/, Points& points, double effective_height)
+{
+ if (points.size() < 3) {
+ return;
+ }
+
+ if (!start_xfade_in) {
+ start_xfade_in = new ArdourCanvas::PolyLine (group);
+ CANVAS_DEBUG_NAME (start_xfade_in, string_compose ("xfade start in line for %1", region()->name()));
+ start_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ start_xfade_in->set_outline_width (1.5);
+ }
+
+ if (!start_xfade_out) {
+ start_xfade_out = new ArdourCanvas::PolyLine (group);
+ CANVAS_DEBUG_NAME (start_xfade_out, string_compose ("xfade start out line for %1", region()->name()));
+ uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ start_xfade_out->set_outline_color (col);
+ start_xfade_out->set_outline_width (2.0);
+ }
+
+ if (!start_xfade_rect) {
+ start_xfade_rect = new ArdourCanvas::Rectangle (group);
+ CANVAS_DEBUG_NAME (start_xfade_rect, string_compose ("xfade start rect for %1", region()->name()));
+ start_xfade_rect->set_fill (true);
+ start_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
+ start_xfade_rect->set_outline (false);
+ start_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
+ start_xfade_rect->set_data ("regionview", this);
+ }
+
+ start_xfade_rect->set (ArdourCanvas::Rect (points.front().x, 1.0, points.back().x, effective_height));
+ start_xfade_rect->show ();
+
+ start_xfade_in->set (points);
+ start_xfade_in->show ();
+
+ /* fade out line */
+
+ boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_in();
+ Points ipoints;
+ Points::size_type npoints = points.size();
+
+ ipoints.assign (npoints, Duple());
+
+ if (!inverse) {
+
+ for (Points::size_type i = 0, pci = 0; i < npoints; ++i, ++pci) {
+ ArdourCanvas::Duple &p (ipoints[pci]);
+ p.x = i;
+ p.y = effective_height - points[pci].y;
+ }
+
+ } else {
+
+ float vec[npoints];
+ inverse->curve().get_vector (0, inverse->back()->when, vec, npoints);
+
+ for (Points::size_type i = 0, pci = 0; i < npoints; ++i, ++pci) {
+ ArdourCanvas::Duple &p (ipoints[pci]);
+ p.x = i;
+ p.y = 1.0 + effective_height - (effective_height * vec[i]);
+ }
+ }
+
+ start_xfade_out->set (ipoints);
+ start_xfade_out->show ();
+
+ show_start_xfade();
+}
+
+void
+AudioRegionView::redraw_end_xfade ()
+{
+ boost::shared_ptr<AudioRegion> ar (audio_region());
+
+ if (!ar->fade_out() || ar->fade_out()->empty()) {
+ return;
+ }
+
+ show_end_xfade();
+
+ reset_fade_out_shape_width (ar, ar->fade_out()->back()->when);
+}
+
+void
+AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t width, Points& points, double effective_height)
+{
+ if (points.size() < 3) {
+ return;
+ }
+
+ if (!end_xfade_in) {
+ end_xfade_in = new ArdourCanvas::PolyLine (group);
+ CANVAS_DEBUG_NAME (end_xfade_in, string_compose ("xfade end in line for %1", region()->name()));
+ uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ end_xfade_in->set_outline_color (col);
+ end_xfade_in->set_outline_width (1.5);
+ }
+
+ if (!end_xfade_out) {
+ end_xfade_out = new ArdourCanvas::PolyLine (group);
+ CANVAS_DEBUG_NAME (end_xfade_out, string_compose ("xfade end out line for %1", region()->name()));
+ end_xfade_out->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ end_xfade_out->set_outline_width (2.0);
+ }
+
+ if (!end_xfade_rect) {
+ end_xfade_rect = new ArdourCanvas::Rectangle (group);
+ CANVAS_DEBUG_NAME (end_xfade_rect, string_compose ("xfade end rect for %1", region()->name()));
+ end_xfade_rect->set_fill (true);
+ end_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
+ end_xfade_rect->set_outline (0);
+ end_xfade_rect->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
+ end_xfade_rect->set_data ("regionview", this);
+ }
+
+ end_xfade_rect->set (ArdourCanvas::Rect (points.front().x, 1.0, points.back().x, effective_height));
+ end_xfade_rect->show ();
+
+ end_xfade_in->set (points);
+ end_xfade_in->show ();
+ end_xfade_in->raise_to_top ();
+
+ /* fade in line */
+
+ boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_out ();
+ Points ipoints;
+ Points::size_type npoints = points.size();
+
+ ipoints.assign (npoints, Duple());
+
+ if (!inverse) {
+
+ const double rend = trackview.editor().sample_to_pixel (_region->length() - points.back().y);
+
+ for (Points::size_type i = 0, pci = 0; i < npoints; ++i, ++pci) {
+ ArdourCanvas::Duple &p (ipoints[pci]);
+ p.x = rend + i;
+ p.y = effective_height - points[pci].y;
+ }
+
+ } else {
+
+ boost::scoped_array<float> vec (new float[npoints]);
+ inverse->curve().get_vector (inverse->front()->when, inverse->back()->when, vec.get(), npoints);
+
+ const double rend = trackview.editor().sample_to_pixel (_region->length() - width);
+
+ float* vp = vec.get();
+
+ for (Points::size_type i = 0, pci = 0; i < npoints; ++i) {
+ ArdourCanvas::Duple& p (ipoints[pci++]);
+ p.x = rend + i;
+ p.y = 1.0 + effective_height - (effective_height * vp[i]);
+ }
+ }
+
+ end_xfade_out->set (ipoints);
+ end_xfade_out->show ();
+ end_xfade_out->raise_to_top ();
+
+ end_xfade_rect->raise_to_top (); //this needs to be topmost so the lines don't steal mouse focus
+
+ show_end_xfade();
+}
+
+void
+AudioRegionView::hide_xfades ()
+{
+ hide_start_xfade ();
+ hide_end_xfade ();
+}
+
+void
+AudioRegionView::hide_start_xfade ()
{
- RegionView::set_samples_per_unit (spu);
+ if (start_xfade_in) {
+ start_xfade_in->hide();
+ }
+ if (start_xfade_out) {
+ start_xfade_out->hide();
+ }
+ if (start_xfade_rect) {
+ start_xfade_rect->hide ();
+ }
+
+ _start_xfade_visible = false;
+}
+
+void
+AudioRegionView::hide_end_xfade ()
+{
+ if (end_xfade_in) {
+ end_xfade_in->hide();
+ }
+ if (end_xfade_out) {
+ end_xfade_out->hide();
+ }
+ if (end_xfade_rect) {
+ end_xfade_rect->hide ();
+ }
+
+ _end_xfade_visible = false;
+}
+
+void
+AudioRegionView::show_start_xfade ()
+{
+ if (start_xfade_in) {
+ start_xfade_in->show();
+ }
+ if (start_xfade_out) {
+ start_xfade_out->show();
+ }
+ if (start_xfade_rect) {
+ start_xfade_rect->show ();
+ }
+
+ _start_xfade_visible = true;
+}
+
+void
+AudioRegionView::show_end_xfade ()
+{
+ if (end_xfade_in) {
+ end_xfade_in->show();
+ }
+ if (end_xfade_out) {
+ end_xfade_out->show();
+ }
+ if (end_xfade_rect) {
+ end_xfade_rect->show ();
+ }
+
+ _end_xfade_visible = true;
+}
+
+void
+AudioRegionView::set_samples_per_pixel (gdouble fpp)
+{
+ RegionView::set_samples_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_samples_per_pixel (fpp);
}
}
@@ -728,10 +1002,10 @@ AudioRegionView::set_samples_per_unit (gdouble spu)
}
void
-AudioRegionView::set_amplitude_above_axis (gdouble spp)
+AudioRegionView::set_amplitude_above_axis (gdouble a)
{
for (uint32_t n=0; n < waves.size(); ++n) {
- waves[n]->property_amplitude_above_axis() = spp;
+ waves[n]->set_amplitude_above_axis (a);
}
}
@@ -751,18 +1025,33 @@ AudioRegionView::set_colors ()
RegionView::set_colors();
if (gain_line) {
- gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
+ gain_line->set_line_color (audio_region()->envelope_active() ?
+ ARDOUR_UI::config()->get_canvasvar_GainLine() :
+ ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
}
- 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);
- } else {
- waves[n]->property_wave_color() = ARDOUR_UI::config()->canvasvar_WaveForm.get();
- }
+ set_waveform_colors ();
+
+ if (start_xfade_in) {
+ start_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ }
+ if (start_xfade_out) {
+ uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ start_xfade_out->set_outline_color (col);
+ }
+ if (end_xfade_in) {
+ end_xfade_in->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine());
+ }
+ if (end_xfade_out) {
+ uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->get_canvasvar_CrossfadeLine(), 128);
+ end_xfade_out->set_outline_color (col);
+ }
- waves[n]->property_clip_color() = ARDOUR_UI::config()->canvasvar_WaveFormClip.get();
- waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_ZeroLine.get();
+ if (start_xfade_rect) {
+ start_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
+ }
+ if (end_xfade_rect) {
+ end_xfade_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_ActiveCrossfade());
}
}
@@ -774,7 +1063,8 @@ AudioRegionView::setup_waveform_visibility ()
/* make sure the zoom level is correct, since we don't update
this when waveforms are hidden.
*/
- waves[n]->property_samples_per_unit() = samples_per_unit;
+ // CAIROCANVAS
+ // waves[n]->set_samples_per_pixel (_samples_per_pixel);
waves[n]->show();
}
} else {
@@ -848,8 +1138,6 @@ AudioRegionView::create_waves ()
break;
}
- wave_caches.push_back (WaveView::create_cache ());
-
// cerr << "\tchannel " << n << endl;
if (wait_for_data) {
@@ -888,35 +1176,24 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
gdouble yoff = which * ht;
- 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;
- 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();
- } 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->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->property_rectified() = Config->get_waveform_shape() == Rectified;
- wave->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
+ WaveView *wave = new WaveView (group, audio_region ());
+ CANVAS_DEBUG_NAME (wave, string_compose ("wave view for chn %1 of %2", which, get_item_name()));
+
+ wave->set_channel (which);
+ wave->set_y_position (yoff);
+ wave->set_height (ht);
+ wave->set_samples_per_pixel (samples_per_pixel);
+ wave->set_show_zero_line (true);
+
+ switch (Config->get_waveform_shape()) {
+ case Rectified:
+ wave->set_shape (WaveView::Rectified);
+ break;
+ default:
+ wave->set_shape (WaveView::Normal);
+ }
+
+ wave->set_logscaled (Config->get_waveform_scale() == Logarithmic);
if (!Config->get_show_waveforms ()) {
wave->hide();
@@ -978,9 +1255,9 @@ 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);
+ framepos_t fx = trackview.editor().pixel_to_sample (x);
if (fx > _region->length()) {
return;
@@ -1025,19 +1302,31 @@ AudioRegionView::remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent */*
void
AudioRegionView::setup_waveform_shape ()
{
+ WaveView::Shape shape;
+
+ switch (Config->get_waveform_shape()) {
+ case Rectified:
+ shape = WaveView::Rectified;
+ break;
+ default:
+ shape = WaveView::Normal;
+ }
for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
- (*wave)->property_rectified() = Config->get_waveform_shape() == Rectified;
+ (*wave)->set_shape (shape);
}
}
void
AudioRegionView::setup_waveform_scale ()
{
- for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
- (*wave)->property_logscaled() = Config->get_waveform_scale() == Logarithmic;
- }
+ WaveView::set_global_logscaled (Config->get_waveform_scale() == Logarithmic);
}
+void
+AudioRegionView::setup_waveform_clipping ()
+{
+ WaveView::set_global_show_waveform_clipping (ARDOUR_UI::config()->get_show_waveform_clipping());
+}
GhostRegion*
AudioRegionView::add_ghost (TimeAxisView& tv)
@@ -1045,7 +1334,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 () / samples_per_pixel;
AudioGhostRegion* ghost = new AudioGhostRegion (tv, trackview, unit_position);
uint32_t nchans;
@@ -1057,26 +1346,18 @@ 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());
+ CANVAS_DEBUG_NAME (wave, string_compose ("ghost wave for %1", get_item_name()));
- wave->property_region_start() = _region->start();
+ wave->set_channel (n);
+ wave->set_samples_per_pixel (samples_per_pixel);
+ wave->set_amplitude_above_axis (_amplitude_above_axis);
ghost->waves.push_back(wave);
}
ghost->set_height ();
- ghost->set_duration (_region->length() / samples_per_unit);
+ ghost->set_duration (_region->length() / samples_per_pixel);
ghost->set_colors();
ghosts.push_back (ghost);
@@ -1094,10 +1375,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 +1393,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));
}
}
@@ -1123,35 +1404,13 @@ void
AudioRegionView::envelope_active_changed ()
{
if (gain_line) {
- gain_line->set_line_color (audio_region()->envelope_active() ? ARDOUR_UI::config()->canvasvar_GainLine.get() : ARDOUR_UI::config()->canvasvar_GainLineInactive.get());
+ gain_line->set_line_color (audio_region()->envelope_active() ?
+ ARDOUR_UI::config()->get_canvasvar_GainLine() :
+ ARDOUR_UI::config()->get_canvasvar_GainLineInactive());
}
}
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:
@@ -1167,6 +1426,59 @@ AudioRegionView::color_handler ()
}
void
+AudioRegionView::set_waveform_colors ()
+{
+ for (vector<ArdourCanvas::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
+ set_one_waveform_color (*w);
+ }
+}
+
+void
+AudioRegionView::set_one_waveform_color (ArdourCanvas::WaveView* wave)
+{
+ ArdourCanvas::Color fill;
+ ArdourCanvas::Color outline;
+
+ if (_selected) {
+ if (_region->muted()) {
+ outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm(), MUTED_ALPHA);
+ } else {
+ outline = ARDOUR_UI::config()->get_canvasvar_SelectedWaveForm();
+ }
+ fill = ARDOUR_UI::config()->get_canvasvar_SelectedWaveFormFill();
+ } else {
+ if (_recregion) {
+ outline = ARDOUR_UI::config()->get_canvasvar_RecWaveForm();
+ fill = ARDOUR_UI::config()->get_canvasvar_RecWaveFormFill();
+ } else {
+ if (_region->muted()) {
+ outline = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->get_canvasvar_WaveForm(), MUTED_ALPHA);
+ } else {
+ outline = ARDOUR_UI::config()->get_canvasvar_WaveForm();
+ }
+ fill = ARDOUR_UI::config()->get_canvasvar_WaveFormFill();
+ }
+ }
+
+ if (ARDOUR_UI::config()->get_color_regions_using_track_color()) {
+
+ /* just use a slightly transparent version of the selected
+ * color so that some of the track color bleeds through
+ */
+
+ double r, g, b, a;
+ ArdourCanvas::color_to_rgba (fill, r, g, b, a);
+ fill = ArdourCanvas::rgba_to_color (r, g, b, 0.85); /* magic number, not user controllable */
+
+ }
+
+ wave->set_fill_color (fill);
+ wave->set_outline_color (outline);
+ wave->set_clip_color (ARDOUR_UI::config()->get_canvasvar_WaveFormClip());
+ wave->set_zero_color (ARDOUR_UI::config()->get_canvasvar_ZeroLine());
+}
+
+void
AudioRegionView::set_frame_color ()
{
if (!frame) {
@@ -1181,42 +1493,7 @@ AudioRegionView::set_frame_color ()
TimeAxisViewItem::set_frame_color ();
- uint32_t wc;
- uint32_t fc;
-
- if (_selected) {
- if (_region->muted()) {
- wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_SelectedWaveForm.get(), MUTED_ALPHA);
- } else {
- wc = ARDOUR_UI::config()->canvasvar_SelectedWaveForm.get();
- }
- fc = ARDOUR_UI::config()->canvasvar_SelectedWaveFormFill.get();
- } else {
- if (_recregion) {
- if (_region->muted()) {
- wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_RecWaveForm.get(), MUTED_ALPHA);
- } else {
- wc = ARDOUR_UI::config()->canvasvar_RecWaveForm.get();
- }
- fc = ARDOUR_UI::config()->canvasvar_RecWaveFormFill.get();
- } else {
- if (_region->muted()) {
- wc = UINT_RGBA_CHANGE_A(ARDOUR_UI::config()->canvasvar_WaveForm.get(), MUTED_ALPHA);
- } else {
- wc = ARDOUR_UI::config()->canvasvar_WaveForm.get();
- }
- fc = ARDOUR_UI::config()->canvasvar_WaveFormFill.get();
- }
- }
-
- 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;
- }
- }
+ set_waveform_colors ();
}
void
@@ -1280,16 +1557,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);
+ CANVAS_DEBUG_NAME (canvas_item, string_compose ("transient group for %1", region()->name()));
- 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->property_first_arrowhead() = TRUE;
canvas_item->property_last_arrowhead() = TRUE;
canvas_item->property_arrow_shape_a() = 11.0;
@@ -1300,7 +1573,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));
}
@@ -1316,17 +1589,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);
+ *pos = trackview.editor().sample_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;
}
}
@@ -1346,7 +1617,7 @@ AudioRegionView::update_transient(float /*old_pos*/, float new_pos)
if (rint(new_pos) == rint(*pos)) {
framepos_t old_frame = (*l).first;
- framepos_t new_frame = trackview.editor().pixel_to_frame (new_pos);
+ framepos_t new_frame = trackview.editor().pixel_to_sample (new_pos);
_region->update_transient (old_frame, new_frame);
@@ -1381,294 +1652,6 @@ AudioRegionView::thaw_after_trim ()
drag_end ();
}
-void
-AudioRegionView::redraw_start_xfade ()
-{
- boost::shared_ptr<AudioRegion> ar (audio_region());
-
- if (!ar->fade_in() || ar->fade_in()->empty()) {
- return;
- }
-
- show_start_xfade();
-
- redraw_start_xfade_to (ar, ar->fade_in()->back()->when);
-}
-
-void
-AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len)
-{
- int32_t const npoints = trackview.editor().frame_to_pixel (len);
-
- if (npoints < 3) {
- return;
- }
-
- if (!start_xfade_in) {
- start_xfade_in = new ArdourCanvas::Line (*group);
- start_xfade_in->property_width_pixels() = 1;
- start_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
- }
-
- if (!start_xfade_out) {
- start_xfade_out = new ArdourCanvas::Line (*group);
- start_xfade_out->property_width_pixels() = 1;
- uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128);
- start_xfade_out->property_fill_color_rgba() = col;
- }
-
- if (!start_xfade_rect) {
- start_xfade_rect = new ArdourCanvas::SimpleRect (*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();
- start_xfade_rect->property_outline_pixels() = 0;
- start_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this));
- start_xfade_rect->set_data ("regionview", this);
- }
-
- Points* points = get_canvas_points ("xfade edit redraw", npoints);
- boost::scoped_array<float> vec (new float[npoints]);
-
- double effective_height;
- if (_height >= NAME_HIGHLIGHT_THRESH) {
- effective_height = _height - NAME_HIGHLIGHT_SIZE - 2;
- } else {
- effective_height = _height - 2;
- }
-
- ar->fade_in()->curve().get_vector (0, ar->fade_in()->back()->when, vec.get(), npoints);
-
- for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
- }
-
- start_xfade_rect->property_x1() = ((*points)[0]).get_x();
- start_xfade_rect->property_y1() = 1.0;
- start_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
- start_xfade_rect->property_y2() = effective_height;
- start_xfade_rect->show ();
-
- start_xfade_in->property_points() = *points;
- start_xfade_in->show ();
- start_xfade_in->raise_to_top ();
-
- /* fade out line */
-
- boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_in();
-
- if (!inverse) {
-
- for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (i);
- p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
- }
-
- } else {
-
- inverse->curve().get_vector (0, inverse->back()->when, vec.get(), npoints);
-
- for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
- }
- }
-
- start_xfade_out->property_points() = *points;
- start_xfade_out->show ();
- start_xfade_out->raise_to_top ();
-
- start_xfade_rect->raise_to_top (); //this needs to be topmost so the lines don't steal mouse focus
-
- show_start_xfade();
-
- delete points;
-}
-
-void
-AudioRegionView::redraw_end_xfade ()
-{
- boost::shared_ptr<AudioRegion> ar (audio_region());
-
- if (!ar->fade_out() || ar->fade_out()->empty()) {
- return;
- }
-
- show_end_xfade();
-
- redraw_end_xfade_to (ar, ar->fade_out()->back()->when);
-}
-
-void
-AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecnt_t len)
-{
- int32_t const npoints = trackview.editor().frame_to_pixel (len);
-
- if (npoints < 3) {
- return;
- }
-
- if (!end_xfade_in) {
- end_xfade_in = new ArdourCanvas::Line (*group);
- end_xfade_in->property_width_pixels() = 1;
- end_xfade_in->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get();
- }
-
- if (!end_xfade_out) {
- end_xfade_out = new ArdourCanvas::Line (*group);
- end_xfade_out->property_width_pixels() = 1;
- uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 128);
- end_xfade_out->property_fill_color_rgba() = col;
- }
-
- if (!end_xfade_rect) {
- end_xfade_rect = new ArdourCanvas::SimpleRect (*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();
- end_xfade_rect->property_outline_pixels() = 0;
- end_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this));
- end_xfade_rect->set_data ("regionview", this);
- }
-
- Points* points = get_canvas_points ("xfade edit redraw", npoints);
- boost::scoped_array<float> vec (new float[npoints]);
-
- ar->fade_out()->curve().get_vector (0, ar->fade_out()->back()->when, vec.get(), npoints);
-
- double rend = trackview.editor().frame_to_pixel (_region->length() - len);
-
- double effective_height;
- if (_height >= NAME_HIGHLIGHT_THRESH) {
- effective_height = _height - NAME_HIGHLIGHT_SIZE - 2;
- } else {
- effective_height = _height - 2;
- }
-
- for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (rend + i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
- }
-
- end_xfade_rect->property_x1() = ((*points)[0]).get_x();
- end_xfade_rect->property_y1() = 1;
- end_xfade_rect->property_x2() = ((*points)[npoints-1]).get_x();
- end_xfade_rect->property_y2() = effective_height;
- end_xfade_rect->show ();
-
- end_xfade_in->property_points() = *points;
- end_xfade_in->show ();
- end_xfade_in->raise_to_top ();
-
- /* fade in line */
-
- boost::shared_ptr<AutomationList> inverse = ar->inverse_fade_out ();
-
- if (!inverse) {
-
- for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (rend + i);
- p.set_y (1.0 + effective_height - (effective_height * (1.0 - vec.get()[i])));
- }
-
- } else {
-
- inverse->curve().get_vector (inverse->front()->when, inverse->back()->when, vec.get(), npoints);
-
- for (int i = 0, pci = 0; i < npoints; ++i) {
- Gnome::Art::Point &p ((*points)[pci++]);
- p.set_x (rend + i);
- p.set_y (1.0 + effective_height - (effective_height * vec.get()[i]));
- }
- }
-
- end_xfade_out->property_points() = *points;
- end_xfade_out->show ();
- end_xfade_out->raise_to_top ();
-
- end_xfade_rect->raise_to_top (); //this needs to be topmost so the lines don't steal mouse focus
-
- show_end_xfade();
-
- delete points;
-}
-
-void
-AudioRegionView::hide_xfades ()
-{
- hide_start_xfade ();
- hide_end_xfade ();
-}
-
-void
-AudioRegionView::hide_start_xfade ()
-{
- if (start_xfade_in) {
- start_xfade_in->hide();
- }
- if (start_xfade_out) {
- start_xfade_out->hide();
- }
- if (start_xfade_rect) {
- start_xfade_rect->hide ();
- }
-
- _start_xfade_visible = false;
-}
-
-void
-AudioRegionView::hide_end_xfade ()
-{
- if (end_xfade_in) {
- end_xfade_in->hide();
- }
- if (end_xfade_out) {
- end_xfade_out->hide();
- }
- if (end_xfade_rect) {
- end_xfade_rect->hide ();
- }
-
- _end_xfade_visible = false;
-}
-
-void
-AudioRegionView::show_start_xfade ()
-{
- if (start_xfade_in) {
- start_xfade_in->show();
- }
- if (start_xfade_out) {
- start_xfade_out->show();
- }
- if (start_xfade_rect) {
- start_xfade_rect->show ();
- }
-
- _start_xfade_visible = true;
-}
-
-void
-AudioRegionView::show_end_xfade ()
-{
- if (end_xfade_in) {
- end_xfade_in->show();
- }
- if (end_xfade_out) {
- end_xfade_out->show();
- }
- if (end_xfade_rect) {
- end_xfade_rect->show ();
- }
-
- _end_xfade_visible = true;
-}
void
AudioRegionView::show_xfades ()
@@ -1702,5 +1685,7 @@ AudioRegionView::parameter_changed (string const & p)
setup_waveform_scale ();
} else if (p == "waveform-shape") {
setup_waveform_shape ();
+ } else if (p == "show-waveform-clipping") {
+ setup_waveform_clipping ();
}
}
diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h
index 7c6d6b88f2..3bfa56d285 100644
--- a/gtk2_ardour/audio_region_view.h
+++ b/gtk2_ardour/audio_region_view.h
@@ -25,17 +25,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;
@@ -54,13 +53,13 @@ class AudioRegionView : public RegionView
AudioRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
- double initial_samples_per_unit,
+ double initial_samples_per_pixel,
Gdk::Color const & basic_color);
AudioRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::AudioRegion>,
- double samples_per_unit,
+ double samples_per_pixel,
Gdk::Color const & basic_color,
bool recording,
TimeAxisViewItem::Visibility);
@@ -76,7 +75,7 @@ class AudioRegionView : public RegionView
void create_waves ();
void set_height (double);
- void set_samples_per_unit (double);
+ void set_samples_per_pixel (double);
void set_amplitude_above_axis (gdouble spp);
@@ -117,8 +116,8 @@ class AudioRegionView : public RegionView
void drag_start ();
void drag_end ();
- void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
- void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t);
+ void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double);
+ void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, framecnt_t, ArdourCanvas::Points&, double);
void redraw_start_xfade ();
void redraw_end_xfade ();
@@ -158,17 +157,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::PolyLine *start_xfade_in;
+ ArdourCanvas::PolyLine *start_xfade_out;
+ 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::PolyLine *end_xfade_in;
+ ArdourCanvas::PolyLine *end_xfade_out;
+ ArdourCanvas::Rectangle* end_xfade_rect;
bool _end_xfade_visible;
boost::shared_ptr<AudioRegionGainLine> gain_line;
@@ -194,15 +193,14 @@ class AudioRegionView : public RegionView
void peaks_ready_handler (uint32_t);
void set_colors ();
+ void set_waveform_colors ();
+ void set_one_waveform_color (ArdourCanvas::WaveView*);
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;
@@ -214,6 +212,7 @@ private:
void setup_waveform_visibility ();
void setup_waveform_shape ();
void setup_waveform_scale ();
+ void setup_waveform_clipping ();
/** A ScopedConnection for each PeaksReady callback (one per channel). Each member
* may be 0 if no connection exists.
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 6d24dff2ca..088eec17e5 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"
@@ -98,19 +98,19 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
case Normal:
if (recording) {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
- _samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility(
- TimeAxisViewItem::ShowFrame |
- TimeAxisViewItem::HideFrameRight |
- TimeAxisViewItem::HideFrameLeft |
- TimeAxisViewItem::HideFrameTB));
+ _samples_per_pixel, region_color, recording, TimeAxisViewItem::Visibility(
+ TimeAxisViewItem::ShowFrame |
+ TimeAxisViewItem::HideFrameRight |
+ TimeAxisViewItem::HideFrameLeft |
+ TimeAxisViewItem::HideFrameTB));
} else {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
- _samples_per_unit, region_color);
+ _samples_per_pixel, region_color);
}
break;
case Destructive:
region_view = new TapeAudioRegionView (_canvas_group, _trackview, region,
- _samples_per_unit, region_color);
+ _samples_per_pixel, region_color);
break;
default:
fatal << string_compose (_("programming error: %1"), "illegal track mode in ::add_region_view_internal") << endmsg;
@@ -263,7 +263,7 @@ AudioStreamView::setup_rec_box ()
at = _trackview.audio_track(); /* we know what it is already */
framepos_t const frame_pos = at->current_capture_start ();
- gdouble xstart = _trackview.editor().frame_to_pixel (frame_pos);
+ gdouble xstart = _trackview.editor().sample_to_pixel (frame_pos);
gdouble xend;
uint32_t fill_color;
@@ -271,12 +271,12 @@ AudioStreamView::setup_rec_box ()
case Normal:
case NonLayered:
xend = xstart;
- fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+ fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
break;
case Destructive:
xend = xstart + 2;
- fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+ fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
/* make the recording rect translucent to allow
the user to see the peak data coming in, etc.
*/
@@ -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()->get_canvasvar_TimeAxisFrame());
+ 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;
- gdouble xend = _trackview.editor().frame_to_pixel (region->position() + region->length());
- rect->property_x2() = xend;
+ ArdourCanvas::Rectangle * rect = rec_rects[n].rectangle;
+ gdouble xend = _trackview.editor().sample_to_pixel (region->position() + region->length());
+ 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()->get_canvasvar_AudioTrackBase());
}
//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()->get_canvasvar_AudioMasterBusBase());
} else {
- canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
+ canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_AudioBusBase());
}
}
}
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 994f167014..8d48da7040 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..17e0792477 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::Curve (group);
line->set_data ("line", this);
+ line->set_outline_width (2.0);
- 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
@@ -247,7 +243,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
y = min (1.0, y);
y = _height - (y * _height);
- double const x = trackview.editor().frame_to_unit_unrounded (_time_converter->to((*cp.model())->when) - _offset);
+ double const x = trackview.editor().sample_to_pixel_unrounded (_time_converter->to((*cp.model())->when) - _offset);
trackview.editor().session()->begin_reversible_command (_("automation event move"));
trackview.editor().session()->add_command (
@@ -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);
}
}
@@ -743,10 +739,10 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp)
/* if xval has not changed, set it directly from the model to avoid rounding errors */
- if (view_x == trackview.editor().frame_to_unit_unrounded (_time_converter->to ((*cp.model())->when)) - _offset) {
+ if (view_x == trackview.editor().sample_to_pixel_unrounded (_time_converter->to ((*cp.model())->when)) - _offset) {
view_x = (*cp.model())->when - _offset;
} else {
- view_x = trackview.editor().unit_to_frame (view_x);
+ view_x = trackview.editor().pixel_to_sample (view_x);
view_x = _time_converter->from (view_x + _offset);
}
@@ -764,7 +760,7 @@ AutomationLine::control_points_adjacent (double xval, uint32_t & before, uint32_
ControlPoint *acp = 0;
double unit_xval;
- unit_xval = trackview.editor().frame_to_unit_unrounded (xval);
+ unit_xval = trackview.editor().sample_to_pixel_unrounded (xval);
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
@@ -884,7 +880,7 @@ AutomationLine::set_selected_points (PointSelection const & points)
void AutomationLine::set_colors ()
{
- set_line_color (ARDOUR_UI::config()->canvasvar_AutomationLine.get());
+ set_line_color (ARDOUR_UI::config()->get_canvasvar_AutomationLine());
for (vector<ControlPoint*>::iterator i = control_points.begin(); i != control_points.end(); ++i) {
(*i)->set_color ();
}
@@ -951,7 +947,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events)
* zoom and scroll into account).
*/
- tx = trackview.editor().frame_to_unit_unrounded (tx);
+ tx = trackview.editor().sample_to_pixel_unrounded (tx);
/* convert from canonical view height (0..1.0) to actual
* height coordinates (using X11's top-left rooted system)
@@ -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..816105b1e5 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/curve.h"
+
class AutomationLine;
class ControlPoint;
class PointSelection;
@@ -47,11 +48,6 @@ class AutomationTimeAxisView;
class Selectable;
class Selection;
-namespace Gnome {
- namespace Canvas {
- class SimpleRect;
- }
-}
/** A GUI representation of an ARDOUR::AutomationList */
class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
@@ -178,7 +174,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
ArdourCanvas::Group& _parent_group;
ArdourCanvas::Group* group;
- ArdourCanvas::Line* line; /* line */
+ ArdourCanvas::Curve* 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..0f62d3636c 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() / samples_per_pixel);
set_height (trackview.current_height());
@@ -114,13 +114,13 @@ 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);
y = std::min (y, _height - NAME_HIGHLIGHT_SIZE);
- add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position() + _region->start(), y);
+ add_automation_event (ev, trackview.editor().pixel_to_sample (x) - _region->position() + _region->start(), y);
}
return false;
diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h
index 3e2a9b6bbf..571a80709a 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_samples_per_pixel,
Gdk::Color const & basic_color);
~AutomationRegionView();
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc
index e477b7ce72..a1ba99a2b4 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;
@@ -48,14 +45,12 @@ using namespace PBD;
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()))
+ : StreamView (*dynamic_cast<RouteTimeAxisView*>(tv.get_parent()))
, _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 +103,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
+ _samples_per_pixel, region_color
);
region_view->init (region_color, false);
@@ -191,11 +186,11 @@ void
AutomationStreamView::color_handler ()
{
/*if (_trackview.is_midi_track()) {
- canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiTrackBase.get();
+ canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->get_canvasvar_MidiTrackBase();
}
if (!_trackview.is_midi_track()) {
- canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiBusBase.get();;
+ canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->get_canvasvar_MidiBusBase();;
}*/
}
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 1621697335..7b5771d74c 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()->get_canvasvar_AutomationTrackOutline());
/* 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()->get_canvasvar_AutomationTrackFill());
_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));
@@ -216,7 +209,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
)
);
- line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get());
+ line->set_line_color (ARDOUR_UI::config()->get_canvasvar_ProcessorAutomationLine());
line->queue_reset ();
add_line (line);
}
@@ -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_samples_per_pixel (double fpp)
{
- TimeAxisView::set_samples_per_unit (spu);
+ TimeAxisView::set_samples_per_pixel (fpp);
if (_line) {
_line->reset ();
}
if (_view) {
- _view->set_samples_per_unit (spu);
+ _view->set_samples_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..d388419e17 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_samples_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-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.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.h b/gtk2_ardour/canvas.h
deleted file mode 100644
index 1139da55cc..0000000000
--- a/gtk2_ardour/canvas.h
+++ /dev/null
@@ -1,43 +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 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/canvas_patch_change.cc b/gtk2_ardour/canvas_patch_change.cc
index 7ab0eefd8c..04626692fb 100644
--- a/gtk2_ardour/canvas_patch_change.cc
+++ b/gtk2_ardour/canvas_patch_change.cc
@@ -55,11 +55,11 @@ CanvasPatchChange::CanvasPatchChange(
parent,
height,
(active_channel
- ? ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get()
- : ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelOutline.get()),
+ ? ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeOutline()
+ : ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeInactiveChannelOutline()),
(active_channel
- ? ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get()
- : ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelFill.get()),
+ ? ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeFill()
+ : ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeInactiveChannelFill()),
x,
y)
, _info (info)
diff --git a/gtk2_ardour/control_point.cc b/gtk2_ardour/control_point.cc
index d869e094aa..8491534ec8 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,13 @@ 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()->get_canvasvar_ControlPointFill());
+ _item->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ControlPointOutline());
_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 +70,9 @@ 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()->get_canvasvar_ControlPointOutline());
/* NOTE: no event handling in copied ControlPoints */
@@ -122,14 +120,6 @@ ControlPoint::visible () const
void
ControlPoint::reset (double x, double y, AutomationList::iterator mi, uint32_t vi, ShapeType shape)
{
- /* If this is too big, libart will confuse itself and segfault after it casts the bounding box
- of this automation line to ints. Sigh.
- */
-
- if (x > INT32_MAX) {
- x = INT32_MAX;
- }
-
_model = mi;
_view_index = vi;
move_to (x, y, shape);
@@ -141,13 +131,13 @@ ControlPoint::set_color ()
uint32_t color = 0;
if (_selected) {
- color = ARDOUR_UI::config()->canvasvar_ControlPointSelected.get();
+ color = ARDOUR_UI::config()->get_canvasvar_ControlPointSelected();
} else {
- color = ARDOUR_UI::config()->canvasvar_ControlPointOutline.get();
+ color = ARDOUR_UI::config()->get_canvasvar_ControlPointOutline();
}
- _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()->get_canvasvar_ControlPointFill());
}
void
@@ -179,10 +169,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 +179,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 aaea3a2242..c545a02b46 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;
@@ -127,38 +128,33 @@ 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()->get_canvasvar_CrossfadeEditorBase());
+ 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_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
- 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()->get_canvasvar_CrossfadeEditorLineShading());
- 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_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
- 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()->get_canvasvar_CrossfadeEditorLineShading());
- 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"));
@@ -465,15 +461,14 @@ 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()->get_canvasvar_CrossfadeEditorPointFill());
+ p->box->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorPointOutline());
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;
}
@@ -520,11 +515,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;
@@ -534,15 +525,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;
@@ -622,9 +618,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_samples_per_pixel (spu);
}
ht = canvas->get_allocation().get_height() / xfade->out()->n_channels();
@@ -634,9 +630,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_samples_per_pixel (spu);
}
}
@@ -681,11 +677,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.
@@ -695,36 +691,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;
}
@@ -734,15 +730,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());
@@ -1069,17 +1065,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()->get_canvasvar_SelectedCrossfadeEditorWave());
+ (*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave());
}
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()->get_canvasvar_CrossfadeEditorWave());
+ (*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave());
}
- 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()->get_canvasvar_SelectedCrossfadeEditorLine());
+ fade[Out].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
fade[Out].shading->hide();
fade[In].shading->show();
@@ -1094,17 +1090,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()->get_canvasvar_CrossfadeEditorWave());
+ (*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave());
}
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()->get_canvasvar_SelectedCrossfadeEditorWave());
+ (*i)->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave());
}
- 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()->get_canvasvar_SelectedCrossfadeEditorLine());
+ fade[In].line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorLine());
fade[In].shading->hide();
fade[Out].shading->show();
@@ -1146,9 +1142,9 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
double spu;
if (which == In) {
- color = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
+ color = ARDOUR_UI::config()->get_canvasvar_SelectedCrossfadeEditorWave();
} else {
- color = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
+ color = ARDOUR_UI::config()->get_canvasvar_CrossfadeEditorWave();
}
ht = canvas->get_allocation().get_height() / (double) nchans;
@@ -1162,29 +1158,22 @@ 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_samples_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() + 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..960bcc2d26 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_samples_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 5aacc59f3c..3d72e080ed 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)
@@ -119,7 +119,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<ArdourCanvas::CanvasNote
double test_time = (*_events.begin())->note()->time ();
double test_length = (*_events.begin())->note()->length ();
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if ((*i)->note()->channel() != test_channel) {
_channel_all.set_sensitive (true);
}
@@ -167,7 +167,7 @@ EditNoteDialog::done (int r)
bool had_change = false;
if (!_channel_all.get_sensitive() || _channel_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_channel.get_value_as_int() - 1 != (*i)->note()->channel()) {
_region_view->change_note_channel (*i, _channel.get_value_as_int () - 1);
had_change = true;
@@ -176,7 +176,7 @@ EditNoteDialog::done (int r)
}
if (!_pitch_all.get_sensitive() || _pitch_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_pitch.get_value_as_int() != (*i)->note()->note()) {
_region_view->change_note_note (*i, _pitch.get_value_as_int ());
had_change = true;
@@ -185,7 +185,7 @@ EditNoteDialog::done (int r)
}
if (!_velocity_all.get_sensitive() || _velocity_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (_velocity.get_value_as_int() != (*i)->note()->velocity()) {
_region_view->change_note_velocity (*i, _velocity.get_value_as_int ());
had_change = true;
@@ -196,7 +196,7 @@ EditNoteDialog::done (int r)
double const t = _region_view->source_relative_time_converter().from (_time_clock.current_time ());
if (!_time_all.get_sensitive() || _time_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (t != (*i)->note()->time()) {
_region_view->change_note_time (*i, t);
had_change = true;
@@ -207,7 +207,7 @@ EditNoteDialog::done (int r)
double const d = _region_view->region_relative_time_converter().from (_length_clock.current_duration ());
if (!_length_all.get_sensitive() || _length_all.get_active ()) {
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
if (d != (*i)->note()->length()) {
_region_view->change_note_length (*i, d);
had_change = true;
@@ -221,7 +221,7 @@ EditNoteDialog::done (int r)
_region_view->apply_diff ();
- for (set<ArdourCanvas::CanvasNoteEvent*>::iterator i = _events.begin(); i != _events.end(); ++i) {
+ for (set<NoteBase*>::iterator i = _events.begin(); i != _events.end(); ++i) {
(*i)->set_selected ((*i)->selected()); // change color
}
}
diff --git a/gtk2_ardour/edit_note_dialog.h b/gtk2_ardour/edit_note_dialog.h
index 1bd8c92144..59e53722a0 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*>);
+public:
+ EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n);
void done (int);
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 fc4b6f4d6c..c7bdfc15da 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"
@@ -250,6 +250,10 @@ Editor::Editor ()
*/
, vertical_adjustment (0.0, 0.0, 10.0, 400.0)
+ , horizontal_adjustment (0.0, 0.0, 1e16)
+ , unused_adjustment (0.0, 0.0, 10.0, 400.0)
+
+ , controls_layout (unused_adjustment, vertical_adjustment)
/* tool bar related */
@@ -306,8 +310,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;
@@ -359,18 +363,18 @@ Editor::Editor ()
sfbrowser = 0;
- location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
- location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
- location_cd_marker_color = ARDOUR_UI::config()->canvasvar_LocationCDMarker.get();
- location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
- location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
+ location_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationMarker();
+ location_range_color = ARDOUR_UI::config()->get_canvasvar_LocationRange();
+ location_cd_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationCDMarker();
+ location_loop_color = ARDOUR_UI::config()->get_canvasvar_LocationLoop();
+ location_punch_color = ARDOUR_UI::config()->get_canvasvar_LocationPunch();
zoom_focus = ZoomFocusLeft;
_edit_point = EditAtMouse;
_internal_editing = false;
current_canvas_cursor = 0;
- frames_per_unit = 2048; /* too early to use reset_zoom () */
+ samples_per_pixel = 2048; /* too early to use reset_zoom () */
_scroll_callbacks = 0;
@@ -466,7 +470,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);
@@ -483,13 +487,14 @@ 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::GtkCanvas* time_pad = manage (new ArdourCanvas::GtkCanvas ());
- pad_line_1->property_color_rgba() = 0xFF0000FF;
+ ArdourCanvas::Line* pad_line_1 = 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->set_outline_color (0xFF0000FF);
pad_line_1->show();
+ // CAIROCANVAS
time_pad->show();
time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2);
@@ -499,15 +504,9 @@ 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));
-
- /* these enable us to have a dedicated window (for cursor setting, etc.)
- for the canvas areas.
- */
-
- track_canvas_event_box.add (*track_canvas);
+ 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));
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);
@@ -520,14 +519,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_viewport, 2, 3, 2, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
bottom_hbox.set_border_width (2);
bottom_hbox.set_spacing (3);
@@ -761,7 +762,8 @@ Editor::~Editor()
delete button_bindings;
delete _routes;
delete _route_groups;
- delete track_canvas;
+ delete _time_bars_canvas_viewport;
+ delete _track_canvas_viewport;
delete _drags;
}
@@ -910,11 +912,11 @@ Editor::zoom_adjustment_changed ()
return;
}
- double fpu = zoom_range_clock->current_duration() / _canvas_width;
- bool clamped = clamp_frames_per_unit (fpu);
+ framecnt_t fpu = llrintf (zoom_range_clock->current_duration() / _visible_canvas_width);
+ bool clamped = clamp_samples_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);
@@ -1015,7 +1017,7 @@ Editor::control_scroll (float fraction)
return;
}
- double step = fraction * current_page_frames();
+ double step = fraction * current_page_samples();
/*
_control_scroll_target is an optional<T>
@@ -1036,7 +1038,7 @@ Editor::control_scroll (float fraction)
if ((fraction < 0.0f) && (*_control_scroll_target < (framepos_t) fabs(step))) {
*_control_scroll_target = 0;
} else if ((fraction > 0.0f) && (max_framepos - *_control_scroll_target < step)) {
- *_control_scroll_target = max_framepos - (current_page_frames()*2); // allow room for slop in where the PH is on the screen
+ *_control_scroll_target = max_framepos - (current_page_samples()*2); // allow room for slop in where the PH is on the screen
} else {
*_control_scroll_target += (framepos_t) floor (step);
}
@@ -1046,9 +1048,9 @@ Editor::control_scroll (float fraction)
playhead_cursor->set_position (*_control_scroll_target);
UpdateAllTransportClocks (*_control_scroll_target);
- if (*_control_scroll_target > (current_page_frames() / 2)) {
+ if (*_control_scroll_target > (current_page_samples() / 2)) {
/* try to center PH in window */
- reset_x_origin (*_control_scroll_target - (current_page_frames()/2));
+ reset_x_origin (*_control_scroll_target - (current_page_samples()/2));
} else {
reset_x_origin (0);
}
@@ -1121,7 +1123,7 @@ Editor::map_position_change (framepos_t frame)
void
Editor::center_screen (framepos_t frame)
{
- double page = _canvas_width * frames_per_unit;
+ framecnt_t const page = _visible_canvas_width * samples_per_pixel;
/* if we're off the page, then scroll.
*/
@@ -1251,7 +1253,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 ();
@@ -1277,7 +1279,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);
@@ -1288,7 +1290,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_samples_per_pixel (samples_per_pixel);
}
super_rapid_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (
@@ -2104,9 +2106,9 @@ Editor::set_snap_to (SnapType st)
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(),
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames(),
+ compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
break;
@@ -2262,9 +2264,11 @@ Editor::set_state (const XMLNode& node, int /*version*/)
}
if ((prop = node.property ("zoom"))) {
- reset_zoom (PBD::atof (prop->value()));
+ /* older versions of ardour used floating point samples_per_pixel */
+ double f = PBD::atof (prop->value());
+ reset_zoom (llrintf (f));
} else {
- reset_zoom (frames_per_unit);
+ reset_zoom (samples_per_pixel);
}
if ((prop = node.property ("snap-to"))) {
@@ -2484,7 +2488,8 @@ 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), "%" PRId64, samples_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));
@@ -2494,7 +2499,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);
@@ -2816,12 +2821,12 @@ Editor::snap_to_internal (framepos_t& start, int32_t direction, bool for_mark)
case SnapMagnetic:
if (presnap > start) {
- if (presnap > (start + unit_to_frame(snap_threshold))) {
+ if (presnap > (start + pixel_to_sample(snap_threshold))) {
start = presnap;
}
} else if (presnap < start) {
- if (presnap < (start - unit_to_frame(snap_threshold))) {
+ if (presnap < (start - pixel_to_sample(snap_threshold))) {
start = presnap;
}
}
@@ -3702,8 +3707,14 @@ Editor::set_show_measures (bool yn)
if (tempo_lines) {
tempo_lines->show();
}
- (void) redraw_measures ();
- }
+
+ ARDOUR::TempoMap::BBTPointList::const_iterator begin;
+ ARDOUR::TempoMap::BBTPointList::const_iterator end;
+
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end);
+ draw_measures (begin, end);
+ }
+
instant_save ();
}
}
@@ -4108,16 +4119,16 @@ Editor::reset_y_origin (double y)
}
void
-Editor::reset_zoom (double fpu)
+Editor::reset_zoom (framecnt_t spp)
{
- clamp_frames_per_unit (fpu);
+ clamp_samples_per_pixel (spp);
- if (fpu == frames_per_unit) {
+ if (spp == samples_per_pixel) {
return;
}
pending_visual_change.add (VisualChange::ZoomLevel);
- pending_visual_change.frames_per_unit = fpu;
+ pending_visual_change.samples_per_pixel = spp;
ensure_visual_change_idle_handler ();
}
@@ -4147,7 +4158,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->samples_per_pixel = samples_per_pixel;
vs->leftmost_frame = leftmost_frame;
vs->zoom_focus = zoom_focus;
@@ -4209,7 +4220,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.samples_per_pixel);
if (vs.gui_state) {
*ARDOUR_UI::instance()->gui_object_state = *vs.gui_state;
@@ -4228,19 +4239,20 @@ 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_samples_per_pixel (framecnt_t spp)
{
+ clamp_samples_per_pixel (spp);
+ samples_per_pixel = spp;
+
if (tempo_lines) {
tempo_lines->tempo_map_changed();
}
- frames_per_unit = fpu;
-
/* convert fpu to frame count */
- framepos_t frames = (framepos_t) floor (frames_per_unit * _canvas_width);
+ framepos_t frames = samples_per_pixel * _visible_canvas_width;
- if (frames_per_unit != zoom_range_clock->current_duration()) {
+ if (samples_per_pixel != zoom_range_clock->current_duration()) {
zoom_range_clock->set (frames);
}
@@ -4257,7 +4269,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();
@@ -4286,6 +4298,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.being_handled = false;
}
}
@@ -4316,27 +4329,26 @@ 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_samples_per_pixel (pending_visual_change.samples_per_pixel);
compute_fixed_ruler_scale ();
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
- compute_current_bbt_points (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames(),
+ compute_current_bbt_points (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
- compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames(),
+ compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_samples(),
current_bbt_points_begin, current_bbt_points_end);
update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end);
- }
- if (p & VisualChange::ZoomLevel) {
update_video_timeline();
}
if (p & VisualChange::TimeOrigin) {
- set_horizontal_position (pending_visual_change.time_origin / frames_per_unit);
+ set_horizontal_position (pending_visual_change.time_origin / samples_per_pixel);
}
if (p & VisualChange::YOrigin) {
@@ -4380,7 +4392,7 @@ Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_men
EditPoint ep = _edit_point;
if (from_context_menu && (ep == EditAtMouse)) {
- return event_frame (&context_click_event, 0, 0);
+ return window_event_frame (&context_click_event, 0, 0);
}
if (entered_marker) {
@@ -4760,7 +4772,6 @@ Editor::idle_resize ()
}
_pending_resize_amount = 0;
- flush_canvas ();
_group_tabs->set_dirty ();
resize_idle_id = -1;
@@ -4844,10 +4855,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();
@@ -5150,16 +5161,16 @@ 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()) {
+ if (frame < leftmost_frame || frame > leftmost_frame + current_page_samples()) {
if (_session->transport_speed() < 0) {
- if (frame > (current_page_frames() / 2)) {
- center_screen (frame-(current_page_frames()/2));
+ if (frame > (current_page_samples() / 2)) {
+ center_screen (frame-(current_page_samples()/2));
} else {
- center_screen (current_page_frames()/2);
+ center_screen (current_page_samples()/2);
}
} else {
@@ -5170,10 +5181,10 @@ Editor::reset_x_origin_to_follow_playhead ()
/* moving left */
if (_session->transport_rolling()) {
/* rolling; end up with the playhead at the right of the page */
- l = frame - current_page_frames ();
+ l = frame - current_page_samples ();
} else {
/* not rolling: end up with the playhead 1/4 of the way along the page */
- l = frame - current_page_frames() / 4;
+ l = frame - current_page_samples() / 4;
}
} else {
/* moving right */
@@ -5182,7 +5193,7 @@ Editor::reset_x_origin_to_follow_playhead ()
l = frame;
} else {
/* not rolling: end up with the playhead 3/4 of the way along the page */
- l = frame - 3 * current_page_frames() / 4;
+ l = frame - 3 * current_page_samples() / 4;
}
}
@@ -5190,7 +5201,7 @@ Editor::reset_x_origin_to_follow_playhead ()
l = 0;
}
- center_screen_internal (l + (current_page_frames() / 2), current_page_frames ());
+ center_screen_internal (l + (current_page_samples() / 2), current_page_samples ());
}
}
}
@@ -5261,11 +5272,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_samples()/2.0) / samples_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_samples() / samples_per_pixel) {
target = (target * 0.15) + (current * 0.85);
} else {
/* relax */
@@ -5300,7 +5311,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 */
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 033888c4b6..566586ebe4 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -25,16 +25,10 @@
#include <set>
#include <string>
#include <sys/time.h>
+#include <cmath>
#include <boost/optional.hpp>
-#include <libgnomecanvasmm/canvas.h>
-#include <libgnomecanvasmm/group.h>
-#include <libgnomecanvasmm/line.h>
-#include <libgnomecanvasmm/pixbuf.h>
-
-#include <cmath>
-
#include <gtkmm/comboboxtext.h>
#include <gtkmm/layout.h>
@@ -52,6 +46,8 @@
#include "ardour/location.h"
#include "ardour/types.h"
+#include "canvas/fwd.h"
+
#include "gtk-custom-ruler.h"
#include "ardour_button.h"
#include "ardour_dialog.h"
@@ -60,14 +56,6 @@
#include "enums.h"
#include "editor_items.h"
#include "region_selection.h"
-#include "canvas.h"
-
-namespace Gnome {
- namespace Canvas {
- class NoEventText;
- class CanvasNoteEvent;
- }
-}
namespace Gtkmm2ext {
class TearOff;
@@ -122,6 +110,7 @@ class Marker;
class MidiRegionView;
class MixerStrip;
class MouseCursors;
+class NoteBase;
class PlaylistSelector;
class PluginSelector;
class ProgressReporter;
@@ -148,14 +137,14 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void first_idle ();
virtual bool have_idled () const { return _have_idled; }
- framepos_t leftmost_position() const { return leftmost_frame; }
+ framepos_t leftmost_sample() const { return leftmost_frame; }
- framecnt_t current_page_frames() const {
- return (framecnt_t) floor (_canvas_width * frames_per_unit);
+ framecnt_t current_page_samples() const {
+ return (framecnt_t) _visible_canvas_width * samples_per_pixel;
}
- double canvas_height () const {
- return _canvas_height;
+ double visible_canvas_height () const {
+ return _visible_canvas_height;
}
void cycle_snap_mode ();
@@ -213,32 +202,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void separate_regions_using_location (ARDOUR::Location&);
void transition_to_rolling (bool forward);
- /* undo related */
-
- framepos_t unit_to_frame (double unit) const {
- return (framepos_t) rint (unit * frames_per_unit);
- }
-
- double frame_to_unit (framepos_t frame) const {
- return rint ((double) frame / (double) frames_per_unit);
- }
-
- double frame_to_unit_unrounded (framepos_t frame) const {
- return frame / frames_per_unit;
- }
-
- double frame_to_unit (double frame) const {
- return rint (frame / frames_per_unit);
- }
-
/* NOTE: these functions assume that the "pixel" coordinate is
- the result of using the world->canvas affine transform on a
- world coordinate. These coordinates already take into
- account any scrolling carried out by adjusting the
- xscroll_adjustment.
+ in canvas coordinates. These coordinates already take into
+ account any scrolling offsets.
*/
- framepos_t pixel_to_frame (double pixel) const {
+ framepos_t pixel_to_sample (double pixel) const {
/* pixel can be less than zero when motion events
are processed. since we've already run the world->canvas
@@ -247,17 +216,19 @@ 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 pixel * samples_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)));
+ double sample_to_pixel (framepos_t sample) const {
+ return sample / samples_per_pixel;
}
- void flush_canvas ();
+ double sample_to_pixel_unrounded (framepos_t sample) const {
+ return sample / (double) samples_per_pixel;
+ }
/* selection */
@@ -303,7 +274,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; }
+ framecnt_t get_current_zoom () const { return samples_per_pixel; }
void cycle_zoom_focus ();
void temporal_zoom_step (bool coarser);
void tav_zoom_step (bool coarser);
@@ -389,7 +360,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void reset_x_origin (framepos_t);
void reset_x_origin_to_follow_playhead ();
void reset_y_origin (double);
- void reset_zoom (double);
+ void reset_zoom (framecnt_t);
void reposition_and_zoom (framepos_t, double);
framepos_t get_preferred_edit_position (bool ignore_playhead = false, bool use_context_click = false);
@@ -452,6 +423,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
return _verbose_cursor;
}
+ double clamp_verbose_cursor_x (double);
+ double clamp_verbose_cursor_y (double);
+
void get_pointer_position (double &, double &) const;
TimeAxisView* stepping_axis_view () {
@@ -462,6 +436,13 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
_stepping_axis_view = v;
}
+ ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; }
+ ArdourCanvas::Group* get_time_bars_group () const;
+ ArdourCanvas::Group* get_track_canvas_group () const;
+ ArdourCanvas::GtkCanvasViewport* get_time_bars_canvas () const;
+ ArdourCanvas::GtkCanvasViewport* get_track_canvas () const;
+
+
protected:
void map_transport_state ();
void map_position_change (framepos_t);
@@ -485,7 +466,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
VisualState (bool with_tracks);
~VisualState ();
double y_position;
- double frames_per_unit;
+ framecnt_t samples_per_pixel;
framepos_t leftmost_frame;
Editing::ZoomFocus zoom_focus;
GUIObjectState* gui_state;
@@ -504,12 +485,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void start_visual_state_op (uint32_t n);
void cancel_visual_state_op (uint32_t n);
- framepos_t leftmost_frame;
- double frames_per_unit;
+ framepos_t leftmost_frame;
+ framecnt_t samples_per_pixel;
Editing::ZoomFocus zoom_focus;
- void set_frames_per_unit (double);
- bool clamp_frames_per_unit (double &) const;
+ void set_samples_per_pixel (framecnt_t);
+ bool clamp_samples_per_pixel (framecnt_t &) const;
Editing::MouseMode mouse_mode;
Editing::MouseMode pre_internal_mouse_mode;
@@ -700,7 +681,12 @@ 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;
+
+ ArdourCanvas::GtkCanvas* _time_bars_canvas;
+ ArdourCanvas::GtkCanvasViewport* _time_bars_canvas_viewport;
+
bool within_track_canvas;
friend class VerboseCursor;
@@ -711,8 +697,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
bool track_canvas_motion (GdkEvent*);
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;
@@ -727,9 +712,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;
@@ -737,16 +722,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
ArdourCanvas::Group* transport_marker_bar_group;
ArdourCanvas::Group* cd_marker_bar_group;
- /** The group containing all items that require horizontal scrolling. */
- ArdourCanvas::Group* _background_group;
- /*
- The _master_group is the group containing all items
- that require horizontal scrolling..
- It is primarily used to separate canvas items
- that require horizontal scrolling from those that do not.
- */
- ArdourCanvas::Group* _master_group;
-
/* The group containing all trackviews. Only scrolled vertically. */
ArdourCanvas::Group* _trackview_group;
@@ -879,16 +854,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;
@@ -902,9 +875,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Label cd_mark_label;
/* videtimline related actions */
- ArdourCanvas::SimpleRect* videotl_bar;
Gtk::Label videotl_label;
- ArdourCanvas::Group* videotl_bar_group;
ArdourCanvas::Group* videotl_group;
Glib::RefPtr<Gtk::ToggleAction> ruler_video_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_proc_action;
@@ -927,13 +898,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void export_video ();
void toggle_region_video_lock ();
- 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);
@@ -971,8 +940,11 @@ 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::Adjustment horizontal_adjustment;
+ Gtk::Adjustment unused_adjustment; // yes, really; Gtk::Layout constructor requires refs
Gtk::Layout controls_layout;
bool control_layout_scroll (GdkEventScroll* ev);
void reset_controls_layout_width ();
@@ -990,9 +962,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*);
@@ -1020,15 +992,9 @@ 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;}
-
- 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 {
@@ -1037,16 +1003,16 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
YOrigin = 0x4
};
- Type pending;
+ Type pending;
framepos_t time_origin;
- double frames_per_unit;
- double y_origin;
+ framecnt_t samples_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), samples_per_pixel (0), idle_handler_id (-1), being_handled (false) {}
void add (Type t) {
pending = Type (pending | t);
}
@@ -1224,7 +1190,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void temporal_zoom_region (bool both_axes);
void zoom_to_region (bool both_axes);
void temporal_zoom_session ();
- void temporal_zoom (double scale);
+ void temporal_zoom (framecnt_t samples_per_pixel);
void temporal_zoom_by_frame (framepos_t start, framepos_t end);
void temporal_zoom_to_frame (bool coarser, framepos_t frame);
@@ -1431,8 +1397,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*);
@@ -1471,9 +1437,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 *);
@@ -1501,7 +1467,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void hide_measures ();
void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
ARDOUR::TempoMap::BBTPointList::const_iterator& end);
- bool redraw_measures ();
void new_tempo_section ();
@@ -1702,22 +1667,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();
@@ -1728,11 +1693,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;
@@ -1866,7 +1831,15 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void duplicate_range (bool with_dialog);
- framepos_t event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
+ /** computes the timeline frame (sample) of an event whose coordinates
+ * are in canvas units (pixels, scroll offset included).
+ */
+ framepos_t canvas_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
+
+ /** computes the timeline frame (sample) of an event whose coordinates
+ * are in window units (pixels, no scroll offset).
+ */
+ framepos_t window_event_frame (GdkEvent const *, double* px = 0, double* py = 0) const;
/* returns false if mouse pointer is not in track or marker canvas
*/
@@ -2032,8 +2005,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void region_view_added (RegionView *);
void region_view_removed ();
- void update_canvas_now ();
-
EditorGroupTabs* _group_tabs;
void fit_route_group (ARDOUR::RouteGroup *);
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index a5e2e8a369..8b4ec4034a 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"
@@ -1679,7 +1682,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..a60a25cefd 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 1a6dc863e1..e0ceb7a8e2 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,17 +29,15 @@
#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 "canvas/debug.h"
+
#include "ardour_ui.h"
#include "editor.h"
#include "global_signals.h"
-#include "waveview.h"
-#include "simplerect.h"
-#include "simpleline.h"
-#include "waveview_p.h"
-#include "simplerect_p.h"
-#include "simpleline_p.h"
-#include "canvas_impl.h"
-#include "canvas-noevent-text.h"
#include "editing.h"
#include "rgb_macros.h"
#include "utils.h"
@@ -70,61 +66,22 @@ 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);
-
- // Register the gtkmm gtypes:
-
- (void) Gnome::Canvas::WaveView::get_type();
- (void) Gnome::Canvas::SimpleLine::get_type();
- (void) Gnome::Canvas::SimpleRect::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);
-
- 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_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, vertical_adjustment);
+ _track_canvas = _track_canvas_viewport->canvas ();
+ _time_bars_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, unused_adjustment);
+ _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;
@@ -133,125 +90,105 @@ 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->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->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);
-
- 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;
-
- 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;
-
- 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;
-
- 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;
-
- 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;
-
- 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;
-
- 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->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->property_outline_pixels() = 0;
- }
- videotl_bar->property_outline_what() = (0x1 | 0x8);
- ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_bar_group, (timebar_height * videotl_bar_height));
-
- timebar_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0);
- cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0);
-
- meter_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 5.0);
- tempo_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 4.0);
- range_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 3.0);
- transport_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height * 2.0);
- marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, timebar_height);
- cd_marker_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0);
- videotl_group = new ArdourCanvas::Group (*timebar_group, 0.0, 0.0);
-
- 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;
+ _trackview_group = new ArdourCanvas::Group (_track_canvas->root());
+ CANVAS_DEBUG_NAME (_trackview_group, "Canvas TrackViews");
+ _region_motion_group = new ArdourCanvas::Group (_trackview_group);
+ CANVAS_DEBUG_NAME (_region_motion_group, "Canvas Region Motion");
+
+ 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));
+ CANVAS_DEBUG_NAME (meter_bar, "meter Bar");
+ 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));
+ CANVAS_DEBUG_NAME (tempo_bar, "Tempo Bar");
+ tempo_bar->set_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));
+ CANVAS_DEBUG_NAME (range_marker_bar, "Range Marker Bar");
+ range_marker_bar->set_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));
+ CANVAS_DEBUG_NAME (transport_marker_bar, "transport Marker Bar");
+ transport_marker_bar->set_outline_what (0x8);
+
+ marker_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
+ marker_bar = new ArdourCanvas::Rectangle (marker_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
+ CANVAS_DEBUG_NAME (marker_bar, "Marker Bar");
+ marker_bar->set_outline_what (0x8);
+
+ cd_marker_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
+ cd_marker_bar = new ArdourCanvas::Rectangle (cd_marker_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height - 1));
+ CANVAS_DEBUG_NAME (cd_marker_bar, "CD Marker Bar");
+ cd_marker_bar->set_outline_what (0x8);
+
+ _time_markers_group = new ArdourCanvas::Group (_time_bars_canvas->root());
+
+ meter_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 5.0));
+ tempo_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 4.0));
+ range_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 3.0));
+ transport_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height * 2.0));
+ marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height));
+ cd_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0));
+ videotl_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple(0.0, 0.0));
+
+ ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_group, (timebar_height * videotl_bar_height));
+
+ 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, ArdourCanvas::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, ArdourCanvas::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 (_track_canvas->root());
+ transport_punchin_line->set_x0 (0);
+ transport_punchin_line->set_y0 (0);
+ transport_punchin_line->set_x1 (0);
+ transport_punchin_line->set_y1 (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 (_track_canvas->root());
+ transport_punchout_line->set_x0 (0);
+ transport_punchout_line->set_y0 (0);
+ transport_punchout_line->set_x1 (0);
+ transport_punchout_line->set_y1 (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 (_track_canvas->root(), ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
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->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));
- videotl_bar_group->signal_event().connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_bar));
- 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));
+ 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));
+ videotl_group->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_videotl_bar_event), videotl_group));
+ 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);
@@ -260,19 +197,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 */
@@ -285,10 +222,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();
@@ -296,45 +233,35 @@ 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();
-
- _canvas_width = canvas_allocation.get_width();
- _canvas_height = canvas_allocation.get_height();
+ bool height_changed = _visible_canvas_height != _canvas_viewport_allocation.get_height();
- if (_session) {
- TrackViewList::iterator i;
+ _visible_canvas_width = _canvas_viewport_allocation.get_width ();
+ _visible_canvas_height = _canvas_viewport_allocation.get_height ();
- for (i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->clip_to_viewport ();
- }
- }
+ // SHOWTRACKS
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);
}
}
@@ -473,8 +400,6 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
vector<string> paths;
GdkEvent ev;
framepos_t frame;
- double wx;
- double wy;
double cy;
if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
@@ -482,13 +407,11 @@ 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);
-
ev.type = GDK_BUTTON_RELEASE;
- ev.button.x = wx;
- ev.button.y = wy;
+ ev.button.x = x;
+ ev.button.y = y;
- frame = event_frame (&ev, 0, &cy);
+ frame = window_event_frame (&ev, 0, &cy);
snap_to (frame);
@@ -515,13 +438,16 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
int
Editor::autoscroll_fudge_threshold () const
{
- return current_page_frames() / 6;
+ return current_page_samples() / 6;
}
/** @param allow_horiz true to allow horizontal autoscroll, otherwise false.
+ *
* @param allow_vert true to allow vertical autoscroll, otherwise false.
+ *
* @param moving_left true if we are moving left, so we only want to autoscroll on the left of the canvas,
* otherwise false, so we only want to autoscroll on the right of the canvas.
+ *
* @param moving_up true if we are moving up, so we only want to autoscroll at the top of the canvas,
* otherwise false, so we only want to autoscroll at the bottom of the canvas.
*/
@@ -548,27 +474,30 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool moving_left, b
Gtk::Allocation editor_list = _the_notebook.get_allocation ();
- framecnt_t distance = pixel_to_frame (root_rect.get_x() + root_rect.get_width() - window_rect.get_x() - window_rect.get_width());
+ framecnt_t distance = pixel_to_sample (root_rect.get_x() + root_rect.get_width() - window_rect.get_x() - window_rect.get_width());
if (_the_notebook.is_visible ()) {
- distance += pixel_to_frame (editor_list.get_width());
+ distance += pixel_to_sample (editor_list.get_width());
}
/* Note whether we're fudging the autoscroll (see autoscroll_fudge_threshold) */
_autoscroll_fudging = (distance < autoscroll_fudge_threshold ());
- double const ty = _drags->current_pointer_y() - get_trackview_group_vertical_offset ();
+ /* ty is in canvas-coordinate space */
+
+ double const ty = _drags->current_pointer_y();
+ ArdourCanvas::Rect visible = _track_canvas->visible_area();
autoscroll_y = 0;
autoscroll_x = 0;
- if (ty < canvas_timebars_vsize && moving_up && allow_vert) {
+ if (ty < visible.y0 && moving_up && allow_vert) {
autoscroll_y = -1;
startit = true;
- } else if (ty > _canvas_height && !moving_up && allow_vert) {
+ } else if (ty > visible.y1 && !moving_up && allow_vert) {
autoscroll_y = 1;
startit = true;
}
- framepos_t rightmost_frame = leftmost_frame + current_page_frames();
+ framepos_t rightmost_frame = leftmost_frame + current_page_samples();
if (_autoscroll_fudging) {
rightmost_frame -= autoscroll_fudge_threshold ();
}
@@ -607,15 +536,13 @@ bool
Editor::autoscroll_canvas ()
{
framepos_t new_frame;
- framepos_t limit = max_framepos - current_page_frames();
- GdkEventMotion ev;
+ framepos_t limit = max_framepos - current_page_samples();
double new_pixel;
- double target_pixel;
-
+
if (autoscroll_x_distance != 0) {
if (autoscroll_x > 0) {
- autoscroll_x_distance = (_drags->current_pointer_frame() - (leftmost_frame + current_page_frames())) / 3;
+ autoscroll_x_distance = (_drags->current_pointer_frame() - (leftmost_frame + current_page_samples())) / 3;
if (_autoscroll_fudging) {
autoscroll_x_distance += autoscroll_fudge_threshold () / 3;
}
@@ -627,7 +554,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() - _visible_canvas_height) / 3;
} else if (autoscroll_y < 0) {
autoscroll_y_distance = (vertical_adjustment.get_value () - _drags->current_pointer_y()) / 3;
@@ -660,31 +587,11 @@ Editor::autoscroll_canvas ()
new_pixel = vertical_pos - autoscroll_y_distance;
}
- target_pixel = _drags->current_pointer_y() - autoscroll_y_distance;
- target_pixel = max (target_pixel, 0.0);
-
} else if (autoscroll_y > 0) {
- double top_of_bottom_of_canvas = full_canvas_height - _canvas_height;
-
- if (vertical_pos > full_canvas_height - autoscroll_y_distance) {
- new_pixel = full_canvas_height;
- } else {
- new_pixel = vertical_pos + autoscroll_y_distance;
- }
-
- new_pixel = min (top_of_bottom_of_canvas, new_pixel);
-
- target_pixel = _drags->current_pointer_y() + autoscroll_y_distance;
-
- /* don't move to the full canvas height because the item will be invisible
- (its top edge will line up with the bottom of the visible canvas.
- */
-
- target_pixel = min (target_pixel, full_canvas_height - 10);
+ new_pixel = min (_full_canvas_height - _visible_canvas_height, min (_full_canvas_height, (vertical_adjustment.get_value() + autoscroll_y_distance)));
} else {
- target_pixel = _drags->current_pointer_y();
new_pixel = vertical_pos;
}
@@ -697,18 +604,24 @@ Editor::autoscroll_canvas ()
reset_x_origin (new_frame);
}
- vertical_adjustment.set_value (new_pixel);
+ if (new_pixel != vertical_pos) {
+ vertical_adjustment.set_value (new_pixel);
+ }
/* 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;
+ GdkEventMotion ev;
canvas_window->get_pointer (x, y, mask);
ev.type = GDK_MOTION_NOTIFY;
ev.state = Gdk::BUTTON1_MASK;
- ev.x = x;
- ev.y = y;
+
+ /* the motion handler expects events in canvas coordinate space */
+ ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (x, y));
+ ev.x = d.x;
+ ev.y = d.y;
motion_handler (0, (GdkEvent*) &ev, true);
@@ -738,7 +651,7 @@ Editor::start_canvas_autoscroll (int dx, int dy)
autoscroll_active = true;
autoscroll_x = dx;
autoscroll_y = dy;
- autoscroll_x_distance = (framepos_t) floor (current_page_frames()/50.0);
+ autoscroll_x_distance = (framepos_t) floor (current_page_samples()/50.0);
autoscroll_y_distance = fabs (dy * 5); /* pixels */
autoscroll_cnt = 0;
@@ -763,7 +676,6 @@ Editor::left_track_canvas (GdkEventCrossing */*ev*/)
{
DropDownKeys ();
within_track_canvas = false;
- //cerr << "left track canvas\n";
set_entered_track (0);
set_entered_regionview (0);
reset_canvas_action_sensitivity (false);
@@ -773,7 +685,6 @@ Editor::left_track_canvas (GdkEventCrossing */*ev*/)
bool
Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
{
- //cerr << "entered track canvas\n";
within_track_canvas = true;
reset_canvas_action_sensitivity (true);
return FALSE;
@@ -786,24 +697,19 @@ Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
double v = vertical_adjustment.get_value ();
- if (begin < v || begin + tav.current_height() > v + _canvas_height - canvas_timebars_vsize) {
+ if (begin < v || begin + tav.current_height() > v + _visible_canvas_height) {
/* try to put the TimeAxisView roughly central */
- if (begin >= _canvas_height/2.0) {
- begin -= _canvas_height/2.0;
+ if (begin >= _visible_canvas_height/2.0) {
+ begin -= _visible_canvas_height/2.0;
}
vertical_adjustment.set_value (begin);
}
}
+/** Called when the main vertical_adjustment has changed */
void
Editor::tie_vertical_scrolling ()
{
- scroll_canvas_vertically ();
-
- /* this will do an immediate redraw */
-
- controls_layout.get_vadjustment()->set_value (vertical_adjustment.get_value());
-
if (pending_visual_change.idle_handler_id < 0) {
_summary->set_overlays_dirty ();
}
@@ -812,18 +718,9 @@ 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);
-
- _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);
+ horizontal_adjustment.set_value (p);
- leftmost_frame = (framepos_t) floor (p * frames_per_unit);
+ leftmost_frame = (framepos_t) floor (p * samples_per_pixel);
update_fixed_rulers ();
redisplay_tempo (true);
@@ -835,92 +732,61 @@ Editor::set_horizontal_position (double p)
update_video_timeline();
HorizontalPositionChanged (); /* EMIT SIGNAL */
-
-#ifndef GTKOSX
- if (!autoscroll_active && !_stationary_playhead) {
- /* force rulers and canvas to move in lock step */
- while (gtk_events_pending ()) {
- gtk_main_iteration ();
- }
- }
-#endif
-}
-
-void
-Editor::scroll_canvas_vertically ()
-{
- /* vertical scrolling only */
-
- double y_delta;
-
- y_delta = last_trackview_group_vertical_offset - get_trackview_group_vertical_offset ();
- _trackview_group->move (0, y_delta);
- _background_group->move (0, y_delta);
-
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->clip_to_viewport ();
- }
- last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
- /* required to keep the controls_layout in lock step with the canvas group */
- update_canvas_now ();
}
void
Editor::color_handler()
{
- playhead_cursor->canvas_item.property_fill_color_rgba() = 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();
+ playhead_cursor->set_color (ARDOUR_UI::config()->get_canvasvar_PlayHead());
+ _verbose_cursor->set_color (ARDOUR_UI::config()->get_canvasvar_VerboseCanvasCursor());
- tempo_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TempoBar.get();
- tempo_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
+ meter_bar->set_fill_color (ARDOUR_UI::config()->get_canvasvar_MeterBar());
+ meter_bar->set_outline_color (ARDOUR_UI::config()->get_canvasvar_MarkerBarSeparator());
- marker_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBar.get();
- marker_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
+ tempo_bar->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TempoBar());
+ tempo_bar->set_outline_color (ARDOUR_UI::config()->get_canvasvar_MarkerBarSeparator());
- 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();
+ marker_bar->set_fill_color (ARDOUR_UI::config()->get_canvasvar_MarkerBar());
+ marker_bar->set_outline_color (ARDOUR_UI::config()->get_canvasvar_MarkerBarSeparator());
- videotl_bar->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_VideoBar.get();
- videotl_bar->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerBarSeparator.get();
+ cd_marker_bar->set_fill_color (ARDOUR_UI::config()->get_canvasvar_CDMarkerBar());
+ cd_marker_bar->set_outline_color (ARDOUR_UI::config()->get_canvasvar_MarkerBarSeparator());
- 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()->get_canvasvar_RangeMarkerBar());
+ range_marker_bar->set_outline_color (ARDOUR_UI::config()->get_canvasvar_MarkerBarSeparator());
- 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()->get_canvasvar_TransportMarkerBar());
+ transport_marker_bar->set_outline_color (ARDOUR_UI::config()->get_canvasvar_MarkerBarSeparator());
- 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()->get_canvasvar_RangeDragBarRect());
+ cd_marker_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RangeDragBarRect());
- 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()->get_canvasvar_RangeDragBarRect());
+ range_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RangeDragBarRect());
- 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()->get_canvasvar_TransportDragRect());
+ transport_bar_drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TransportDragRect());
- 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()->get_canvasvar_TransportLoopRect());
+ transport_loop_range_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TransportLoopRect());
- 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()->get_canvasvar_TransportPunchRect());
+ transport_punch_range_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TransportPunchRect());
- 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_outline_color (ARDOUR_UI::config()->get_canvasvar_PunchLine());
+ transport_punchout_line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_PunchLine());
- 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()->get_canvasvar_ZoomRect());
+ zoom_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_ZoomRect());
- 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()->get_canvasvar_RubberBandRect());
+ rubberband_rect->set_fill_color ((guint32) ARDOUR_UI::config()->get_canvasvar_RubberBandRect());
- location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
- location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
- location_cd_marker_color = ARDOUR_UI::config()->canvasvar_LocationCDMarker.get();
- location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
- location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
+ location_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationMarker();
+ location_range_color = ARDOUR_UI::config()->get_canvasvar_LocationRange();
+ location_cd_marker_color = ARDOUR_UI::config()->get_canvasvar_LocationCDMarker();
+ location_loop_color = ARDOUR_UI::config()->get_canvasvar_LocationLoop();
+ location_punch_color = ARDOUR_UI::config()->get_canvasvar_LocationPunch();
refresh_location_display ();
/*
@@ -931,37 +797,10 @@ Editor::color_handler()
*/
}
-void
-Editor::flush_canvas ()
-{
- if (is_mapped()) {
- update_canvas_now ();
- // gdk_window_process_updates (GTK_LAYOUT(track_canvas->gobj())->bin_window, true);
- }
-}
-
-void
-Editor::update_canvas_now ()
-{
- /* GnomeCanvas has a bug whereby if its idle handler is not scheduled between
- two calls to update_now, an assert will trip. This wrapper works around
- that problem by only calling update_now if the assert will not trip.
-
- I think the GC bug is due to the fact that its code will reset need_update
- and need_redraw to FALSE without checking to see if an idle handler is scheduled.
- 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 ();
- }
-}
-
double
Editor::horizontal_position () const
{
- return frame_to_unit (leftmost_frame);
+ return sample_to_pixel (leftmost_frame);
}
void
@@ -971,10 +810,10 @@ Editor::set_canvas_cursor (Gdk::Cursor* cursor, bool save)
current_canvas_cursor = cursor;
}
- Glib::RefPtr<Gdk::Window> win = track_canvas->get_window();
+ Glib::RefPtr<Gdk::Window> win = _track_canvas->get_window();
if (win) {
- track_canvas->get_window()->set_cursor (*cursor);
+ _track_canvas->get_window()->set_cursor (*cursor);
}
}
@@ -998,3 +837,46 @@ Editor::track_canvas_key_release (GdkEventKey*)
return false;
}
+
+double
+Editor::clamp_verbose_cursor_x (double x)
+{
+ if (x < 0) {
+ x = 0;
+ } else {
+ x = min (_visible_canvas_width - 200.0, x);
+ }
+ return x;
+}
+
+double
+Editor::clamp_verbose_cursor_y (double y)
+{
+ y = max (0.0, y);
+ y = min (_visible_canvas_height - 50, y);
+ return y;
+}
+
+ArdourCanvas::Group*
+Editor::get_time_bars_group () const
+{
+ return _time_bars_canvas->root();
+}
+
+ArdourCanvas::Group*
+Editor::get_track_canvas_group() const
+{
+ return _track_canvas->root();
+}
+
+ArdourCanvas::GtkCanvasViewport*
+Editor::get_time_bars_canvas() const
+{
+ return _time_bars_canvas_viewport;
+}
+
+ArdourCanvas::GtkCanvasViewport*
+Editor::get_track_canvas() const
+{
+ return _track_canvas_viewport;
+}
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index 79cc1e066f..5bd0060d23 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"
@@ -63,6 +63,12 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
framepos_t xdelta;
int direction = ev->direction;
+ /* this event arrives without transformation by the canvas, so we have
+ * to transform the coordinates to be able to look things up.
+ */
+
+ Duple event_coords = _track_canvas->window_to_canvas (Duple (ev->x, ev->y));
+
retry:
switch (direction) {
case GDK_SCROLL_UP:
@@ -79,7 +85,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
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 (event_coords.y);
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;
@@ -108,7 +114,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ScrollZoomVerticalModifier)) {
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 (event_coords.y);
current_stepping_trackview = p.first;
if (!current_stepping_trackview) {
return false;
@@ -124,7 +130,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
break;
case GDK_SCROLL_LEFT:
- xdelta = (current_page_frames() / 8);
+ xdelta = (current_page_samples() / 8);
if (leftmost_frame > xdelta) {
reset_x_origin (leftmost_frame - xdelta);
} else {
@@ -133,11 +139,11 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
break;
case GDK_SCROLL_RIGHT:
- xdelta = (current_page_frames() / 8);
+ xdelta = (current_page_samples() / 8);
if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_frames());
+ reset_x_origin (max_framepos - current_page_samples());
}
break;
@@ -152,7 +158,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 +166,7 @@ bool
Editor::track_canvas_button_press_event (GdkEventButton */*event*/)
{
selection->clear ();
- track_canvas->grab_focus();
+ _track_canvas->grab_focus();
return false;
}
@@ -178,7 +184,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;
}
@@ -1003,8 +1009,6 @@ 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;
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> region_copy;
RouteTimeAxisView* rtav;
@@ -1012,21 +1016,19 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
double px;
double py;
- string target = track_canvas->drag_dest_find_target (context, track_canvas->drag_dest_get_target_list());
+ string target = _track_canvas->drag_dest_find_target (context, _track_canvas->drag_dest_get_target_list());
if (target.empty()) {
return false;
}
- track_canvas->window_to_world (x, y, wx, wy);
-
event.type = GDK_MOTION_NOTIFY;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
/* assume we're dragging with button 1 */
event.motion.state = Gdk::BUTTON1_MASK;
- (void) event_frame (&event, &px, &py);
+ (void) window_event_frame (&event, &px, &py);
std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
bool can_drop = false;
@@ -1096,8 +1098,6 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
const SelectionData& /*data*/,
guint /*info*/, guint /*time*/)
{
- double wx;
- double wy;
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> region_copy;
RouteTimeAxisView* rtav;
@@ -1105,15 +1105,13 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
double px;
double py;
- track_canvas->window_to_world (x, y, wx, wy);
-
event.type = GDK_MOTION_NOTIFY;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
/* assume we're dragging with button 1 */
event.motion.state = Gdk::BUTTON1_MASK;
- framepos_t const pos = event_frame (&event, &px, &py);
+ framepos_t const pos = window_event_frame (&event, &px, &py);
std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index ccacda210f..557120c1db 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -20,7 +20,8 @@
#include <cstdlib>
#include <cmath>
-#include <libgnomecanvas/libgnomecanvas.h>
+#include "canvas/canvas.h"
+#include "canvas/debug.h"
#include "utils.h"
#include "editor_cursors.h"
@@ -31,29 +32,37 @@ 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 */
+ CANVAS_DEBUG_NAME ((&_time_bars_canvas_item), "timebars editor cursor");
+ CANVAS_DEBUG_NAME ((&_track_canvas_item), "track canvas editor cursor");
+
+ _time_bars_canvas_item.set_show_head (0, true);
+ _time_bars_canvas_item.set_head_height (0, 9);
+ _time_bars_canvas_item.set_head_width (0, 16);
+ _time_bars_canvas_item.set_head_outward (0, false);
+ _time_bars_canvas_item.set_show_head (1, false); // head only
+ _time_bars_canvas_item.set_outline_width (0.5);
+
+ _time_bars_canvas_item.set_data ("cursor", this);
+ _track_canvas_item.set_data ("cursor", this);
+ _track_canvas_item.set_outline_width (0.5);
+
+ _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 +70,40 @@ EditorCursor::set_position (framepos_t frame)
{
PositionChanged (frame);
- double new_pos = editor.frame_to_unit (frame);
+ /* See Cairo FAQ question on single pixel lines to understand
+ why we add 0.5
+ */
- if (new_pos != points.front().get_x()) {
+ double const new_pos = _editor.sample_to_pixel (frame) + 0.5;
- 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_x (new_pos, 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..93689c6e7b 100644
--- a/gtk2_ardour/editor_cursors.h
+++ b/gtk2_ardour/editor_cursors.h
@@ -19,22 +19,42 @@
#include "pbd/signals.h"
+#include "canvas/arrow.h"
+#include "canvas/line.h"
+#include "canvas/types.h"
+
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;
+ }
+
+ ArdourCanvas::Arrow& time_bar_canvas_item () {
+ return _time_bars_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 9c65892ebd..d9580c1eeb 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;
@@ -126,7 +127,7 @@ DragManager::start_grab (GdkEvent* e, Gdk::Cursor* c)
_old_follow_playhead = _editor->follow_playhead ();
_editor->set_follow_playhead (false);
- _current_pointer_frame = _editor->event_frame (e, &_current_pointer_x, &_current_pointer_y);
+ _current_pointer_frame = _editor->canvas_event_frame (e, &_current_pointer_x, &_current_pointer_y);
for (list<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) {
(*i)->start_grab (e, c);
@@ -159,12 +160,38 @@ DragManager::end_grab (GdkEvent* e)
return r;
}
+void
+DragManager::mark_double_click ()
+{
+ for (list<Drag*>::const_iterator i = _drags.begin(); i != _drags.end(); ++i) {
+ (*i)->set_double_click (true);
+ }
+}
+
bool
DragManager::motion_handler (GdkEvent* e, bool from_autoscroll)
{
bool r = false;
- _current_pointer_frame = _editor->event_frame (e, &_current_pointer_x, &_current_pointer_y);
+ _current_pointer_frame = _editor->canvas_event_frame (e, &_current_pointer_x, &_current_pointer_y);
+
+ for (list<Drag*>::iterator i = _drags.begin(); i != _drags.end(); ++i) {
+ bool const t = (*i)->motion_handler (e, from_autoscroll);
+ if (t) {
+ r = true;
+ }
+
+ }
+
+ return r;
+}
+
+bool
+DragManager::window_motion_handler (GdkEvent* e, bool from_autoscroll)
+{
+ bool r = false;
+
+ _current_pointer_frame = _editor->window_event_frame (e, &_current_pointer_x, &_current_pointer_y);
for (list<Drag*>::iterator i = _drags.begin(); i != _drags.end(); ++i) {
bool const t = (*i)->motion_handler (e, from_autoscroll);
@@ -193,6 +220,7 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i)
, _item (i)
, _pointer_frame_offset (0)
, _move_threshold_passed (false)
+ , _was_double_click (false)
, _raw_grab_frame (0)
, _grab_frame (0)
, _last_pointer_frame (0)
@@ -201,15 +229,15 @@ Drag::Drag (Editor* e, ArdourCanvas::Item* i)
}
void
-Drag::swap_grab (ArdourCanvas::Item* new_item, Gdk::Cursor* cursor, uint32_t time)
+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 ();
}
}
@@ -231,7 +259,7 @@ Drag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
_y_constrained = false;
}
- _raw_grab_frame = _editor->event_frame (event, &_grab_x, &_grab_y);
+ _raw_grab_frame = _editor->canvas_event_frame (event, &_grab_x, &_grab_y);
setup_pointer_frame_offset ();
_grab_frame = adjusted_frame (_raw_grab_frame, event);
_last_pointer_frame = _grab_frame;
@@ -239,12 +267,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 +304,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 +383,7 @@ void
Drag::abort ()
{
if (_item) {
- _item->ungrab (0);
+ _item->ungrab ();
}
aborted (_move_threshold_passed);
@@ -369,8 +397,8 @@ Drag::show_verbose_cursor_time (framepos_t frame)
{
_editor->verbose_cursor()->set_time (
frame,
- _drags->current_pointer_x() + 10 - _editor->horizontal_position(),
- _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ _drags->current_pointer_x() + 10,
+ _drags->current_pointer_y() + 10
);
_editor->verbose_cursor()->show ();
@@ -383,8 +411,8 @@ Drag::show_verbose_cursor_duration (framepos_t start, framepos_t end, double xof
_editor->verbose_cursor()->set_duration (
start, end,
- _drags->current_pointer_x() + 10 - _editor->horizontal_position(),
- _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ _drags->current_pointer_x() + 10,
+ _drags->current_pointer_y() + 10
);
}
@@ -395,8 +423,8 @@ Drag::show_verbose_cursor_text (string const & text)
_editor->verbose_cursor()->set (
text,
- _drags->current_pointer_x() + 10 - _editor->horizontal_position(),
- _drags->current_pointer_y() + 10 - _editor->vertical_adjustment.get_value() + _editor->canvas_timebars_vsize
+ _drags->current_pointer_x() + 10,
+ _drags->current_pointer_y() + 10
);
}
@@ -491,14 +519,15 @@ RegionDrag::find_time_axis_view (TimeAxisView* t) const
}
RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b)
- : RegionDrag (e, i, p, v),
- _brushing (b),
- _total_x_delta (0)
+ : RegionDrag (e, i, p, v)
+ , _brushing (b)
+ , _total_x_delta (0)
+ , _last_pointer_time_axis_view (0)
+ , _last_pointer_layer (0)
{
-
+ DEBUG_TRACE (DEBUG::Drags, "New RegionMotionDrag\n");
}
-
void
RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
@@ -507,8 +536,10 @@ RegionMotionDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
show_verbose_cursor_time (_last_frame_position);
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (_drags->current_pointer_y ());
- _last_pointer_time_axis_view = find_time_axis_view (tv.first);
- _last_pointer_layer = tv.first->layer_display() == Overlaid ? 0 : tv.second;
+ if (tv.first) {
+ _last_pointer_time_axis_view = find_time_axis_view (tv.first);
+ _last_pointer_layer = tv.first->layer_display() == Overlaid ? 0 : tv.second;
+ }
}
double
@@ -551,7 +582,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->samples_per_pixel;
/* total x movement */
framecnt_t total_dx = *pending_region_position;
@@ -615,17 +646,18 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
/* Find the TimeAxisView that the pointer is now over */
pair<TimeAxisView*, double> const tv = _editor->trackview_by_y_position (_drags->current_pointer_y ());
- if (first_move && tv.first->view()->layer_display() == Stacked) {
- tv.first->view()->set_layer_display (Expanded);
- }
-
/* Bail early if we're not over a track */
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv.first);
+
if (!rtv || !rtv->is_track()) {
_editor->verbose_cursor()->hide ();
return;
}
+ if (first_move && tv.first->view()->layer_display() == Stacked) {
+ tv.first->view()->set_layer_display (Expanded);
+ }
+
/* Note: time axis views in this method are often expressed as an index into the _time_axis_views vector */
/* Here's the current pointer position in terms of time axis view and layer */
@@ -637,6 +669,7 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
double const x_delta = compute_x_delta (event, &pending_region_position);
/* Work out the change in y */
+
int delta_time_axis_view = current_pointer_time_axis_view - _last_pointer_time_axis_view;
double delta_layer = current_pointer_layer - _last_pointer_layer;
@@ -667,20 +700,19 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
rv->drag_start ();
- /* Absolutely no idea why this is necessary, but it is; without
- it, the region view disappears after the reparent.
- */
- _editor->update_canvas_now ();
-
/* Reparent to a non scrolling group so that we can keep the
region selection above all time axis views.
Reparenting means that we will have to move the region view
- later, as the two parent groups have different coordinates.
+ within its new parent, as the two parent groups have different coordinates.
*/
- rv->get_canvas_group()->reparent (*(_editor->_region_motion_group));
-
+ ArdourCanvas::Group* rvg = rv->get_canvas_group();
+ Duple rv_canvas_offset = rvg->item_to_canvas (Duple (0,0));
+
+ rv->get_canvas_group()->reparent (_editor->_region_motion_group);
+
rv->fake_set_opaque (true);
+ rvg->set_position (rv_canvas_offset);
}
/* If we have moved tracks, we'll fudge the layer delta so that the
@@ -729,9 +761,8 @@ 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);
- y += _editor->get_trackview_group_vertical_offset();
-
+ tv->canvas_display()->item_to_canvas (x, y);
+
/* And adjust for the layer that it should be on */
StreamView* cv = tv->view ();
switch (cv->layer_display ()) {
@@ -746,17 +777,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 (x_delta, y - rv->get_canvas_group()->position().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);
}
@@ -819,15 +846,6 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
_views = new_regionviews;
swap_grab (new_regionviews.front().view->get_canvas_group (), 0, event ? event->motion.time : 0);
-
- /*
- sync the canvas to what we think is its current state
- without it, the canvas seems to
- "forget" to update properly after the upcoming reparent()
- ..only if the mouse is in rapid motion at the time of the grab.
- something to do with regionview creation taking so long?
- */
- _editor->update_canvas_now();
}
}
@@ -880,8 +898,6 @@ RegionMoveDrag::finished (GdkEvent* ev, bool movement_occurred)
bool const changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view());
framecnt_t const drag_delta = _primary->region()->position() - _last_frame_position;
- _editor->update_canvas_now ();
-
if (_copy) {
finished_copy (
@@ -1061,8 +1077,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 */
@@ -1265,8 +1281,13 @@ void
RegionMotionDrag::aborted (bool)
{
for (vector<TimeAxisView*>::iterator i = _time_axis_views.begin(); i != _time_axis_views.end(); ++i) {
- if ((*i)->view()->layer_display() == Expanded) {
- (*i)->view()->set_layer_display (Stacked);
+
+ StreamView* sview = (*i)->view();
+
+ if (sview) {
+ if (sview->layer_display() == Expanded) {
+ sview->set_layer_display (Stacked);
+ }
}
}
@@ -1275,15 +1296,13 @@ 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);
rv->set_height (rtv->view()->child_height ());
}
-
- _editor->update_canvas_now ();
}
/** @param b true to brush, otherwise false.
@@ -1332,12 +1351,10 @@ RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, Rout
void
RegionInsertDrag::finished (GdkEvent *, bool)
{
- _editor->update_canvas_now ();
-
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();
@@ -1518,7 +1535,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) {
@@ -1532,7 +1550,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;
@@ -1542,7 +1560,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;
@@ -1576,7 +1594,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);
}
}
@@ -1585,7 +1605,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);
}
}
@@ -1679,7 +1701,6 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move)
DEBUG_TRACE (DEBUG::Drags, string_compose("SHIFT REGION at %1 by %2\n", i->initial_position, dt));
if (first_move) {
rv->drag_start ();
- _editor->update_canvas_now ();
rv->fake_set_opaque (true);
rv->region()->clear_changes ();
rv->region()->suspend_property_changes();
@@ -1741,7 +1762,6 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred)
_editor->commit_reversible_command ();
- _editor->update_canvas_now ();
}
void
@@ -1829,6 +1849,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
TimeAxisView* tvp = &_primary->get_time_axis_view ();
RouteTimeAxisView* tv = dynamic_cast<RouteTimeAxisView*>(tvp);
pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
+ frameoffset_t frame_delta = 0;
if (tv && tv->is_track()) {
speed = tv->track()->speed();
@@ -1895,7 +1916,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_in()->back()->when;
- new_length = len - _editor->unit_to_frame (distance);
+ new_length = len - _editor->pixel_to_sample (distance);
new_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
arv->reset_fade_in_shape_width (ar, new_length); //the grey shape
}
@@ -1915,7 +1936,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = grab_x() - _drags->current_pointer_x();
len = ar->fade_out()->back()->when;
- new_length = len - _editor->unit_to_frame (distance);
+ new_length = len - _editor->pixel_to_sample (distance);
new_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
arv->reset_fade_out_shape_width (ar, new_length); //the grey shape
}
@@ -1925,27 +1946,11 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
case ContentsTrim:
{
- bool swap_direction = false;
-
- if (event && Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
- swap_direction = true;
- }
-
- framecnt_t frame_delta = 0;
-
- bool left_direction = false;
- if (last_pointer_frame() > adjusted_current_frame(event)) {
- left_direction = true;
- }
-
- if (left_direction) {
- frame_delta = (last_pointer_frame() - adjusted_current_frame(event));
- } else {
- frame_delta = (adjusted_current_frame(event) - last_pointer_frame());
- }
+ frame_delta = (adjusted_current_frame(event) - last_pointer_frame());
+ // frame_delta = (last_pointer_frame() - adjusted_current_frame(event));
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
- i->view->trim_contents (frame_delta, left_direction, swap_direction);
+ i->view->move_contents (frame_delta);
}
}
break;
@@ -1959,7 +1964,7 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
show_verbose_cursor_time ((framepos_t) (rv->region()->last_frame() / speed));
break;
case ContentsTrim:
- show_verbose_cursor_time (adjusted_current_frame (event));
+ // show_verbose_cursor_time (frame_delta);
break;
}
}
@@ -1989,7 +1994,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_in()->back()->when;
- new_length = len - _editor->unit_to_frame (distance);
+ new_length = len - _editor->pixel_to_sample (distance);
new_length = ar->verify_xfade_bounds (new_length, true /*START*/ );
ar->set_fade_in_length(new_length);
}
@@ -2006,7 +2011,7 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
boost::shared_ptr<AudioRegion> ar (arv->audio_region());
distance = _drags->current_pointer_x() - grab_x();
len = ar->fade_out()->back()->when;
- new_length = len - _editor->unit_to_frame (distance);
+ new_length = len - _editor->pixel_to_sample (distance);
new_length = ar->verify_xfade_bounds (new_length, false /*END*/ );
ar->set_fade_out_length(new_length);
}
@@ -2160,7 +2165,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
_marker = new MeterMarker (
*_editor,
*_editor->meter_group,
- ARDOUR_UI::config()->canvasvar_MeterMarker.get(),
+ ARDOUR_UI::config()->get_canvasvar_MeterMarker(),
name,
*new MeterSection (_marker->meter())
);
@@ -2279,7 +2284,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
_marker = new TempoMarker (
*_editor,
*_editor->tempo_group,
- ARDOUR_UI::config()->canvasvar_TempoMarker.get(),
+ ARDOUR_UI::config()->get_canvasvar_TempoMarker(),
name,
*new TempoSection (_marker->tempo())
);
@@ -2352,9 +2357,10 @@ TempoMarkerDrag::aborted (bool moved)
}
}
-CursorDrag::CursorDrag (Editor* e, ArdourCanvas::Item* i, bool s)
- : Drag (e, i),
- _stop (s)
+CursorDrag::CursorDrag (Editor* e, EditorCursor& c, bool s)
+ : Drag (e, &c.time_bar_canvas_item())
+ , _cursor (c)
+ , _stop (s)
{
DEBUG_TRACE (DEBUG::Drags, "New CursorDrag\n");
}
@@ -2370,7 +2376,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 ();
/* This is asynchronous so it will be sent "now"
*/
s->send_mmc_locate (f);
@@ -2390,15 +2396,20 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
{
Drag::start_grab (event, c);
- _grab_zoom = _editor->frames_per_unit;
+ _grab_zoom = _editor->samples_per_pixel;
+
+ framepos_t where = _editor->canvas_event_frame (event);
- framepos_t where = _editor->event_frame (event, 0, 0);
_editor->snap_to_with_modifier (where, event);
_editor->_dragging_playhead = true;
Session* s = _editor->session ();
+ /* grab the track canvas item as well */
+
+ _cursor.track_canvas_item().grab();
+
if (s) {
if (_was_rolling && _stop) {
s->request_stop ();
@@ -2434,9 +2445,6 @@ CursorDrag::motion (GdkEvent* event, bool)
framepos_t const adjusted_frame = adjusted_current_frame (event);
if (adjusted_frame != last_pointer_frame()) {
fake_locate (adjusted_frame);
-#ifdef GTKOSX
- _editor->update_canvas_now ();
-#endif
}
}
@@ -2445,6 +2453,8 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
{
_editor->_dragging_playhead = false;
+ _cursor.track_canvas_item().ungrab();
+
if (!movement_occurred && _stop) {
return;
}
@@ -2453,7 +2463,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 ();
}
@@ -2462,6 +2472,8 @@ CursorDrag::finished (GdkEvent* event, bool movement_occurred)
void
CursorDrag::aborted (bool)
{
+ _cursor.track_canvas_item().ungrab();
+
if (_editor->_dragging_playhead) {
_editor->session()->request_resume_timecode_transmission ();
_editor->_dragging_playhead = false;
@@ -2710,8 +2722,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 ()
@@ -2981,16 +2993,16 @@ MarkerDrag::motion (GdkEvent* event, bool)
assert (!_copied_locations.empty());
show_verbose_cursor_time (newframe);
-
-#ifdef GTKOSX
- _editor->update_canvas_now ();
-#endif
}
void
MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
{
if (!movement_occurred) {
+
+ if (was_double_click()) {
+ cerr << "End of marker double click\n";
+ }
/* just a click, do nothing but finish
off the selection process
@@ -3145,7 +3157,7 @@ ControlPointDrag::motion (GdkEvent* event, bool)
cy = max (0.0, cy);
cy = min ((double) _point->line().height(), cy);
- framepos_t cx_frames = _editor->unit_to_frame (cx);
+ framepos_t cx_frames = _editor->pixel_to_sample (cx);
if (!_x_constrained) {
_editor->snap_to_with_modifier (cx_frames, event);
@@ -3155,7 +3167,7 @@ ControlPointDrag::motion (GdkEvent* event, bool)
float const fraction = 1.0 - (cy / _point->line().height());
- _point->line().drag_motion (_editor->frame_to_unit_unrounded (cx_frames), fraction, false, _pushing, _final_index);
+ _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index);
_editor->verbose_cursor()->set_text (_point->line().get_verbose_cursor_string (fraction));
}
@@ -3220,9 +3232,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->samples_per_pixel);
uint32_t before;
uint32_t after;
@@ -3309,7 +3321,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;
@@ -3318,7 +3330,7 @@ FeatureLineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
_arv = reinterpret_cast<AudioRegionView*> (_item->get_data ("regionview"));
- _max_x = _editor->frame_to_pixel(_arv->get_duration());
+ _max_x = _editor->sample_to_pixel(_arv->get_duration());
}
void
@@ -3339,16 +3351,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<ArdourCanvas::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;
@@ -3421,20 +3426,20 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool)
if (start != end || y1 != y2) {
- double x1 = _editor->frame_to_pixel (start);
- double x2 = _editor->frame_to_pixel (end);
+ double x1 = _editor->sample_to_pixel (start);
+ double x2 = _editor->sample_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();
@@ -3859,7 +3864,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);
}
@@ -3955,12 +3960,13 @@ 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,
- physical_screen_height (_editor->get_window()));
+ _drag_rect = new ArdourCanvas::Rectangle (_editor->time_line_group,
+ ArdourCanvas::Rect (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()->get_canvasvar_RangeDragRect());
+ _drag_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RangeDragRect());
}
void
@@ -4000,7 +4006,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:
@@ -4049,17 +4055,17 @@ 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);
}
if (start != end) {
_editor->temp_location->set (start, end);
- double x1 = _editor->frame_to_pixel (start);
- double x2 = _editor->frame_to_pixel (end);
- crect->property_x1() = x1;
- crect->property_x2() = x2;
+ double x1 = _editor->sample_to_pixel (start);
+ double x2 = _editor->sample_to_pixel (end);
+ crect->set_x0 (x1);
+ crect->set_x1 (x2);
update_item (_editor->temp_location);
}
@@ -4157,11 +4163,11 @@ RangeMarkerBarDrag::aborted (bool)
void
RangeMarkerBarDrag::update_item (Location* location)
{
- double const x1 = _editor->frame_to_pixel (location->start());
- double const x2 = _editor->frame_to_pixel (location->end());
+ double const x1 = _editor->sample_to_pixel (location->start());
+ double const x2 = _editor->sample_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)
@@ -4253,7 +4259,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 ();
}
@@ -4289,7 +4296,7 @@ frameoffset_t
NoteDrag::total_dx () const
{
/* dx in frames */
- frameoffset_t const dx = _editor->unit_to_frame (_drags->current_pointer_x() - grab_x());
+ frameoffset_t const dx = _editor->pixel_to_sample (_drags->current_pointer_x() - grab_x());
/* primary note time */
frameoffset_t const n = _region->source_beats_to_absolute_frames (_primary->note()->time ());
@@ -4329,7 +4336,7 @@ NoteDrag::motion (GdkEvent *, bool)
int8_t const dy = total_dy ();
/* Now work out what we have to do to the note canvas items to set this new drag delta */
- double const tdx = _editor->frame_to_unit (dx) - _cumulative_dx;
+ double const tdx = _editor->sample_to_pixel (dx) - _cumulative_dx;
double const tdy = -dy * _note_height - _cumulative_dy;
if (tdx || tdy) {
@@ -4625,14 +4632,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)
@@ -4651,8 +4658,8 @@ PatchChangeDrag::motion (GdkEvent* ev, bool)
f = min (f, r->last_frame ());
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);
+ double const dxu = _editor->sample_to_pixel (dxf); // permitted fx in units
+ _patch_change->move (ArdourCanvas::Duple (dxu - _cumulative_dx, 0));
_cumulative_dx = dxu;
}
@@ -4677,7 +4684,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
@@ -4688,7 +4695,7 @@ PatchChangeDrag::setup_pointer_frame_offset ()
}
MidiRubberbandSelectDrag::MidiRubberbandSelectDrag (Editor* e, MidiRegionView* rv)
- : RubberbandSelectDrag (e, rv->get_canvas_frame ())
+ : RubberbandSelectDrag (e, rv->get_canvas_group ())
, _region_view (rv)
{
@@ -4706,8 +4713,8 @@ MidiRubberbandSelectDrag::select_things (int button_state, framepos_t x1, framep
y2 = max (0.0, y2 - y);
_region_view->update_drag_selection (
- _editor->frame_to_pixel (x1),
- _editor->frame_to_pixel (x2),
+ _editor->sample_to_pixel (x1),
+ _editor->sample_to_pixel (x2),
y1,
y2,
Keyboard::modifier_state_contains (button_state, Keyboard::TertiaryModifier)
@@ -4721,7 +4728,7 @@ MidiRubberbandSelectDrag::deselect_things ()
}
MidiVerticalSelectDrag::MidiVerticalSelectDrag (Editor* e, MidiRegionView* rv)
- : RubberbandSelectDrag (e, rv->get_canvas_frame ())
+ : RubberbandSelectDrag (e, rv->get_canvas_group ())
, _region_view (rv)
{
_vertical_only = true;
@@ -4810,7 +4817,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);
@@ -4825,28 +4832,24 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
_note[0] = adjusted_frame (pf, event) - _region_view->region()->position ();
MidiStreamView* sv = _region_view->midi_stream_view ();
- double const x = _editor->frame_to_pixel (_note[0]);
+ double const x = _editor->sample_to_pixel (_note[0]);
double const y = sv->note_to_y (sv->y_to_note (y_to_region (event->button.y)));
- _drag_rect->property_x1() = x;
- _drag_rect->property_y1() = y;
- _drag_rect->property_x2() = x;
- _drag_rect->property_y2() = y + floor (_region_view->midi_stream_view()->note_height ());
-
- _drag_rect->property_outline_what() = 0xff;
- _drag_rect->property_outline_color_rgba() = 0xffffff99;
- _drag_rect->property_fill_color_rgba() = 0xffffff66;
+ _drag_rect->set (ArdourCanvas::Rect (x, y, x, y + floor (_region_view->midi_stream_view()->note_height ())));
+ _drag_rect->set_outline_what (0xff);
+ _drag_rect->set_outline_color (0xffffff99);
+ _drag_rect->set_fill_color (0xffffff66);
}
void
NoteCreateDrag::motion (GdkEvent* event, bool)
{
_note[1] = max ((framepos_t)0, adjusted_current_frame (event) - _region_view->region()->position ());
- double const x = _editor->frame_to_pixel (_note[1]);
+ double const x = _editor->sample_to_pixel (_note[1]);
if (_note[1] > _note[0]) {
- _drag_rect->property_x2() = x;
+ _drag_rect->set_x1 (x);
} else {
- _drag_rect->property_x1() = x;
+ _drag_rect->set_x0 (x);
}
}
@@ -4869,14 +4872,14 @@ NoteCreateDrag::finished (GdkEvent*, bool had_movement)
double const length_beats = max (one_tick, _region_view->region_frames_to_region_beats (length));
- _region_view->create_note_at (start, _drag_rect->property_y1(), length_beats, false);
+ _region_view->create_note_at (start, _drag_rect->y0(), length_beats, false);
}
double
NoteCreateDrag::y_to_region (double y) const
{
double x = 0;
- _region_view->get_canvas_group()->w2i (x, y);
+ _region_view->get_canvas_group()->canvas_to_item (x, y);
return y;
}
@@ -4919,16 +4922,16 @@ CrossfadeEdgeDrag::motion (GdkEvent*, bool)
/* how long should it be ? */
- new_length = len + _editor->unit_to_frame (distance);
+ new_length = len + _editor->pixel_to_sample (distance);
/* now check with the region that this is legal */
new_length = ar->verify_xfade_bounds (new_length, start);
if (start) {
- arv->redraw_start_xfade_to (ar, new_length);
+ arv->reset_fade_in_shape_width (ar, new_length);
} else {
- arv->redraw_end_xfade_to (ar, new_length);
+ arv->reset_fade_out_shape_width (ar, new_length);
}
}
@@ -4949,7 +4952,7 @@ CrossfadeEdgeDrag::finished (GdkEvent*, bool)
len = ar->fade_out()->back()->when;
}
- new_length = ar->verify_xfade_bounds (len + _editor->unit_to_frame (distance), start);
+ new_length = ar->verify_xfade_bounds (len + _editor->pixel_to_sample (distance), start);
_editor->begin_reversible_command ("xfade trim");
ar->playlist()->clear_owned_changes ();
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index 6267956ed7..3f4c82d2d0 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
@@ -60,6 +54,7 @@ public:
~DragManager ();
bool motion_handler (GdkEvent *, bool);
+ bool window_motion_handler (GdkEvent *, bool);
void abort ();
void add (Drag *);
@@ -68,6 +63,8 @@ public:
bool end_grab (GdkEvent *);
bool have_item (ArdourCanvas::Item *) const;
+ void mark_double_click ();
+
/** @return true if an end drag or abort is in progress */
bool ending () const {
return _ending;
@@ -77,12 +74,12 @@ public:
return !_drags.empty ();
}
- /** @return current pointer x position in trackview coordinates */
+ /** @return current pointer x position in canvas coordinates */
double current_pointer_x () const {
return _current_pointer_x;
}
- /** @return current pointer y position in trackview coordinates */
+ /** @return current pointer y position in canvas coordinates */
double current_pointer_y () const {
return _current_pointer_y;
}
@@ -96,8 +93,8 @@ private:
Editor* _editor;
std::list<Drag*> _drags;
bool _ending; ///< true if end_grab or abort is in progress, otherwise false
- double _current_pointer_x; ///< trackview x of the current pointer
- double _current_pointer_y; ///< trackview y of the current pointer
+ double _current_pointer_x; ///< canvas-coordinate space x of the current pointer
+ double _current_pointer_y; ///< canvas-coordinate space y of the current pointer
ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
};
@@ -106,7 +103,7 @@ private:
class Drag
{
public:
- Drag (Editor *, ArdourCanvas::Item *);
+ Drag (Editor *, ArdourCanvas::Item *);
virtual ~Drag () {}
void set_manager (DragManager* m) {
@@ -125,6 +122,9 @@ public:
ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
+ bool was_double_click() const { return _was_double_click; }
+ void set_double_click (bool yn) { _was_double_click = yn; }
+
/** Called to start a grab of an item.
* @param e Event that caused the grab to start.
* @param c Cursor to use, or 0.
@@ -230,6 +230,7 @@ protected:
private:
bool _move_threshold_passed; ///< true if the move threshold has been passed, otherwise false
+ bool _was_double_click; ///< true if drag initiated by a double click event
double _grab_x; ///< trackview x of the grab start position
double _grab_y; ///< trackview y of the grab start position
double _last_pointer_x; ///< trackview x of the pointer last time a motion occurred
@@ -456,7 +457,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 +480,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 +488,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 +502,7 @@ public:
private:
MidiRegionView* _region_view;
- ArdourCanvas::CanvasPatchChange* _patch_change;
+ PatchChange* _patch_change;
double _cumulative_dx;
};
@@ -632,7 +633,7 @@ private:
class CursorDrag : public Drag
{
public:
- CursorDrag (Editor *, ArdourCanvas::Item *, bool);
+ CursorDrag (Editor *, EditorCursor&, bool);
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
@@ -654,6 +655,7 @@ public:
private:
void fake_locate (framepos_t);
+ EditorCursor& _cursor;
bool _stop; ///< true to stop the transport on starting the drag, otherwise false
double _grab_zoom; ///< editor frames per unit when our grab started
};
@@ -698,7 +700,7 @@ public:
class MarkerDrag : public Drag
{
public:
- MarkerDrag (Editor *, ArdourCanvas::Item *);
+ MarkerDrag (Editor *, ArdourCanvas::Item *);
~MarkerDrag ();
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
@@ -965,7 +967,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_markers.cc b/gtk2_ardour/editor_markers.cc
index 6dee565287..f21f4b21bc 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -20,7 +20,6 @@
#include <cstdlib>
#include <cmath>
-#include <libgnomecanvas/libgnomecanvas.h>
#include <gtkmm2ext/gtk_ui.h>
#include "ardour/session.h"
@@ -28,12 +27,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"
@@ -171,7 +173,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
@@ -256,7 +258,7 @@ Editor::check_marker_label (Marker* m)
/* Update just the available space between the previous marker and this one */
- double const p = frame_to_pixel (m->position() - (*prev)->position());
+ double const p = sample_to_pixel (m->position() - (*prev)->position());
if (m->label_on_left()) {
(*prev)->set_right_label_limit (p / 2);
@@ -275,7 +277,7 @@ Editor::check_marker_label (Marker* m)
/* Update just the available space between this marker and the next */
- double const p = frame_to_pixel ((*next)->position() - m->position());
+ double const p = sample_to_pixel ((*next)->position() - m->position());
if ((*next)->label_on_left()) {
m->set_right_label_limit (p / 2);
@@ -329,7 +331,7 @@ Editor::update_marker_labels (ArdourCanvas::Group* group)
while (i != sorted.end()) {
if (prev != sorted.end()) {
- double const p = frame_to_pixel ((*i)->position() - (*prev)->position());
+ double const p = sample_to_pixel ((*i)->position() - (*prev)->position());
if ((*prev)->label_on_left()) {
(*i)->set_left_label_limit (p);
@@ -340,7 +342,7 @@ Editor::update_marker_labels (ArdourCanvas::Group* group)
}
if (next != sorted.end()) {
- double const p = frame_to_pixel ((*next)->position() - (*i)->position());
+ double const p = sample_to_pixel ((*next)->position() - (*i)->position());
if ((*next)->label_on_left()) {
(*i)->set_right_label_limit (p / 2);
@@ -671,7 +673,7 @@ Editor::mouse_add_new_range (framepos_t where)
it's reasonably easy to manipulate after creation.
*/
- framepos_t const end = where + current_page_frames() / 8;
+ framepos_t const end = where + current_page_samples() / 8;
string name;
_session->locations()->next_available_name (name, _("range"));
@@ -1416,11 +1418,11 @@ Editor::update_loop_range_view (bool visibility)
if (_session->get_play_loop() && ((tll = transport_loop_location()) != 0)) {
- double x1 = frame_to_pixel (tll->start());
- double x2 = frame_to_pixel (tll->end());
+ double x1 = sample_to_pixel (tll->start());
+ double x2 = sample_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();
@@ -1441,14 +1443,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->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 (sample_to_pixel (tpl->start()));
+ transport_punch_range_rect->set_x1 (_session->config.get_punch_out() ? sample_to_pixel (tpl->end()) : sample_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() ? sample_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 be716d64d0..b2ee2777cf 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"
@@ -101,84 +102,89 @@ 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<const Gdk::Window> pointer_window;
+ Glib::RefPtr<Gdk::Window> canvas_window = const_cast<Editor*>(this)->_track_canvas->get_window();
if (!canvas_window) {
return false;
}
- pointer_window = canvas_window->get_pointer (x, y, mask);
+ Glib::RefPtr<const Gdk::Window> pointer_window = Gdk::Display::get_default()->get_window_at_pointer (x, y);
- if (pointer_window == track_canvas->get_bin_window()) {
- wx = x;
- wy = y;
- in_track_canvas = true;
+ if (!pointer_window) {
+ return false;
+ }
- } else {
+ if (pointer_window != canvas_window && pointer_window != _time_bars_canvas->get_window()) {
in_track_canvas = false;
- return false;
+ return false;
}
+ in_track_canvas = true;
+
GdkEvent event;
event.type = GDK_BUTTON_RELEASE;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
+
+ where = window_event_frame (&event, 0, 0);
- where = event_frame (&event, 0, 0);
return true;
}
framepos_t
-Editor::event_frame (GdkEvent const * event, double* pcx, double* pcy) const
+Editor::window_event_frame (GdkEvent const * event, double* pcx, double* pcy) const
{
- double cx, cy;
+ double x;
+ double y;
- if (pcx == 0) {
- pcx = &cx;
+ if (!gdk_event_get_coords (event, &x, &y)) {
+ return 0;
}
- if (pcy == 0) {
- pcy = &cy;
+
+ /* event coordinates are in window units, so convert to canvas
+ * (i.e. account for scrolling)
+ */
+
+ ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (x, y));
+
+ if (pcx) {
+ *pcx = d.x;
}
- *pcx = 0;
- *pcy = 0;
+ if (pcy) {
+ *pcy = d.y;
+ }
- switch (event->type) {
- case GDK_BUTTON_RELEASE:
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- *pcx = event->button.x;
- *pcy = event->button.y;
- _trackview_group->w2i(*pcx, *pcy);
- break;
- case GDK_MOTION_NOTIFY:
- *pcx = event->motion.x;
- *pcy = event->motion.y;
- _trackview_group->w2i(*pcx, *pcy);
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- track_canvas->w2c(event->crossing.x, event->crossing.y, *pcx, *pcy);
- break;
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- // track_canvas->w2c(event->key.x, event->key.y, *pcx, *pcy);
- break;
- default:
- warning << string_compose (_("Editor::event_frame() used on unhandled event type %1"), event->type) << endmsg;
- break;
+ return pixel_to_sample (d.x);
+}
+
+framepos_t
+Editor::canvas_event_frame (GdkEvent const * event, double* pcx, double* pcy) const
+{
+ double x;
+ double y;
+
+ /* event coordinates are already in canvas units */
+
+ if (!gdk_event_get_coords (event, &x, &y)) {
+ cerr << "!NO c COORDS for event type " << event->type << endl;
+ return 0;
+ }
+
+ if (pcx) {
+ *pcx = x;
+ }
+
+ if (pcy) {
+ *pcy = y;
}
- /* note that pixel_to_frame() never returns less than zero, so even if the pixel
+ /* note that pixel_to_sample() never returns less than zero, so even if the pixel
position is negative (as can be the case with motion events in particular),
the frame location is always positive.
*/
- return pixel_to_frame (*pcx);
+ return pixel_to_sample (x);
}
Gdk::Cursor*
@@ -303,13 +309,27 @@ Editor::set_canvas_cursor ()
/* up-down cursor as a cue that automation can be dragged up and down when in join object/range mode */
if (!_internal_editing && get_smart_mode() ) {
+
double x, y;
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);
- if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
- current_canvas_cursor = _cursors->up_down;
+
+ if (x >= 0 && y >= 0) {
+
+ vector<ArdourCanvas::Item const *> items;
+
+ _track_canvas->root()->add_items_at_point (ArdourCanvas::Duple (x,y), items);
+
+ // first item will be the upper most
+
+ if (!items.empty()) {
+ const ArdourCanvas::Item* i = items.front();
+
+ if (i && i->parent() && i->parent()->get_data (X_("timeselection"))) {
+ pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y);
+ if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
+ current_canvas_cursor = _cursors->up_down;
+ }
+ }
}
}
}
@@ -688,7 +708,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
switch (item_type) {
case PlayheadCursorItem:
- _drags->set (new CursorDrag (this, item, true), event);
+ _drags->set (new CursorDrag (this, *playhead_cursor, true), event);
return true;
case MarkerItem:
@@ -746,7 +766,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, false), event);
}
return true;
break;
@@ -754,7 +774,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, false), event);
} else {
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateRangeMarker), event);
}
@@ -763,7 +783,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, false), event);
} else {
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateCDMarker), event);
}
@@ -772,7 +792,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, false), event);
} else {
_drags->set (new RangeMarkerBarDrag (this, item, RangeMarkerBarDrag::CreateTransportMarker), event);
}
@@ -823,11 +843,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;
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
if (tvp.first) {
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
@@ -883,7 +904,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 {
@@ -910,7 +932,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 {
@@ -992,6 +1015,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
// }
_drags->start_grab (event);
+ return true;
break;
case RegionViewNameHighlight:
@@ -1047,7 +1071,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
_drags->set (new RegionCreateDrag (this, item, parent), event);
} else {
/* See if there's a region before the click that we can extend, and extend it if so */
- framepos_t const t = event_frame (event);
+ framepos_t const t = canvas_event_frame (event);
boost::shared_ptr<Region> prev = pl->find_next_region (t, End, -1);
if (!prev) {
_drags->set (new RegionCreateDrag (this, item, parent), event);
@@ -1066,7 +1090,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;
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 */
@@ -1085,7 +1109,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
boost::shared_ptr<Playlist> pl = t->playlist ();
if (pl) {
- boost::shared_ptr<Region> r = pl->top_region_at (event_frame (event));
+ boost::shared_ptr<Region> r = pl->top_region_at (canvas_event_frame (event));
if (r) {
RegionView* rv = rtv->view()->find_view (r);
clicked_selection = select_range (rv->region()->position(),
@@ -1095,6 +1119,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;
}
}
}
@@ -1251,9 +1276,9 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case MouseZoom:
if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
- temporal_zoom_to_frame (false, event_frame (event));
+ temporal_zoom_to_frame (false, canvas_event_frame (event));
} else {
- temporal_zoom_to_frame (true, event_frame(event));
+ temporal_zoom_to_frame (true, canvas_event_frame(event));
}
return true;
break;
@@ -1268,11 +1293,16 @@ Editor::button_press_handler_2 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
bool
Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
+ if (event->type == GDK_2BUTTON_PRESS) {
+ _drags->mark_double_click ();
+ return false;
+ }
+
if (event->type != GDK_BUTTON_PRESS) {
return false;
}
- 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_window();
if (canvas_window) {
Glib::RefPtr<const Gdk::Window> pointer_window;
@@ -1282,14 +1312,14 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
pointer_window = canvas_window->get_pointer (x, y, mask);
- if (pointer_window == track_canvas->get_bin_window()) {
- track_canvas->window_to_world (x, y, wx, wy);
+ if (pointer_window == _track_canvas->get_window()) {
+ _track_canvas->window_to_canvas (x, y, wx, wy);
}
}
pre_press_cursor = current_canvas_cursor;
- track_canvas->grab_focus();
+ _track_canvas->grab_focus();
if (_session && _session->actively_recording()) {
return true;
@@ -1346,7 +1376,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
//not rolling, range mode click + join_play_range : locate the PH here
if ( !_drags->active () && !_session->transport_rolling() && ( effective_mouse_mode() == MouseRange ) && Config->get_always_play_range() ) {
- framepos_t where = event_frame (event, 0, 0);
+ framepos_t where = canvas_event_frame (event);
snap_to(where);
_session->request_locate (where, false);
}
@@ -1395,7 +1425,7 @@ Editor::button_release_dispatch (GdkEventButton* ev)
bool
Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
- framepos_t where = event_frame (event, 0, 0);
+ framepos_t where = canvas_event_frame (event);
AutomationTimeAxisView* atv = 0;
if (pre_press_cursor) {
@@ -1422,7 +1452,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
were_dragging = true;
}
- update_region_layering_order_editor ();
+ update_region_layering_order_editor ();
/* edit events get handled here */
@@ -1617,7 +1647,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case MeterBarItem:
if (!_dragging_playhead) {
- mouse_add_new_meter_event (pixel_to_frame (event->button.x));
+ mouse_add_new_meter_event (pixel_to_sample (event->button.x));
}
return true;
break;
@@ -1776,8 +1806,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()->get_canvasvar_EnteredGainLine());
+ }
if (is_drawable()) {
set_canvas_cursor (_cursors->fader);
}
@@ -1788,7 +1819,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_outline_color (ARDOUR_UI::config()->get_canvasvar_EnteredAutomationLine());
}
if (is_drawable()) {
set_canvas_cursor (_cursors->fader);
@@ -1888,7 +1919,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
break;
}
entered_marker = marker;
- marker->set_color_rgba (ARDOUR_UI::config()->canvasvar_EnteredMarker.get());
+ marker->set_color_rgba (ARDOUR_UI::config()->get_canvasvar_EnteredMarker());
// fall through
case MeterMarkerItem:
case TempoMarkerItem:
@@ -1899,9 +1930,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);
}
@@ -1909,19 +1940,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 ();
@@ -2001,8 +2033,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);
@@ -2053,9 +2086,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);
@@ -2071,7 +2104,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()->get_canvasvar_ZeroLine());
}
break;
@@ -2188,7 +2221,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) {
@@ -2487,14 +2520,11 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* /*event*/)
void
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;
-
- zoom_rect->property_x1() = x1;
- zoom_rect->property_y1() = 1.0;
- zoom_rect->property_x2() = x2;
- zoom_rect->property_y2() = y2;
+ double x1 = sample_to_pixel (start);
+ double x2 = sample_to_pixel (end);
+ double y2 = _full_canvas_height - 1.0;
+
+ zoom_rect->set (ArdourCanvas::Rect (x1, 1.0, x2, y2));
}
@@ -2594,9 +2624,6 @@ Editor::add_region_drag (ArdourCanvas::Item* item, GdkEvent*, RegionView* region
} else {
_drags->add (new RegionMoveDrag (this, item, region_view, selection->regions.by_layer(), false, false));
}
-
- /* sync the canvas to what we think is its current state */
- update_canvas_now();
}
void
@@ -2772,7 +2799,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);
if (tvp.first) {
@@ -2781,7 +2808,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);
@@ -2805,7 +2832,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 ());
@@ -2814,20 +2841,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* 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) {
@@ -2845,11 +2878,11 @@ Editor::set_canvas_cursor_for_region_view (double x, RegionView* rv)
}
}
-/** Obtain the pointer position in world coordinates */
+/** Obtain the pointer position in canvas coordinates */
void
Editor::get_pointer_position (double& x, double& y) const
{
int px, py;
- track_canvas->get_pointer (px, py);
- track_canvas->window_to_world (px, py, x, y);
+ _track_canvas->get_pointer (px, py);
+ _track_canvas->window_to_canvas (px, py, x, y);
}
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 93a53dd1d3..e1daeca75c 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,8 +1145,8 @@ Editor::selected_marker_to_selection_end ()
void
Editor::scroll_playhead (bool forward)
{
- framepos_t pos = playhead_cursor->current_frame;
- framecnt_t delta = (framecnt_t) floor (current_page_frames() / 0.8);
+ framepos_t pos = playhead_cursor->current_frame ();
+ framecnt_t delta = (framecnt_t) floor (current_page_samples() / 0.8);
if (forward) {
if (pos == max_framepos) {
@@ -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 * samples_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 * samples_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_samples_per_pixel (framecnt_t& fpp) const
{
bool clamped = false;
- if (fpu < 2.0) {
- fpu = 2.0;
+ if (fpp < 1) {
+ fpp = 1;
clamped = true;
}
- if (max_framepos / fpu < 800) {
- fpu = max_framepos / 800.0;
+ if (max_framepos / fpp < 800) {
+ fpp = max_framepos / 800;
clamped = true;
}
@@ -1351,25 +1353,25 @@ Editor::temporal_zoom_step (bool coarser)
{
ENSURE_GUI_THREAD (*this, &Editor::temporal_zoom_step, coarser)
- double nfpu = frames_per_unit;
+ framecnt_t nspp = samples_per_pixel;
if (coarser) {
- nfpu = min (9e6, nfpu * 1.61803399);
+ nspp *= 2;
} else {
- nfpu = max (1.0, nfpu / 1.61803399);
+ nspp /= 2;
}
- temporal_zoom (nfpu);
+ temporal_zoom (nspp);
}
void
-Editor::temporal_zoom (double fpu)
+Editor::temporal_zoom (framecnt_t fpp)
{
if (!_session) {
return;
}
- framepos_t current_page = current_page_frames();
+ framepos_t current_page = current_page_samples();
framepos_t current_leftmost = leftmost_frame;
framepos_t current_rightmost;
framepos_t current_center;
@@ -1378,24 +1380,22 @@ Editor::temporal_zoom (double fpu)
framepos_t leftmost_after_zoom = 0;
framepos_t where;
bool in_track_canvas;
- double nfpu;
+ framecnt_t nfpp;
double l;
- clamp_frames_per_unit (fpu);
- if (fpu == frames_per_unit) {
+ clamp_samples_per_pixel (fpp);
+ if (fpp == samples_per_pixel) {
return;
}
- nfpu = fpu;
-
// 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;
- }
- new_page_size = (framepos_t) floor (_canvas_width * nfpu);
+ nfpp = min (fpp, (framecnt_t) 8589934592);
+ nfpp = max ((framecnt_t) 1, fpp);
+
+ new_page_size = (framepos_t) floor (_visible_canvas_width * nfpp);
half_page_size = new_page_size / 2;
switch (zoom_focus) {
@@ -1423,7 +1423,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 +1439,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 +1488,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 +1533,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 +1558,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 +1632,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 +1646,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 +1656,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 = samples_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 == samples_per_pixel) {
return;
}
@@ -1682,7 +1682,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 +1847,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 +1863,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;
@@ -1962,22 +1962,19 @@ Editor::unhide_ranges ()
void
Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y)
{
- double wx, wy;
double cx, cy;
framepos_t where;
RouteTimeAxisView *rtv = 0;
boost::shared_ptr<Playlist> playlist;
- track_canvas->window_to_world (x, y, wx, wy);
-
GdkEvent event;
event.type = GDK_BUTTON_RELEASE;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
- where = event_frame (&event, &cx, &cy);
+ where = window_event_frame (&event, &cx, &cy);
- if (where < leftmost_frame || where > leftmost_frame + current_page_frames()) {
+ if (where < leftmost_frame || where > leftmost_frame + current_page_samples()) {
/* clearly outside canvas area */
return;
}
@@ -2007,21 +2004,16 @@ Editor::insert_region_list_drag (boost::shared_ptr<Region> region, int x, int y)
void
Editor::insert_route_list_drag (boost::shared_ptr<Route> route, int x, int y)
{
- double wx, wy;
double cx, cy;
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();
-
GdkEvent event;
event.type = GDK_BUTTON_RELEASE;
- event.button.x = wx;
- event.button.y = wy;
+ event.button.x = x;
+ event.button.y = y;
- event_frame (&event, &cx, &cy);
+ window_event_frame (&event, &cx, &cy);
std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (cy);
if (tv.first == 0) {
@@ -4424,14 +4416,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 * samples_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 * samples_per_pixel;
center_screen_internal (get_preferred_edit_position(), page);
}
@@ -5602,7 +5594,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 ();
@@ -5619,7 +5611,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);
@@ -6367,8 +6359,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);
@@ -6380,8 +6375,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);
@@ -6732,7 +6730,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)) {
@@ -6794,7 +6792,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..10f2c3f5ed 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -518,7 +518,7 @@ EditorRoutes::redisplay ()
/* show or hide the TimeAxisView */
if (visible) {
position += tv->show_at (position, n, &_editor->edit_controls_vbox);
- tv->clip_to_viewport ();
+ // SHOWTRACKS
} else {
tv->hide ();
}
@@ -534,15 +534,14 @@ 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;
- 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);
}
}
@@ -687,7 +686,6 @@ EditorRoutes::handle_gui_changes (string const & what, void*)
/* Optional :make tracks change height while it happens, instead
of on first-idle
*/
- //update_canvas_now ();
redisplay ();
}
@@ -1305,8 +1303,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 a7883674cd..9f6e978dce 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -29,6 +29,9 @@
#include <gtk/gtkaction.h>
+#include "canvas/group.h"
+#include "canvas/canvas.h"
+
#include "ardour/session.h"
#include "ardour/tempo.h"
#include "ardour/profile.h"
@@ -121,7 +124,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();
@@ -168,7 +171,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
@@ -190,7 +192,7 @@ Editor::ruler_scroll (GdkEventScroll* event)
break;
case GDK_SCROLL_LEFT:
- xdelta = (current_page_frames() / 2);
+ xdelta = (current_page_samples() / 2);
if (leftmost_frame > xdelta) {
reset_x_origin (leftmost_frame - xdelta);
} else {
@@ -200,11 +202,11 @@ Editor::ruler_scroll (GdkEventScroll* event)
break;
case GDK_SCROLL_RIGHT:
- xdelta = (current_page_frames() / 2);
+ xdelta = (current_page_samples() / 2);
if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta);
} else {
- reset_x_origin (max_framepos - current_page_frames());
+ reset_x_origin (max_framepos - current_page_samples());
}
handled = true;
break;
@@ -249,8 +251,17 @@ Editor::ruler_button_press (GdkEventButton* ev)
_session->cancel_audition ();
}
- /* playhead cursor */
- _drags->set (new CursorDrag (this, &playhead_cursor->canvas_item, false), reinterpret_cast<GdkEvent *> (ev));
+ /* playhead cursor drag: CursorDrag expects an event with
+ * canvas coordinates, so convert from window coordinates,
+ * since for now, rulers are still Gtk::Widgets.
+ */
+
+ GdkEventButton canvas_ev = *ev;
+ ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (ev->x, ev->y));
+ canvas_ev.x = rint (d.x);
+ canvas_ev.y = rint (d.y);
+
+ _drags->set (new CursorDrag (this, *playhead_cursor, false), reinterpret_cast<GdkEvent *> (&canvas_ev));
_dragging_playhead = true;
}
@@ -264,21 +275,21 @@ Editor::ruler_button_release (GdkEventButton* ev)
return false;
}
- gint x,y;
- Gdk::ModifierType state;
-
if (_drags->active ()) {
- _drags->end_grab (reinterpret_cast<GdkEvent*> (ev));
+ GdkEventButton canvas_ev = *ev;
+ ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (ev->x, ev->y));
+ canvas_ev.x = rint (d.x);
+ canvas_ev.x = rint (d.y);
+ _drags->end_grab (reinterpret_cast<GdkEvent*> (&canvas_ev));
_dragging_playhead = false;
}
if (ev->button == 3) {
- /* need to use the correct x,y, the event lies */
- time_canvas_event_box.get_window()->get_pointer (x, y, state);
-
+
stop_canvas_autoscroll();
- framepos_t where = leftmost_frame + pixel_to_frame (x);
+ framepos_t where = window_event_frame ((GdkEvent*) ev);
+
snap_to (where);
popup_ruler_menu (where);
}
@@ -313,7 +324,7 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
}
if (_drags->active ()) {
- _drags->motion_handler (reinterpret_cast<GdkEvent*> (ev), false);
+ _drags->window_motion_handler (reinterpret_cast<GdkEvent*> (ev), false);
}
return true;
@@ -645,13 +656,13 @@ Editor::update_ruler_visibility ()
videotl_label.hide();
#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();
@@ -666,13 +677,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();
@@ -687,13 +698,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();
@@ -709,13 +720,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();
@@ -730,13 +741,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();
@@ -755,13 +766,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();
@@ -776,15 +787,15 @@ Editor::update_ruler_visibility ()
}
if (ruler_video_action->get_active()) {
- old_unit_pos = videotl_group->property_y();
+ old_unit_pos = videotl_group->position().y;
if (tbpos != old_unit_pos) {
- videotl_group->move ( 0.0, tbpos - old_unit_pos);
+ videotl_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
}
- old_unit_pos = videotl_bar_group->property_y();
+ old_unit_pos = videotl_group->position().y;
if (tbgpos != old_unit_pos) {
- videotl_bar_group->move ( 0.0, tbgpos - old_unit_pos);
+ videotl_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
}
- videotl_bar_group->show();
+ videotl_group->show();
videotl_group->show();
videotl_label.show();
tbpos += timebar_height * videotl_bar_height;
@@ -792,35 +803,12 @@ Editor::update_ruler_visibility ()
visible_timebars+=videotl_bar_height;
queue_visual_videotimeline_update();
} else {
- videotl_bar_group->hide();
+ videotl_group->hide();
videotl_group->hide();
videotl_label.hide();
update_video_timeline(true);
}
- 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);
@@ -843,7 +831,7 @@ Editor::update_just_timecode ()
return;
}
- framepos_t rightmost_frame = leftmost_frame + current_page_frames();
+ framepos_t rightmost_frame = leftmost_frame + current_page_samples();
if (ruler_timecode_action->get_active()) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_timecode_ruler), leftmost_frame, rightmost_frame,
@@ -859,15 +847,15 @@ Editor::compute_fixed_ruler_scale ()
}
if (ruler_timecode_action->get_active()) {
- set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
+ set_timecode_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
}
if (ruler_minsec_action->get_active()) {
- set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
+ set_minsec_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
}
if (ruler_samples_action->get_active()) {
- set_samples_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
+ set_samples_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
}
}
@@ -882,11 +870,11 @@ 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 = samples_per_pixel;
+ ruler_metrics[ruler_metric_samples].units_per_pixel = samples_per_pixel;
+ ruler_metrics[ruler_metric_minsec].units_per_pixel = samples_per_pixel;
- rightmost_frame = leftmost_frame + current_page_frames();
+ rightmost_frame = leftmost_frame + current_page_samples();
/* these force a redraw, which in turn will force execution of the metric callbacks
to compute the relevant ticks to display.
@@ -916,13 +904,13 @@ Editor::update_tempo_based_rulers (ARDOUR::TempoMap::BBTPointList::const_iterato
return;
}
- compute_bbt_ruler_scale (leftmost_frame, leftmost_frame+current_page_frames(),
+ compute_bbt_ruler_scale (leftmost_frame, leftmost_frame+current_page_samples(),
begin, end);
- ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_unit;
+ ruler_metrics[ruler_metric_bbt].units_per_pixel = samples_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(),
+ gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_samples(),
leftmost_frame, _session->current_end_frame());
}
}
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index e19afe375c..065cfdbcba 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);
}
}
@@ -1677,12 +1677,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 0dc728d18e..1c30df4f3a 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");
}
}
@@ -432,11 +436,11 @@ EditorSummary::get_editor (pair<double, double>* x, pair<double, double>* y) con
/* Otherwise query the editor for its actual position */
- x->first = (_editor->leftmost_position () - _start) * _x_scale;
- x->second = x->first + _editor->current_page_frames() * _x_scale;
+ x->first = (_editor->leftmost_sample () - _start) * _x_scale;
+ x->second = x->first + _editor->current_page_samples() * _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());
}
}
@@ -686,7 +690,7 @@ 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) {
+ if (_editor->pending_visual_change.idle_handler_id >= 0 && _editor->pending_visual_change.being_handled == true) {
/* As a side-effect, the Editor's visual change idle handler processes
pending GTK events. Hence this motion notify handler can be called
@@ -784,7 +788,7 @@ EditorSummary::set_editor_x (pair<double, double> x)
double const nx = (
((x.second - x.first) / _x_scale) /
- _editor->frame_to_unit (_editor->current_page_frames())
+ _editor->sample_to_pixel (_editor->current_page_samples())
);
if (nx != _editor->get_current_zoom ()) {
@@ -801,10 +805,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;
@@ -881,7 +885,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 488b804d65..b997d3bb5d 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"
@@ -85,7 +85,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) {
snprintf (buf, sizeof(buf), "%g/%g", ms->divisions_per_bar(), ms->note_divisor ());
- metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), buf,
+ metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->get_canvasvar_MeterMarker(), buf,
*(const_cast<MeterSection*>(ms))));
} else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) {
if (Config->get_allow_non_quarter_pulse()) {
@@ -93,7 +93,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
} else {
snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute());
}
- metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), buf,
+ metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->get_canvasvar_TempoMarker(), buf,
*(const_cast<TempoSection*>(ts))));
}
@@ -117,9 +117,9 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/)
ARDOUR::TempoMap::BBTPointList::const_iterator begin;
ARDOUR::TempoMap::BBTPointList::const_iterator end;
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), begin, end);
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end);
_session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers
- redraw_measures ();
+ draw_measures (begin, end);
update_tempo_based_rulers (begin, end);
}
@@ -130,22 +130,18 @@ Editor::redisplay_tempo (bool immediate_redraw)
return;
}
- ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
- ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
-
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(),
- current_bbt_points_begin, current_bbt_points_end);
-
if (immediate_redraw) {
- redraw_measures ();
+ ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin;
+ ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end;
+
+ compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(),
+ current_bbt_points_begin, current_bbt_points_end);
+ draw_measures (current_bbt_points_begin, current_bbt_points_end);
+ update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end); // redraw rulers and measures
+
} else {
-#ifdef GTKOSX
- redraw_measures ();
-#else
- Glib::signal_idle().connect (sigc::mem_fun (*this, &Editor::redraw_measures));
-#endif
+ Glib::signal_idle().connect (sigc::bind_return (sigc::bind (sigc::mem_fun (*this, &Editor::redisplay_tempo), true), false));
}
- update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end); // redraw rulers and measures
}
void
@@ -166,20 +162,9 @@ Editor::compute_current_bbt_points (framepos_t leftmost, framepos_t rightmost,
void
Editor::hide_measures ()
{
- if (tempo_lines)
+ if (tempo_lines) {
tempo_lines->hide();
-}
-
-bool
-Editor::redraw_measures ()
-{
- ARDOUR::TempoMap::BBTPointList::const_iterator begin;
- ARDOUR::TempoMap::BBTPointList::const_iterator end;
-
- compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), begin, end);
- draw_measures (begin, end);
-
- return false;
+ }
}
void
@@ -191,10 +176,10 @@ 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, ArdourCanvas::COORD_MAX);
}
-
- tempo_lines->draw (begin, end, frames_per_unit);
+
+ tempo_lines->draw (begin, end, samples_per_pixel);
}
void
diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc
index ce373f0406..1da9fb4f19 100644
--- a/gtk2_ardour/editor_videotimeline.cc
+++ b/gtk2_ardour/editor_videotimeline.cc
@@ -29,8 +29,7 @@
#include "ardour_ui.h"
#include "editor.h"
-#include "simplerect.h"
-#include "canvas_impl.h"
+#include "canvas/rectangle.h"
#include "editing.h"
#include "audio_time_axis.h"
#include "video_image_frame.h"
@@ -49,9 +48,7 @@ Editor::set_video_timeline_height (const int h)
if (videotl_bar_height == h) { return; }
if (h < 2 || h > 8) { return; }
videotl_bar_height = h;
- const double nh = (videotl_bar_height * timebar_height - ((ARDOUR::Profile->get_sae())?1.0:0.0));
videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
- videotl_bar->property_y2().set_value(nh);
ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
update_ruler_visibility();
}
@@ -59,16 +56,6 @@ Editor::set_video_timeline_height (const int h)
void
Editor::update_video_timeline (bool flush)
{
-#if DEBUG
- framepos_t rightmost_frame = leftmost_frame + current_page_frames();
- std::cout << "VIDEO SCROLL: " << leftmost_frame << " -- " << rightmost_frame << std::endl;
- std::cout << "SCROLL UNITS: " << frame_to_unit(leftmost_frame) << " -- " << frame_to_unit(rightmost_frame)
- << " = " << frame_to_unit(rightmost_frame) - frame_to_unit(leftmost_frame)
- << std::endl;
-#endif
-
- // TODO later: make this a list for mult. video tracks
- // also modify ardour_ui_dialogs.cc : set_session()
if (flush) {
ARDOUR_UI::instance()->video_timeline->flush_local_cache();
}
@@ -142,10 +129,6 @@ Editor::export_video ()
}
ExportVideoDialog dialog (_session, get_selection().time);
Gtk::ResponseType r = (Gtk::ResponseType) dialog.run();
+ (void) r; // keep gcc quiet
dialog.hide();
-#if 0
- if (r == Gtk::RESPONSE_ACCEPT) {
- ARDOUR_UI::instance()->popup_error(string_compose(_("Export Successful: %1"),dialog.get_exported_filename()));
- }
-#endif
}
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/gain_meter.cc b/gtk2_ardour/gain_meter.cc
index f9ab062750..edf07a13a5 100644
--- a/gtk2_ardour/gain_meter.cc
+++ b/gtk2_ardour/gain_meter.cc
@@ -144,7 +144,7 @@ void
GainMeterBase::set_flat_buttons ()
{
printf("set_flat_butt\n");
-// gain_slider->set_flat_buttons( ARDOUR_UI::config()->flat_buttons.get() );
+// gain_slider->set_flat_buttons( ARDOUR_UI::config()->get_flat_buttons() );
}
GainMeterBase::~GainMeterBase ()
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc
index 83f091a1e0..ab22d97221 100644
--- a/gtk2_ardour/generic_pluginui.cc
+++ b/gtk2_ardour/generic_pluginui.cc
@@ -675,8 +675,8 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat
0xcccc00ff, 0xcccc00ff,
0xffaa00ff, 0xffaa00ff,
0xff0000ff,
- ARDOUR_UI::config()->canvasvar_MeterBackgroundBot.get(),
- ARDOUR_UI::config()->canvasvar_MeterBackgroundTop.get()
+ ARDOUR_UI::config()->get_canvasvar_MeterBackgroundBot(),
+ ARDOUR_UI::config()->get_canvasvar_MeterBackgroundTop()
);
info->min_unbound = desc.min_unbound;
diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc
index 31e6de390b..5350a0e459 100644
--- a/gtk2_ardour/ghostregion.cc
+++ b/gtk2_ardour/ghostregion.cc
@@ -18,15 +18,18 @@
*/
#include "evoral/Note.hpp"
+#include "canvas/group.h"
+#include "canvas/rectangle.h"
+#include "canvas/wave_view.h"
+#include "canvas/debug.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 +42,16 @@ 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);
+ CANVAS_DEBUG_NAME (group, "ghost region group");
+ 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);
+ CANVAS_DEBUG_NAME (base_rect, "ghost region rect");
+ 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 +74,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()->get_canvasvar_GhostTrackBase());
+ base_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_GhostTrackBase());
}
}
@@ -108,28 +112,26 @@ AudioGhostRegion::AudioGhostRegion(TimeAxisView& tv, TimeAxisView& source_tv, do
}
void
-AudioGhostRegion::set_samples_per_unit (double spu)
+AudioGhostRegion::set_samples_per_pixel (double fpp)
{
for (vector<WaveView*>::iterator i = waves.begin(); i != waves.end(); ++i) {
- (*i)->property_samples_per_unit() = spu;
+ (*i)->set_samples_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);
}
}
@@ -140,17 +142,17 @@ AudioGhostRegion::set_colors ()
guint fill_color;
if (is_automation_ghost()) {
- fill_color = ARDOUR_UI::config()->canvasvar_GhostTrackWaveFill.get();
+ fill_color = ARDOUR_UI::config()->get_canvasvar_GhostTrackWaveFill();
}
else {
fill_color = source_track_color(200);
}
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]->property_clip_color() = ARDOUR_UI::config()->canvasvar_GhostTrackWaveClip.get();
- waves[n]->property_zero_color() = ARDOUR_UI::config()->canvasvar_GhostTrackZeroLine.get();
+ waves[n]->set_outline_color (ARDOUR_UI::config()->get_canvasvar_GhostTrackWave());
+ waves[n]->set_fill_color (fill_color);
+ waves[n]->set_clip_color (ARDOUR_UI::config()->get_canvasvar_GhostTrackWaveClip());
+ waves[n]->set_zero_color (ARDOUR_UI::config()->get_canvasvar_GhostTrackZeroLine());
}
}
@@ -189,20 +191,21 @@ MidiGhostRegion::~MidiGhostRegion()
clear_events ();
}
-MidiGhostRegion::Event::Event (ArdourCanvas::CanvasNoteEvent* e, ArdourCanvas::Group* g)
+MidiGhostRegion::GhostEvent::GhostEvent (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, ArdourCanvas::Rect (e->x0(), e->y0(), e->x1(), e->y1()));
+ CANVAS_DEBUG_NAME (rect, "ghost note rect");
}
-MidiGhostRegion::Event::~Event ()
+MidiGhostRegion::GhostEvent::~GhostEvent ()
{
/* event is not ours to delete */
delete rect;
}
void
-MidiGhostRegion::set_samples_per_unit (double /*spu*/)
+MidiGhostRegion::set_samples_per_pixel (double /*spu*/)
{
}
@@ -233,8 +236,8 @@ MidiGhostRegion::set_colors()
GhostRegion::set_colors();
for (EventList::iterator it = events.begin(); it != events.end(); ++it) {
- (*it)->rect->property_fill_color_rgba() = fill;
- (*it)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get();
+ (*it)->rect->set_fill_color (fill);
+ (*it)->rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_GhostTrackMidiOutline());
}
}
@@ -257,20 +260,20 @@ MidiGhostRegion::update_range ()
} else {
(*it)->rect->show();
double const y = trackview.current_height() - (note_num + 1 - mv->lowest_note()) * h + 1;
- (*it)->rect->property_y1() = y;
- (*it)->rect->property_y2() = y + h;
+ (*it)->rect->set_y0 (y);
+ (*it)->rect->set_y1 (y + h);
}
}
}
void
-MidiGhostRegion::add_note(ArdourCanvas::CanvasNote* n)
+MidiGhostRegion::add_note (NoteBase* n)
{
- Event* event = new Event (n, group);
+ GhostEvent* event = new GhostEvent (n, group);
events.push_back (event);
- event->rect->property_fill_color_rgba() = source_track_color(200);
- event->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_GhostTrackMidiOutline.get();
+ event->rect->set_fill_color (source_track_color(200));
+ event->rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_GhostTrackMidiOutline());
MidiStreamView* mv = midi_view();
@@ -281,8 +284,8 @@ MidiGhostRegion::add_note(ArdourCanvas::CanvasNote* n)
event->rect->hide();
} else {
const double y = mv->note_to_y(note_num);
- event->rect->property_y1() = y;
- event->rect->property_y2() = y + mv->note_height();
+ event->rect->set_y0 (y);
+ event->rect->set_y1 (y + mv->note_height());
}
}
}
@@ -302,23 +305,23 @@ MidiGhostRegion::clear_events()
* @param parent The CanvasNote from the parent MidiRegionView.
*/
void
-MidiGhostRegion::update_note (ArdourCanvas::CanvasNote* parent)
+MidiGhostRegion::update_note (NoteBase* parent)
{
- Event* ev = find_event (parent);
+ GhostEvent* 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
-MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
+MidiGhostRegion::remove_note (NoteBase* note)
{
- Event* ev = find_event (note);
+ GhostEvent* ev = find_event (note);
if (!ev) {
return;
}
@@ -333,8 +336,8 @@ MidiGhostRegion::remove_note (ArdourCanvas::CanvasNoteEvent* note)
* @return Our Event, or 0 if not found.
*/
-MidiGhostRegion::Event *
-MidiGhostRegion::find_event (ArdourCanvas::CanvasNoteEvent* parent)
+MidiGhostRegion::GhostEvent *
+MidiGhostRegion::find_event (NoteBase* 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..e8271a8ad8 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_samples_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_samples_per_pixel (double);
void set_height();
void set_colors();
@@ -75,13 +71,13 @@ public:
class MidiGhostRegion : public GhostRegion {
public:
- class Event : public sigc::trackable {
- public:
- Event(ArdourCanvas::CanvasNoteEvent *, ArdourCanvas::Group *);
- ~Event ();
-
- ArdourCanvas::CanvasNoteEvent* event;
- ArdourCanvas::SimpleRect* rect;
+ class GhostEvent : public sigc::trackable {
+ public:
+ GhostEvent(::NoteBase *, ArdourCanvas::Group *);
+ virtual ~GhostEvent ();
+
+ 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_samples_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(NoteBase*);
+ void update_note (NoteBase*);
+ void remove_note (NoteBase*);
void clear_events();
private:
- MidiGhostRegion::Event* find_event (ArdourCanvas::CanvasNoteEvent *);
+ MidiGhostRegion::GhostEvent* find_event (NoteBase*);
- typedef std::list<MidiGhostRegion::Event*> EventList;
+ typedef std::list<MidiGhostRegion::GhostEvent*> EventList;
EventList events;
EventList::iterator _optimization_iterator;
};
diff --git a/gtk2_ardour/gtk_pianokeyboard.c b/gtk2_ardour/gtk_pianokeyboard.c
index 1e5768040e..5101bd8aff 100644
--- a/gtk2_ardour/gtk_pianokeyboard.c
+++ b/gtk2_ardour/gtk_pianokeyboard.c
@@ -244,7 +244,7 @@ bind_key(PianoKeyboard *pk, const char *key, int note)
{
assert(pk->key_bindings != NULL);
- g_hash_table_insert(pk->key_bindings, (gpointer)key, (gpointer)((intptr_t)note));
+ g_hash_table_insert(pk->key_bindings, key, (gpointer)((intptr_t)note));
}
static void
@@ -360,6 +360,8 @@ keyboard_event_handler(GtkWidget *mk, GdkEventKey *event, gpointer ignored)
GdkKeymapKey kk;
PianoKeyboard *pk = PIANO_KEYBOARD(mk);
+ (void) ignored;
+
/* We're not using event->keyval, because we need keyval with level set to 0.
E.g. if user holds Shift and presses '7', we want to get a '7', not '&'. */
kk.keycode = event->hardware_keycode;
@@ -440,6 +442,8 @@ mouse_button_event_handler(PianoKeyboard *pk, GdkEventButton *event, gpointer ig
int note = get_note_for_xy(pk, x, y);
+ (void) ignored;
+
if (event->button != 1)
return TRUE;
@@ -477,6 +481,8 @@ mouse_motion_event_handler(PianoKeyboard *pk, GdkEventMotion *event, gpointer ig
{
int note;
+ (void) ignored;
+
if ((event->state & GDK_BUTTON1_MASK) == 0)
return TRUE;
@@ -529,6 +535,8 @@ piano_keyboard_expose(GtkWidget *widget, GdkEventExpose *event)
static void
piano_keyboard_size_request(GtkWidget* w, GtkRequisition *requisition)
{
+ (void) w;
+
requisition->width = PIANO_KEYBOARD_DEFAULT_WIDTH;
requisition->height = PIANO_KEYBOARD_DEFAULT_HEIGHT;
}
diff --git a/gtk2_ardour/hit.cc b/gtk2_ardour/hit.cc
new file mode 100644
index 0000000000..257a3cd4f0
--- /dev/null
+++ b/gtk2_ardour/hit.cc
@@ -0,0 +1,114 @@
+/*
+ Copyright (C) 2007 Paul Davis
+ Author: Dave 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 "evoral/Note.hpp"
+#include "canvas/polygon.h"
+#include "midi_region_view.h"
+#include "public_editor.h"
+#include "utils.h"
+#include "hit.h"
+
+using namespace ARDOUR;
+using namespace ArdourCanvas;
+
+Hit::Hit (
+ MidiRegionView& region,
+ Group* group,
+ double /*size*/,
+ const boost::shared_ptr<NoteType> note,
+ bool with_events)
+ : NoteBase (region, with_events, note)
+{
+ _polygon = new Polygon (group);
+ set_item (_polygon);
+}
+
+void
+Hit::move_event (double dx, double dy)
+{
+ _polygon->move (Duple (dx, dy));
+}
+
+Coord
+Hit::x0 () const
+{
+ boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
+ assert (bbox);
+ return bbox.get().x0;
+}
+
+Coord
+Hit::x1 () const
+{
+ boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
+ assert (bbox);
+ return bbox.get().x1;
+}
+
+Coord
+Hit::y0 () const
+{
+ boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
+ assert (bbox);
+ return bbox.get().y0;
+}
+
+Coord
+Hit::y1 () const
+{
+ boost::optional<ArdourCanvas::Rect> bbox = _polygon->bounding_box ();
+ assert (bbox);
+ return bbox.get().y1;
+}
+
+void
+Hit::set_outline_color (uint32_t color)
+{
+ _polygon->set_outline_color (color);
+}
+
+void
+Hit::set_fill_color (uint32_t color)
+{
+ _polygon->set_fill_color (color);
+}
+
+void
+Hit::show ()
+{
+ _polygon->show ();
+}
+
+void
+Hit::hide ()
+{
+ _polygon->hide ();
+}
+
+void
+Hit::set_height (Distance /*height*/)
+{
+ /* XXX */
+}
+
+void
+Hit::set_position (Duple position)
+{
+ _polygon->set_position (position);
+}
diff --git a/gtk2_ardour/hit.h b/gtk2_ardour/hit.h
new file mode 100644
index 0000000000..3afdd91367
--- /dev/null
+++ b/gtk2_ardour/hit.h
@@ -0,0 +1,63 @@
+/*
+ Copyright (C) 2007 Paul Davis
+ Author: Dave 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_hit_h__
+#define __gtk_ardour_hit_h__
+
+#include <iostream>
+#include "note_base.h"
+
+namespace ArdourCanvas {
+ class Polygon;
+}
+
+class Hit : public NoteBase
+{
+public:
+ typedef Evoral::Note<double> NoteType;
+
+ Hit (
+ MidiRegionView& region,
+ ArdourCanvas::Group* group,
+ double size,
+ const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>(),
+ bool with_events = true);
+
+ void show ();
+ void hide ();
+
+ ArdourCanvas::Coord x0 () const;
+ ArdourCanvas::Coord y0 () const;
+ ArdourCanvas::Coord x1 () const;
+ ArdourCanvas::Coord y1 () const;
+
+ void set_position (ArdourCanvas::Duple);
+
+ void set_height (ArdourCanvas::Coord);
+
+ void set_outline_color (uint32_t);
+ void set_fill_color (uint32_t);
+
+ void move_event (double, double);
+
+private:
+ ArdourCanvas::Polygon* _polygon;
+};
+
+#endif /* __gtk_ardour_hit_h__ */
diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc
index bf9823518b..194e446115 100644
--- a/gtk2_ardour/level_meter.cc
+++ b/gtk2_ardour/level_meter.cc
@@ -266,36 +266,36 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
uint32_t b[4];
float stp[4];
int styleflags = Config->get_meter_style_led() ? 3 : 1;
- b[0] = ARDOUR_UI::config()->canvasvar_MeterBackgroundBot.get();
- b[1] = ARDOUR_UI::config()->canvasvar_MeterBackgroundTop.get();
+ b[0] = ARDOUR_UI::config()->get_canvasvar_MeterBackgroundBot();
+ b[1] = ARDOUR_UI::config()->get_canvasvar_MeterBackgroundTop();
b[2] = 0x991122ff; // red highlight gradient Bot
b[3] = 0x551111ff; // red highlight gradient Top
if (n < nmidi) {
- c[0] = ARDOUR_UI::config()->canvasvar_MidiMeterColor0.get();
- c[1] = ARDOUR_UI::config()->canvasvar_MidiMeterColor1.get();
- c[2] = ARDOUR_UI::config()->canvasvar_MidiMeterColor2.get();
- c[3] = ARDOUR_UI::config()->canvasvar_MidiMeterColor3.get();
- c[4] = ARDOUR_UI::config()->canvasvar_MidiMeterColor4.get();
- c[5] = ARDOUR_UI::config()->canvasvar_MidiMeterColor5.get();
- c[6] = ARDOUR_UI::config()->canvasvar_MidiMeterColor6.get();
- c[7] = ARDOUR_UI::config()->canvasvar_MidiMeterColor7.get();
- c[8] = ARDOUR_UI::config()->canvasvar_MidiMeterColor8.get();
- c[9] = ARDOUR_UI::config()->canvasvar_MidiMeterColor9.get();
+ c[0] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor0();
+ c[1] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor1();
+ c[2] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor2();
+ c[3] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor3();
+ c[4] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor4();
+ c[5] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor5();
+ c[6] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor6();
+ c[7] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor7();
+ c[8] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor8();
+ c[9] = ARDOUR_UI::config()->get_canvasvar_MidiMeterColor9();
stp[0] = 115.0 * 32.0 / 128.0;
stp[1] = 115.0 * 64.0 / 128.0;
stp[2] = 115.0 * 100.0 / 128.0;
stp[3] = 115.0 * 112.0 / 128.0;
} else {
- c[0] = ARDOUR_UI::config()->canvasvar_MeterColor0.get();
- c[1] = ARDOUR_UI::config()->canvasvar_MeterColor1.get();
- c[2] = ARDOUR_UI::config()->canvasvar_MeterColor2.get();
- c[3] = ARDOUR_UI::config()->canvasvar_MeterColor3.get();
- c[4] = ARDOUR_UI::config()->canvasvar_MeterColor4.get();
- c[5] = ARDOUR_UI::config()->canvasvar_MeterColor5.get();
- c[6] = ARDOUR_UI::config()->canvasvar_MeterColor6.get();
- c[7] = ARDOUR_UI::config()->canvasvar_MeterColor7.get();
- c[8] = ARDOUR_UI::config()->canvasvar_MeterColor8.get();
- c[9] = ARDOUR_UI::config()->canvasvar_MeterColor9.get();
+ c[0] = ARDOUR_UI::config()->get_canvasvar_MeterColor0();
+ c[1] = ARDOUR_UI::config()->get_canvasvar_MeterColor1();
+ c[2] = ARDOUR_UI::config()->get_canvasvar_MeterColor2();
+ c[3] = ARDOUR_UI::config()->get_canvasvar_MeterColor3();
+ c[4] = ARDOUR_UI::config()->get_canvasvar_MeterColor4();
+ c[5] = ARDOUR_UI::config()->get_canvasvar_MeterColor5();
+ c[6] = ARDOUR_UI::config()->get_canvasvar_MeterColor6();
+ c[7] = ARDOUR_UI::config()->get_canvasvar_MeterColor7();
+ c[8] = ARDOUR_UI::config()->get_canvasvar_MeterColor8();
+ c[9] = ARDOUR_UI::config()->get_canvasvar_MeterColor9();
switch (meter_type) {
case MeterK20:
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/marker.cc b/gtk2_ardour/marker.cc
index 2492d1a348..652a43657e 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -20,6 +20,14 @@
#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/text.h"
+#include "canvas/canvas.h"
+#include "canvas/debug.h"
+
#include "ardour_ui.h"
/*
* ardour_ui.h include was moved to the top of the list
@@ -30,9 +38,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>
@@ -50,12 +55,12 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
: editor (ed)
, _parent (&parent)
- , _line (0)
+ , _time_bars_line (0)
+ , _track_canvas_line (0)
, _type (type)
, _selected (false)
, _shown (false)
, _line_shown (false)
- , _canvas_height (0)
, _color (rgba)
, _left_label_limit (DBL_MAX)
, _right_label_limit (DBL_MAX)
@@ -134,12 +139,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 +154,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 +169,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 +181,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 +192,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 +203,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 +214,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 +225,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;
@@ -232,20 +237,26 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
}
frame_position = frame;
- unit_position = editor.frame_to_unit (frame);
+ unit_position = editor.sample_to_pixel (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
/* adjust to properly locate the tip */
- mark = new ArdourCanvas::Polygon (*group);
- mark->property_points() = *points;
+ mark = new ArdourCanvas::Polygon (group);
+ CANVAS_DEBUG_NAME (mark, string_compose ("Marker::mark for %1", annotation));
+
+ mark->set (*points);
set_color_rgba (rgba);
- mark->property_width_pixels() = 1;
/* setup name pixbuf sizes */
name_font = get_font_for_style (N_("MarkerText"));
@@ -257,37 +268,42 @@ 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_item = new ArdourCanvas::Text (group);
+ CANVAS_DEBUG_NAME (_name_item, string_compose ("Marker::_name_item for %1", annotation));
+ _name_item->set_font_description (name_font);
+ _name_item->set_color (RGBA_TO_UINT (0,0,0,255));
+ _name_item->set_position (ArdourCanvas::Duple (_label_offset, (13.0 / 2.0) - (name_height / 2.0) - 2.0));
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);
+ /* events will be handled by both the group and the mark itself, so
+ * make sure they can both be used to lookup this object.
+ */
+ group->set_data ("marker", this);
+ mark->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));
}
-
}
-
Marker::~Marker ()
{
CatchDeletion (this); /* EMIT SIGNAL */
/* destroying the parent group destroys its contents, namely any polygons etc. that we added */
delete group;
- delete _line;
+ delete _time_bars_line;
+ delete _track_canvas_line;
}
void Marker::reparent(ArdourCanvas::Group & parent)
{
- group->reparent (parent);
+ group->reparent (&parent);
_parent = &parent;
}
@@ -310,32 +326,41 @@ Marker::setup_line ()
{
if (_shown && (_selected || _line_shown)) {
- if (_line == 0) {
+ if (_time_bars_line == 0) {
- _line = new ArdourCanvas::SimpleLine (*group);
- _line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
-
- _line->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
+ _time_bars_line = new ArdourCanvas::Line (editor.get_time_bars_group());
+ _time_bars_line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_EditPoint());
+ _time_bars_line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
+
+ _track_canvas_line = new ArdourCanvas::Line (editor.get_track_canvas_group());
+ _track_canvas_line->set_outline_color (ARDOUR_UI::config()->get_canvasvar_EditPoint());
+ _track_canvas_line->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_marker_event), group, this));
}
- /* work out where to start the line from so that it extends from the top of the canvas */
- double yo = 0;
- double xo = 0;
-
- _line->i2w (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->property_color_rgba() = _selected ? ARDOUR_UI::config()->canvasvar_EditPoint.get() : _color;
- _line->raise_to_top ();
- _line->show ();
+ ArdourCanvas::Duple g = group->item_to_canvas (ArdourCanvas::Duple (0, 0));
+ ArdourCanvas::Duple d = _time_bars_line->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0));
+
+ _time_bars_line->set_x0 (d.x);
+ _time_bars_line->set_x1 (d.x);
+ _time_bars_line->set_y0 (d.y);
+ _time_bars_line->set_y1 (ArdourCanvas::COORD_MAX);
+ _time_bars_line->set_outline_color (_selected ? ARDOUR_UI::config()->get_canvasvar_EditPoint() : _color);
+ _time_bars_line->raise_to_top ();
+ _time_bars_line->show ();
+
+ d = _track_canvas_line->canvas_to_item (ArdourCanvas::Duple (g.x + _shift, 0));
+ _track_canvas_line->set_x0 (d.x);
+ _track_canvas_line->set_x1 (d.x);
+ _track_canvas_line->set_y0 (d.y);
+ _track_canvas_line->set_y1 (ArdourCanvas::COORD_MAX);
+ _track_canvas_line->set_outline_color (_selected ? ARDOUR_UI::config()->get_canvasvar_EditPoint() : _color);
+ _track_canvas_line->raise_to_top ();
+ _track_canvas_line->show ();
} else {
- if (_line) {
- _line->hide ();
+ if (_time_bars_line) {
+ _time_bars_line->hide ();
+ _track_canvas_line->hide ();
}
}
}
@@ -350,7 +375,7 @@ Marker::canvas_height_set (double h)
ArdourCanvas::Item&
Marker::the_item() const
{
- return *mark;
+ return *group;
}
void
@@ -381,36 +406,39 @@ Marker::setup_name_display ()
/* Work out how wide the name can be */
int name_width = min ((double) pixel_width (_name, name_font) + 2, limit);
+
if (name_width == 0) {
name_width = 1;
}
if (label_on_left ()) {
- name_pixbuf->property_x() = -name_width;
+ _name_item->set_x_position (-name_width);
}
- name_pixbuf->property_pixbuf() = pixbuf_from_string (_name, name_font, name_width, name_height, Gdk::Color ("#000000"));
+ _name_item->set (_name);
+
+ // CAIROCANVAS
+ // need to "clip" name to name_width and name_height
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_item->position().x - 2);
+ _name_background->set_x1 (_name_item->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->set_x0 (_name_item->position().x - _label_offset + 2);
+ _name_background->set_x1 (_name_item->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.sample_to_pixel (frame) - _shift;
+ group->set_x_position (unit_position);
+ setup_line ();
frame_position = frame;
- unit_position = new_unit_position;
}
void
@@ -441,16 +469,17 @@ 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;
+ if (_time_bars_line && !_selected) {
+ _time_bars_line->set_outline_color (_color);
+ _track_canvas_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 +520,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), group, this));
}
TempoMarker::~TempoMarker ()
@@ -506,7 +535,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), group, this));
}
MeterMarker::~MeterMarker ()
diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h
index 6bf6d08f51..b3a85294ea 100644
--- a/gtk2_ardour/marker.h
+++ b/gtk2_ardour/marker.h
@@ -23,13 +23,13 @@
#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/fwd.h"
+#include "canvas/types.h"
namespace ARDOUR {
class TempoSection;
@@ -101,11 +101,11 @@ class Marker : public sigc::trackable
ArdourCanvas::Group* _parent;
ArdourCanvas::Group *group;
ArdourCanvas::Polygon *mark;
- ArdourCanvas::Pixbuf *name_pixbuf;
+ ArdourCanvas::Text *_name_item;
ArdourCanvas::Points *points;
- ArdourCanvas::SimpleLine* _line;
- ArdourCanvas::Points *line_points;
- ArdourCanvas::SimpleRect* _name_background;
+ ArdourCanvas::Line* _time_bars_line;
+ ArdourCanvas::Line* _track_canvas_line;
+ ArdourCanvas::Rectangle* _name_background;
std::string _name;
double unit_position;
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 9925a52c5c..d681bb43de 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/debug.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,18 +67,21 @@
#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"
using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
-using namespace ArdourCanvas;
using Gtkmm2ext::Keyboard;
PBD::Signal1<void, MidiRegionView *> MidiRegionView::SelectionCleared;
@@ -93,7 +94,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)
@@ -113,6 +114,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
, pre_press_cursor (0)
, _note_player (0)
{
+ CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
_note_group->raise_to_top();
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
@@ -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)
@@ -149,7 +151,9 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
, pre_press_cursor (0)
, _note_player (0)
{
+ CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
_note_group->raise_to_top();
+
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
connect_to_diskstream ();
@@ -173,7 +177,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 +211,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,10 +245,10 @@ 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::NoteBaseDeleted.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,8 +279,6 @@ 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);
-
midi_view()->midi_track()->PlaybackChannelModeChanged.connect (_channel_mode_changed_connection, invalidator (*this),
boost::bind (&MidiRegionView::midi_channel_mode_changed, this),
@@ -318,7 +320,7 @@ MidiRegionView::connect_to_diskstream ()
}
bool
-MidiRegionView::canvas_event(GdkEvent* ev)
+MidiRegionView::canvas_group_event(GdkEvent* ev)
{
bool r;
@@ -384,7 +386,7 @@ MidiRegionView::canvas_event(GdkEvent* ev)
break;
}
- return false;
+ return trackview.editor().canvas_region_view_event (ev, group, this);
}
void
@@ -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,10 +528,10 @@ 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));
+ Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_sample (event_x));
if (!success) {
beats = 1;
@@ -540,7 +542,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
*/
beats -= 1.0 / Timecode::BBT_Time::ticks_per_beat;
- create_note_at (editor.pixel_to_frame (event_x), event_y, beats, true);
+ create_note_at (editor.pixel_to_sample (event_x), event_y, beats, true);
}
break;
@@ -548,7 +550,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
case MouseDraw:
{
bool success;
- Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_frame (event_x));
+ Evoral::MusicalTime beats = editor.get_grid_type_as_beats (success, editor.pixel_to_sample (event_x));
if (!success) {
beats = 1;
@@ -559,7 +561,7 @@ MidiRegionView::button_release (GdkEventButton* ev)
*/
beats -= 1.0 / Timecode::BBT_Time::ticks_per_beat;
- create_note_at (editor.pixel_to_frame (event_x), event_y, beats, true);
+ create_note_at (editor.pixel_to_sample (event_x), event_y, beats, true);
break;
}
@@ -625,7 +627,6 @@ MidiRegionView::motion (GdkEventMotion* ev)
MouseMode m = editor.current_mouse_mode();
if (m == MouseDraw || (m == MouseObject && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier()))) {
-
editor.drags()->set (new NoteCreateDrag (dynamic_cast<Editor *> (&editor), group, this), (GdkEvent *) ev);
_mouse_state = AddDragging;
remove_ghost_note ();
@@ -995,7 +996,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());
@@ -1003,7 +1004,7 @@ MidiRegionView::note_diff_remove_note (ArdourCanvas::CanvasNoteEvent* ev)
}
void
-MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
+MidiRegionView::note_diff_add_change (NoteBase* ev,
MidiModel::NoteDiffCommand::Property property,
uint8_t val)
{
@@ -1013,7 +1014,7 @@ MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
}
void
-MidiRegionView::note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev,
+MidiRegionView::note_diff_add_change (NoteBase* ev,
MidiModel::NoteDiffCommand::Property property,
Evoral::MusicalTime val)
{
@@ -1062,7 +1063,7 @@ MidiRegionView::abort_command()
clear_selection();
}
-CanvasNoteEvent*
+NoteBase*
MidiRegionView::find_canvas_note (boost::shared_ptr<NoteType> note)
{
if (_optimization_iterator != _events.end()) {
@@ -1089,7 +1090,7 @@ MidiRegionView::get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::No
_model->get_notes (notes, op, val, chan_mask);
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
- CanvasNoteEvent* cne = find_canvas_note (*n);
+ NoteBase* cne = find_canvas_note (*n);
if (cne) {
e.push_back (cne);
}
@@ -1117,24 +1118,26 @@ MidiRegionView::redisplay_model()
MidiModel::Notes& notes (_model->notes());
_optimization_iterator = _events.begin();
+ bool empty_when_starting = !_events.empty();
+
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)) {
- if ((cne = find_canvas_note (note)) != 0) {
+ if (empty_when_starting && (cne = find_canvas_note (note)) != 0) {
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);
}
@@ -1151,7 +1154,7 @@ MidiRegionView::redisplay_model()
} else {
- if ((cne = find_canvas_note (note)) != 0) {
+ if (empty_when_starting && (cne = find_canvas_note (note)) != 0) {
cne->validate ();
cne->hide ();
}
@@ -1161,21 +1164,23 @@ MidiRegionView::redisplay_model()
/* remove note items that are no longer valid */
- for (Events::iterator i = _events.begin(); i != _events.end(); ) {
- if (!(*i)->valid ()) {
-
- for (vector<GhostRegion*>::iterator j = ghosts.begin(); j != ghosts.end(); ++j) {
- MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*j);
- if (gr) {
- gr->remove_note (*i);
+ if (empty_when_starting) {
+ for (Events::iterator i = _events.begin(); i != _events.end(); ) {
+ if (!(*i)->valid ()) {
+
+ for (vector<GhostRegion*>::iterator j = ghosts.begin(); j != ghosts.end(); ++j) {
+ MidiGhostRegion* gr = dynamic_cast<MidiGhostRegion*> (*j);
+ if (gr) {
+ gr->remove_note (*i);
+ }
}
+
+ delete *i;
+ i = _events.erase (i);
+
+ } else {
+ ++i;
}
-
- delete *i;
- i = _events.erase (i);
-
- } else {
- ++i;
}
}
@@ -1289,12 +1294,15 @@ MidiRegionView::display_sysexes()
}
string text = str.str();
- const double x = trackview.editor().frame_to_pixel(source_beats_to_region_frames(time));
+ const double x = trackview.editor().sample_to_pixel(source_beats_to_region_frames(time));
double height = midi_stream_view()->contents_height();
- boost::shared_ptr<CanvasSysEx> sysex = boost::shared_ptr<CanvasSysEx>(
- new CanvasSysEx(*this, *_note_group, text, height, x, 1.0, (*i)));
+ // CAIROCANVAS: no longer passing *i (the sysex event) to the
+ // SysEx canvas object!!!
+
+ boost::shared_ptr<SysEx> sysex = boost::shared_ptr<SysEx>(
+ new SysEx (*this, _note_group, text, height, x, 1.0));
// Show unless message is beyond the region bounds
if (time - _region->start() >= _region->length() || time < _region->start()) {
@@ -1357,7 +1365,7 @@ MidiRegionView::reset_width_dependent_items (double pixel_width)
}
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
- if ((*x)->width() >= _pixel_width) {
+ if ((*x)->canvas_item()->width() >= _pixel_width) {
(*x)->hide();
} else {
(*x)->show();
@@ -1380,8 +1388,8 @@ MidiRegionView::set_height (double height)
midi_stream_view()->highest_note(),
height != old_height + FUDGE);
- if (name_pixbuf) {
- name_pixbuf->raise_to_top();
+ if (name_text) {
+ name_text->raise_to_top();
}
for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) {
@@ -1389,7 +1397,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 +1420,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 +1430,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 +1450,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 () / samples_per_pixel;
MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(&tv);
MidiGhostRegion* ghost;
@@ -1458,13 +1466,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() / samples_per_pixel);
ghosts.push_back (ghost);
GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RegionView::remove_ghost, this, _1), gui_context());
@@ -1481,7 +1489,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 +1525,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().sample_to_pixel(end_time_frames));
+ _active_notes[note]->set_outline_what (0xf);
_active_notes[note] = 0;
}
}
@@ -1535,7 +1543,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().sample_to_pixel(_region->length()));
}
}
}
@@ -1621,43 +1629,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 x = trackview.editor().sample_to_pixel (source_beats_to_region_frames (note->time()));
+ 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().sample_to_pixel (note_end_frames));
} else {
- ev->property_x2() = trackview.editor().frame_to_pixel (_region->length());
+ ev->set_x1 (trackview.editor().sample_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,16 +1679,16 @@ 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();
const framepos_t note_start_frames = source_beats_to_region_frames(note->time());
- const double x = trackview.editor().frame_to_pixel(note_start_frames);
+ const double x = trackview.editor().sample_to_pixel(note_start_frames);
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 +1702,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 +1726,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 Hit (*this, _note_group, diamond_size, note);
update_hit (ev_diamond);
@@ -1795,23 +1803,27 @@ MidiRegionView::step_sustain (Evoral::MusicalTime beats)
* @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel.
*/
void
-MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool active_channel)
+MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool /*active_channel*/)
{
framecnt_t region_frames = source_beats_to_region_frames (patch->time());
- const double x = trackview.editor().frame_to_pixel (region_frames);
+ const double x = trackview.editor().sample_to_pixel (region_frames);
double const height = midi_stream_view()->contents_height();
- boost::shared_ptr<CanvasPatchChange> patch_change = boost::shared_ptr<CanvasPatchChange>(
- new CanvasPatchChange(*this, *group,
- displaytext,
- height,
- x, 1.0,
- instrument_info(),
- patch,
- active_channel));
+ // CAIROCANVAS: active_channel info removed from PatcChange constructor
+ // so we need to do something more sophisticated to keep its color
+ // appearance (MidiPatchChangeFill/MidiPatchChangeInactiveChannelFill)
+ // up to date.
- if (patch_change->width() < _pixel_width) {
+ boost::shared_ptr<PatchChange> patch_change = boost::shared_ptr<PatchChange>(
+ new PatchChange(*this, group,
+ displaytext,
+ height,
+ x, 1.0,
+ instrument_info(),
+ patch));
+
+ if (patch_change->item().width() < _pixel_width) {
// Show unless patch change is beyond the region bounds
if (region_frames < 0 || region_frames >= _region->length()) {
patch_change->hide();
@@ -1865,7 +1877,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 +1949,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 +1960,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 +1971,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 +1981,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());
@@ -1979,7 +1991,7 @@ MidiRegionView::next_patch (CanvasPatchChange& patch)
}
void
-MidiRegionView::next_bank (CanvasPatchChange& patch)
+MidiRegionView::next_bank (PatchChange& patch)
{
if (patch.patch()->program() < 127) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@@ -1991,7 +2003,7 @@ MidiRegionView::next_bank (CanvasPatchChange& patch)
}
void
-MidiRegionView::previous_bank (CanvasPatchChange& patch)
+MidiRegionView::previous_bank (PatchChange& patch)
{
if (patch.patch()->program() > 0) {
MIDI::Name::PatchPrimaryKey key = patch_change_to_patch_key (patch.patch());
@@ -2003,7 +2015,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 +2055,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 +2082,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 +2170,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 +2207,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 +2222,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,20 +2275,20 @@ 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);
}
void
-MidiRegionView::update_drag_selection(double x1, double x2, double y1, double y2, bool extend)
+MidiRegionView::update_drag_selection(double x0, double x1, double y0, double y1, bool extend)
{
// TODO: Make this faster by storing the last updated selection rect, and only
// adjusting things that are in the area that appears/disappeared.
// We probably need a tree to be able to find events in O(log(n)) time.
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
- if ((*i)->x1() < x2 && (*i)->x2() > x1 && (*i)->y1() < y2 && (*i)->y2() > y1) {
+ if ((*i)->x0() < x1 && (*i)->x1() > x0 && (*i)->y0() < y1 && (*i)->y1() > y0) {
// Rectangles intersect
if (!(*i)->selected()) {
add_to_selection (*i);
@@ -2312,7 +2324,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 +2342,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 +2405,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;
@@ -2460,10 +2472,10 @@ MidiRegionView::note_dropped(CanvasNoteEvent *, frameoffset_t dt, int8_t dnote)
* @return Snapped frame relative to the region position.
*/
framepos_t
-MidiRegionView::snap_pixel_to_frame(double x)
+MidiRegionView::snap_pixel_to_sample(double x)
{
PublicEditor& editor (trackview.editor());
- return snap_frame_to_frame (editor.pixel_to_frame (x));
+ return snap_frame_to_frame (editor.pixel_to_sample (x));
}
/** @param x Pixel relative to the region position.
@@ -2472,21 +2484,21 @@ MidiRegionView::snap_pixel_to_frame(double x)
double
MidiRegionView::snap_to_pixel(double x)
{
- return (double) trackview.editor().frame_to_pixel(snap_pixel_to_frame(x));
+ return (double) trackview.editor().sample_to_pixel(snap_pixel_to_sample(x));
}
double
MidiRegionView::get_position_pixels()
{
framepos_t region_frame = get_position();
- return trackview.editor().frame_to_pixel(region_frame);
+ return trackview.editor().sample_to_pixel(region_frame);
}
double
MidiRegionView::get_end_position_pixels()
{
framepos_t frame = get_position() + get_duration ();
- return trackview.editor().frame_to_pixel(frame);
+ return trackview.editor().sample_to_pixel(frame);
}
framepos_t
@@ -2529,33 +2541,33 @@ 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());
+ ArdourCanvas::Rectangle *resize_rect = new ArdourCanvas::Rectangle (_note_group,
+ ArdourCanvas::Rect (note->x0(), note->y0(), note->x0(), note->y1()));
// calculate the colors: get the color settings
uint32_t fill_color = UINT_RGBA_CHANGE_A(
- ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get(),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(),
128);
// make the resize preview notes more transparent and bright
fill_color = UINT_INTERPOLATE(fill_color, 0xFFFFFF40, 0.5);
// calculate color based on note velocity
- resize_rect->property_fill_color_rgba() = UINT_INTERPOLATE(
- CanvasNoteEvent::meter_style_fill_color(note->note()->velocity(), note->selected()),
+ resize_rect->set_fill_color (UINT_INTERPOLATE(
+ NoteBase::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()->get_canvasvar_MidiNoteSelected()));
resize_data->resize_rect = resize_rect;
_resize_data.push_back(resize_data);
@@ -2573,41 +2585,41 @@ 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;
+ ArdourCanvas::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 = canvas_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 = canvas_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) {
double beats;
- beats = snap_pixel_to_frame (current_x);
+ beats = snap_pixel_to_sample (current_x);
beats = region_frames_to_region_beats (beats);
double len;
@@ -2642,13 +2654,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;
+ ArdourCanvas::Rectangle* resize_rect = (*i)->resize_rect;
/* Get the new x position for this resize, which is in pixels relative
* to the region position.
@@ -2658,20 +2670,20 @@ MidiRegionView::commit_resizing (ArdourCanvas::CanvasNoteEvent* primary, bool at
if (at_front) {
if (relative) {
- current_x = canvas_note->x1() + delta_x;
+ current_x = canvas_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 = canvas_note->x1() + delta_x;
} else {
- current_x = primary->x2() + delta_x;
+ current_x = primary->x1() + delta_x;
}
}
/* Convert that to a frame within the source */
- current_x = snap_pixel_to_frame (current_x) + _region->start ();
+ current_x = snap_pixel_to_sample (current_x) + _region->start ();
/* and then to beats */
current_x = region_frames_to_region_beats (current_x);
@@ -2717,7 +2729,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 +2746,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 +2761,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 +2833,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 (NoteBase* event, int8_t chn, bool relative)
{
uint8_t new_channel;
@@ -2843,7 +2855,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 +2877,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 +3104,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 +3118,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 +3135,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 */
@@ -3131,11 +3143,11 @@ MidiRegionView::patch_entered (ArdourCanvas::CanvasPatchChange* p)
<< _("Program ") << ((int) p->patch()->program()) + MIDI_BP_ZERO << '\n'
<< _("Channel ") << ((int) p->patch()->channel() + 1);
show_verbose_cursor (s.str(), 10, 20);
- p->grab_focus();
+ p->item().grab_focus();
}
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
@@ -3144,16 +3156,18 @@ MidiRegionView::patch_left (ArdourCanvas::CanvasPatchChange *)
}
void
-MidiRegionView::sysex_entered (ArdourCanvas::CanvasSysEx* p)
+MidiRegionView::sysex_entered (SysEx* p)
{
ostringstream s;
- s << p->text();
- show_verbose_cursor (s.str(), 10, 20);
- p->grab_focus();
+ // CAIROCANVAS
+ // need a way to extract text from p->_flag->_text
+ // s << p->text();
+ // show_verbose_cursor (s.str(), 10, 20);
+ p->item().grab_focus();
}
void
-MidiRegionView::sysex_left (ArdourCanvas::CanvasSysEx *)
+MidiRegionView::sysex_left (SysEx *)
{
trackview.editor().verbose_cursor()->hide ();
/* focus will transfer back via the enter-notify event sent to this
@@ -3191,9 +3205,9 @@ MidiRegionView::set_frame_color()
}
if (_selected) {
- f = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
+ f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
} else if (high_enough_for_name) {
- f= ARDOUR_UI::config()->canvasvar_MidiFrameBase.get();
+ f= ARDOUR_UI::config()->get_canvasvar_MidiFrameBase();
} else {
f = fill_color;
}
@@ -3202,7 +3216,7 @@ MidiRegionView::set_frame_color()
f = UINT_RGBA_CHANGE_A (f, 0);
}
- frame->property_fill_color_rgba() = f;
+ frame->set_fill_color (f);
}
void
@@ -3356,7 +3370,7 @@ MidiRegionView::paste (framepos_t pos, float times, const MidiCutBuffer& mcb)
}
struct EventNoteTimeEarlyFirstComparator {
- bool operator() (CanvasNoteEvent* a, CanvasNoteEvent* b) {
+ bool operator() (NoteBase* a, NoteBase* b) {
return a->note()->time() < b->note()->time();
}
};
@@ -3477,11 +3491,11 @@ 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 ();
- framepos_t const unsnapped_frame = editor.pixel_to_frame (x);
+ framepos_t const unsnapped_frame = editor.pixel_to_sample (x);
framecnt_t grid_frames;
framepos_t const f = snap_frame_to_grid_underneath (unsnapped_frame, grid_frames);
@@ -3515,8 +3529,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 +3619,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);
@@ -3621,8 +3636,8 @@ MidiRegionView::move_step_edit_cursor (Evoral::MusicalTime pos)
_step_edit_cursor_position = pos;
if (_step_edit_cursor) {
- double pixel = trackview.editor().frame_to_pixel (region_beats_to_region_frames (pos));
- _step_edit_cursor->property_x1() = pixel;
+ double pixel = trackview.editor().sample_to_pixel (region_beats_to_region_frames (pos));
+ _step_edit_cursor->set_x0 (pixel);
set_step_edit_cursor_width (_step_edit_cursor_width);
}
}
@@ -3641,7 +3656,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().sample_to_pixel (region_beats_to_region_frames (beats)));
}
}
@@ -3717,15 +3732,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 +3751,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);
@@ -3756,14 +3771,16 @@ MidiRegionView::edit_patch_change (ArdourCanvas::CanvasPatchChange* pc)
}
void
-MidiRegionView::delete_sysex (CanvasSysEx* sysex)
+MidiRegionView::delete_sysex (SysEx* /*sysex*/)
{
- MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex"));
- c->remove (sysex->sysex());
- _model->apply_command (*trackview.session(), c);
+ // CAIROCANVAS
+ // sysyex object doesn't have a pointer to a sysex event
+ // MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex"));
+ // c->remove (sysex->sysex());
+ // _model->apply_command (*trackview.session(), c);
- _sys_exes.clear ();
- display_sysexes();
+ //_sys_exes.clear ();
+ // display_sysexes();
}
void
@@ -3802,6 +3819,7 @@ MidiRegionView::show_verbose_cursor (string const & text, double xoffset, double
{
double wx, wy;
+ trackview.editor().verbose_cursor()->set_text (text);
trackview.editor().get_pointer_position (wx, wy);
wx += xoffset;
@@ -3809,14 +3827,17 @@ MidiRegionView::show_verbose_cursor (string const & text, double xoffset, double
/* Flip the cursor above the mouse pointer if it would overlap the bottom of the canvas */
- double x1, y1, x2, y2;
- trackview.editor().verbose_cursor()->canvas_item()->get_bounds (x1, y1, x2, y2);
+ boost::optional<ArdourCanvas::Rect> bbo = trackview.editor().verbose_cursor()->item().bounding_box();
+
+ assert (bbo);
+
+ ArdourCanvas::Rect bb = bbo.get();
- if ((wy + y2 - y1) > trackview.editor().canvas_height()) {
- wy -= (y2 - y1) + 2 * yoffset;
+ if ((wy + bb.y1 - bb.y0) > trackview.editor().visible_canvas_height()) {
+ wy -= (bb.y1 - bb.y0) + 2 * yoffset;
}
- trackview.editor().verbose_cursor()->set (text, wx, wy);
+ trackview.editor().verbose_cursor()->set_position (wx, wy);
trackview.editor().verbose_cursor()->show ();
}
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 219d07f376..5a5c74cb2c 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -22,12 +22,6 @@
#include <string>
#include <vector>
-#ifdef interface
-#undef interface
-#endif
-
-#include <libgnomecanvasmm.h>
-#include <libgnomecanvasmm/polygon.h>
#include "pbd/signals.h"
@@ -40,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;
@@ -59,6 +47,10 @@ namespace MIDI {
};
};
+class SysEx;
+class NoteBase;
+class Note;
+class Hit;
class MidiTimeAxisView;
class GhostRegion;
class AutomationTimeAxisView;
@@ -67,6 +59,7 @@ class MidiCutBuffer;
class MidiListEditor;
class EditNoteDialog;
class NotePlayer;
+class PatchChange;
class MidiRegionView : public RegionView
{
@@ -77,7 +70,7 @@ public:
MidiRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::MidiRegion>,
- double initial_samples_per_unit,
+ double initial_samples_per_pixel,
Gdk::Color const & basic_color);
MidiRegionView (const MidiRegionView& other);
@@ -139,26 +132,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*);
+ void delete_sysex (SysEx*);
/** 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.
*/
@@ -175,24 +168,24 @@ public:
void display_model(boost::shared_ptr<ARDOUR::MidiModel> model);
void start_note_diff_command (std::string name = "midi edit");
- void note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val);
- void note_diff_add_change (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Evoral::MusicalTime val);
+ void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, uint8_t val);
+ void note_diff_add_change (NoteBase* ev, ARDOUR::MidiModel::NoteDiffCommand::Property, Evoral::MusicalTime val);
void note_diff_add_note (const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity = false);
- void note_diff_remove_note (ArdourCanvas::CanvasNoteEvent* ev);
+ void note_diff_remove_note (NoteBase* ev);
void apply_diff (bool as_subcommand = false);
void abort_command();
- void note_entered(ArdourCanvas::CanvasNoteEvent* ev);
- void note_left(ArdourCanvas::CanvasNoteEvent* ev);
- void patch_entered (ArdourCanvas::CanvasPatchChange *);
- void patch_left (ArdourCanvas::CanvasPatchChange *);
- void sysex_entered (ArdourCanvas::CanvasSysEx* p);
- void sysex_left (ArdourCanvas::CanvasSysEx* p);
+ void note_entered(NoteBase* ev);
+ void note_left(NoteBase* ev);
+ void patch_entered (PatchChange *);
+ void patch_left (PatchChange *);
+ void sysex_entered (SysEx* p);
+ void sysex_left (SysEx* p);
void note_mouse_position (float xfraction, float yfraction, bool can_set_cursor=true);
- void unique_select(ArdourCanvas::CanvasNoteEvent* ev);
- void note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool extend=false);
- void note_deselected(ArdourCanvas::CanvasNoteEvent* ev);
+ void unique_select(NoteBase* ev);
+ void note_selected(NoteBase* ev, bool add, bool extend=false);
+ void note_deselected(NoteBase* ev);
void delete_selection();
void delete_note (boost::shared_ptr<NoteType>);
size_t selection_size() { return _selection.size(); }
@@ -201,7 +194,7 @@ public:
void invert_selection ();
void move_selection(double dx, double dy, double cumulative_dy);
- void note_dropped (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::frameoffset_t, int8_t d_note);
+ void note_dropped (NoteBase* ev, ARDOUR::frameoffset_t, int8_t d_note);
void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
@@ -223,8 +216,8 @@ public:
*/
void begin_resizing(bool at_front);
- void update_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool);
- void commit_resizing (ArdourCanvas::CanvasNoteEvent*, bool, double, bool);
+ void update_resizing (NoteBase*, bool, double, bool);
+ void commit_resizing (NoteBase*, bool, double, bool);
void abort_resizing ();
/** Change the channel of the selection.
@@ -246,8 +239,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.
@@ -260,7 +253,7 @@ public:
* @param x a pixel coordinate relative to region start
* @return the snapped framepos_t coordinate relative to region start
*/
- framepos_t snap_pixel_to_frame(double x);
+ framepos_t snap_pixel_to_sample(double x);
/** Convert a timestamp in beats into frames (both relative to region position) */
framepos_t region_beats_to_region_frames(double beats) const;
@@ -291,7 +284,7 @@ public:
void show_list_editor ();
- typedef std::set<ArdourCanvas::CanvasNoteEvent*> Selection;
+ typedef std::set<NoteBase*> Selection;
Selection selection () const {
return _selection;
}
@@ -300,8 +293,8 @@ public:
void enable_display (bool);
- void set_channel_selector_scoped_note(ArdourCanvas::CanvasNoteEvent* note){ _channel_selection_scoped_note = note; }
- ArdourCanvas::CanvasNoteEvent* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
+ void set_channel_selector_scoped_note(NoteBase* note){ _channel_selection_scoped_note = note; }
+ NoteBase* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
void trim_front_starting ();
void trim_front_ending ();
@@ -319,7 +312,7 @@ protected:
MidiRegionView (ArdourCanvas::Group *,
RouteTimeAxisView&,
boost::shared_ptr<ARDOUR::MidiRegion>,
- double samples_per_unit,
+ double samples_per_pixel,
Gdk::Color& basic_color,
TimeAxisViewItem::Visibility);
@@ -356,7 +349,7 @@ private:
void clear_events (bool with_selection_signal = true);
- bool canvas_event(GdkEvent* ev);
+ bool canvas_group_event(GdkEvent* ev);
bool note_canvas_event(GdkEvent* ev);
void midi_channel_mode_changed ();
@@ -364,20 +357,20 @@ private:
void instrument_settings_changed ();
PBD::ScopedConnection _instrument_changed_connection;
- void change_note_channel (ArdourCanvas::CanvasNoteEvent *, int8_t, bool relative=false);
- void change_note_velocity(ArdourCanvas::CanvasNoteEvent* ev, int8_t vel, bool relative=false);
- void change_note_note(ArdourCanvas::CanvasNoteEvent* ev, int8_t note, bool relative=false);
- void change_note_time(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
- void change_note_length (ArdourCanvas::CanvasNoteEvent *, ARDOUR::MidiModel::TimeType);
- void trim_note(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::TimeType start_delta,
+ void change_note_channel (NoteBase *, int8_t, bool relative=false);
+ void change_note_velocity(NoteBase* ev, int8_t vel, bool relative=false);
+ void change_note_note(NoteBase* ev, int8_t note, bool relative=false);
+ void change_note_time(NoteBase* ev, ARDOUR::MidiModel::TimeType, bool relative=false);
+ void change_note_length (NoteBase *, ARDOUR::MidiModel::TimeType);
+ void trim_note(NoteBase* ev, ARDOUR::MidiModel::TimeType start_delta,
ARDOUR::MidiModel::TimeType end_delta);
- void clear_selection_except (ArdourCanvas::CanvasNoteEvent* ev, bool signal = true);
+ void clear_selection_except (NoteBase* ev, bool signal = true);
void update_drag_selection (double last_x, double x, double last_y, double y, bool extend);
void update_vertical_drag_selection (double last_y, double y, bool extend);
- void add_to_selection (ArdourCanvas::CanvasNoteEvent*);
- void remove_from_selection (ArdourCanvas::CanvasNoteEvent*);
+ void add_to_selection (NoteBase*);
+ void remove_from_selection (NoteBase*);
void show_verbose_cursor (std::string const &, double, double) const;
void show_verbose_cursor (boost::shared_ptr<NoteType>) const;
@@ -385,24 +378,24 @@ private:
uint8_t _current_range_min;
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<ArdourCanvas::CanvasSysEx> > SysExes;
+ typedef std::list<NoteBase*> Events;
+ typedef std::vector< boost::shared_ptr<PatchChange> > PatchChanges;
+ typedef std::vector< boost::shared_ptr<SysEx> > SysExes;
boost::shared_ptr<ARDOUR::MidiModel> _model;
Events _events;
PatchChanges _patch_changes;
SysExes _sys_exes;
- ArdourCanvas::CanvasNote** _active_notes;
+ Note** _active_notes;
ArdourCanvas::Group* _note_group;
ARDOUR::MidiModel::NoteDiffCommand* _note_diff_command;
- ArdourCanvas::CanvasNote* _ghost_note;
+ Note* _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;
+ NoteBase* _channel_selection_scoped_note;
/** A group used to temporarily reparent _note_group to during start trims, so
@@ -413,7 +406,7 @@ private:
MouseState _mouse_state;
int _pressed_button;
- /** Currently selected CanvasNoteEvents */
+ /** Currently selected NoteBase objects */
Selection _selection;
bool _sort_needed;
@@ -434,11 +427,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);
@@ -446,7 +439,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..640c0263e1 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);
+ _samples_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()->get_canvasvar_PianoRollBlackOutline());
switch (i % 12) {
case 1:
@@ -311,17 +306,17 @@ MidiStreamView::draw_note_lines()
case 6:
case 8:
case 10:
- color = ARDOUR_UI::config()->canvasvar_PianoRollBlack.get();
+ color = ARDOUR_UI::config()->get_canvasvar_PianoRollBlack();
break;
default:
- color = ARDOUR_UI::config()->canvasvar_PianoRollWhite.get();
+ color = ARDOUR_UI::config()->get_canvasvar_PianoRollWhite();
break;
}
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;
@@ -484,19 +479,16 @@ MidiStreamView::setup_rec_box ()
boost::shared_ptr<MidiTrack> mt = _trackview.midi_track(); /* we know what it is already */
framepos_t const frame_pos = mt->current_capture_start ();
- gdouble const xstart = _trackview.editor().frame_to_pixel (frame_pos);
+ gdouble const xstart = _trackview.editor().sample_to_pixel (frame_pos);
gdouble const xend = xstart;
uint32_t fill_color;
- fill_color = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+ fill_color = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
- 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()->get_canvasvar_RecordingRect());
+ 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()->get_canvasvar_MidiTrackBase());
} else {
- canvas_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiBusBase.get();;
+ canvas_rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_MidiBusBase());
}
}
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 93649dbebe..4884dc34f3 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -60,8 +60,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"
@@ -82,8 +80,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"
@@ -99,7 +97,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)
@@ -314,7 +312,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);
}
}
@@ -511,7 +509,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 ();
}
@@ -1034,7 +1032,7 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay, bo
if (_channel_selector) {
if (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/mono_panner.cc b/gtk2_ardour/mono_panner.cc
index daec1eede1..e29ec01b70 100644
--- a/gtk2_ardour/mono_panner.cc
+++ b/gtk2_ardour/mono_panner.cc
@@ -435,12 +435,12 @@ MonoPanner::on_key_press_event (GdkEventKey* ev)
void
MonoPanner::set_colors ()
{
- colors.fill = ARDOUR_UI::config()->canvasvar_MonoPannerFill.get();
- colors.outline = ARDOUR_UI::config()->canvasvar_MonoPannerOutline.get();
- colors.text = ARDOUR_UI::config()->canvasvar_MonoPannerText.get();
- colors.background = ARDOUR_UI::config()->canvasvar_MonoPannerBackground.get();
- colors.pos_outline = ARDOUR_UI::config()->canvasvar_MonoPannerPositionOutline.get();
- colors.pos_fill = ARDOUR_UI::config()->canvasvar_MonoPannerPositionFill.get();
+ colors.fill = ARDOUR_UI::config()->get_canvasvar_MonoPannerFill();
+ colors.outline = ARDOUR_UI::config()->get_canvasvar_MonoPannerOutline();
+ colors.text = ARDOUR_UI::config()->get_canvasvar_MonoPannerText();
+ colors.background = ARDOUR_UI::config()->get_canvasvar_MonoPannerBackground();
+ colors.pos_outline = ARDOUR_UI::config()->get_canvasvar_MonoPannerPositionOutline();
+ colors.pos_fill = ARDOUR_UI::config()->get_canvasvar_MonoPannerPositionFill();
}
void
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/canvas-note-event.cc b/gtk2_ardour/note_base.cc
index dfcf04eea1..3bdb73489e 100644
--- a/gtk2_ardour/canvas-note-event.cc
+++ b/gtk2_ardour/note_base.cc
@@ -21,7 +21,9 @@
#include "gtkmm2ext/keyboard.h"
-#include "canvas-note-event.h"
+#include "canvas/text.h"
+
+#include "note_base.h"
#include "midi_region_view.h"
#include "public_editor.h"
#include "editing_syms.h"
@@ -30,135 +32,133 @@
using namespace std;
using namespace Gtkmm2ext;
using ARDOUR::MidiModel;
+using namespace ArdourCanvas;
-namespace Gnome {
-namespace Canvas {
-
-PBD::Signal1<void,CanvasNoteEvent*> CanvasNoteEvent::CanvasNoteEventDeleted;
+PBD::Signal1<void,NoteBase*> NoteBase::NoteBaseDeleted;
/// dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms
-const uint32_t CanvasNoteEvent::midi_channel_colors[16] = {
+const uint32_t NoteBase::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)
+NoteBase::NoteBase(MidiRegionView& region, bool with_events, const boost::shared_ptr<NoteType> note)
: _region(region)
- , _item(item)
+ , _item (0)
, _text(0)
, _state(None)
, _note(note)
+ , _with_events (with_events)
, _selected(false)
, _valid (true)
, _mouse_x_fraction (-1.0)
, _mouse_y_fraction (-1.0)
- , _channel_selection (0xffff)
{
}
-CanvasNoteEvent::~CanvasNoteEvent()
+NoteBase::~NoteBase()
+{
+ NoteBaseDeleted (this);
+
+ delete _text;
+}
+
+void
+NoteBase::set_item (Item* item)
{
- CanvasNoteEventDeleted (this);
+ _item = item;
+ _item->set_data ("notebase", this);
- if (_text) {
- _text->hide();
- delete _text;
+ if (_with_events) {
+ _item->Event.connect (sigc::mem_fun (*this, &NoteBase::event_handler));
}
}
void
-CanvasNoteEvent::invalidate ()
+NoteBase::invalidate ()
{
_valid = false;
}
void
-CanvasNoteEvent::validate ()
+NoteBase::validate ()
{
_valid = true;
}
void
-CanvasNoteEvent::show_velocity()
+NoteBase::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 = new Text (_item->parent ());
+ _text->set_ignore_events (true);
+ _text->set_color (ARDOUR_UI::config()->get_canvasvar_MidiNoteVelocityText());
+ _text->set_alignment (Pango::ALIGN_CENTER);
}
- _text->property_x() = (x1() + x2()) /2;
- _text->property_y() = (y1() + y2()) /2;
+ _text->set_x_position ((x0() + x1()) / 2);
+ _text->set_y_position ((y0() + y1()) / 2);
ostringstream velo(ios::ate);
velo << int(_note->velocity());
- _text->property_text() = velo.str();
+ _text->set (velo.str ());
_text->show();
_text->raise_to_top();
}
void
-CanvasNoteEvent::hide_velocity()
+NoteBase::hide_velocity()
{
- if (_text) {
- _text->hide();
- delete _text;
- _text = 0;
- }
+ delete _text;
+ _text = 0;
}
void
-CanvasNoteEvent::on_channel_selection_change(uint16_t selection)
+NoteBase::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);
-
+ // make note change its color if its channel is not marked active
+ if ( (selection & (1 << _note->channel())) == 0 ) {
+ set_fill_color(ARDOUR_UI::config()->get_canvasvar_MidiNoteInactiveChannel());
+ set_outline_color(calculate_outline(ARDOUR_UI::config()->get_canvasvar_MidiNoteInactiveChannel()));
+ } else {
+ // set the color according to the notes selection state
+ set_selected(_selected);
+ }
// this forces the item to update..... maybe slow...
_item->hide();
_item->show();
}
void
-CanvasNoteEvent::on_channel_change(uint8_t channel)
+NoteBase::on_channel_change(uint8_t channel)
{
_region.note_selected(this, true);
_region.change_channel(channel);
}
void
-CanvasNoteEvent::set_selected(bool selected)
+NoteBase::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()));
- set_fill_color (base_color ());
-
+ set_fill_color (base_color());
+
+ if (_selected) {
+ set_outline_color(calculate_outline(ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected()));
} 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()));
- }
+ set_outline_color(calculate_outline(base_color()));
}
+
}
#define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257)
uint32_t
-CanvasNoteEvent::base_color()
+NoteBase::base_color()
{
using namespace ARDOUR;
@@ -175,14 +175,14 @@ CanvasNoteEvent::base_color()
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);
+ opacity),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(), 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);
+ return UINT_INTERPOLATE (UINT_RGBA_CHANGE_A (NoteBase::midi_channel_colors[_note->channel()],
+ opacity),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected(), 0.5);
default:
return meter_style_fill_color(_note->velocity(), selected());
@@ -192,10 +192,9 @@ CanvasNoteEvent::base_color()
}
void
-CanvasNoteEvent::set_mouse_fractions (GdkEvent* ev)
+NoteBase::set_mouse_fractions (GdkEvent* ev)
{
double ix, iy;
- double bx1, bx2, by1, by2;
bool set_cursor = false;
switch (ev->type) {
@@ -220,21 +219,24 @@ CanvasNoteEvent::set_mouse_fractions (GdkEvent* ev)
return;
}
- _item->get_bounds (bx1, by1, bx2, by2);
- _item->w2i (ix, iy);
+ boost::optional<ArdourCanvas::Rect> bbox = _item->bounding_box ();
+ assert (bbox);
+
+ _item->canvas_to_item (ix, iy);
+ /* XXX: CANVAS */
/* hmm, something wrong here. w2i should give item-local coordinates
but it doesn't. for now, finesse this.
*/
- ix = ix - bx1;
- iy = iy - by1;
+ ix = ix - bbox.get().x0;
+ iy = iy - bbox.get().y0;
/* fraction of width/height */
double xf;
double yf;
bool notify = false;
- xf = ix / (bx2 - bx1);
- yf = iy / (by2 - by1);
+ xf = ix / bbox.get().width ();
+ yf = iy / bbox.get().height ();
if (xf != _mouse_x_fraction || yf != _mouse_y_fraction) {
notify = true;
@@ -256,7 +258,7 @@ CanvasNoteEvent::set_mouse_fractions (GdkEvent* ev)
}
bool
-CanvasNoteEvent::on_event(GdkEvent* ev)
+NoteBase::event_handler (GdkEvent* ev)
{
if (!_region.get_time_axis_view().editor().internal_editing()) {
return false;
@@ -296,22 +298,19 @@ CanvasNoteEvent::on_event(GdkEvent* ev)
break;
}
- return false;
+ return _region.get_time_axis_view().editor().canvas_note_event (ev, _item);
}
bool
-CanvasNoteEvent::mouse_near_ends () const
+NoteBase::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
+NoteBase::big_enough_to_trim () const
{
- return (x2() - x1()) > 20; /* canvas units, really pixels */
+ return (x1() - x0()) > 10;
}
-} // namespace Canvas
-} // namespace Gnome
-
diff --git a/gtk2_ardour/canvas-note-event.h b/gtk2_ardour/note_base.h
index bf98e2b7cb..8ee3a4d277 100644
--- a/gtk2_ardour/canvas-note-event.h
+++ b/gtk2_ardour/note_base.h
@@ -17,28 +17,28 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef __gtk_ardour_canvas_midi_event_h__
-#define __gtk_ardour_canvas_midi_event_h__
+#ifndef __gtk_ardour_note_base_h__
+#define __gtk_ardour_note_base_h__
#include <boost/shared_ptr.hpp>
-#include <libgnomecanvasmm/text.h>
-#include <libgnomecanvasmm/widget.h>
-
+#include "canvas/types.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 {
+namespace Evoral {
+ template<typename T> class Note;
+}
+namespace ArdourCanvas {
+ class Item;
+ class Text;
+}
/** This manages all the event handling for any MIDI event on the canvas.
*
@@ -51,23 +51,25 @@ namespace Canvas {
*
* A newer, better canvas should remove the need for all the ugly here.
*/
-class CanvasNoteEvent : virtual public sigc::trackable
+class NoteBase : public sigc::trackable
{
- public:
+public:
typedef Evoral::Note<ARDOUR::MidiModel::TimeType> NoteType;
- CanvasNoteEvent(
- MidiRegionView& region,
- Item* item,
- const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>());
+ NoteBase (
+ MidiRegionView& region,
+ bool,
+ const boost::shared_ptr<NoteType> note = boost::shared_ptr<NoteType>()
+ );
+
+ virtual ~NoteBase ();
- virtual ~CanvasNoteEvent();
+ void set_item (ArdourCanvas::Item *);
- static PBD::Signal1<void,CanvasNoteEvent*> CanvasNoteEventDeleted;
+ static PBD::Signal1<void, NoteBase*> NoteBaseDeleted;
virtual void show() = 0;
virtual void hide() = 0;
- virtual bool on_event(GdkEvent* ev);
bool valid() const { return _valid; }
void invalidate ();
@@ -92,10 +94,10 @@ class CanvasNoteEvent : virtual public sigc::trackable
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;
+ virtual ArdourCanvas::Coord x0 () const = 0;
+ virtual ArdourCanvas::Coord y0 () const = 0;
+ virtual ArdourCanvas::Coord x1 () const = 0;
+ virtual ArdourCanvas::Coord y1 () const = 0;
float mouse_x_fraction() const { return _mouse_x_fraction; }
float mouse_y_fraction() const { return _mouse_y_fraction; }
@@ -107,25 +109,25 @@ class CanvasNoteEvent : virtual public sigc::trackable
if (selected) {
if (vel < 64) {
return UINT_INTERPOLATE(
- ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorBase.get(),
- ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorMid.get(),
+ ARDOUR_UI::config()->get_canvasvar_SelectedMidiNoteColorBase(),
+ ARDOUR_UI::config()->get_canvasvar_SelectedMidiNoteColorMid(),
(vel / (double)63.0));
} else {
return UINT_INTERPOLATE(
- ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorMid.get(),
- ARDOUR_UI::config()->canvasvar_SelectedMidiNoteColorTop.get(),
+ ARDOUR_UI::config()->get_canvasvar_SelectedMidiNoteColorMid(),
+ ARDOUR_UI::config()->get_canvasvar_SelectedMidiNoteColorTop(),
((vel-64) / (double)63.0));
}
} else {
if (vel < 64) {
return UINT_INTERPOLATE(
- ARDOUR_UI::config()->canvasvar_MidiNoteColorBase.get(),
- ARDOUR_UI::config()->canvasvar_MidiNoteColorMid.get(),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteColorBase(),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteColorMid(),
(vel / (double)63.0));
} else {
return UINT_INTERPOLATE(
- ARDOUR_UI::config()->canvasvar_MidiNoteColorMid.get(),
- ARDOUR_UI::config()->canvasvar_MidiNoteColorTop.get(),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteColorMid(),
+ ARDOUR_UI::config()->get_canvasvar_MidiNoteColorTop(),
((vel-64) / (double)63.0));
}
}
@@ -142,24 +144,25 @@ class CanvasNoteEvent : virtual public sigc::trackable
bool mouse_near_ends () const;
bool big_enough_to_trim () const;
- protected:
+protected:
enum State { None, Pressed, Dragging };
MidiRegionView& _region;
- Item* const _item;
- NoEventText* _text;
+ ArdourCanvas::Item* _item;
+ ArdourCanvas::Text* _text;
State _state;
const boost::shared_ptr<NoteType> _note;
+ bool _with_events;
+ bool _own_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
+private:
+ bool event_handler (GdkEvent *);
+};
-#endif /* __gtk_ardour_canvas_midi_event_h__ */
+#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..df824f4342
--- /dev/null
+++ b/gtk2_ardour/patch_change.cc
@@ -0,0 +1,248 @@
+/*
+ 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 <boost/algorithm/string.hpp>
+
+#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,
+ ARDOUR::InstrumentInfo& info,
+ ARDOUR::MidiModel::PatchChangePtr patch)
+ : _region (region)
+ , _info (info)
+ , _patch (patch)
+ , _popup_initialized(false)
+{
+ _flag = new ArdourCanvas::Flag (
+ parent,
+ height,
+ ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeOutline(),
+ ARDOUR_UI::config()->get_canvasvar_MidiPatchChangeFill(),
+ 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()
+{
+ using namespace MIDI::Name;
+
+ boost::shared_ptr<ChannelNameSet> channel_name_set = _info.get_patches (_patch->channel());
+
+ if (!channel_name_set) {
+ return;
+ }
+
+ const ChannelNameSet::PatchBanks& patch_banks = channel_name_set->patch_banks();
+
+ if (patch_banks.size() > 1) {
+
+ // 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 PatchNameList& patches = (*bank)->patch_name_list();
+ Gtk::Menu::MenuList& patch_menus = patch_bank_menu.items();
+
+ for (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) );
+ }
+
+ } else {
+ /* only one patch bank, so make it the initial menu */
+
+ const PatchNameList& patches = patch_banks.front()->patch_name_list();
+ Gtk::Menu::MenuList& patch_menus = _popup.items();
+
+ for (PatchNameList::const_iterator patch = patches.begin();
+ patch != patches.end();
+ ++patch) {
+ std::string name = (*patch)->name();
+ boost::replace_all (name, "_", " ");
+
+ patch_menus.push_back (
+ Gtk::Menu_Helpers::MenuElem (
+ name,
+ sigc::bind (sigc::mem_fun(*this, &PatchChange::on_patch_menu_selected),
+ (*patch)->patch_primary_key())));
+ }
+ }
+}
+
+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..652f9d66c1 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,31 +30,21 @@ 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
+ ARDOUR::MidiModel::PatchChangePtr patch
);
- virtual ~CanvasPatchChange();
-
- virtual bool on_event(GdkEvent* ev);
+ ~PatchChange();
ARDOUR::MidiModel::PatchChangePtr patch () const { return _patch; }
@@ -62,14 +52,26 @@ public:
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 ();
+
+ ArdourCanvas::Item& item() const { return *_flag; }
+
private:
- ARDOUR::InstrumentInfo& _info;
+ bool event_handler (GdkEvent *);
+
+ MidiRegionView& _region;
+ ARDOUR::InstrumentInfo& _info;
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 b5f8503458..3fc2b878b0 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -39,10 +39,10 @@
#include "pbd/statefuldestructible.h"
+#include "canvas/fwd.h"
#include "gtkmm2ext/visibility_tracker.h"
#include "editing.h"
-#include "canvas.h"
#include "selection.h"
namespace ARDOUR {
@@ -197,12 +197,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void separate_region_from_selection () = 0;
virtual void transition_to_rolling (bool fwd) = 0;
- virtual framepos_t unit_to_frame (double unit) const = 0;
- virtual double frame_to_unit (framepos_t frame) const = 0;
- virtual double frame_to_unit (double frame) const = 0;
- virtual double frame_to_unit_unrounded (framepos_t frame) const = 0;
- virtual framepos_t pixel_to_frame (double pixel) const = 0;
- virtual gulong frame_to_pixel (framepos_t frame) const = 0;
+ virtual framepos_t pixel_to_sample (double pixel) const = 0;
+ virtual double sample_to_pixel (framepos_t frame) const = 0;
+ virtual double sample_to_pixel_unrounded (framepos_t frame) const = 0;
virtual Selection& get_selection () const = 0;
virtual Selection& get_cut_buffer () const = 0;
virtual void track_mixer_selection () = 0;
@@ -212,7 +209,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void maybe_locate_with_edit_preroll (framepos_t location) = 0;
virtual void set_show_measures (bool yn) = 0;
virtual bool show_measures () const = 0;
- virtual bool redraw_measures () = 0;
virtual Editing::MouseMode effective_mouse_mode () const = 0;
@@ -236,7 +232,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual void add_toplevel_controls (Gtk::Container&) = 0;
virtual void set_zoom_focus (Editing::ZoomFocus) = 0;
virtual Editing::ZoomFocus get_zoom_focus () const = 0;
- virtual gdouble get_current_zoom () const = 0;
+ virtual framecnt_t get_current_zoom () const = 0;
virtual PlaylistSelector& playlist_selector() const = 0;
virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;
virtual void new_playlists (TimeAxisView*) = 0;
@@ -267,9 +263,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual bool dragging_playhead () const = 0;
virtual void ensure_float (Gtk::Window&) = 0;
virtual void show_window () = 0;
- virtual framepos_t leftmost_position() const = 0;
- virtual framecnt_t current_page_frames() const = 0;
- virtual double canvas_height () const = 0;
+ virtual framepos_t leftmost_sample() const = 0;
+ virtual framecnt_t current_page_samples() const = 0;
+ virtual double visible_canvas_height () const = 0;
virtual void temporal_zoom_step (bool coarser) = 0;
virtual void ensure_time_axis_view_is_visible (const TimeAxisView& tav) = 0;
virtual void scroll_tracks_down_line () = 0;
@@ -365,10 +361,12 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi
virtual Gtk::HBox& get_status_bar_packer() = 0;
#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;
+ virtual ArdourCanvas::Group* get_time_bars_group () const = 0;
+ virtual ArdourCanvas::Group* get_track_canvas_group () const = 0;
+
+ virtual ArdourCanvas::GtkCanvasViewport* get_time_bars_canvas() const = 0;
+ virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0;
virtual TimeAxisView* axis_view_from_route (boost::shared_ptr<ARDOUR::Route>) const = 0;
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index ed9ffda4ef..04b3b5a8c2 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -1400,14 +1400,6 @@ RCOptionEditor::RCOptionEditor ()
add_option (_("Editor"),
new BoolOption (
- "color-regions-using-track-color",
- _("Color regions using their track's color"),
- sigc::mem_fun (*_rc_config, &RCConfiguration::get_color_regions_using_track_color),
- sigc::mem_fun (*_rc_config, &RCConfiguration::set_color_regions_using_track_color)
- ));
-
- add_option (_("Editor"),
- new BoolOption (
"update-editor-during-summary-drag",
_("Update editor window during drags of the summary"),
sigc::mem_fun (*_rc_config, &RCConfiguration::get_update_editor_during_summary_drag),
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 61b361210b..1eae91bc27 100644
--- a/gtk2_ardour/region_gain_line.h
+++ b/gtk2_ardour/region_gain_line.h
@@ -22,11 +22,6 @@
#include "ardour/ardour.h"
-#ifdef interface
-#undef interface
-#endif
-
-#include <libgnomecanvasmm.h>
#include "automation_line.h"
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index 3f20353ee5..530d046f5a 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -28,17 +28,18 @@
#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 "canvas/line.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 +166,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));
+ if (name_text) {
+ name_text->set_data ("regionview", this);
+ name_text->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_event), name_text, this));
}
if (wfd) {
@@ -195,8 +196,6 @@ 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));
-
set_colors ();
ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
@@ -212,7 +211,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;
}
@@ -221,6 +220,12 @@ RegionView::~RegionView ()
delete editor;
}
+bool
+RegionView::canvas_group_event (GdkEvent* event)
+{
+ return trackview.editor().canvas_region_view_event (event, group, this);
+}
+
void
RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*threshold*/)
{
@@ -233,21 +238,22 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*thr
return;
}
- uint32_t const color = ARDOUR_UI::config()->canvasvar_Silence.get();
+ uint32_t const color = ARDOUR_UI::config()->get_canvasvar_Silence();
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
- ArdourCanvas::SimpleRect* cr = new ArdourCanvas::NoEventSimpleRect (*group);
+ ArdourCanvas::Rectangle* cr = new ArdourCanvas::Rectangle (group);
+ cr->set_ignore_events (true);
_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().sample_to_pixel (i->first - _region->start()));
+ cr->set_x1 (trackview.editor().sample_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 +276,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_color (ARDOUR_UI::config()->get_canvasvar_SilenceText());
/* 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().sample_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 +324,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);
}
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 +339,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 ();
@@ -421,7 +427,7 @@ RegionView::region_resized (const PropertyChange& what_changed)
set_duration (_region->length(), 0);
- unit_length = _region->length() / samples_per_unit;
+ unit_length = _region->length() / samples_per_pixel;
for (vector<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@@ -479,7 +485,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));
}
}
@@ -487,13 +493,13 @@ RegionView::set_position (framepos_t pos, void* /*src*/, double* ignored)
}
void
-RegionView::set_samples_per_unit (gdouble spu)
+RegionView::set_samples_per_pixel (double fpp)
{
- TimeAxisViewItem::set_samples_per_unit (spu);
+ TimeAxisViewItem::set_samples_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_samples_per_pixel (fpp);
+ (*i)->set_duration (_region->length() / fpp);
}
region_sync_changed ();
@@ -507,7 +513,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() / samples_per_pixel);
}
return true;
@@ -519,8 +525,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));
}
}
@@ -628,15 +635,16 @@ 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);
+ CANVAS_DEBUG_NAME (sync_mark, string_compose ("sync mark for %1", get_item_name()));
+ sync_mark->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // 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);
+ CANVAS_DEBUG_NAME (sync_line, string_compose ("sync mark for %1", get_item_name()));
+ sync_line->set_outline_color (RGBA_TO_UINT(0,255,0,255)); // FIXME make a themeable colour
}
- /* 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 samples_per_pixel
and a change in the bounds of the _region->
*/
@@ -664,19 +672,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 / samples_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 ();
}
}
@@ -689,12 +693,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));
}
}
@@ -740,19 +744,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 / samples_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);
}
}
@@ -763,7 +768,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;
}
@@ -783,11 +788,11 @@ 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 */
- uint32_t const non_playing_color = ARDOUR_UI::config()->canvasvar_CoveredRegion.get ();
+ uint32_t const non_playing_color = ARDOUR_UI::config()->get_canvasvar_CoveredRegion ();
while (t < end) {
@@ -798,21 +803,22 @@ RegionView::update_coverage_frames (LayerDisplay d)
/* finish off any old rect, if required */
if (cr && me != new_me) {
- cr->property_x2() = trackview.editor().frame_to_pixel (t - position);
+ cr->set_x1 (trackview.editor().sample_to_pixel (t - position));
}
/* 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().sample_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);
}
}
@@ -822,7 +828,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().sample_to_pixel (end - position));
}
if (frame_handle_start) {
@@ -837,8 +843,8 @@ RegionView::update_coverage_frames (LayerDisplay d)
name_highlight->raise_to_top ();
}
- if (name_pixbuf) {
- name_pixbuf->raise_to_top ();
+ if (name_text) {
+ name_text->raise_to_top ();
}
}
@@ -930,32 +936,12 @@ RegionView::thaw_after_trim ()
void
-RegionView::trim_contents (framepos_t frame_delta, bool left_direction, bool swap_direction)
+RegionView::move_contents (frameoffset_t distance)
{
if (_region->locked()) {
return;
}
-
- framepos_t new_bound;
-
- RouteTimeAxisView& rtv = dynamic_cast<RouteTimeAxisView&> (trackview);
- double const speed = rtv.track()->speed ();
-
- if (left_direction) {
- if (swap_direction) {
- new_bound = (framepos_t) (_region->position() / speed) + frame_delta;
- } else {
- new_bound = (framepos_t) (_region->position() / speed) - frame_delta;
- }
- } else {
- if (swap_direction) {
- new_bound = (framepos_t) (_region->position() / speed) - frame_delta;
- } else {
- new_bound = (framepos_t) (_region->position() / speed) + frame_delta;
- }
- }
-
- _region->trim_start ((framepos_t) (new_bound * speed));
+ _region->move_start (distance);
region_changed (PropertyChange (ARDOUR::Properties::start));
}
diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h
index 3016117353..a5d5fddbd0 100644
--- a/gtk2_ardour/region_view.h
+++ b/gtk2_ardour/region_view.h
@@ -25,16 +25,15 @@
#include <vector>
-#include <libgnomecanvasmm.h>
-#include <libgnomecanvasmm/polygon.h>
#include <sigc++/signal.h>
#include "ardour/region.h"
#include "ardour/beats_frames_converter.h"
+#include "canvas/fwd.h"
+
#include "time_axis_view_item.h"
#include "automation_line.h"
#include "enums.h"
-#include "canvas.h"
class TimeAxisView;
class RegionEditor;
@@ -42,9 +41,10 @@ class GhostRegion;
class AutomationTimeAxisView;
class AutomationRegionView;
-namespace Gnome { namespace Canvas {
- class NoEventText;
-} }
+namespace ArdourCanvas {
+ class Polygon;
+ class Text;
+}
class RegionView : public TimeAxisViewItem
{
@@ -52,7 +52,7 @@ class RegionView : public TimeAxisViewItem
RegionView (ArdourCanvas::Group* parent,
TimeAxisView& time_view,
boost::shared_ptr<ARDOUR::Region> region,
- double samples_per_unit,
+ double samples_per_pixel,
Gdk::Color const & basic_color,
bool automation = false);
@@ -70,7 +70,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_samples_per_pixel (double);
virtual bool set_duration (framecnt_t, void*);
void move (double xdelta, double ydelta);
@@ -117,7 +117,7 @@ class RegionView : public TimeAxisViewItem
virtual void trim_front_ending () {}
bool trim_end (framepos_t, bool);
- void trim_contents (framepos_t, bool, bool);
+ void move_contents (ARDOUR::frameoffset_t);
virtual void thaw_after_trim ();
void set_silent_frames (const ARDOUR::AudioIntervalResult&, double threshold);
@@ -134,11 +134,13 @@ class RegionView : public TimeAxisViewItem
RegionView (ArdourCanvas::Group *,
TimeAxisView&,
boost::shared_ptr<ARDOUR::Region>,
- double samples_per_unit,
+ double samples_per_pixel,
Gdk::Color const & basic_color,
bool recording,
TimeAxisViewItem::Visibility);
+ bool canvas_group_event (GdkEvent*);
+
virtual void region_resized (const PBD::PropertyChange&);
virtual void region_muted ();
void region_locked ();
@@ -180,17 +182,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 a113fe9db8..29794eb54f 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -58,7 +58,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"
@@ -69,7 +68,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"
@@ -86,7 +84,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)
@@ -243,8 +241,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
}
- _editor.ZoomChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
- _editor.HorizontalPositionChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::horizontal_position_changed));
+ _editor.ZoomChanged.connect (sigc::mem_fun(*this, &RouteTimeAxisView::reset_samples_per_pixel));
ColorsChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::color_handler));
PropertyList* plist = new PropertyList();
@@ -784,13 +781,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()->get_canvasvar_TimeStretchFill());
+ timestretch_rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeStretchOutline());
}
timestretch_rect->show ();
@@ -799,10 +792,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
@@ -912,21 +903,13 @@ RouteTimeAxisView::route_color_changed ()
}
void
-RouteTimeAxisView::reset_samples_per_unit ()
+RouteTimeAxisView::reset_samples_per_pixel ()
{
- set_samples_per_unit (_editor.get_current_zoom());
+ set_samples_per_pixel (_editor.get_current_zoom());
}
void
-RouteTimeAxisView::horizontal_position_changed ()
-{
- if (_view) {
- _view->horizontal_position_changed ();
- }
-}
-
-void
-RouteTimeAxisView::set_samples_per_unit (double spu)
+RouteTimeAxisView::set_samples_per_pixel (double fpp)
{
double speed = 1.0;
@@ -935,10 +918,10 @@ RouteTimeAxisView::set_samples_per_unit (double spu)
}
if (_view) {
- _view->set_samples_per_unit (spu * speed);
+ _view->set_samples_per_pixel (fpp * speed);
}
- TimeAxisView::set_samples_per_unit (spu * speed);
+ TimeAxisView::set_samples_per_pixel (fpp * speed);
}
void
@@ -1156,7 +1139,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_samples_per_pixel, this));
}
void
@@ -1634,11 +1617,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()->get_canvasvar_TimeStretchOutline());
}
//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()->get_canvasvar_TimeStretchFill());
}
reset_meter();
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 3a5bc34250..2d854c451a 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_samples_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,8 +211,7 @@ protected:
virtual void label_view ();
- void reset_samples_per_unit ();
- void horizontal_position_changed ();
+ void reset_samples_per_pixel ();
virtual void build_automation_action_menu (bool);
virtual void append_extra_display_menu_items () {}
@@ -264,7 +266,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/shuttle_control.cc b/gtk2_ardour/shuttle_control.cc
index a4a83d7018..1d150f73d6 100644
--- a/gtk2_ardour/shuttle_control.cc
+++ b/gtk2_ardour/shuttle_control.cc
@@ -113,7 +113,7 @@ ShuttleControl::on_size_allocate (Gtk::Allocation& alloc)
//background
pattern = cairo_pattern_create_linear (0, 0, 0, alloc.get_height());
- uint32_t col = ARDOUR_UI::config()->canvasvar_Shuttle.get();
+ uint32_t col = ARDOUR_UI::config()->get_canvasvar_Shuttle();
int r,b,g,a;
UINT_TO_RGBA(col, &r, &g, &b, &a);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, r/400.0, g/400.0, b/400.0);
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/step_editor.cc b/gtk2_ardour/step_editor.cc
index 11ac6c3187..4665da348b 100644
--- a/gtk2_ardour/step_editor.cc
+++ b/gtk2_ardour/step_editor.cc
@@ -279,8 +279,8 @@ StepEditor::step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity, Evo
framepos_t fpos = step_edit_region_view->region_beats_to_absolute_frames (step_edit_beat_pos + beat_duration);
- if (fpos >= (_editor.leftmost_position() + _editor.current_page_frames())) {
- _editor.reset_x_origin (fpos - (_editor.current_page_frames()/4));
+ if (fpos >= (_editor.leftmost_sample() + _editor.current_page_samples())) {
+ _editor.reset_x_origin (fpos - (_editor.current_page_samples()/4));
}
Evoral::MusicalTime at = step_edit_beat_pos;
diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc
index 721567bf10..4e5c6de959 100644
--- a/gtk2_ardour/stereo_panner.cc
+++ b/gtk2_ardour/stereo_panner.cc
@@ -615,23 +615,23 @@ StereoPanner::on_key_press_event (GdkEventKey* ev)
void
StereoPanner::set_colors ()
{
- colors[Normal].fill = ARDOUR_UI::config()->canvasvar_StereoPannerFill.get();
- colors[Normal].outline = ARDOUR_UI::config()->canvasvar_StereoPannerOutline.get();
- colors[Normal].text = ARDOUR_UI::config()->canvasvar_StereoPannerText.get();
- colors[Normal].background = ARDOUR_UI::config()->canvasvar_StereoPannerBackground.get();
- colors[Normal].rule = ARDOUR_UI::config()->canvasvar_StereoPannerRule.get();
-
- colors[Mono].fill = ARDOUR_UI::config()->canvasvar_StereoPannerMonoFill.get();
- colors[Mono].outline = ARDOUR_UI::config()->canvasvar_StereoPannerMonoOutline.get();
- colors[Mono].text = ARDOUR_UI::config()->canvasvar_StereoPannerMonoText.get();
- colors[Mono].background = ARDOUR_UI::config()->canvasvar_StereoPannerMonoBackground.get();
- colors[Mono].rule = ARDOUR_UI::config()->canvasvar_StereoPannerRule.get();
-
- colors[Inverted].fill = ARDOUR_UI::config()->canvasvar_StereoPannerInvertedFill.get();
- colors[Inverted].outline = ARDOUR_UI::config()->canvasvar_StereoPannerInvertedOutline.get();
- colors[Inverted].text = ARDOUR_UI::config()->canvasvar_StereoPannerInvertedText.get();
- colors[Inverted].background = ARDOUR_UI::config()->canvasvar_StereoPannerInvertedBackground.get();
- colors[Inverted].rule = ARDOUR_UI::config()->canvasvar_StereoPannerRule.get();
+ colors[Normal].fill = ARDOUR_UI::config()->get_canvasvar_StereoPannerFill();
+ colors[Normal].outline = ARDOUR_UI::config()->get_canvasvar_StereoPannerOutline();
+ colors[Normal].text = ARDOUR_UI::config()->get_canvasvar_StereoPannerText();
+ colors[Normal].background = ARDOUR_UI::config()->get_canvasvar_StereoPannerBackground();
+ colors[Normal].rule = ARDOUR_UI::config()->get_canvasvar_StereoPannerRule();
+
+ colors[Mono].fill = ARDOUR_UI::config()->get_canvasvar_StereoPannerMonoFill();
+ colors[Mono].outline = ARDOUR_UI::config()->get_canvasvar_StereoPannerMonoOutline();
+ colors[Mono].text = ARDOUR_UI::config()->get_canvasvar_StereoPannerMonoText();
+ colors[Mono].background = ARDOUR_UI::config()->get_canvasvar_StereoPannerMonoBackground();
+ colors[Mono].rule = ARDOUR_UI::config()->get_canvasvar_StereoPannerRule();
+
+ colors[Inverted].fill = ARDOUR_UI::config()->get_canvasvar_StereoPannerInvertedFill();
+ colors[Inverted].outline = ARDOUR_UI::config()->get_canvasvar_StereoPannerInvertedOutline();
+ colors[Inverted].text = ARDOUR_UI::config()->get_canvasvar_StereoPannerInvertedText();
+ colors[Inverted].background = ARDOUR_UI::config()->get_canvasvar_StereoPannerInvertedBackground();
+ colors[Inverted].rule = ARDOUR_UI::config()->get_canvasvar_StereoPannerRule();
}
void
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc
index 19f6ee65bb..8239bca2f4 100644
--- a/gtk2_ardour/streamview.cc
+++ b/gtk2_ardour/streamview.cc
@@ -28,12 +28,15 @@
#include "ardour/track.h"
#include "ardour/session.h"
+#include "pbd/compose.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"
@@ -47,13 +50,10 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Editing;
-StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_group, ArdourCanvas::Group* canvas_group)
+StreamView::StreamView (RouteTimeAxisView& tv)
: _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 ())
+ , _canvas_group (new ArdourCanvas::Group (_trackview.canvas_display()))
+ , _samples_per_pixel (_trackview.editor().get_current_zoom ())
, rec_updating(false)
, rec_active(false)
, stream_base_color(0xFFFFFFFF)
@@ -62,19 +62,21 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* background_g
, height(tv.height)
, last_rec_data_frame(0)
{
+ CANVAS_DEBUG_NAME (_canvas_group, string_compose ("SV canvas group %1", _trackview.name()));
+
/* 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 (_canvas_group);
+ CANVAS_DEBUG_NAME (canvas_rect, string_compose ("SV canvas rectangle %1", _trackview.name()));
+ 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 (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::TOP | ArdourCanvas::Rectangle::BOTTOM));
+ canvas_rect->set_outline_color (RGBA_TO_UINT (0, 0, 0, 255));
+ canvas_rect->set_fill_color (RGBA_TO_UINT (1.0, 0, 0, 255));
+ canvas_rect->set_fill (true);
- 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));
@@ -95,14 +97,6 @@ StreamView::~StreamView ()
undisplay_track ();
delete canvas_rect;
-
- if (owns_background_group) {
- delete _background_group;
- }
-
- if (owns_canvas_group) {
- delete _canvas_group;
- }
}
void
@@ -116,8 +110,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 +122,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_samples_per_pixel (double fpp)
{
RegionViewList::iterator i;
- if (spp < 1.0) {
+ if (fpp < 1.0) {
return -1;
}
- _samples_per_unit = spp;
+ _samples_per_pixel = fpp;
for (i = region_views.begin(); i != region_views.end(); ++i) {
- (*i)->set_samples_per_unit (spp);
+ (*i)->set_samples_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().sample_to_pixel (recbox.start);
+ ArdourCanvas::Coord const xend = _trackview.editor().sample_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 +360,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;
}
}
@@ -424,19 +416,19 @@ StreamView::update_rec_box ()
case NonLayered:
case Normal:
rect.length = at - rect.start;
- xstart = _trackview.editor().frame_to_pixel (rect.start);
- xend = _trackview.editor().frame_to_pixel (at);
+ xstart = _trackview.editor().sample_to_pixel (rect.start);
+ xend = _trackview.editor().sample_to_pixel (at);
break;
case Destructive:
rect.length = 2;
- xstart = _trackview.editor().frame_to_pixel (_trackview.track()->current_capture_start());
- xend = _trackview.editor().frame_to_pixel (at);
+ xstart = _trackview.editor().sample_to_pixel (_trackview.track()->current_capture_start());
+ xend = _trackview.editor().sample_to_pixel (at);
break;
}
- rect.rectangle->property_x1() = xstart;
- rect.rectangle->property_x2() = xend;
+ rect.rectangle->set_x0 (xstart);
+ rect.rectangle->set_x1 (xend);
}
}
@@ -603,13 +595,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..c54d5dea70 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,9 +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 void horizontal_position_changed () {}
+ virtual int set_samples_per_pixel (double);
+ gdouble get_samples_per_pixel () const { return _samples_per_pixel; }
virtual void enter_internal_edit_mode ();
virtual void leave_internal_edit_mode ();
@@ -80,7 +82,6 @@ public:
void set_layer_display (LayerDisplay);
LayerDisplay layer_display () const { return _layer_display; }
- ArdourCanvas::Group* background_group() { return _background_group; }
ArdourCanvas::Group* canvas_item() { return _canvas_group; }
enum ColorTarget {
@@ -126,7 +127,7 @@ public:
sigc::signal<void> ContentsHeightChanged;
protected:
- StreamView (RouteTimeAxisView&, ArdourCanvas::Group* background_group = 0, ArdourCanvas::Group* canvas_group = 0);
+ StreamView (RouteTimeAxisView&);
void transport_changed();
void transport_looped();
@@ -149,16 +150,13 @@ protected:
virtual void color_handler () = 0;
RouteTimeAxisView& _trackview;
- bool owns_background_group;
- 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 _samples_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/canvas-sysex.cc b/gtk2_ardour/sys_ex.cc
index ca378fb303..2097de4fa9 100644
--- a/gtk2_ardour/canvas-sysex.cc
+++ b/gtk2_ardour/sys_ex.cc
@@ -18,43 +18,38 @@
*/
#include <iostream>
-
+#include "canvas/flag.h"
#include "ardour_ui.h"
+#include "sys_ex.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)
+SysEx::SysEx (
+ MidiRegionView& region,
+ ArdourCanvas::Group* parent,
+ string& text,
+ double height,
+ double x,
+ double y)
+ : _region (region)
{
- _text = text;
- set_text(text);
+ _flag = new ArdourCanvas::Flag (
+ parent,
+ height,
+ ARDOUR_UI::config()->get_canvasvar_MidiSysExOutline(),
+ ARDOUR_UI::config()->get_canvasvar_MidiSysExFill(),
+ ArdourCanvas::Duple (x, y)
+ );
+
+ _flag->set_text (text);
}
-CanvasSysEx::~CanvasSysEx()
+SysEx::~SysEx()
{
}
bool
-CanvasSysEx::on_event(GdkEvent* ev)
+SysEx::event_handler (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
@@ -71,28 +66,6 @@ CanvasSysEx::on_event(GdkEvent* ev)
}
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;
}
@@ -100,3 +73,14 @@ CanvasSysEx::on_event(GdkEvent* ev)
return false;
}
+void
+SysEx::hide ()
+{
+ _flag->hide ();
+}
+
+void
+SysEx::show ()
+{
+ _flag->show ();
+}
diff --git a/gtk2_ardour/canvas-sysex.h b/gtk2_ardour/sys_ex.h
index c49fcc6df9..1d6787a75e 100644
--- a/gtk2_ardour/canvas-sysex.h
+++ b/gtk2_ardour/sys_ex.h
@@ -17,45 +17,38 @@
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"
+#ifndef __SYSEX_H__
+#define __SYSEX_H__
class MidiRegionView;
-namespace Gnome {
-namespace Canvas {
+namespace ArdourCanvas {
+ class Flag;
+}
-class CanvasSysEx : public CanvasFlag
+class SysEx
{
public:
- CanvasSysEx(
+ SysEx (
MidiRegionView& region,
- Group& parent,
+ ArdourCanvas::Group* parent,
std::string& text,
double height,
double x,
- double y,
- ARDOUR::MidiModel::SysExPtr sysex);
+ double y);
- virtual ~CanvasSysEx();
+ ~SysEx ();
- const ARDOUR::MidiModel::SysExPtr sysex() const { return _sysex; }
- const string text() const { return _text; }
+ void hide ();
+ void show ();
- virtual bool on_event(GdkEvent* ev);
+ ArdourCanvas::Item& item() const { return *_flag; }
-private:
- const ARDOUR::MidiModel::SysExPtr _sysex;
+private:
+ bool event_handler (GdkEvent* ev);
- string _text;
+ MidiRegionView& _region;
+ ArdourCanvas::Flag* _flag;
};
-} // namespace Canvas
-} // namespace Gnome
-
-#endif /* CANVAS_SYSEX_H_ */
+#endif /* __SYSEX_H__ */
diff --git a/gtk2_ardour/tape_region_view.cc b/gtk2_ardour/tape_region_view.cc
index 33731798d7..d626f3df49 100644
--- a/gtk2_ardour/tape_region_view.cc
+++ b/gtk2_ardour/tape_region_view.cc
@@ -79,7 +79,7 @@ TapeAudioRegionView::~TapeAudioRegionView()
}
void
-TapeAudioRegionView::update (uint32_t n)
+TapeAudioRegionView::update (uint32_t /*n*/)
{
/* check that all waves are build and ready */
@@ -87,11 +87,9 @@ 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);
+ // CAIROCANVAS
+ // waves[n]->rebuild ();
}
void
diff --git a/gtk2_ardour/tape_region_view.h b/gtk2_ardour/tape_region_view.h
index a3aa7142ea..c0e04cd8da 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_samples_per_pixel,
Gdk::Color const & base_color);
~TapeAudioRegionView ();
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index 97aa662c38..083b7a5cca 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -17,87 +17,66 @@
*/
-#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"
using namespace std;
-#define MAX_CACHED_LINES 128
-
-TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height)
- : _canvas(canvas)
- , _group(group)
- , _clean_left(DBL_MAX)
- , _clean_right(0.0)
- , _height(screen_height)
+TempoLines::TempoLines (ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double h)
+ : _canvas (canvas)
+ , _group (group)
+ , _height (h)
{
}
void
TempoLines::tempo_map_changed()
{
- _clean_left = DBL_MAX;
- _clean_right = 0.0;
-
- double_t d = 1.0;
- // TODO: Dirty/slow, but 'needed' for zoom :(
- 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;
- _lines.erase(i);
- _lines.insert(make_pair(- d, f));
- i = next;
- }
+ /* remove all lines from the group, put them in the cache (to avoid
+ * unnecessary object destruction+construction later), and clear _lines
+ */
+
+ _group->clear ();
+ _cache.insert (_cache.end(), _lines.begin(), _lines.end());
+ _lines.clear ();
}
void
TempoLines::show ()
{
- for (Lines::iterator i = _lines.begin(); i != _lines.end(); ++i) {
- i->second->show();
- }
+ _group->show ();
}
void
TempoLines::hide ()
{
- for (Lines::iterator i = _lines.begin(); i != _lines.end(); ++i) {
- i->second->hide();
- }
+ _group->hide ();
}
void
TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
const ARDOUR::TempoMap::BBTPointList::const_iterator& end,
- double frames_per_unit)
+ double samples_per_pixel)
{
ARDOUR::TempoMap::BBTPointList::const_iterator i;
- ArdourCanvas::SimpleLine *line = NULL;
- gdouble xpos;
- double who_cares;
- double x1, x2, y1, beat_density;
+ ArdourCanvas::Rect const visible = _canvas.visible_area ();
+ double beat_density;
uint32_t beats = 0;
uint32_t bars = 0;
uint32_t color;
- const size_t needed = distance (begin, end);
-
- _canvas.get_scroll_region (x1, y1, x2, who_cares);
-
/* get the first bar spacing */
i = end;
i--;
- bars = (*i).bar - (*begin).bar;
+ 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,145 +84,43 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
return;
}
- xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
- const double needed_right = xpos;
-
- i = begin;
-
- xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
- const double needed_left = xpos;
-
- Lines::iterator left = _lines.lower_bound(xpos); // first line >= xpos
-
- bool exhausted = (left == _lines.end());
- Lines::iterator li = left;
- if (li != _lines.end())
- line = li->second;
-
- // Tempo map hasn't changed and we're entirely within a clean
- // range, don't need to do anything. Yay.
- if (needed_left >= _clean_left && needed_right <= _clean_right) {
- // cout << endl << "*** LINE CACHE PERFECT HIT" << endl;
- return;
- }
-
- //cout << endl << "*** LINE CACHE MISS" << endl;
-
- bool invalidated = false;
+ tempo_map_changed ();
for (i = begin; i != end; ++i) {
if ((*i).is_bar()) {
- color = ARDOUR_UI::config()->canvasvar_MeasureLineBar.get();
+ color = ARDOUR_UI::config()->get_canvasvar_MeasureLineBar();
} else {
if (beat_density > 2.0) {
continue; /* only draw beat lines if the gaps between beats are large. */
}
- color = ARDOUR_UI::config()->canvasvar_MeasureLineBeat.get();
+ color = ARDOUR_UI::config()->get_canvasvar_MeasureLineBeat();
}
- xpos = rint(((framepos_t)(*i).frame) / (double)frames_per_unit);
-
- li = _lines.lower_bound(xpos); // first line >= xpos
-
- line = (li != _lines.end()) ? li->second : NULL;
- assert(!line || line->property_x1() == li->first);
-
- Lines::iterator next = li;
- if (next != _lines.end())
- ++next;
-
- exhausted = (next == _lines.end());
-
- // Hooray, line is perfect
- if (line && line->property_x1() == xpos) {
- if (li != _lines.end())
- ++li;
-
- line->property_color_rgba() = color;
- // Use existing line, moving if necessary
- } else if (!exhausted) {
- Lines::iterator steal = _lines.end();
- --steal;
-
- // Steal from the right
- if (left->first > needed_left && li != steal && steal->first > needed_right) {
- //cout << "*** STEALING FROM RIGHT" << endl;
- double const x = steal->first;
- line = steal->second;
- _lines.erase(steal);
- line->property_x1() = xpos;
- line->property_x2() = xpos;
- line->property_color_rgba() = color;
- _lines.insert(make_pair(xpos, line));
- invalidated = true;
-
- // Shift clean range left
- _clean_left = min(_clean_left, xpos);
- _clean_right = min(_clean_right, x);
-
- // Move this line to where we need it
- } else {
- Lines::iterator existing = _lines.find(xpos);
- if (existing != _lines.end()) {
- //cout << "*** EXISTING LINE" << endl;
- li = existing;
- li->second->property_color_rgba() = color;
- } else {
- //cout << "*** MOVING LINE" << endl;
- const double x1 = line->property_x1();
- 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;
- _lines.insert(make_pair(xpos, line));
- }
- }
-
- // Create a new line
- } else if (_lines.size() < needed || _lines.size() < MAX_CACHED_LINES) {
- //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;
- _lines.insert(make_pair(xpos, line));
- }
-
- // Steal from the left
+ ArdourCanvas::Coord xpos = rint(((framepos_t)(*i).frame) / (double)samples_per_pixel);
+
+ ArdourCanvas::Line* line;
+
+ if (!_cache.empty()) {
+ line = _cache.back ();
+ _cache.pop_back ();
+ line->reparent (_group);
} else {
- //cout << "*** STEALING FROM LEFT" << endl;
- if (_lines.find (xpos) == _lines.end()) {
- Lines::iterator steal = _lines.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;
- _lines.insert(make_pair(xpos, line));
- invalidated = true;
-
- // Shift clean range right
- _clean_left = max(_clean_left, x);
- _clean_right = max(_clean_right, xpos);
- }
+ line = new ArdourCanvas::Line (_group);
+ CANVAS_DEBUG_NAME (line, "tempo measure line");
+ line->set_ignore_events (true);
}
- }
- // Extend range to what we've 'fixed'
- if (!invalidated) {
- _clean_left = min(_clean_left, needed_left);
- _clean_right = max(_clean_right, needed_right);
+ /* move to 0.5 offset to ensure single pixel lines (see Cairo
+ * FAQ for info on why we do this).
+ */
+
+ line->set_x0 (xpos + 0.5);
+ line->set_x1 (xpos + 0.5);
+ line->set_y0 (0.0);
+ line->set_y1 (_height);
+ line->set_outline_color (color);
+ line->show ();
}
}
diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h
index 1ab71e0681..f4ee293e29 100644
--- a/gtk2_ardour/tempo_lines.h
+++ b/gtk2_ardour/tempo_lines.h
@@ -19,19 +19,8 @@
#ifndef __ardour_tempo_lines_h__
#define __ardour_tempo_lines_h__
-#include <map>
-#include <boost/pool/pool.hpp>
-#include <boost/pool/pool_alloc.hpp>
+#include <list>
#include "ardour/tempo.h"
-#include "canvas.h"
-#include "simpleline.h"
-
-typedef boost::fast_pool_allocator<
- std::pair<const double, ArdourCanvas::SimpleLine*>,
- boost::default_user_allocator_new_delete,
- boost::details::pool::null_mutex,
- 8192>
- MapAllocator;
class TempoLines {
public:
@@ -39,21 +28,20 @@ public:
void tempo_map_changed();
- void draw(const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
- const ARDOUR::TempoMap::BBTPointList::const_iterator& end,
- double frames_per_unit);
+ void draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
+ const ARDOUR::TempoMap::BBTPointList::const_iterator& end,
+ double frames_per_unit);
void show();
void hide();
private:
- typedef std::map<double, ArdourCanvas::SimpleLine*, std::less<double>, MapAllocator> Lines;
+ typedef std::list<ArdourCanvas::Line*> Lines;
Lines _lines;
+ Lines _cache;
- ArdourCanvas::Canvas& _canvas;
+ ArdourCanvas::Canvas& _canvas;
ArdourCanvas::Group* _group;
- double _clean_left;
- double _clean_right;
double _height;
};
diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc
index 5f707e3212..3514d918bd 100644
--- a/gtk2_ardour/theme_manager.cc
+++ b/gtk2_ardour/theme_manager.cc
@@ -35,8 +35,9 @@
#include "ardour/filesystem_paths.h"
+#include "canvas/wave_view.h"
+
#include "ardour_button.h"
-#include "canvas-waveview.h"
#include "theme_manager.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
@@ -58,8 +59,13 @@ ThemeManager::ThemeManager()
, light_button (_("Light Theme"))
, reset_button (_("Restore Defaults"))
, flat_buttons (_("Draw \"flat\" buttons"))
+ , region_color_button (_("Color regions using their track's color"))
+ , show_clipping_button (_("Show waveform clipping"))
+ , waveform_gradient_depth (0, 1.0, 0.05)
+ , waveform_gradient_depth_label (_("Waveforms color gradient depth"))
+ , timeline_item_gradient_depth (0, 1.0, 0.05)
+ , timeline_item_gradient_depth_label (_("Timeline item gradient depth"))
, all_dialogs (_("All floating windows are dialogs"))
- , gradient_waveforms (_("Draw waveforms with color gradient"))
{
set_title (_("Theme Manager"));
@@ -98,26 +104,50 @@ ThemeManager::ThemeManager()
vbox->pack_start (all_dialogs, PACK_SHRINK);
#endif
vbox->pack_start (flat_buttons, PACK_SHRINK);
- vbox->pack_start (gradient_waveforms, PACK_SHRINK);
+ vbox->pack_start (region_color_button, PACK_SHRINK);
+ vbox->pack_start (show_clipping_button, PACK_SHRINK);
+
+ Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox());
+ hbox->set_spacing (6);
+ hbox->pack_start (waveform_gradient_depth, true, true);
+ hbox->pack_start (waveform_gradient_depth_label, false, false);
+ vbox->pack_start (*hbox, PACK_SHRINK);
+
+ hbox = Gtk::manage (new Gtk::HBox());
+ hbox->set_spacing (6);
+ hbox->pack_start (timeline_item_gradient_depth, true, true);
+ hbox->pack_start (timeline_item_gradient_depth_label, false, false);
+
+ vbox->pack_start (*hbox, PACK_SHRINK);
vbox->pack_start (scroller);
vbox->show_all ();
add (*vbox);
+ waveform_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
+ timeline_item_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
+
color_display.signal_button_press_event().connect (sigc::mem_fun (*this, &ThemeManager::button_press_event), false);
color_dialog.get_colorsel()->set_has_opacity_control (true);
color_dialog.get_colorsel()->set_has_palette (true);
+ flat_buttons.set_active (ARDOUR_UI::config()->get_flat_buttons());
+ region_color_button.set_active (ARDOUR_UI::config()->get_color_regions_using_track_color());
+ show_clipping_button.set_active (ARDOUR_UI::config()->get_show_waveform_clipping());
+
color_dialog.get_ok_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_ACCEPT));
color_dialog.get_cancel_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (color_dialog, &Gtk::Dialog::response), RESPONSE_CANCEL));
dark_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_dark_theme_button_toggled));
light_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_light_theme_button_toggled));
reset_button.signal_clicked().connect (sigc::mem_fun (*this, &ThemeManager::reset_canvas_colors));
flat_buttons.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_flat_buttons_toggled));
+ region_color_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_region_color_toggled));
+ show_clipping_button.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_show_clip_toggled));
+ waveform_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_waveform_gradient_depth_change));
+ timeline_item_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_timeline_item_gradient_depth_change));
all_dialogs.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_all_dialogs_toggled));
- gradient_waveforms.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_gradient_waveforms_toggled));
Gtkmm2ext::UI::instance()->set_tip (all_dialogs,
string_compose (_("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
@@ -252,7 +282,7 @@ load_rc_file (const string& filename, bool themechange)
void
ThemeManager::on_flat_buttons_toggled ()
{
- ARDOUR_UI::config()->flat_buttons.set (flat_buttons.get_active());
+ ARDOUR_UI::config()->set_flat_buttons (flat_buttons.get_active());
ARDOUR_UI::config()->set_dirty ();
ArdourButton::set_flat_buttons (flat_buttons.get_active());
/* force a redraw */
@@ -260,22 +290,43 @@ ThemeManager::on_flat_buttons_toggled ()
}
void
+ThemeManager::on_region_color_toggled ()
+{
+ ARDOUR_UI::config()->set_color_regions_using_track_color (region_color_button.get_active());
+ ARDOUR_UI::config()->set_dirty ();
+}
+
+void
+ThemeManager::on_show_clip_toggled ()
+{
+ ARDOUR_UI::config()->set_show_waveform_clipping (show_clipping_button.get_active());
+ ARDOUR_UI::config()->set_dirty ();
+}
+
+void
ThemeManager::on_all_dialogs_toggled ()
{
- ARDOUR_UI::config()->all_floating_windows_are_dialogs.set (all_dialogs.get_active());
+ ARDOUR_UI::config()->set_all_floating_windows_are_dialogs (all_dialogs.get_active());
ARDOUR_UI::config()->set_dirty ();
}
void
-ThemeManager::on_gradient_waveforms_toggled ()
+ThemeManager::on_waveform_gradient_depth_change ()
{
- ARDOUR_UI::config()->gradient_waveforms.set (gradient_waveforms.get_active());
+ double v = waveform_gradient_depth.get_value();
+
+ ARDOUR_UI::config()->set_waveform_gradient_depth (v);
ARDOUR_UI::config()->set_dirty ();
-
- gnome_canvas_waveview_set_gradient_waveforms (gradient_waveforms.get_active());
+ ArdourCanvas::WaveView::set_global_gradient_depth (v);
+}
- /* force a redraw */
- gtk_rc_reset_styles (gtk_settings_get_default());
+void
+ThemeManager::on_timeline_item_gradient_depth_change ()
+{
+ double v = timeline_item_gradient_depth.get_value();
+
+ ARDOUR_UI::config()->set_timeline_item_gradient_depth (v);
+ ARDOUR_UI::config()->set_dirty ();
}
void
@@ -284,13 +335,13 @@ ThemeManager::on_dark_theme_button_toggled()
if (!dark_button.get_active()) return;
if (HACK_PROFILE_IS_SAE()){
- ARDOUR_UI::config()->ui_rc_file.set("ardour3_ui_dark_sae.rc");
+ ARDOUR_UI::config()->set_ui_rc_file("ardour3_ui_dark_sae.rc");
} else {
- ARDOUR_UI::config()->ui_rc_file.set("ardour3_ui_dark.rc");
+ ARDOUR_UI::config()->set_ui_rc_file("ardour3_ui_dark.rc");
}
ARDOUR_UI::config()->set_dirty ();
- load_rc_file (ARDOUR_UI::config()->ui_rc_file.get(), true);
+ load_rc_file (ARDOUR_UI::config()->get_ui_rc_file(), true);
}
void
@@ -299,12 +350,12 @@ ThemeManager::on_light_theme_button_toggled()
if (!light_button.get_active()) return;
if (HACK_PROFILE_IS_SAE()){
- ARDOUR_UI::config()->ui_rc_file.set("ardour3_ui_light_sae.rc");
+ ARDOUR_UI::config()->set_ui_rc_file("ardour3_ui_light_sae.rc");
} else {
- ARDOUR_UI::config()->ui_rc_file.set("ardour3_ui_light.rc");
+ ARDOUR_UI::config()->set_ui_rc_file("ardour3_ui_light.rc");
}
- load_rc_file (ARDOUR_UI::config()->ui_rc_file.get(), true);
+ load_rc_file (ARDOUR_UI::config()->get_ui_rc_file(), true);
}
void
@@ -377,7 +428,7 @@ ThemeManager::setup_theme ()
string rcfile = Glib::getenv("ARDOUR3_UI_RC", env_defined);
if(!env_defined) {
- rcfile = ARDOUR_UI::config()->ui_rc_file.get();
+ rcfile = ARDOUR_UI::config()->get_ui_rc_file();
}
if (rcfile == "ardour3_ui_dark.rc" || rcfile == "ardour3_ui_dark_sae.rc") {
@@ -386,9 +437,10 @@ ThemeManager::setup_theme ()
light_button.set_active();
}
- flat_buttons.set_active (ARDOUR_UI::config()->flat_buttons.get());
- all_dialogs.set_active (ARDOUR_UI::config()->all_floating_windows_are_dialogs.get());
- gradient_waveforms.set_active (ARDOUR_UI::config()->gradient_waveforms.get());
+ flat_buttons.set_active (ARDOUR_UI::config()->get_flat_buttons());
+ waveform_gradient_depth.set_value (ARDOUR_UI::config()->get_waveform_gradient_depth());
+ timeline_item_gradient_depth.set_value (ARDOUR_UI::config()->get_timeline_item_gradient_depth());
+ all_dialogs.set_active (ARDOUR_UI::config()->get_all_floating_windows_are_dialogs());
load_rc_file(rcfile, false);
}
diff --git a/gtk2_ardour/theme_manager.h b/gtk2_ardour/theme_manager.h
index 04aa3ed770..7c8d81fef9 100644
--- a/gtk2_ardour/theme_manager.h
+++ b/gtk2_ardour/theme_manager.h
@@ -26,6 +26,7 @@
#include <gtkmm/colorselection.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/button.h>
+#include <gtkmm/scale.h>
#include <gtkmm/rc.h>
#include "ardour_window.h"
#include "ui_config.h"
@@ -43,8 +44,11 @@ class ThemeManager : public ArdourWindow
void on_dark_theme_button_toggled ();
void on_light_theme_button_toggled ();
void on_flat_buttons_toggled ();
+ void on_region_color_toggled ();
+ void on_show_clip_toggled ();
+ void on_waveform_gradient_depth_change ();
+ void on_timeline_item_gradient_depth_change ();
void on_all_dialogs_toggled ();
- void on_gradient_waveforms_toggled ();
private:
struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
@@ -71,6 +75,12 @@ class ThemeManager : public ArdourWindow
Gtk::RadioButton light_button;
Gtk::Button reset_button;
Gtk::CheckButton flat_buttons;
+ Gtk::CheckButton region_color_button;
+ Gtk::CheckButton show_clipping_button;
+ Gtk::HScale waveform_gradient_depth;
+ Gtk::Label waveform_gradient_depth_label;
+ Gtk::HScale timeline_item_gradient_depth;
+ Gtk::Label timeline_item_gradient_depth_label;
Gtk::CheckButton all_dialogs;
Gtk::CheckButton gradient_waveforms;
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 2cc2adf761..fa181476cf 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,10 @@
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/selector.h>
+#include "canvas/canvas.h"
+#include "canvas/rectangle.h"
+#include "canvas/debug.h"
+
#include "ardour_ui.h"
#include "ardour_dialog.h"
#include "global_signals.h"
@@ -42,8 +43,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 +96,14 @@ 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_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();
@@ -180,7 +178,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;
@@ -195,9 +193,6 @@ TimeAxisView::~TimeAxisView()
delete selection_group;
selection_group = 0;
- delete _canvas_background;
- _canvas_background = 0;
-
delete _canvas_display;
_canvas_display = 0;
@@ -215,7 +210,6 @@ TimeAxisView::hide ()
}
_canvas_display->hide ();
- _canvas_background->hide ();
if (control_parent) {
control_parent->remove (time_axis_vbox);
@@ -260,19 +254,12 @@ 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);
_y_position = y;
}
- _canvas_background->raise_to_top ();
_canvas_display->raise_to_top ();
-
- _canvas_background->show ();
_canvas_display->show ();
_hidden = false;
@@ -293,21 +280,6 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
return _effective_height;
}
-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()) {
- _canvas_background->hide ();
- _canvas_display->hide ();
- return;
- }
- _canvas_background->show ();
- _canvas_display->show ();
- }
- return;
-}
-
bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{
@@ -389,15 +361,33 @@ bool
TimeAxisView::controls_ebox_motion (GdkEventMotion* ev)
{
if (_resize_drag_start >= 0) {
- /* (ab)use the DragManager to do autoscrolling; adjust the event coordinates
- into the world coordinate space that DragManager::motion_handler is expecting,
- and then fake a DragManager motion event so that when maybe_autoscroll
- asks DragManager for the current pointer position it will get the correct
- answers.
+
+ /* (ab)use the DragManager to do autoscrolling - basically we
+ * are pretending that the drag is taking place over the canvas
+ * (which perhaps in the glorious future, when track headers
+ * and the canvas are unified, will actually be true.)
+ *
+ * First, translate the event coordinates into the canvas
+ * coordinate space that DragManager::motion_handler is
+ * expecting (this requires translation into the *window*
+ * coordinates for the track canvas window, and then conversion
+ * from window to canvas coordinate spaces).
+ *
+ * Then fake a DragManager motion event so that when
+ * maybe_autoscroll asks DragManager for the current pointer
+ * position it will get the correct answers.
*/
+
int tx, ty;
- controls_ebox.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
- ev->y = ty - _editor.get_trackview_group_vertical_offset();
+ controls_ebox.translate_coordinates (*_editor.get_track_canvas(), ev->x, ev->y, tx, ty);
+
+ /* x-axis of track headers is not shared with the canvas, but
+ the y-axis is, so we we can get a valid translation here.
+ */
+
+ Duple canvas_coord = _editor.get_track_canvas()->canvas()->window_to_canvas (Duple (tx, ty));
+ ev->y = (int) floor (canvas_coord.y);
+
_editor.drags()->motion_handler ((GdkEvent *) ev, false);
_editor.maybe_autoscroll (false, true, false, ev->y_root < _resize_drag_start);
@@ -547,7 +537,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);
}
@@ -809,14 +799,11 @@ TimeAxisView::build_display_menu ()
}
void
-TimeAxisView::set_samples_per_unit (double spu)
+TimeAxisView::set_samples_per_pixel (double fpp)
{
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
- (*i)->set_samples_per_unit (spu);
+ (*i)->set_samples_per_pixel (fpp);
}
-
- AnalysisFeatureList::const_iterator i;
- list<ArdourCanvas::SimpleLine*>::iterator l;
}
void
@@ -847,7 +834,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,27 +858,17 @@ TimeAxisView::show_selection (TimeSelection& ts)
rect = get_selection_rect ((*i).id);
- x1 = _editor.frame_to_unit (start);
- x2 = _editor.frame_to_unit (start + cnt - 1);
+ x1 = _editor.sample_to_pixel (start);
+ x2 = _editor.sample_to_pixel (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();
@@ -918,7 +895,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();
@@ -986,29 +963,26 @@ 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 ArdourCanvas::Rectangle (selection_group);
+ CANVAS_DEBUG_NAME (rect->rect, "selection rect");
+ rect->rect->set_outline (false);
+ rect->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
- 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 ArdourCanvas::Rectangle (selection_group);
+ CANVAS_DEBUG_NAME (rect->rect, "selection rect start trim");
+ rect->start_trim->set_outline (false);
+ rect->start_trim->set_fill (false);
- 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 ArdourCanvas::Rectangle (selection_group);
+ CANVAS_DEBUG_NAME (rect->rect, "selection rect end trim");
+ rect->end_trim->set_outline (false);
+ rect->end_trim->set_fill (false);
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();
@@ -1168,26 +1142,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()->get_canvasvar_SelectionRect());
+ (*i)->rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
- (*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()->get_canvasvar_Selection());
+ (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
+
+ (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
+ (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
}
-
+
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()->get_canvasvar_SelectionRect());
+ (*i)->rect->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
+
+ (*i)->start_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
+ (*i)->start_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
+
+ (*i)->end_trim->set_fill_color (ARDOUR_UI::config()->get_canvasvar_Selection());
+ (*i)->end_trim->set_outline_color (ARDOUR_UI::config()->get_canvasvar_Selection());
}
}
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 17dfec986b..7dc3ba9494 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;
@@ -100,7 +105,6 @@ class TimeAxisView : public virtual AxisView
virtual void leave_internal_edit_mode () {}
ArdourCanvas::Group* canvas_display () { return _canvas_display; }
- ArdourCanvas::Group* canvas_background () { return _canvas_background; }
ArdourCanvas::Group* ghost_group () { return _ghost_group; }
/** @return effective height (taking children into account) in canvas units, or
@@ -120,8 +124,6 @@ class TimeAxisView : public virtual AxisView
virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent);
virtual void hide ();
- void clip_to_viewport ();
-
bool touched (double top, double bot);
/** @return true if hidden, otherwise false */
@@ -149,7 +151,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_samples_per_pixel (double);
virtual void show_selection (TimeSelection&);
virtual void hide_selection ();
virtual void reshow_selection (TimeSelection&);
@@ -276,7 +278,6 @@ class TimeAxisView : public virtual AxisView
void build_size_menu ();
private:
- ArdourCanvas::Group* _canvas_background;
Gtk::VBox* control_parent;
int _order;
uint32_t _effective_height;
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 2b20b3c45e..23c17476d3 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -17,6 +17,8 @@
*/
+#include <utility>
+
#include "pbd/error.h"
#include "pbd/stacktrace.h"
@@ -26,6 +28,12 @@
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/gui_thread.h"
+#include "canvas/group.h"
+#include "canvas/rectangle.h"
+#include "canvas/debug.h"
+#include "canvas/text.h"
+#include "canvas/utils.h"
+
#include "ardour_ui.h"
/*
* ardour_ui.h was moved up in the include list
@@ -36,9 +44,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"
@@ -77,7 +83,7 @@ TimeAxisViewItem::set_constant_heights ()
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
NAME_HEIGHT = height;
- NAME_Y_OFFSET = height + 3;
+ NAME_Y_OFFSET = height + 5; // XXX this offset is magic
NAME_HIGHLIGHT_SIZE = height + 2;
NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
}
@@ -105,9 +111,7 @@ TimeAxisViewItem::TimeAxisViewItem(
, _automation (automation)
, _dragging (false)
{
- group = new ArdourCanvas::Group (parent);
-
- init (it_name, spu, base_color, start, duration, vis, true, true);
+ init (it_name, &parent, spu, base_color, start, duration, vis, true, true);
}
TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
@@ -128,22 +132,25 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
/* share the other's parent, but still create a new group */
- Gnome::Canvas::Group* parent = other.group->property_parent();
-
- group = new ArdourCanvas::Group (*parent);
-
+ ArdourCanvas::Group* parent = other.group->parent();
+
_selected = other._selected;
-
- init (other.item_name, other.samples_per_unit, c, other.frame_position,
+
+ init (other.item_name, parent, other.samples_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, ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color,
+ framepos_t start, framepos_t duration, Visibility vis,
+ bool wide, bool high)
{
+ group = new ArdourCanvas::Group (parent);
+ CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
+ group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
+
item_name = it_name;
- samples_per_unit = spu;
+ samples_per_pixel = fpp;
frame_position = start;
item_duration = duration;
name_connected = false;
@@ -154,7 +161,7 @@ TimeAxisViewItem::init (
show_vestigial = true;
visibility = vis;
_sensitive = true;
- name_pixbuf_width = 0;
+ name_text_width = 0;
last_item_width = 0;
wide_enough_for_name = wide;
high_enough_for_name = high;
@@ -164,54 +171,63 @@ 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()));
+ CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name()));
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_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
+ vestigial_frame->set_fill_color (ARDOUR_UI::config()->get_canvasvar_VestigialFrame());
if (visibility & ShowFrame) {
- frame = new ArdourCanvas::SimpleRect (*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 = new ArdourCanvas::Rectangle (group,
+ ArdourCanvas::Rect (0.0, 1.0,
+ trackview.editor().sample_to_pixel(duration),
+ trackview.current_height()));
+ CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
if (_recregion) {
- frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+ frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_RecordingRect());
} else {
- frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
+ frame->set_outline_color (ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame());
}
- frame->property_outline_what() = 0x1|0x2|0x4|0x8;
-
} else {
+
frame = 0;
}
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().sample_to_pixel(item_duration),
+ trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
+ trackview.current_height()));
+ CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
} 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().sample_to_pixel(item_duration) - 1,
+ trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE,
+ trackview.current_height()));
+ CANVAS_DEBUG_NAME (name_highlight, string_compose ("name highlight for %1", get_item_name()));
}
name_highlight->set_data ("timeaxisviewitem", this);
- name_highlight->property_outline_what() = 0x4;
+ name_highlight->set_outline_what (ArdourCanvas::Rectangle::TOP);
/* 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_text = new ArdourCanvas::Text (group);
+ CANVAS_DEBUG_NAME (name_text, string_compose ("name text for %1", get_item_name()));
+ name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, trackview.current_height() - NAME_Y_OFFSET));
+ name_text->set_font_description (NAME_FONT);
+
} else {
- name_pixbuf = 0;
+ name_text = 0;
}
/* create our grab handles used for trimming/duration etc */
@@ -219,10 +235,17 @@ 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()));
+ CANVAS_DEBUG_NAME (frame_handle_start, "TAVI frame handle start");
+ frame_handle_start->set_outline (false);
+ frame_handle_start->set_fill (false);
+ frame_handle_start->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_start));
+
+ frame_handle_end = new ArdourCanvas::Rectangle (group, ArdourCanvas::Rect (0.0, top, width, trackview.current_height()));
+ CANVAS_DEBUG_NAME (frame_handle_end, "TAVI frame handle end");
+ frame_handle_end->set_outline (false);
+ frame_handle_end->set_fill (false);
+ frame_handle_end->Event.connect (sigc::bind (sigc::mem_fun (*this, &TimeAxisViewItem::frame_handle_crossing), frame_handle_end));
} else {
frame_handle_start = frame_handle_end = 0;
}
@@ -233,6 +256,7 @@ TimeAxisViewItem::init (
set_position (start, this);
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TimeAxisViewItem::parameter_changed, this, _1), gui_context ());
+ ARDOUR_UI::config()->ParameterChanged.connect (sigc::mem_fun (*this, &TimeAxisViewItem::parameter_changed));
}
TimeAxisViewItem::~TimeAxisViewItem()
@@ -240,6 +264,12 @@ TimeAxisViewItem::~TimeAxisViewItem()
delete group;
}
+bool
+TimeAxisViewItem::canvas_group_event (GdkEvent* /*ev*/)
+{
+ return false;
+}
+
void
TimeAxisViewItem::hide_rect ()
{
@@ -247,8 +277,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 (ArdourCanvas::Rectangle::What (0));
+ name_highlight->set_fill_color (UINT_RGBA_CHANGE_A (fill_color, 64));
}
}
@@ -259,12 +289,11 @@ 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 (ArdourCanvas::Rectangle::TOP);
+ name_highlight->set_fill_color (fill_color);
}
}
-
/**
* Set the position of this item on the timeline.
*
@@ -292,12 +321,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 / samples_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) {
@@ -341,7 +370,7 @@ TimeAxisViewItem::set_duration (framecnt_t dur, void* src)
item_duration = dur;
- reset_width_dependent_items (trackview.editor().frame_to_pixel (dur));
+ reset_width_dependent_items (trackview.editor().sample_to_pixel (dur));
DurationChanged (dur, src); /* EMIT_SIGNAL */
return true;
@@ -510,15 +539,15 @@ TimeAxisViewItem::get_time_axis_view () const
void
TimeAxisViewItem::set_name_text(const string& new_name)
{
- if (!name_pixbuf) {
+ if (!name_text) {
return;
}
- 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"));
-}
+ last_item_width = trackview.editor().sample_to_pixel(item_duration);
+ name_text_width = pixel_width (new_name, NAME_FONT) + 2;
+ name_text->set (new_name);
+}
/**
* Set the height of this item.
@@ -541,31 +570,31 @@ 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_text->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 ();
+ update_name_text_visibility ();
set_colors ();
}
@@ -594,12 +623,6 @@ TimeAxisViewItem::get_name_highlight()
return name_highlight;
}
-ArdourCanvas::Pixbuf*
-TimeAxisViewItem::get_name_pixbuf()
-{
- return name_pixbuf;
-}
-
/**
* Calculate some contrasting color for displaying various parts of this item, based upon the base color.
*
@@ -703,74 +726,162 @@ TimeAxisViewItem::set_colors()
set_frame_color();
if (name_highlight) {
- name_highlight->property_fill_color_rgba() = fill_color;
+ name_highlight->set_fill_color (fill_color);
}
+
+ if (name_text) {
+ double r, g, b, a;
+
+ const double black_r = 0.0;
+ const double black_g = 0.0;
+ const double black_b = 0.0;
+
+ const double white_r = 1.0;
+ const double white_g = 1.0;
+ const double white_b = 1.0;
+
+ ArdourCanvas::color_to_rgba (fill_color, r, g, b, a);
+
+ /* Use W3C contrast guideline calculation */
+
+ double white_contrast = (max (r, white_r) - min (r, white_r)) +
+ (max (g, white_g) - min (g, white_g)) +
+ (max (b, white_b) - min (b, white_b));
+
+ double black_contrast = (max (r, black_r) - min (r, black_r)) +
+ (max (g, black_g) - min (g, black_g)) +
+ (max (b, black_b) - min (b, black_b));
+
+ if (white_contrast > black_contrast) {
+ /* use white */
+ name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
+ } else {
+ /* use black */
+ name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
+ }
+
+#if 0
+ double h, s, v;
+
+ ArdourCanvas::color_to_hsv (fill_color, h, s, v);
+
+ if (v == 0.0) {
+ /* fill is black, set text to white */
+ name_text->set_color (ArdourCanvas::rgba_to_color (1.0, 1.0, 1.0, 1.0));
+ } else if (v == 1.0) {
+ /* fill is white, set text to black */
+ name_text->set_color (ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0));
+ } else {
+
+ h = fabs (fmod ((h - 180), 360.0)); /* complementary color */
+ s = 1.0; /* fully saturate */
+ v = 0.9; /* increase lightness/brightness/value */
+
+ name_text->set_color (ArdourCanvas::hsv_to_color (h, s, v, 1.0));
+ }
+#endif
+
+ }
+
set_trim_handle_colors();
}
-/**
- * Sets the frame color depending on whether this item is selected
- */
-void
-TimeAxisViewItem::set_frame_color()
+uint32_t
+TimeAxisViewItem::get_fill_color () const
{
uint32_t f = 0;
- if (!frame) {
- return;
- }
-
if (_selected) {
- f = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
-
- if (fill_opacity) {
- f = UINT_RGBA_CHANGE_A (f, fill_opacity);
- }
-
- if (!rect_visible) {
- f = UINT_RGBA_CHANGE_A (f, 0);
- }
+ f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
} else {
if (_recregion) {
- f = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+ f = ARDOUR_UI::config()->get_canvasvar_RecordingRect();
} else {
- if (high_enough_for_name && !Config->get_color_regions_using_track_color()) {
- f = ARDOUR_UI::config()->canvasvar_FrameBase.get();
+ if (high_enough_for_name && !ARDOUR_UI::config()->get_color_regions_using_track_color()) {
+ f = ARDOUR_UI::config()->get_canvasvar_FrameBase();
} else {
f = fill_color;
}
+ }
+ }
- if (fill_opacity) {
- f = UINT_RGBA_CHANGE_A (f, fill_opacity);
- }
+ return f;
+}
- if (!rect_visible) {
- f = UINT_RGBA_CHANGE_A (f, 0);
- }
- }
+/**
+ * Sets the frame color depending on whether this item is selected
+ */
+void
+TimeAxisViewItem::set_frame_color()
+{
+ uint32_t f = 0;
+
+ if (!frame) {
+ return;
+ }
+
+ f = get_fill_color ();
+
+ if (fill_opacity) {
+ f = UINT_RGBA_CHANGE_A (f, fill_opacity);
+ }
+
+ if (!rect_visible) {
+ f = UINT_RGBA_CHANGE_A (f, 0);
}
- frame->property_fill_color_rgba() = f;
+ frame->set_fill_color (f);
+ set_frame_gradient ();
if (!_recregion) {
if (_selected) {
- f = ARDOUR_UI::config()->canvasvar_SelectedTimeAxisFrame.get();
+ f = ARDOUR_UI::config()->get_canvasvar_SelectedTimeAxisFrame();
} else {
- f = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
+ f = ARDOUR_UI::config()->get_canvasvar_TimeAxisFrame();
}
if (!rect_visible) {
f = UINT_RGBA_CHANGE_A (f, 64);
}
- frame->property_outline_color_rgba() = f;
+ frame->set_outline_color (f);
}
}
+void
+TimeAxisViewItem::set_frame_gradient ()
+{
+ if (ARDOUR_UI::config()->get_timeline_item_gradient_depth() == 0.0) {
+ frame->set_gradient (ArdourCanvas::Fill::StopList (), 0);
+ return;
+ }
+
+ ArdourCanvas::Fill::StopList stops;
+ double r, g, b, a;
+ double h, s, v;
+ ArdourCanvas::Color f (get_fill_color());
+
+ /* need to get alpha value */
+ ArdourCanvas::color_to_rgba (f, r, g, b, a);
+
+ stops.push_back (std::make_pair (0.0, f));
+
+ /* now a darker version */
+
+ ArdourCanvas::color_to_hsv (f, h, s, v);
+
+ v = min (1.0, v * (1.0 - ARDOUR_UI::config()->get_timeline_item_gradient_depth()));
+
+ ArdourCanvas::Color darker = ArdourCanvas::hsv_to_color (h, s, v, a);
+ stops.push_back (std::make_pair (1.0, darker));
+
+ frame->set_gradient (stops, true);
+}
+
/**
* Set the colors of the start and end trim handle depending on object state
*/
@@ -779,41 +890,55 @@ 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()->get_canvasvar_TrimHandleLocked());
+ frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandleLocked());
} 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 (ARDOUR_UI::config()->get_canvasvar_TrimHandle());
+ frame_handle_end->set_fill_color (ARDOUR_UI::config()->get_canvasvar_TrimHandle());
}
}
}
-/** @return the samples per unit of this item */
+bool
+TimeAxisViewItem::frame_handle_crossing (GdkEvent* ev, ArdourCanvas::Rectangle* item)
+{
+ switch (ev->type) {
+ case GDK_LEAVE_NOTIFY:
+ item->set_fill (false);
+ break;
+ case GDK_ENTER_NOTIFY:
+ item->set_fill (true);
+ break;
+ default:
+ break;
+ }
+ return false;
+}
+
+/** @return the frames per pixel */
double
-TimeAxisViewItem::get_samples_per_unit()
+TimeAxisViewItem::get_samples_per_pixel () const
{
- return samples_per_unit;
+ return samples_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_samples_per_pixel (double fpp)
{
- samples_per_unit = spu;
+ samples_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() / samples_per_pixel);
}
void
TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
{
-
if (pixel_width < 2.0) {
if (show_vestigial) {
@@ -851,12 +976,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) {
@@ -866,12 +991,13 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
* the right-hand end of frame_handle_start and the left-hand
* end of frame_handle_end, so disable the handles
*/
+
frame_handle_start->hide();
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();
}
}
@@ -879,7 +1005,7 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
wide_enough_for_name = true;
}
- update_name_pixbuf_visibility ();
+ update_name_text_visibility ();
}
void
@@ -887,19 +1013,19 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
{
uint32_t it_width;
int pb_width;
- bool pixbuf_holds_full_name;
+ bool showing_full_name;
- if (!name_pixbuf) {
+ if (!name_text) {
return;
}
- it_width = trackview.editor().frame_to_pixel(item_duration);
- pb_width = name_pixbuf_width;
+ it_width = trackview.editor().sample_to_pixel(item_duration);
+ pb_width = name_text_width;
- pixbuf_holds_full_name = last_item_width > pb_width + NAME_X_OFFSET;
+ showing_full_name = last_item_width > pb_width + NAME_X_OFFSET;
last_item_width = it_width;
- if (pixbuf_holds_full_name && (it_width >= pb_width + NAME_X_OFFSET)) {
+ if (showing_full_name && (it_width >= pb_width + NAME_X_OFFSET)) {
/*
we've previously had the full name length showing
and its still showing.
@@ -917,13 +1043,14 @@ TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
wide_enough_for_name = true;
}
- update_name_pixbuf_visibility ();
+ update_name_text_visibility ();
if (pb_width < 1) {
pb_width = 1;
}
- name_pixbuf->property_pixbuf() = pixbuf_from_string(item_name, NAME_FONT, pb_width, NAME_HEIGHT, Gdk::Color ("#000000"));
+ name_text->set (item_name);
+ name_text->clamp_width (pb_width);
}
/**
@@ -946,23 +1073,20 @@ 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
-TimeAxisViewItem::update_name_pixbuf_visibility ()
+TimeAxisViewItem::update_name_text_visibility ()
{
- if (!name_pixbuf) {
+ if (!name_text) {
return;
}
if (wide_enough_for_name && high_enough_for_name) {
- name_pixbuf->show ();
+ name_text->show ();
} else {
- name_pixbuf->hide ();
+ name_text->hide ();
}
}
@@ -970,6 +1094,8 @@ void
TimeAxisViewItem::parameter_changed (string p)
{
if (p == "color-regions-using-track-color") {
- set_frame_color ();
+ set_colors ();
+ } else if (p == "timeline-item-gradient-depth") {
+ set_frame_gradient ();
}
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 3985b8ffd8..054d496013 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -21,17 +21,22 @@
#define __gtk_ardour_time_axis_view_item_h__
#include <string>
-
-#include <libgnomecanvasmm/pixbuf.h>
-
+#include <gdk/gdk.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;
+ class Text;
+}
+
using ARDOUR::framepos_t;
using ARDOUR::framecnt_t;
@@ -69,14 +74,15 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
void set_y (double);
void set_color (Gdk::Color const &);
+ uint32_t get_fill_color () const;
+
ArdourCanvas::Item* get_canvas_frame();
ArdourCanvas::Group* get_canvas_group();
ArdourCanvas::Item* get_name_highlight();
- ArdourCanvas::Pixbuf* get_name_pixbuf();
- virtual void set_samples_per_unit(double spu);
+ virtual void set_samples_per_pixel (double);
- double get_samples_per_unit();
+ double get_samples_per_pixel () const;
virtual void drag_start() { _dragging = true; }
virtual void drag_end() { _dragging = false; }
@@ -153,16 +159,19 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
TimeAxisViewItem (const TimeAxisViewItem&);
- void init (const std::string&, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
+ void init (const std::string&, ArdourCanvas::Group*, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
+
+ virtual bool canvas_group_event (GdkEvent*);
virtual void compute_colors (Gdk::Color const &);
virtual void set_colors();
virtual void set_frame_color();
+ virtual void set_frame_gradient ();
void set_trim_handle_colors();
virtual void reset_width_dependent_items (double);
void reset_name_width (double);
- void update_name_pixbuf_visibility ();
+ void update_name_text_visibility ();
static gint idle_remove_this_item(TimeAxisViewItem*, void*);
@@ -190,8 +199,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 samples_per_pixel;
/** should the item respond to events */
bool _sensitive;
@@ -225,20 +234,22 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
uint32_t lock_handle_color_g;
uint32_t lock_handle_color_b;
uint32_t last_item_width;
- int name_pixbuf_width;
+ int name_text_width;
bool wide_enough_for_name;
bool high_enough_for_name;
bool rect_visible;
ArdourCanvas::Group* group;
- ArdourCanvas::SimpleRect* vestigial_frame;
- ArdourCanvas::SimpleRect* frame;
- ArdourCanvas::Pixbuf* name_pixbuf;
- ArdourCanvas::SimpleRect* name_highlight;
+ ArdourCanvas::Rectangle* vestigial_frame;
+ ArdourCanvas::Rectangle* frame;
+ ArdourCanvas::Text* name_text;
+ 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
+
+ bool frame_handle_crossing (GdkEvent*, ArdourCanvas::Rectangle*);
double _height;
Visibility visibility;
diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc
index 573e509ab9..215df25e7f 100644
--- a/gtk2_ardour/ui_config.cc
+++ b/gtk2_ardour/ui_config.cc
@@ -59,6 +59,15 @@ UIConfiguration::~UIConfiguration ()
{
}
+void
+UIConfiguration::map_parameters (boost::function<void (std::string)>& functor)
+{
+#undef UI_CONFIG_VARIABLE
+#define UI_CONFIG_VARIABLE(Type,var,Name,value) functor (Name);
+#include "ui_config_vars.h"
+#undef UI_CONFIG_VARIABLE
+}
+
int
UIConfiguration::load_defaults ()
{
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h
index f96659de76..bfa8859afd 100644
--- a/gtk2_ardour/ui_config.h
+++ b/gtk2_ardour/ui_config.h
@@ -91,18 +91,36 @@ class UIConfiguration : public PBD::Stateful
uint32_t color_by_name (const std::string&);
- sigc::signal<void,const char*> ParameterChanged;
+ sigc::signal<void,std::string> ParameterChanged;
+ void map_parameters (boost::function<void (std::string)>&);
+#undef UI_CONFIG_VARIABLE
+#define UI_CONFIG_VARIABLE(Type,var,name,value) \
+ Type get_##var () const { return var.get(); } \
+ bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
+#include "ui_config_vars.h"
#undef UI_CONFIG_VARIABLE
+#undef CANVAS_VARIABLE
+#define CANVAS_VARIABLE(var,name) \
+ uint32_t get_##var () const { return var.get(); } \
+ bool set_##var (uint32_t val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
+#include "canvas_vars.h"
#undef CANVAS_VARIABLE
-#define UI_CONFIG_VARIABLE(Type,var,name,val) UIConfigVariable<Type> var;
-#define CANVAS_VARIABLE(var,name) UIConfigVariable<uint32_t> var;
+
+ private:
+
+ /* declare variables */
+
+#undef UI_CONFIG_VARIABLE
+#define UI_CONFIG_VARIABLE(Type,var,name,value) UIConfigVariable<Type> var;
#include "ui_config_vars.h"
+#undef UI_CONFIG_VARIABLE
+
+#undef CANVAS_VARIABLE
+#define CANVAS_VARIABLE(var,name) UIConfigVariable<uint32_t> var;
#include "canvas_vars.h"
-#undef UI_CONFIG_VARIABLE
#undef CANVAS_VARIABLE
- private:
XMLNode& state ();
bool _dirty;
};
diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h
index ad266d9674..18bda55457 100644
--- a/gtk2_ardour/ui_config_vars.h
+++ b/gtk2_ardour/ui_config_vars.h
@@ -19,6 +19,9 @@
UI_CONFIG_VARIABLE(std::string, ui_rc_file, "ui-rc-file", "ardour3_ui_dark.rc")
UI_CONFIG_VARIABLE(bool, flat_buttons, "flat-buttons", false)
-UI_CONFIG_VARIABLE(bool, gradient_waveforms, "gradient-waveforms", false)
+UI_CONFIG_VARIABLE(float, waveform_gradient_depth, "waveform-gradient-depth", 0.6)
+UI_CONFIG_VARIABLE(float, timeline_item_gradient_depth, "timeline-item-gradient-depth", 1.3)
UI_CONFIG_VARIABLE(bool, all_floating_windows_are_dialogs, "all-floating-windows-are-dialogs", false)
+UI_CONFIG_VARIABLE (bool, color_regions_using_track_color, "color-regions-using-track-color", false)
+UI_CONFIG_VARIABLE (bool, show_waveform_clipping, "show-waveform-clipping", true)
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index bbce202ad1..eb370be0dc 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;
@@ -201,18 +199,6 @@ xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h)
return (savergb);
}
-ArdourCanvas::Points*
-get_canvas_points (string /*who*/, uint32_t npoints)
-{
- // cerr << who << ": wants " << npoints << " canvas points" << endl;
-#ifdef TRAP_EXCESSIVE_POINT_REQUESTS
- if (npoints > (uint32_t) gdk_screen_width() + 4) {
- abort ();
- }
-#endif
- return new ArdourCanvas::Points (npoints);
-}
-
Pango::FontDescription
get_font_for_style (string widgetname)
{
@@ -348,12 +334,6 @@ rgba_p_from_style (string style, float *r, float *g, float *b, string attr, int
return true;
}
-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)
{
@@ -401,7 +381,7 @@ emulate_key_event (Gtk::Widget* w, unsigned int keyval)
ev.state = 0;
ev.keyval = keyval;
ev.length = 0;
- ev.string = (const gchar*) "";
+ ev.string = const_cast<gchar*> ("");
ev.hardware_keycode = keymapkey[0].keycode;
ev.group = keymapkey[0].group;
g_free(keymapkey);
@@ -830,15 +810,15 @@ unique_random_color (list<Gdk::Color>& used_colors)
while (1) {
- /* avoid neon/glowing tones by limiting them to the
- "inner section" (paler) of a color wheel/circle.
- */
+ double h, s, v;
- const int32_t max_saturation = 48000; // 65535 would open up the whole color wheel
+ h = fmod (random(), 360.0);
+ s = (random() % 65535) / 65535.0;
+ v = (random() % 65535) / 65535.0;
- newcolor.set_red (g_random_int() % max_saturation);
- newcolor.set_blue (g_random_int() % max_saturation);
- newcolor.set_green (g_random_int() % max_saturation);
+ s = min (0.5, s); /* not too saturated */
+ v = max (0.9, v); /* not too bright */
+ newcolor.set_hsv (h, s, v);
if (used_colors.size() == 0) {
used_colors.push_back (newcolor);
@@ -854,6 +834,7 @@ unique_random_color (list<Gdk::Color>& used_colors)
gdelta = newcolor.get_green() - c.get_green();
if (sqrt (rdelta*rdelta + bdelta*bdelta + gdelta*gdelta) > 25.0) {
+ /* different enough */
used_colors.push_back (newcolor);
return newcolor;
}
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 5d7bf000ea..54ef65acd0 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*);
@@ -60,8 +65,6 @@ bool rgba_p_from_style (std::string, float*, float*, float*, std::string = "fg",
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..fec9e80ae1 100644
--- a/gtk2_ardour/verbose_cursor.cc
+++ b/gtk2_ardour/verbose_cursor.cc
@@ -22,6 +22,8 @@
#include "pbd/stacktrace.h"
#include "ardour/profile.h"
+#include "canvas/debug.h"
+
#include "ardour_ui.h"
#include "audio_clock.h"
#include "editor.h"
@@ -41,9 +43,10 @@ VerboseCursor::VerboseCursor (Editor* editor)
, _xoffset (0)
, _yoffset (0)
{
- _canvas_item = new ArdourCanvas::NoEventText (*_editor->track_canvas->root());
- _canvas_item->property_font_desc() = get_font_for_style (N_("VerboseCanvasCursor"));
- _canvas_item->property_anchor() = Gtk::ANCHOR_NW;
+ _canvas_item = new ArdourCanvas::Text (_editor->_track_canvas->root());
+ CANVAS_DEBUG_NAME (_canvas_item, "verbose canvas cursor");
+ _canvas_item->set_ignore_events (true);
+ _canvas_item->set_font_description (get_font_for_style (N_("VerboseCanvasCursor")));
}
ArdourCanvas::Item *
@@ -62,7 +65,7 @@ VerboseCursor::set (string const & text, double x, double y)
void
VerboseCursor::set_text (string const & text)
{
- _canvas_item->property_text() = text.c_str();
+ _canvas_item->set (text);
}
/** @param xoffset x offset to be applied on top of any set_position() call
@@ -94,22 +97,14 @@ VerboseCursor::hide ()
double
VerboseCursor::clamp_x (double x)
{
- if (x < 0) {
- x = 0;
- } else {
- x = min (_editor->_canvas_width - 200.0, x);
- }
+ _editor->clamp_verbose_cursor_x (x);
return x;
}
double
VerboseCursor::clamp_y (double y)
{
- if (y < _editor->canvas_timebars_vsize) {
- y = _editor->canvas_timebars_vsize;
- } else {
- y = min (_editor->_canvas_height - 50, y);
- }
+ _editor->clamp_verbose_cursor_y (y);
return y;
}
@@ -254,7 +249,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_color (color);
}
/** Set the position of the verbose cursor. Any x/y offsets
@@ -264,8 +259,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..8db45608cd 100644
--- a/gtk2_ardour/verbose_cursor.h
+++ b/gtk2_ardour/verbose_cursor.h
@@ -17,10 +17,9 @@
*/
-#include <libgnomecanvasmm/item.h>
#include "ardour/types.h"
-#include "canvas-noevent-text.h"
-#include "canvas.h"
+#include "canvas/text.h"
+#include "canvas/canvas.h"
class Editor;
@@ -43,13 +42,15 @@ public:
void show (double xoffset = 0, double yoffset = 0);
void hide ();
+ ArdourCanvas::Item& item() { return *_canvas_item; }
+
private:
double clamp_x (double);
double clamp_y (double);
- Editor* _editor;
- ArdourCanvas::NoEventText* _canvas_item;
- bool _visible;
- double _xoffset;
- double _yoffset;
+ Editor* _editor;
+ ArdourCanvas::Text* _canvas_item;
+ bool _visible;
+ double _xoffset;
+ double _yoffset;
};
diff --git a/gtk2_ardour/video_image_frame.cc b/gtk2_ardour/video_image_frame.cc
index 58e0d68d71..ebcb9e6f96 100644
--- a/gtk2_ardour/video_image_frame.cc
+++ b/gtk2_ardour/video_image_frame.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2010 Paul Davis
+ Copyright (C) 2010, 2013 Paul Davis
Author: Robin Gareus <robin@gareus.org>
This program is free software; you can redistribute it and/or modify
@@ -24,9 +24,7 @@
#include "video_image_frame.h"
#include "public_editor.h"
#include "utils.h"
-#include "canvas_impl.h"
-#include "simpleline.h"
-#include "rgb_macros.h"
+#include "canvas/group.h"
#include "utils_videotl.h"
#include <gtkmm2ext/utils.h>
@@ -38,6 +36,13 @@ using namespace std;
using namespace ARDOUR;
using namespace VideoUtils;
+static void freedata_cb (uint8_t *d, void* /*arg*/) {
+ /* later this can be used with libharvid
+ * the buffer/videocacheline instead of freeing it
+ */
+ free (d);
+}
+
VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent, int w, int h, std::string vsurl, std::string vfn)
: editor (ed)
, _parent(&parent)
@@ -51,60 +56,46 @@ VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent,
queued_request=false;
video_frame_number = -1;
rightend = -1;
- frame_position = 0;
+ sample_position = 0;
thread_active=false;
-#if 0 /* DEBUG */
- printf("New VideoImageFrame (%ix%i) %s - %s\n", w, h, vsurl.c_str(), vfn.c_str());
-#endif
-
- unit_position = editor.frame_to_unit (frame_position);
- group = new Group (parent, unit_position, 1.0);
- img_pixbuf = new ArdourCanvas::Pixbuf(*group);
-
- Glib::RefPtr<Gdk::Pixbuf> img;
-
- img = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height);
- img->fill(RGBA_TO_UINT(0,0,0,255));
- img_pixbuf->property_pixbuf() = img;
+ unit_position = editor.sample_to_pixel (sample_position);
+ image = new ArdourCanvas::Image (_parent, Cairo::FORMAT_ARGB32, clip_width, clip_height);
+ img = image->get_image();
+ fill_frame(0, 0, 0);
draw_line();
- video_draw_cross(img_pixbuf->property_pixbuf());
+ draw_x();
+ image->put_image(img);
- group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
- //img_pixbuf->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
+ image->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
}
VideoImageFrame::~VideoImageFrame ()
{
if (thread_active) pthread_join(thread_id_tt, NULL);
- delete img_pixbuf;
- delete group;
+ delete image;
pthread_mutex_destroy(&request_lock);
pthread_mutex_destroy(&queue_lock);
}
void
-VideoImageFrame::set_position (framepos_t frame)
+VideoImageFrame::set_position (framepos_t sample)
{
- double new_unit_position = editor.frame_to_unit (frame);
- group->move (new_unit_position - unit_position, 0.0);
- frame_position = frame;
+ double new_unit_position = editor.sample_to_pixel (sample);
+ image->move (ArdourCanvas::Duple (new_unit_position - unit_position, 0.0));
+ sample_position = sample;
unit_position = new_unit_position;
}
void
VideoImageFrame::reposition ()
{
- set_position (frame_position);
+ set_position (sample_position);
}
void
-VideoImageFrame::exposeimg ()
-{
- img_pixbuf->show();
- /* Note: we can not use this thread to update the window
- * it needs to be done from the Editor's thread idle_update */
+VideoImageFrame::exposeimg () {
ImgChanged(); /* EMIT SIGNAL */
}
@@ -115,21 +106,15 @@ VideoImageFrame::set_videoframe (framepos_t videoframenumber, int re)
video_frame_number = videoframenumber;
rightend = re;
-#if 0 /* dummy mode: print framenumber */
- gchar buf[16];
- snprintf (buf, sizeof(buf), "%li", (long int) videoframenumber);
- img_pixbuf->property_pixbuf() = pixbuf_from_ustring(g_strdup (buf), get_font_for_style (N_("MarkerText")), 80, 60, Gdk::Color ("#C0C0C0"));
- return;
-#endif
-#if 1 /* draw "empty frame" while we request the data */
- Glib::RefPtr<Gdk::Pixbuf> img;
- img = img_pixbuf->property_pixbuf();
- img->fill(RGBA_TO_UINT(0,0,0,255));
- video_draw_cross(img_pixbuf->property_pixbuf());
+
+ img = image->get_image();
+ fill_frame(0, 0, 0);
+ draw_x();
draw_line();
cut_rightend();
+ image->put_image(img);
exposeimg();
-#endif
+
/* request video-frame from decoder in background thread */
http_get(video_frame_number);
}
@@ -137,47 +122,75 @@ VideoImageFrame::set_videoframe (framepos_t videoframenumber, int re)
void
VideoImageFrame::draw_line ()
{
- Glib::RefPtr<Gdk::Pixbuf> img;
- img = img_pixbuf->property_pixbuf();
-
- int rowstride = img->get_rowstride();
- int clip_height = img->get_height();
- int n_channels = img->get_n_channels();
- guchar *pixels, *p;
- pixels = img->get_pixels();
+ const int rowstride = img->stride;
+ const int clip_height = img->height;
+ uint8_t *pixels, *p;
+ pixels = img->data;
int y;
- for (y=0;y<clip_height;y++) {
+ for (y = 0;y < clip_height; y++) {
p = pixels + y * rowstride;
- p[0] = 255; p[1] = 255; p[2] = 255;
- if (n_channels>3) p[3] = 255;
+ p[0] = 255; p[1] = 255; p[2] = 255; p[3] = 255;
+ }
+}
+
+void
+VideoImageFrame::fill_frame (const uint8_t r, const uint8_t g, const uint8_t b)
+{
+ const int rowstride = img->stride;
+ const int clip_height = img->height;
+ const int clip_width = img->width;
+ uint8_t *pixels, *p;
+ pixels = img->data;
+
+ int x,y;
+ for (y = 0; y < clip_height; ++y) {
+ for (x = 0; x < clip_width; ++x) {
+ p = pixels + y * rowstride + x * 4;
+ p[0] = b; p[1] = g; p[2] = r; p[3] = 255;
+ }
+ }
+}
+
+void
+VideoImageFrame::draw_x ()
+{
+ int x,y;
+ const int rowstride = img->stride;
+ const int clip_width = img->width;
+ const int clip_height = img->height;
+ uint8_t *pixels, *p;
+ pixels = img->data;
+
+ for (x = 0;x < clip_width; x++) {
+ y = clip_height * x / clip_width;
+ p = pixels + y * rowstride + x * 4;
+ p[0] = 192; p[1] = 192; p[2] = 192; p[3] = 255;
+ p = pixels + y * rowstride + (clip_width-x-1) * 4;
+ p[0] = 192; p[1] = 192; p[2] = 192; p[3] = 255;
}
}
void
VideoImageFrame::cut_rightend ()
{
+
if (rightend < 0 ) { return; }
- Glib::RefPtr<Gdk::Pixbuf> img;
- img = img_pixbuf->property_pixbuf();
-
- int rowstride = img->get_rowstride();
- int clip_height = img->get_height();
- int clip_width = img->get_width();
- int n_channels = img->get_n_channels();
- guchar *pixels, *p;
- pixels = img->get_pixels();
+
+ const int rowstride = img->stride;
+ const int clip_height = img->height;
+ const int clip_width = img->width;
+ uint8_t *pixels, *p;
+ pixels = img->data;
if (rightend > clip_width) { return; }
int x,y;
- for (y=0;y<clip_height;++y) {
- p = pixels + y * rowstride + rightend * n_channels;
- p[0] = 192; p[1] = 127; p[2] = 127;
- if (n_channels>3) p[3] = 255;
- for (x=rightend+1; x<clip_width; ++x) {
- p = pixels + y * rowstride + x * n_channels;
- p[0] = 0; p[1] = 0; p[2] = 0;
- if (n_channels>3) p[3] = 0;
+ for (y = 0;y < clip_height; ++y) {
+ p = pixels + y * rowstride + rightend * 4;
+ p[0] = 192; p[1] = 192; p[2] = 192; p[3] = 255;
+ for (x=rightend+1; x < clip_width; ++x) {
+ p = pixels + y * rowstride + x * 4;
+ p[0] = 0; p[1] = 0; p[2] = 0; p[3] = 0;
}
}
}
@@ -188,7 +201,7 @@ http_get_thread (void *arg) {
char url[2048];
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
- snprintf(url, sizeof(url), "%s?frame=%li&w=%d&h=%di&file=%s&format=rgb",
+ snprintf(url, sizeof(url), "%s?frame=%li&w=%d&h=%di&file=%s&format=bgra",
vif->get_video_server_url().c_str(),
(long int) vif->get_req_frame(), vif->get_width(), vif->get_height(),
vif->get_video_filename().c_str()
@@ -220,29 +233,20 @@ VideoImageFrame::http_download_done (char *data){
if (!data) {
/* Image request failed (HTTP error or timeout) */
- Glib::RefPtr<Gdk::Pixbuf> img;
- img = img_pixbuf->property_pixbuf();
- img->fill(RGBA_TO_UINT(128,0,0,255));
- video_draw_cross(img_pixbuf->property_pixbuf());
+ img = image->get_image();
+ fill_frame(128, 0, 0);
+ draw_x();
cut_rightend();
draw_line();
cut_rightend();
- /* TODO: mark as invalid:
- * video_frame_number = -1;
- * TODO: but prevent live-loops when calling update again
- */
+ image->put_image(img);
} else {
- Glib::RefPtr<Gdk::Pixbuf> tmp, img;
-#if 0 // RGBA
- tmp = Gdk::Pixbuf::create_from_data ((guint8*) data, Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height, clip_width*4);
-#else // RGB
- tmp = Gdk::Pixbuf::create_from_data ((guint8*) data, Gdk::COLORSPACE_RGB, false, 8, clip_width, clip_height, clip_width*3);
-#endif
- img = img_pixbuf->property_pixbuf();
- tmp->copy_area (0, 0, clip_width, clip_height, img, 0, 0);
- free(data);
+ img = image->get_image(false);
+ img->data = (uint8_t*) data;
+ img->destroy_callback = &freedata_cb;
draw_line();
cut_rightend();
+ image->put_image(img);
}
exposeimg();
@@ -259,24 +263,11 @@ VideoImageFrame::http_download_done (char *data){
void
VideoImageFrame::http_get(framepos_t fn) {
if (pthread_mutex_trylock(&request_lock)) {
- /* remember last request and schedule after the lock has been released. */
pthread_mutex_lock(&queue_lock);
queued_request=true;
want_video_frame_number=fn;
pthread_mutex_unlock(&queue_lock);
-#if 0
- /* TODO: cancel request and start a new one
- * but only if we're waiting for curl request.
- * don't interrupt http_download_done()
- *
- * This should work, but requires testing:
- */
- if (!pthread_cancel(thread_id_tt)) {
- pthread_mutex_unlock(&request_lock);
- } else return;
-#else
return;
-#endif
}
if (thread_active) pthread_join(thread_id_tt, NULL);
pthread_mutex_lock(&queue_lock);
diff --git a/gtk2_ardour/video_image_frame.h b/gtk2_ardour/video_image_frame.h
index b6d45dbe6d..b611ff0d9e 100644
--- a/gtk2_ardour/video_image_frame.h
+++ b/gtk2_ardour/video_image_frame.h
@@ -26,14 +26,15 @@
#include <string>
#include <glib.h>
-#include <libgnomecanvasmm/pixbuf.h>
#include <sigc++/signal.h>
#include <pthread.h>
#include "ardour/ardour.h"
#include "pbd/signals.h"
-#include "canvas.h"
+#include "canvas/group.h"
+#include "canvas/pixbuf.h"
+#include "canvas/image.h"
namespace ARDOUR {
class TempoSection;
@@ -69,8 +70,8 @@ class VideoImageFrame : public sigc::trackable
PublicEditor& editor;
ArdourCanvas::Group *_parent;
- ArdourCanvas::Group *group;
- ArdourCanvas::Pixbuf *img_pixbuf;
+ ArdourCanvas::Image *image;
+ boost::shared_ptr<ArdourCanvas::Image::Data> img;
int clip_width;
int clip_height;
@@ -80,13 +81,15 @@ class VideoImageFrame : public sigc::trackable
std::string video_filename;
double unit_position;
- framepos_t frame_position;
+ framepos_t sample_position;
framepos_t video_frame_number;
void reposition ();
void exposeimg ();
+ void fill_frame (const uint8_t r, const uint8_t g, const uint8_t b);
void draw_line ();
+ void draw_x ();
void cut_rightend ();
diff --git a/gtk2_ardour/video_monitor.cc b/gtk2_ardour/video_monitor.cc
index ae4d5faacc..a94e89b50d 100644
--- a/gtk2_ardour/video_monitor.cc
+++ b/gtk2_ardour/video_monitor.cc
@@ -481,18 +481,18 @@ VideoMonitor::set_offset (ARDOUR::frameoffset_t offset)
if (offset == NO_OFFSET ) { return; }
framecnt_t video_frame_offset;
- framecnt_t audio_frame_rate;
+ framecnt_t audio_sample_rate;
if (_session->config.get_videotimeline_pullup()) {
- audio_frame_rate = _session->frame_rate();
+ audio_sample_rate = _session->frame_rate();
} else {
- audio_frame_rate = _session->nominal_frame_rate();
+ audio_sample_rate = _session->nominal_frame_rate();
}
/* Note: pull-up/down are applied here: frame_rate() vs. nominal_frame_rate() */
if (_session->config.get_use_video_file_fps()) {
- video_frame_offset = floor(offset * fps / audio_frame_rate);
+ video_frame_offset = floor(offset * fps / audio_sample_rate);
} else {
- video_frame_offset = floor(offset * _session->timecode_frames_per_second() / audio_frame_rate);
+ video_frame_offset = floor(offset * _session->timecode_frames_per_second() / audio_sample_rate);
}
if (video_offset == video_frame_offset) { return; }
@@ -508,18 +508,18 @@ VideoMonitor::manual_seek (framepos_t when, bool /*force*/, ARDOUR::frameoffset_
if (!is_started()) { return; }
if (!_session) { return; }
framecnt_t video_frame;
- framecnt_t audio_frame_rate;
+ framecnt_t audio_sample_rate;
if (_session->config.get_videotimeline_pullup()) {
- audio_frame_rate = _session->frame_rate();
+ audio_sample_rate = _session->frame_rate();
} else {
- audio_frame_rate = _session->nominal_frame_rate();
+ audio_sample_rate = _session->nominal_frame_rate();
}
/* Note: pull-up/down are applied here: frame_rate() vs. nominal_frame_rate() */
if (_session->config.get_use_video_file_fps()) {
- video_frame = floor(when * fps / audio_frame_rate);
+ video_frame = floor(when * fps / audio_sample_rate);
} else {
- video_frame = floor(when * _session->timecode_frames_per_second() / audio_frame_rate);
+ video_frame = floor(when * _session->timecode_frames_per_second() / audio_sample_rate);
}
if (video_frame < 0 ) video_frame = 0;
diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc
index bb7fc16723..10a444dadb 100644
--- a/gtk2_ardour/video_timeline.cc
+++ b/gtk2_ardour/video_timeline.cc
@@ -29,8 +29,6 @@
#include "public_editor.h"
#include "gui_thread.h"
#include "utils.h"
-#include "canvas_impl.h"
-#include "simpleline.h"
#include "utils_videotl.h"
#include "rgb_macros.h"
#include "video_timeline.h"
@@ -49,7 +47,7 @@ using namespace VideoUtils;
VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Group *vbg, int initial_height)
: editor (ed)
- , videotl_bar_group(vbg)
+ , videotl_group(vbg)
, bar_height(initial_height)
{
video_start_offset = 0L;
@@ -271,7 +269,7 @@ float
VideoTimeLine::get_apv()
{
// XXX: dup code - TODO use this fn in update_video_timeline()
- float apv = -1; /* audio frames per video frame; */
+ float apv = -1; /* audio samples per video frame; */
if (!_session) return apv;
if (_session->config.get_use_video_file_fps()) {
@@ -304,8 +302,8 @@ VideoTimeLine::update_video_timeline()
if (_session->timecode_frames_per_second() == 0 ) return;
}
- double frames_per_unit = editor->unit_to_frame(1.0);
- framepos_t leftmost_frame = editor->leftmost_position();
+ const double samples_per_pixel = editor->get_current_zoom();
+ const framepos_t leftmost_sample = editor->leftmost_sample();
/* Outline:
* 1) calculate how many frames there should be in current zoom (plus 1 page on each side)
@@ -317,12 +315,12 @@ VideoTimeLine::update_video_timeline()
/* video-file and session properties */
double display_vframe_width; /* unit: pixels ; width of one thumbnail in the timeline */
- float apv; /* audio frames per video frame; */
+ float apv; /* audio samples per video frame; */
framepos_t leftmost_video_frame; /* unit: video-frame number ; temporary var -> vtl_start */
/* variables needed to render videotimeline -- what needs to computed first */
- framepos_t vtl_start; /* unit: audio-frames ; first displayed video-frame */
- framepos_t vtl_dist; /* unit: audio-frames ; distance between displayed video-frames */
+ framepos_t vtl_start; /* unit: audio-samples ; first displayed video-frame */
+ framepos_t vtl_dist; /* unit: audio-samples ; distance between displayed video-frames */
unsigned int visible_video_frames; /* number of frames that fit on current canvas */
if (_session->config.get_videotimeline_pullup()) {
@@ -338,21 +336,21 @@ VideoTimeLine::update_video_timeline()
display_vframe_width = bar_height * video_aspect_ratio;
- if (apv > frames_per_unit * display_vframe_width) {
+ if (apv > samples_per_pixel * display_vframe_width) {
/* high-zoom: need space between successive video-frames */
vtl_dist = rint(apv);
} else {
/* continous timeline: skip video-frames */
- vtl_dist = ceil(display_vframe_width * frames_per_unit / apv) * apv;
+ vtl_dist = ceil(display_vframe_width * samples_per_pixel / apv) * apv;
}
assert (vtl_dist > 0);
assert (apv > 0);
- leftmost_video_frame = floor (floor((leftmost_frame - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
+ leftmost_video_frame = floor (floor((leftmost_sample - video_start_offset - video_offset ) / vtl_dist) * vtl_dist / apv);
vtl_start = rint (video_offset + video_start_offset + leftmost_video_frame * apv);
- visible_video_frames = 2 + ceil(editor->current_page_frames() / vtl_dist); /* +2 left+right partial frames */
+ visible_video_frames = 2 + ceil(editor->current_page_samples() / vtl_dist); /* +2 left+right partial frames */
/* expand timeline (cache next/prev page images) */
vtl_start -= visible_video_frames * vtl_dist;
@@ -379,7 +377,7 @@ VideoTimeLine::update_video_timeline()
while (video_frames.size() < visible_video_frames) {
VideoImageFrame *frame;
- frame = new VideoImageFrame(*editor, *videotl_bar_group, display_vframe_width, bar_height, video_server_url, translated_filename());
+ frame = new VideoImageFrame(*editor, *videotl_group, display_vframe_width, bar_height, video_server_url, translated_filename());
frame->ImgChanged.connect (*this, invalidator (*this), boost::bind (&PublicEditor::queue_visual_videotimeline_update, editor), gui_context());
video_frames.push_back(frame);
}
@@ -412,7 +410,7 @@ VideoTimeLine::update_video_timeline()
}
VideoImageFrame * frame = get_video_frame(vframeno, cut, rightend);
if (frame) {
- frame->set_position(vfpos-leftmost_frame);
+ frame->set_position(vfpos);
outdated_video_frames.remove(frame);
} else {
remaining.push_back(vfcount);
@@ -422,7 +420,7 @@ VideoTimeLine::update_video_timeline()
for (VideoFrames::iterator i = outdated_video_frames.begin(); i != outdated_video_frames.end(); ++i ) {
VideoImageFrame *frame = (*i);
if (remaining.empty()) {
- frame->set_position(-2 * vtl_dist); /* move off screen */
+ frame->set_position(-2 * vtl_dist + leftmost_sample); /* move off screen */
} else {
int vfcount=remaining.front();
remaining.pop_front();
@@ -433,7 +431,7 @@ VideoTimeLine::update_video_timeline()
rightend = display_vframe_width * (video_start_offset + video_duration + video_offset - vfpos) / vtl_dist;
//printf("lf(n): %lu\n", vframeno); // XXX
}
- frame->set_position(vfpos-leftmost_frame);
+ frame->set_position(vfpos);
frame->set_videoframe(vframeno, rightend);
}
}
diff --git a/gtk2_ardour/video_timeline.h b/gtk2_ardour/video_timeline.h
index c96c9b1320..dd61d2ef73 100644
--- a/gtk2_ardour/video_timeline.h
+++ b/gtk2_ardour/video_timeline.h
@@ -29,7 +29,7 @@
#include "video_image_frame.h"
#include "video_monitor.h"
#include "pbd/signals.h"
-#include "canvas.h"
+#include "canvas/group.h"
namespace ARDOUR {
class Session;
@@ -93,7 +93,7 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p
void save_session ();
void close_session ();
void sync_session_state (); /* video-monitor does not actively report window/pos changes, query it */
- float get_apv(); /* audio frames per video frame; */
+ float get_apv(); /* audio samples per video frame; */
ARDOUR::framecnt_t get_duration () { return video_duration;}
ARDOUR::frameoffset_t get_offset () { return video_offset;}
ARDOUR::frameoffset_t quantify_frames_to_apv (ARDOUR::frameoffset_t offset) { return rint(offset/get_apv())*get_apv(); }
@@ -102,17 +102,17 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p
protected:
PublicEditor *editor;
- ArdourCanvas::Group *videotl_bar_group;
+ ArdourCanvas::Group *videotl_group;
int bar_height;
std::string _xjadeo_bin;
void find_xjadeo ();
- ARDOUR::frameoffset_t video_start_offset; /**< unit: audio-frames - video-file */
- ARDOUR::frameoffset_t video_offset; /**< unit: audio-frames - session */
+ ARDOUR::frameoffset_t video_start_offset; /**< unit: audio-samples - video-file */
+ ARDOUR::frameoffset_t video_offset; /**< unit: audio-samples - session */
ARDOUR::frameoffset_t video_offset_p; /**< used for undo from editor_drag.cc */
- framepos_t video_duration; /**< unit: audio-frames */
+ framepos_t video_duration; /**< unit: audio-samples */
std::string video_filename;
bool local_file;
double video_aspect_ratio;
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/wscript b/gtk2_ardour/wscript
index a02e27f83d..e6ce7bb3b6 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -46,22 +46,12 @@ gtk2_ardour_sources = [
'big_clock_window.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',
@@ -116,12 +106,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',
@@ -156,6 +146,8 @@ gtk2_ardour_sources = [
'nag.cc',
'new_plugin_preset_dialog.cc',
'normalize_dialog.cc',
+ 'note.cc',
+ 'note_base.cc',
'note_player.cc',
'nsm.cc',
'nsmclient.cc',
@@ -165,6 +157,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',
@@ -208,8 +201,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',
@@ -219,6 +210,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',
@@ -237,7 +229,6 @@ gtk2_ardour_sources = [
'version.cc',
'visibility_group.cc',
'volume_controller.cc',
- 'waveview.cc',
'window_manager.cc',
# video-timeline related sources:
'video_image_frame.cc',
@@ -281,10 +272,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')
@@ -384,7 +371,9 @@ def build(bld):
'libardour_cp',
'libgtk2_ardour',
'libgtkmm2ext',
- 'libtaglib']
+ 'libtaglib',
+ 'libcanvas'
+ ]
obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
obj.includes = [ '../libs/fst', '.' ]
obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
@@ -410,21 +399,22 @@ 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 bld.env['build_target'] == 'mingw':
if bld.env['DEBUG'] == False:
obj.linkflags = ['-mwindows']
if sys.platform == 'darwin':
- obj.use += ' libappleutility'
+ obj.uselib += ' AUDIOUNITS OSX GTKOSX'
+ obj.use += ' libappleutility'
obj.defines = [
'PACKAGE="' + I18N_PACKAGE + '"',
'VERSIONSTRING="' + bld.env['VERSION'] + '"',