From 2b49b2433b6dc06a52b0848af62373c747f18ac9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 28 Nov 2005 22:36:26 +0000 Subject: [PATCH] mega commit to remove gtk_object cruft, and much other stuff git-svn-id: svn://localhost/trunk/ardour2@139 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/SConscript | 1 + gtk2_ardour/actions.cc | 10 +- gtk2_ardour/ardour-menus.xml | 40 +-- gtk2_ardour/ardour_ui_ed.cc | 5 +- gtk2_ardour/audio_time_axis.cc | 10 +- gtk2_ardour/automation_line.cc | 5 +- gtk2_ardour/automation_time_axis.cc | 2 +- gtk2_ardour/canvas-imageframe.c | 7 +- gtk2_ardour/canvas-waveview.c | 517 +++++++++++++-------------- gtk2_ardour/connection_editor.cc | 4 +- gtk2_ardour/crossfade_edit.cc | 2 +- gtk2_ardour/editor.cc | 287 +-------------- gtk2_ardour/editor_markers.cc | 20 +- gtk2_ardour/editor_mixer.cc | 6 +- gtk2_ardour/editor_mouse.cc | 58 ++- gtk2_ardour/editor_region_list.cc | 10 +- gtk2_ardour/editor_rulers.cc | 2 +- gtk2_ardour/editor_selection_list.cc | 2 +- gtk2_ardour/editor_tempodisplay.cc | 8 +- gtk2_ardour/imageframe_time_axis.cc | 14 +- gtk2_ardour/marker_time_axis_view.cc | 6 +- gtk2_ardour/mixer_ui.cc | 4 +- gtk2_ardour/redirect_box.cc | 2 +- gtk2_ardour/regionview.cc | 36 +- gtk2_ardour/regionview.h | 18 +- gtk2_ardour/route_params_ui.cc | 4 +- gtk2_ardour/streamview.cc | 11 +- gtk2_ardour/time_axis_view.cc | 54 ++- gtk2_ardour/utils.cc | 6 + gtk2_ardour/utils.h | 3 + 30 files changed, 426 insertions(+), 728 deletions(-) diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 4479f345ad..168db5871b 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -89,6 +89,7 @@ editing.cc editor.cc editor_actions.cc editor_audiotrack.cc +editor_canvas.cc editor_canvas_events.cc editor_cursors.cc editor_edit_groups.cc diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 1d90134830..1ac2ea7228 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -51,13 +51,17 @@ ActionManager::init () ui_manager = UIManager::create (); try { - ui_manager->add_ui_from_file (ARDOUR::find_config_file("ardour-menus.xml")); + ui_manager->add_ui_from_file (ARDOUR::find_config_file("ardour-menus.xml")); } catch (Glib::MarkupError& err) { error << "badly formatted UI definition file" << endmsg; } catch (...) { - std::cerr << "ardour action xml file not found" << endl; + cerr << "ardour action xml file not found" << endl; } - + + RefPtr grp = ActionGroup::create ("misc"); + register_action (grp, "null", "relax"); + + ui_manager->insert_action_group (grp); } RefPtr diff --git a/gtk2_ardour/ardour-menus.xml b/gtk2_ardour/ardour-menus.xml index 2d01aaaf1d..a451055bc1 100644 --- a/gtk2_ardour/ardour-menus.xml +++ b/gtk2_ardour/ardour-menus.xml @@ -1,28 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - + + @@ -30,22 +9,22 @@ - + - + - - - - + + + + @@ -57,7 +36,7 @@ - + @@ -65,7 +44,6 @@ - diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index b7e9d89f03..87a5ebf2e5 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -63,7 +63,10 @@ ARDOUR_UI::install_actions () Glib::RefPtr main_actions = ActionGroup::create (X_("Main")); Glib::RefPtr act; - ActionManager::ActionManager::register_action (main_actions, X_("New"), _("New"), bind (mem_fun(*this, &ARDOUR_UI::new_session), false, string ())); + act = ActionManager::ActionManager::register_action (main_actions, X_("New"), _("New"), bind (mem_fun(*this, &ARDOUR_UI::new_session), false, string ())); + + cerr << "\n\n\n NEW has accel path " << act->get_accel_path() << endl; + ActionManager::ActionManager::register_action (main_actions, X_("Open"), _("Open"), mem_fun(*this, &ARDOUR_UI::open_session)); ActionManager::ActionManager::register_action (main_actions, X_("Recent"), _("Recent"), mem_fun(*this, &ARDOUR_UI::open_recent_session)); act = ActionManager::register_action (main_actions, X_("Close"), _("Close"), mem_fun(*this, &ARDOUR_UI::close_session)); diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 1c25863e23..1f7f813a47 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -500,12 +500,10 @@ AudioTimeAxisView::show_timestretch (jack_nframes_t start, jack_nframes_t end) x2 = (end - 1) / editor.get_current_zoom(); y2 = height - 2; - gtk_object_set (GTK_OBJECT(timestretch_rect), - "x1", x1, - "y1", 1.0, - "x2", x2, - "y2", y2, - NULL); + timestretch_rect->property_x1() = x1; + timestretch_rect->property_y1() = 1.0; + timestretch_rect->property_x2() = x2; + timestretch_rect->property_y2() = y2; } void diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index bf75edb461..dd3c14a23f 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -105,7 +105,7 @@ ControlPoint::ControlPoint (const ControlPoint& other, bool dummy_arg_to_force_s ControlPoint::~ControlPoint () { - gtk_object_destroy (GTK_OBJECT(item)); + delete item; } bool @@ -246,8 +246,7 @@ AutomationLine::AutomationLine (string name, TimeAxisView& tv, ArdourCanvas::Gro AutomationLine::~AutomationLine () { vector_delete (&control_points); - - gtk_object_destroy (GTK_OBJECT(group)); + delete group; } bool diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 286730bf14..989c86b916 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -300,7 +300,7 @@ AutomationTimeAxisView::set_height (TrackHeight h) controls_table.show_all (); TimeAxisView::set_height (h); - gtk_object_set (GTK_OBJECT(base_rect), "y2", (double) h, NULL); + base_rect->property_y2() = h; for (vector::iterator i = lines.begin(); i != lines.end(); ++i) { (*i)->set_height (h); diff --git a/gtk2_ardour/canvas-imageframe.c b/gtk2_ardour/canvas-imageframe.c index 31ac9e36de..6ba51c0fdc 100644 --- a/gtk2_ardour/canvas-imageframe.c +++ b/gtk2_ardour/canvas-imageframe.c @@ -100,10 +100,9 @@ gnome_canvas_imageframe_class_init (GnomeCanvasImageFrameClass *class) g_object_class_install_property (gobject_class, PROP_PIXBUF, - g_param_spec_boxed ("pixbuf", + g_param_spec_pointer ("pixbuf", _("pixbuf"), _("the pixbuf"), - GDK_TYPE_PIXBUF, G_PARAM_WRITABLE)); g_object_class_install_property (gobject_class, PROP_X, @@ -291,10 +290,10 @@ gnome_canvas_imageframe_set_property (GObject *object, switch (prop_id) { case PROP_PIXBUF: - if (item->canvas->aa && g_value_get_boxed (value)) { + if (item->canvas->aa && g_value_get_pointer (value)) { if (image->pixbuf != NULL) art_pixbuf_free (image->pixbuf); - image->pixbuf = g_value_get_boxed (value); + image->pixbuf = g_value_get_pointer (value); } update = TRUE; break; diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index 370c324d9d..f47529973e 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -1,279 +1,272 @@ -/* - Copyright (C) 2000-2002 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. - - $Id$ -*/ - -#include -#include -#include -#include -#include - -#include - -#include "canvas-waveview.h" -#include "rgb_macros.h" - -enum { - PROP_0, - PROP_DATA_SRC, - PROP_CHANNEL, - PROP_LENGTH_FUNCTION, - PROP_SOURCEFILE_LENGTH_FUNCTION, - PROP_PEAK_FUNCTION, - PROP_GAIN_FUNCTION, - PROP_GAIN_SRC, - PROP_CACHE, - PROP_CACHE_UPDATER, - PROP_SAMPLES_PER_UNIT, - PROP_AMPLITUDE_ABOVE_AXIS, - PROP_X, - PROP_Y, - PROP_HEIGHT, - PROP_WAVE_COLOR, - PROP_RECTIFIED, - PROP_REGION_START -}; - -static void gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class); - -static void gnome_canvas_waveview_init (GnomeCanvasWaveView *waveview); - -static void gnome_canvas_waveview_destroy (GtkObject *object); - -static void gnome_canvas_waveview_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); -static void gnome_canvas_waveview_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); - -static void gnome_canvas_waveview_update (GnomeCanvasItem *item, - double *affine, - ArtSVP *clip_path, - int flags); - -static void gnome_canvas_waveview_bounds (GnomeCanvasItem *item, - double *x1, - double *y1, - double *x2, - double *y2); - -static double gnome_canvas_waveview_point (GnomeCanvasItem *item, - double x, - double y, - int cx, - int cy, - GnomeCanvasItem **actual_item); - -static void gnome_canvas_waveview_render (GnomeCanvasItem *item, - GnomeCanvasBuf *buf); - -static void gnome_canvas_waveview_draw (GnomeCanvasItem *item, - GdkDrawable *drawable, - int x, - int y, - int w, - int h); - -static void gnome_canvas_waveview_set_data_src (GnomeCanvasWaveView *, - void *); - -static void gnome_canvas_waveview_set_channel (GnomeCanvasWaveView *, - guint32); - -static gint32 gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, - gulong start_sample, - gulong end_sample); - -static GnomeCanvasItemClass *parent_class; - -GType -gnome_canvas_waveview_get_type (void) -{ - static GType waveview_type; - - if (!waveview_type) { - static const GTypeInfo object_info = { - sizeof (GnomeCanvasWaveViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gnome_canvas_waveview_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GnomeCanvasWaveView), - 0, /* n_preallocs */ - (GInstanceInitFunc) gnome_canvas_waveview_init, - NULL /* value_table */ - }; - - waveview_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasWaveView", - &object_info, 0); - } + /* + Copyright (C) 2000-2002 Paul Davis - return waveview_type; -} + 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. -static void -gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class) -{ - GObjectClass *gobject_class; - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; + 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. - gobject_class = (GObjectClass *) class; - object_class = (GtkObjectClass *) class; - item_class = (GnomeCanvasItemClass *) class; + 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. - parent_class = g_type_class_peek_parent (class); + $Id$ + */ - gobject_class->set_property = gnome_canvas_waveview_set_property; - gobject_class->get_property = gnome_canvas_waveview_get_property; - - g_object_class_install_property - (gobject_class, - PROP_DATA_SRC, - g_param_spec_boxed ("data_src", NULL, NULL, - GTK_TYPE_POINTER, + #include + #include + #include + #include + #include + + #include + + #include "canvas-waveview.h" + #include "rgb_macros.h" + + enum { + PROP_0, + PROP_DATA_SRC, + PROP_CHANNEL, + PROP_LENGTH_FUNCTION, + PROP_SOURCEFILE_LENGTH_FUNCTION, + PROP_PEAK_FUNCTION, + PROP_GAIN_FUNCTION, + PROP_GAIN_SRC, + PROP_CACHE, + PROP_CACHE_UPDATER, + PROP_SAMPLES_PER_UNIT, + PROP_AMPLITUDE_ABOVE_AXIS, + PROP_X, + PROP_Y, + PROP_HEIGHT, + PROP_WAVE_COLOR, + PROP_RECTIFIED, + PROP_REGION_START + }; + + static void gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class); + + static void gnome_canvas_waveview_init (GnomeCanvasWaveView *waveview); + + static void gnome_canvas_waveview_destroy (GtkObject *object); + + static void gnome_canvas_waveview_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); + static void gnome_canvas_waveview_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + + static void gnome_canvas_waveview_update (GnomeCanvasItem *item, + double *affine, + ArtSVP *clip_path, + int flags); + + static void gnome_canvas_waveview_bounds (GnomeCanvasItem *item, + double *x1, + double *y1, + double *x2, + double *y2); + + static double gnome_canvas_waveview_point (GnomeCanvasItem *item, + double x, + double y, + int cx, + int cy, + GnomeCanvasItem **actual_item); + + static void gnome_canvas_waveview_render (GnomeCanvasItem *item, + GnomeCanvasBuf *buf); + + static void gnome_canvas_waveview_draw (GnomeCanvasItem *item, + GdkDrawable *drawable, + int x, + int y, + int w, + int h); + + static void gnome_canvas_waveview_set_data_src (GnomeCanvasWaveView *, + void *); + + static void gnome_canvas_waveview_set_channel (GnomeCanvasWaveView *, + guint32); + + static gint32 gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, + gulong start_sample, + gulong end_sample); + + static GnomeCanvasItemClass *parent_class; + + GType + gnome_canvas_waveview_get_type (void) + { + static GType waveview_type; + + if (!waveview_type) { + static const GTypeInfo object_info = { + sizeof (GnomeCanvasWaveViewClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gnome_canvas_waveview_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (GnomeCanvasWaveView), + 0, /* n_preallocs */ + (GInstanceInitFunc) gnome_canvas_waveview_init, + NULL /* value_table */ + }; + + waveview_type = g_type_register_static (GNOME_TYPE_CANVAS_ITEM, "GnomeCanvasWaveView", + &object_info, 0); + } + + return waveview_type; + } + + static void + gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class) + { + GObjectClass *gobject_class; + GtkObjectClass *object_class; + GnomeCanvasItemClass *item_class; + + gobject_class = (GObjectClass *) class; + object_class = (GtkObjectClass *) class; + item_class = (GnomeCanvasItemClass *) class; + + parent_class = g_type_class_peek_parent (class); + + gobject_class->set_property = gnome_canvas_waveview_set_property; + gobject_class->get_property = gnome_canvas_waveview_get_property; + + g_object_class_install_property + (gobject_class, + PROP_DATA_SRC, + g_param_spec_pointer ("data_src", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_CHANNEL, + g_param_spec_uint ("channel", NULL, NULL, + 0, G_MAXUINT, 0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_CHANNEL, - g_param_spec_uint ("channel", NULL, NULL, - 0, G_MAXUINT, 0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_LENGTH_FUNCTION, - g_param_spec_boxed ("length_function", NULL, NULL, - GTK_TYPE_POINTER, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property + + g_object_class_install_property + (gobject_class, + PROP_LENGTH_FUNCTION, + g_param_spec_pointer ("length_function", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property (gobject_class, PROP_SOURCEFILE_LENGTH_FUNCTION, - g_param_spec_boxed ("sourcefile_length_function", NULL, NULL, - GTK_TYPE_POINTER, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_PEAK_FUNCTION, - g_param_spec_boxed ("peak_function", NULL, NULL, - GTK_TYPE_POINTER, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_GAIN_FUNCTION, - g_param_spec_boxed ("gain_function", NULL, NULL, - GTK_TYPE_POINTER, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, + g_param_spec_pointer ("sourcefile_length_function", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_PEAK_FUNCTION, + g_param_spec_pointer ("peak_function", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_GAIN_FUNCTION, + g_param_spec_pointer ("gain_function", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, PROP_GAIN_SRC, - g_param_spec_boxed ("gain_src", NULL, NULL, - GTK_TYPE_POINTER, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_CACHE, - g_param_spec_boxed ("cache", NULL, NULL, - GTK_TYPE_POINTER, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + g_param_spec_pointer ("gain_src", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); - g_object_class_install_property - (gobject_class, - PROP_CACHE_UPDATER, + g_object_class_install_property + (gobject_class, + PROP_CACHE, + g_param_spec_pointer ("cache", NULL, NULL, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_CACHE_UPDATER, g_param_spec_boolean ("cache_updater", NULL, NULL, FALSE, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_SAMPLES_PER_UNIT, - g_param_spec_double ("sample_per_unit", NULL, NULL, - 0.0, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_AMPLITUDE_ABOVE_AXIS, - g_param_spec_double ("amplitude_above_axis", NULL, NULL, - 0.0, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_X, - g_param_spec_double ("x", NULL, NULL, - 0.0, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_Y, - g_param_spec_double ("y", NULL, NULL, - 0.0, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_HEIGHT, - g_param_spec_double ("height", NULL, NULL, - 0.0, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_WAVE_COLOR, - g_param_spec_uint ("wave_color", NULL, NULL, - 0, G_MAXUINT, 0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_RECTIFIED, - g_param_spec_boolean ("rectified", NULL, NULL, - FALSE, + + g_object_class_install_property + (gobject_class, + PROP_SAMPLES_PER_UNIT, + g_param_spec_double ("samples_per_unit", NULL, NULL, + 0.0, G_MAXDOUBLE, 0.0, (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - g_object_class_install_property - (gobject_class, - PROP_REGION_START, - g_param_spec_uint ("region_start", NULL, NULL, - 0, G_MAXUINT, 0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); - - object_class->destroy = gnome_canvas_waveview_destroy; - - item_class->update = gnome_canvas_waveview_update; - item_class->bounds = gnome_canvas_waveview_bounds; - item_class->point = gnome_canvas_waveview_point; - item_class->render = gnome_canvas_waveview_render; - item_class->draw = gnome_canvas_waveview_draw; -} + + g_object_class_install_property + (gobject_class, + PROP_AMPLITUDE_ABOVE_AXIS, + g_param_spec_double ("amplitude_above_axis", NULL, NULL, + 0.0, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_X, + g_param_spec_double ("x", NULL, NULL, + 0.0, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_Y, + g_param_spec_double ("y", NULL, NULL, + 0.0, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_HEIGHT, + g_param_spec_double ("height", NULL, NULL, + 0.0, G_MAXDOUBLE, 0.0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_WAVE_COLOR, + g_param_spec_uint ("wave_color", NULL, NULL, + 0, G_MAXUINT, 0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_RECTIFIED, + g_param_spec_boolean ("rectified", NULL, NULL, + FALSE, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + g_object_class_install_property + (gobject_class, + PROP_REGION_START, + g_param_spec_uint ("region_start", NULL, NULL, + 0, G_MAXUINT, 0, + (G_PARAM_READABLE | G_PARAM_WRITABLE))); + + object_class->destroy = gnome_canvas_waveview_destroy; + + item_class->update = gnome_canvas_waveview_update; + item_class->bounds = gnome_canvas_waveview_bounds; + item_class->point = gnome_canvas_waveview_point; + item_class->render = gnome_canvas_waveview_render; + item_class->draw = gnome_canvas_waveview_draw; + } GnomeCanvasWaveViewCache* gnome_canvas_waveview_cache_new () diff --git a/gtk2_ardour/connection_editor.cc b/gtk2_ardour/connection_editor.cc index f1ee07149f..938be6763e 100644 --- a/gtk2_ardour/connection_editor.cc +++ b/gtk2_ardour/connection_editor.cc @@ -333,8 +333,8 @@ ConnectionEditor::refill_connection_display () input_connection_display.set_model (Glib::RefPtr(0)); output_connection_display.set_model (Glib::RefPtr(0)); - input_connection_model.clear(); - output_connection_model.clear(); + input_connection_model->clear(); + output_connection_model->clear(); current_connection = 0; diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index b5242d5cf5..521c6b5c68 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -454,7 +454,7 @@ CrossfadeEditor::canvas_event (GdkEvent* event) CrossfadeEditor::Point::~Point() { - gtk_object_destroy (GTK_OBJECT(box)); + delete box; } CrossfadeEditor::Point* diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 1be409f4a1..caa66290d2 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -26,8 +26,6 @@ #include -#include - #include #include @@ -60,7 +58,6 @@ #include "rgb_macros.h" #include "selection.h" #include "streamview.h" -#include "simpleline.h" #include "time_axis_view.h" #include "utils.h" #include "crossfade_view.h" @@ -85,9 +82,6 @@ using namespace Glib; using namespace Gtkmm2ext; using namespace Editing; -/* XXX this is a hack. it ought to be the maximum value of an jack_nframes_t */ - -const double max_canvas_coordinate = 100000000.0; const double Editor::timebar_height = 15.0; #include "editor_xpms" @@ -795,186 +789,6 @@ Editor::left_track_canvas (GdkEventCrossing *ev) } -void -Editor::initialize_canvas () -{ - ArdourCanvas::init (); - - /* adjust sensitivity for "picking" items */ - - // GNOME_CANVAS(track_canvas)->close_enough = 2; - - track_canvas.signal_event().connect (bind (mem_fun (*this, &Editor::track_canvas_event), (ArdourCanvas::Item*) 0)); - track_canvas.set_name ("EditorMainCanvas"); - track_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK); - track_canvas.signal_leave_notify_event().connect (mem_fun(*this, &Editor::left_track_canvas)); - - /* set up drag-n-drop */ - vector target_table; - - target_table.push_back (TargetEntry ("STRING")); - target_table.push_back (TargetEntry ("text/plain")); - target_table.push_back (TargetEntry ("text/uri-list")); - target_table.push_back (TargetEntry ("application/x-rootwin-drop")); - - // GTK2FIX - // track_canvas.drag_dest_set (target_table, DEST_DEFAULT_ALL, GdkDragAction (Gdk::ACTION_COPY|Gdk::ACTION_MOVE)); - // track_canvas.signal_drag_data_received().connect (mem_fun(*this, &Editor::track_canvas_drag_data_received)); - - /* stuff for the verbose canvas cursor */ - - Pango::FontDescription font = get_font_for_style (N_("VerboseCanvasCursor")); - - verbose_canvas_cursor = new ArdourCanvas::Text (*track_canvas.root()); - verbose_canvas_cursor->property_font_desc() = font; - // GTK2FIX - // verbose_canvas_cursor->property_anchor() = GTK_ANCHOR_NW; - verbose_canvas_cursor->property_fill_color_rgba() = color_map[cVerboseCanvasCursor]; - - verbose_cursor_visible = false; - - /* a group to hold time (measure) lines */ - - time_line_group = new ArdourCanvas::Group (*track_canvas.root(), 0.0, 0.0); - cursor_group = new ArdourCanvas::Group (*track_canvas.root(), 0.0, 0.0); - - time_canvas.set_name ("EditorTimeCanvas"); - time_canvas.add_events (Gdk::POINTER_MOTION_HINT_MASK); - - meter_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0); - tempo_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, 0.0); - marker_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height * 2.0); - range_marker_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height * 3.0); - transport_marker_group = new ArdourCanvas::Group (*time_canvas.root(), 0.0, timebar_height * 4.0); - - tempo_bar = new ArdourCanvas::SimpleRect (*tempo_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - tempo_bar->property_fill_color_rgba() = color_map[cTempoBar]; - tempo_bar->property_outline_pixels() = 0; - - meter_bar = new ArdourCanvas::SimpleRect (*meter_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - meter_bar->property_fill_color_rgba() = color_map[cMeterBar]; - meter_bar->property_outline_pixels() = 0; - - marker_bar = new ArdourCanvas::SimpleRect (*marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - marker_bar->property_fill_color_rgba() = color_map[cMarkerBar]; - marker_bar->property_outline_pixels() = 0; - - range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - range_marker_bar->property_fill_color_rgba() = color_map[cRangeMarkerBar]; - range_marker_bar->property_outline_pixels() = 0; - - transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - transport_marker_bar->property_fill_color_rgba() = color_map[cTransportMarkerBar]; - transport_marker_bar->property_outline_pixels() = 0; - - range_bar_drag_rect = new ArdourCanvas::SimpleRect (*range_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - range_bar_drag_rect->property_fill_color_rgba() = color_map[cRangeDragBarRectFill]; - range_bar_drag_rect->property_outline_color_rgba() = color_map[cRangeDragBarRect]; - range_bar_drag_rect->property_outline_pixels() = 0; - range_bar_drag_rect->hide (); - - transport_bar_drag_rect = new ArdourCanvas::SimpleRect (*transport_marker_group, 0.0, 0.0, max_canvas_coordinate, timebar_height); - transport_bar_drag_rect ->property_fill_color_rgba() = color_map[cTransportDragRectFill]; - transport_bar_drag_rect->property_outline_color_rgba() = color_map[cTransportDragRect]; - transport_bar_drag_rect->property_outline_pixels() = 0; - transport_bar_drag_rect->hide (); - - marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0)); - marker_drag_line_points.push_back(Gnome::Art::Point(0.0, 0.0)); - - marker_drag_line = new ArdourCanvas::Line (*track_canvas.root()); - marker_drag_line->property_width_pixels() = 1; - marker_drag_line->property_fill_color_rgba() = color_map[cMarkerDragLine]; - marker_drag_line->property_points() = marker_drag_line_points; - marker_drag_line->hide(); - - range_marker_drag_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0); - range_marker_drag_rect->property_fill_color_rgba() = color_map[cRangeDragRectFill]; - range_marker_drag_rect->property_outline_color_rgba() = color_map[cRangeDragRect]; - range_marker_drag_rect->hide (); - - transport_loop_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0); - transport_loop_range_rect->property_fill_color_rgba() = color_map[cTransportLoopRectFill]; - transport_loop_range_rect->property_outline_color_rgba() = color_map[cTransportLoopRect]; - transport_loop_range_rect->property_outline_pixels() = 1; - transport_loop_range_rect->hide(); - - transport_punch_range_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0); - transport_punch_range_rect->property_fill_color_rgba() = color_map[cTransportPunchRectFill]; - transport_punch_range_rect->property_outline_color_rgba() = color_map[cTransportPunchRect]; - transport_punch_range_rect->property_outline_pixels() = 0; - transport_punch_range_rect->hide(); - - transport_loop_range_rect->lower_to_bottom (); // loop on the bottom - - transport_punchin_line = new ArdourCanvas::SimpleLine (*time_line_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() = 0.0; - transport_punchin_line->property_color_rgba() = color_map[cPunchInLine]; - transport_punchin_line->hide (); - - transport_punchout_line = new ArdourCanvas::SimpleLine (*time_line_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() = 0.0; - transport_punchout_line->property_color_rgba() = color_map[cPunchOutLine]; - transport_punchout_line->hide(); - - // used to show zoom mode active zooming - zoom_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0); - zoom_rect->property_fill_color_rgba() = color_map[cZoomRectFill]; - zoom_rect->property_outline_color_rgba() = color_map[cZoomRect]; - zoom_rect->property_outline_pixels() = 1; - zoom_rect->hide(); - - zoom_rect->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0)); - - // used as rubberband rect - rubberband_rect = new ArdourCanvas::SimpleRect (*track_canvas.root(), 0.0, 0.0, 0.0, 0.0); - rubberband_rect->property_outline_color_rgba() = color_map[cRubberBandRect]; - rubberband_rect->property_fill_color_rgba() = (guint32) color_map[cRubberBandRectFill]; - rubberband_rect->property_outline_pixels() = 1; - rubberband_rect->hide(); - - tempo_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar)); - meter_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar)); - marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar)); - range_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar)); - transport_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar)); - - /* separator lines */ - - tempo_line = new ArdourCanvas::SimpleLine (*tempo_group, 0, timebar_height, max_canvas_coordinate, timebar_height); - tempo_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255); - - meter_line = new ArdourCanvas::SimpleLine (*meter_group, 0, timebar_height, max_canvas_coordinate, timebar_height); - meter_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255); - - marker_line = new ArdourCanvas::SimpleLine (*marker_group, 0, timebar_height, max_canvas_coordinate, timebar_height); - marker_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255); - - range_marker_line = new ArdourCanvas::SimpleLine (*range_marker_group, 0, timebar_height, max_canvas_coordinate, timebar_height); - range_marker_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255); - - transport_marker_line = new ArdourCanvas::SimpleLine (*transport_marker_group, 0, timebar_height, max_canvas_coordinate, timebar_height); - transport_marker_line->property_color_rgba() = RGBA_TO_UINT (0,0,0,255); - - ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_loop_range_view), false)); - ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_punch_range_view), false)); - - double time_height = timebar_height * 5; - double time_width = FLT_MAX/frames_per_unit; - time_canvas.set_scroll_region(0.0, 0.0, time_width, time_height); - - edit_cursor = new Cursor (*this, "blue", &Editor::canvas_edit_cursor_event); - playhead_cursor = new Cursor (*this, "red", &Editor::canvas_playhead_cursor_event); - - track_canvas.signal_size_allocate().connect (mem_fun(*this, &Editor::track_canvas_allocate)); -} - void Editor::show_window () { @@ -1265,103 +1079,6 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc) Resized (); /* EMIT_SIGNAL */ } -void -Editor::reset_scrolling_region (Gtk::Allocation* alloc) -{ - guint32 last_canvas_unit; - double height; - guint32 canvas_alloc_height, canvas_alloc_width; - TrackViewList::iterator i; - static bool first_time = true; - - /* We need to make sure that the canvas always has its - scrolling region set to larger of: - - - the size allocated for it (within the container its packed in) - - the size required to see the entire session - - If we don't ensure at least the first of these, the canvas - does some wierd and in my view unnecessary stuff to center - itself within the allocated area, which causes bad, bad - results. - - XXX GnomeCanvas has fixed this, and has an option to - control the centering behaviour. - */ - - last_canvas_unit = (guint32) ceil ((float) max_frames / frames_per_unit); - - height = 0; - - if (session) { - for (i = track_views.begin(); i != track_views.end(); ++i) { - if ((*i)->control_parent) { - height += (*i)->effective_height; - height += track_spacing; - } - } - - if (height) { - height -= track_spacing; - } - } - - canvas_height = (guint32) height; - - if (alloc) { - canvas_alloc_height = alloc->get_height(); - canvas_alloc_width = alloc->get_width(); - } else { - canvas_alloc_height = track_canvas.get_height(); - canvas_alloc_width = track_canvas.get_width(); - } - - canvas_height = max (canvas_height, canvas_alloc_height); - track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_alloc_width), canvas_height); - - if (edit_cursor) edit_cursor->set_length (canvas_alloc_height); - if (playhead_cursor) playhead_cursor->set_length (canvas_alloc_height); - - if (marker_drag_line) { - marker_drag_line_points.back().set_x(canvas_height); - // cerr << "set mlA points, nc = " << marker_drag_line_points.num_points << endl; - marker_drag_line->property_points() = marker_drag_line_points; - } - if (range_marker_drag_rect) { - range_marker_drag_rect->property_y1() = 0.0; - range_marker_drag_rect->property_y2() = (double) canvas_height; - } - - if (transport_loop_range_rect) { - transport_loop_range_rect->property_y1() = 0.0; - transport_loop_range_rect->property_y2() = (double) canvas_height; - } - - if (transport_punch_range_rect) { - transport_punch_range_rect->property_y1() = 0.0; - transport_punch_range_rect->property_y2() = (double) canvas_height; - } - - if (transport_punchin_line) { - transport_punchin_line->property_y1() = 0.0; - transport_punchin_line->property_y2() = (double) canvas_height; - } - - if (transport_punchout_line) { - transport_punchout_line->property_y1() = 0.0; - transport_punchout_line->property_y2() = (double) canvas_height; - } - - update_fixed_rulers (); - - if (is_visible() && first_time) { - tempo_map_changed (Change (0)); - first_time = false; - } else { - redisplay_tempo (); - } -} - void Editor::queue_session_control_changed (Session::ControlType t) { @@ -1626,7 +1343,7 @@ Editor::connect_to_session (Session *t) redisplay_named_selections (); //route_list.freeze (); GTK2FIX - route_display_model.clear (); + route_display_model->clear (); session->foreach_route (this, &Editor::handle_new_route); // route_list.select_all (); // GTK2FIX @@ -1740,7 +1457,7 @@ void Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType item_type) { using namespace Menu_Helpers; - AudioRegionView* arv = static_cast (gtk_object_get_data (GTK_OBJECT(item), "regionview")); + AudioRegionView* arv = static_cast (item->get_data ("regionview")); if (arv == 0) { fatal << _("programming error: fade in canvas item has no regionview data pointer!") << endmsg; diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 4979cfd4de..47982ff728 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -373,7 +373,7 @@ void Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item) { Marker * marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -505,7 +505,7 @@ Editor::marker_menu_hide () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -523,7 +523,7 @@ Editor::marker_menu_play_from () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -553,7 +553,7 @@ Editor::marker_menu_set_playhead () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -581,7 +581,7 @@ Editor::marker_menu_set_from_playhead () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -609,7 +609,7 @@ Editor::marker_menu_set_from_selection () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -647,7 +647,7 @@ Editor::marker_menu_loop_range () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -674,7 +674,7 @@ Editor::marker_menu_edit () TempoMarker* tm; Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -697,7 +697,7 @@ Editor::marker_menu_remove () TempoMarker* tm; Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -716,7 +716,7 @@ Editor::marker_menu_rename () { Marker* marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(marker_menu_item), "marker"))) == 0) { + if ((marker = reinterpret_cast (marker_menu_item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 732340f24c..70df0b1bf9 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -263,9 +263,9 @@ Editor::session_going_away () /* rip everything out of the list displays */ region_list_clear (); // no clear() method in gtkmm 1.2 - route_display_model.clear (); - named_selection_model.clear (); - group_model.clear (); + route_display_model->clear (); + named_selection_model->clear (); + group_model->clear (); edit_cursor_clock.set_session (0); selection_start_clock.set_session (0); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 03e6d43e72..9324bed8cc 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -315,7 +315,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case AudioRegionViewNameHighlight: case AudioRegionViewName: - if ((rv = reinterpret_cast (gtk_object_get_data(GTK_OBJECT(item), "regionview"))) != 0) { + if ((rv = reinterpret_cast (item->get_data ("regionview"))) != 0) { set_selected_regionview_from_click (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift), true); } break; @@ -323,7 +323,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case GainAutomationControlPointItem: case PanAutomationControlPointItem: case RedirectAutomationControlPointItem: - if ((cp = reinterpret_cast (gtk_object_get_data(GTK_OBJECT(item), "control_point"))) != 0) { + if ((cp = reinterpret_cast (item->get_data ("control_point"))) != 0) { set_selected_control_point_from_click (Keyboard::modifier_state_equals (event->button.state, Keyboard::Shift), true); } break; @@ -358,7 +358,7 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp case AudioRegionViewNameHighlight: case AudioRegionViewName: - rv = reinterpret_cast (gtk_object_get_data(GTK_OBJECT(item), "regionview")); + rv = reinterpret_cast (item->get_data ("regionview")); default: break; } @@ -1125,7 +1125,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ switch (item_type) { case GainControlPointItem: if (mouse_mode == MouseGain) { - cp = reinterpret_cast(gtk_object_get_data (GTK_OBJECT(item), "control_point")); + cp = reinterpret_cast(item->get_data ("control_point")); cp->set_visible (true); double at_x, at_y; @@ -1149,7 +1149,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case GainAutomationControlPointItem: case PanAutomationControlPointItem: case RedirectAutomationControlPointItem: - cp = reinterpret_cast(gtk_object_get_data (GTK_OBJECT(item), "control_point")); + cp = reinterpret_cast(item->get_data ("control_point")); cp->set_visible (true); double at_x, at_y; @@ -1224,7 +1224,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ /* when the name is not an active item, the entire name highlight is for trimming */ - if (!reinterpret_cast (gtk_object_get_data(GTK_OBJECT(item), "regionview"))->name_active()) { + if (!reinterpret_cast (item->get_data ("regionview"))->name_active()) { if (mouse_mode == MouseObject && is_drawable()) { track_canvas_scroller.get_window()->set_cursor (*trimmer_cursor); } @@ -1250,7 +1250,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ track_canvas_scroller.get_window()->set_cursor (*cursor); AutomationTimeAxisView* atv; - if ((atv = static_cast(gtk_object_get_data(GTK_OBJECT(item), "trackview"))) != 0) { + if ((atv = static_cast(item->get_data ("trackview"))) != 0) { clear_entered_track = false; set_entered_track (atv); } @@ -1268,7 +1268,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; case MarkerItem: - if ((marker = static_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = static_cast (item->get_data ("marker"))) == 0) { break; } marker->set_color_rgba (color_map[cEnteredMarker]); @@ -1337,7 +1337,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case GainAutomationControlPointItem: case PanAutomationControlPointItem: case RedirectAutomationControlPointItem: - cp = reinterpret_cast(gtk_object_get_data (GTK_OBJECT(item), "control_point")); + cp = reinterpret_cast(item->get_data ("control_point")); if (cp->line.npoints() > 1) { if (!cp->selected) { cp->set_visible (false); @@ -1371,7 +1371,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case GainAutomationLineItem: case RedirectAutomationLineItem: case PanAutomationLineItem: - al = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item),"line")); + al = reinterpret_cast (item->get_data ("line")); { ArdourCanvas::Line *line = dynamic_cast (item); if (line) @@ -1384,7 +1384,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case AudioRegionViewName: /* see enter_handler() for notes */ - if (!reinterpret_cast (gtk_object_get_data(GTK_OBJECT(item), "regionview"))->name_active()) { + if (!reinterpret_cast (item->get_data ("regionview"))->name_active()) { if (is_drawable() && mouse_mode == MouseObject) { track_canvas_scroller.get_window()->set_cursor (*current_canvas_cursor); } @@ -1402,7 +1402,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ break; case MarkerItem: - if ((marker = static_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = static_cast (item->get_data ("marker"))) == 0) { break; } loc = find_location_from_marker (marker, is_start); @@ -1419,7 +1419,7 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_ case FadeInHandleItem: case FadeOutHandleItem: - rv = static_cast(gtk_object_get_data (GTK_OBJECT(item), "regionview")); + rv = static_cast(item->get_data ("regionview")); { ArdourCanvas::SimpleRect *rect = dynamic_cast (item); if (rect) { @@ -1701,7 +1701,7 @@ Editor::start_fade_in_grab (ArdourCanvas::Item* item, GdkEvent* event) start_grab (event); - if ((drag_info.data = (gtk_object_get_data (GTK_OBJECT(item), "regionview"))) == 0) { + if ((drag_info.data = (item->get_data ("regionview"))) == 0) { fatal << _("programming error: fade in canvas item has no regionview data pointer!") << endmsg; /*NOTREACHED*/ } @@ -1791,7 +1791,7 @@ Editor::start_fade_out_grab (ArdourCanvas::Item* item, GdkEvent* event) start_grab (event); - if ((drag_info.data = (gtk_object_get_data (GTK_OBJECT(item), "regionview"))) == 0) { + if ((drag_info.data = (item->get_data ("regionview"))) == 0) { fatal << _("programming error: fade out canvas item has no regionview data pointer!") << endmsg; /*NOTREACHED*/ } @@ -1884,7 +1884,7 @@ Editor::start_cursor_grab (ArdourCanvas::Item* item, GdkEvent* event) start_grab (event); - if ((drag_info.data = (gtk_object_get_data (GTK_OBJECT(item), "cursor"))) == 0) { + if ((drag_info.data = (item->get_data ("cursor"))) == 0) { fatal << _("programming error: cursor canvas item has no cursor data pointer!") << endmsg; /*NOTREACHED*/ } @@ -1974,7 +1974,7 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) { Marker* marker; - if ((marker = static_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = static_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -2112,7 +2112,7 @@ Editor::start_meter_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) Marker* marker; MeterMarker* meter_marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: meter marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -2191,7 +2191,7 @@ Editor::start_tempo_marker_grab (ArdourCanvas::Item* item, GdkEvent* event) Marker* marker; TempoMarker* tempo_marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "tempo_marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data ("tempo_marker"))) == 0) { fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -2272,7 +2272,7 @@ Editor::remove_gain_control_point (ArdourCanvas::Item*item, GdkEvent* event) { ControlPoint* control_point; - if ((control_point = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "control_point"))) == 0) { + if ((control_point = reinterpret_cast (item->get_data ("control_point"))) == 0) { fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg; /*NOTREACHED*/ } @@ -2291,7 +2291,7 @@ Editor::remove_control_point (ArdourCanvas::Item*item, GdkEvent* event) { ControlPoint* control_point; - if ((control_point = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "control_point"))) == 0) { + if ((control_point = reinterpret_cast (item->get_data ("control_point"))) == 0) { fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg; /*NOTREACHED*/ } @@ -2304,7 +2304,7 @@ Editor::start_control_point_grab (ArdourCanvas::Item* item, GdkEvent* event) { ControlPoint* control_point; - if ((control_point = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "control_point"))) == 0) { + if ((control_point = reinterpret_cast (item->get_data ("control_point"))) == 0) { fatal << _("programming error: control point canvas item has no control point object pointer!") << endmsg; /*NOTREACHED*/ } @@ -2402,7 +2402,7 @@ Editor::start_line_grab_from_line (ArdourCanvas::Item* item, GdkEvent* event) { AutomationLine* al; - if ((al = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "line"))) == 0) { + if ((al = reinterpret_cast (item->get_data ("line"))) == 0) { fatal << _("programming error: line canvas item has no line pointer!") << endmsg; /*NOTREACHED*/ } @@ -4089,7 +4089,7 @@ Editor::hide_marker (ArdourCanvas::Item* item, GdkEvent* event) Marker* marker; bool is_start; - if ((marker = static_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = static_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -4397,12 +4397,10 @@ Editor::drag_rubberband_select (ArdourCanvas::Item* item, GdkEvent* event) double x1 = frame_to_pixel (start); double x2 = frame_to_pixel (end); - gtk_object_set (GTK_OBJECT(rubberband_rect), - "x1", x1, - "y1", y1, - "x2", x2, - "y2", y2, - NULL); + rubberband_rect->property_x1() = x1; + rubberband_rect->property_y1() = y1; + rubberband_rect->property_x2() = x2; + rubberband_rect->property_y2() = y2; rubberband_rect->show(); rubberband_rect->raise_to_top(); diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc index 393ba0763e..de0abee8bf 100644 --- a/gtk2_ardour/editor_region_list.cc +++ b/gtk2_ardour/editor_region_list.cc @@ -261,6 +261,7 @@ Editor::add_audio_region_to_region_display (AudioRegion *region) TreeModel::iterator i; TreeModel::Children rows = region_list_model->children(); + bool found_parent = false; for (i = rows.begin(); i != rows.end(); ++i) { @@ -271,13 +272,14 @@ Editor::add_audio_region_to_region_display (AudioRegion *region) if (region->source_equivalent (*r)) { row = *(region_list_model->append ((*i).children())); + found_parent = true; break; } } } - if (i == rows.end()) { - TreeModel::Row row = *(region_list_model->append()); + if (!found_parent) { + row = *(region_list_model->append()); } @@ -328,9 +330,9 @@ void Editor::redisplay_regions () { if (session) { - + region_list_display.set_model (Glib::RefPtr(0)); - region_list_model.clear (); + region_list_model->clear (); /* now add everything we have, via a temporary list used to help with sorting. diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 536c1d1e22..93af2a18be 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -617,7 +617,7 @@ Editor::update_ruler_visibility () if (ruler_shown[ruler_time_tempo]) { lab_children.push_back (Element(tempo_label, PACK_SHRINK, PACK_START)); - gtk_object_get (GTK_OBJECT(tempo_group), "y", &old_unit_pos); + old_unit_pos = tempo_group->property_y(); if (tbpos != old_unit_pos) { tempo_group->move(0.0, tbpos - old_unit_pos); } diff --git a/gtk2_ardour/editor_selection_list.cc b/gtk2_ardour/editor_selection_list.cc index 51789880f0..e92051572f 100644 --- a/gtk2_ardour/editor_selection_list.cc +++ b/gtk2_ardour/editor_selection_list.cc @@ -62,7 +62,7 @@ Editor::redisplay_named_selections () { //GTK2FIX //named_selection_display.freeze (); - named_selection_model.clear (); + named_selection_model->clear (); session->foreach_named_selection (*this, &Editor::add_named_selection_to_named_selection_display); //named_selection_display.thaw (); } diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 217d99438f..65d772db3e 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -325,7 +325,7 @@ Editor::remove_tempo_marker (ArdourCanvas::Item* item) Marker* marker; TempoMarker* tempo_marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -409,7 +409,7 @@ Editor::edit_tempo_marker (ArdourCanvas::Item *item) Marker* marker; TempoMarker* tempo_marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -428,7 +428,7 @@ Editor::edit_meter_marker (ArdourCanvas::Item *item) Marker* marker; MeterMarker* meter_marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: tempo marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } @@ -459,7 +459,7 @@ Editor::remove_meter_marker (ArdourCanvas::Item* item) Marker* marker; MeterMarker* meter_marker; - if ((marker = reinterpret_cast (gtk_object_get_data (GTK_OBJECT(item), "marker"))) == 0) { + if ((marker = reinterpret_cast (item->get_data ("marker"))) == 0) { fatal << _("programming error: meter marker canvas item has no marker object pointer!") << endmsg; /*NOTREACHED*/ } diff --git a/gtk2_ardour/imageframe_time_axis.cc b/gtk2_ardour/imageframe_time_axis.cc index 7551bf36bc..27d1b3e077 100644 --- a/gtk2_ardour/imageframe_time_axis.cc +++ b/gtk2_ardour/imageframe_time_axis.cc @@ -116,21 +116,21 @@ ImageFrameTimeAxis::~ImageFrameTimeAxis () for(list::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) { - gtk_object_destroy (GTK_OBJECT((*i)->rect)); - gtk_object_destroy (GTK_OBJECT((*i)->start_trim)); - gtk_object_destroy (GTK_OBJECT((*i)->end_trim)); + delete (*i)->rect; + delete (*i)->start_trim; + delete (*i)->end_trim; } for(list::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) { - gtk_object_destroy (GTK_OBJECT((*i)->rect)); - gtk_object_destroy (GTK_OBJECT((*i)->start_trim)); - gtk_object_destroy (GTK_OBJECT((*i)->end_trim)); + delete (*i)->rect; + delete (*i)->start_trim; + delete (*i)->end_trim; } if (selection_group) { - gtk_object_destroy (GTK_OBJECT (selection_group)); + delete selection_group; selection_group = 0 ; } diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc index 53010300b1..e08f581951 100644 --- a/gtk2_ardour/marker_time_axis_view.cc +++ b/gtk2_ardour/marker_time_axis_view.cc @@ -95,13 +95,13 @@ MarkerTimeAxisView::~MarkerTimeAxisView() if(canvas_rect) { - gtk_object_destroy(GTK_OBJECT(canvas_rect)) ; + delete canvas_rect; canvas_rect = 0 ; } if(canvas_group) { - gtk_object_destroy(GTK_OBJECT(canvas_group)) ; + delete canvas_group; canvas_group = 0 ; } } @@ -123,7 +123,7 @@ MarkerTimeAxisView::set_height(gdouble h) return -1 ; } - gtk_object_set (GTK_OBJECT(canvas_rect), "y2", h, NULL); + canvas_rect->property_y2() = h; for (MarkerViewList::iterator i = marker_view_list.begin(); i != marker_view_list.end(); ++i) { diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 364f7b0f3e..221f45ec2a 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -301,7 +301,7 @@ Mixer_UI::connect_to_session (Session* sess) // GTK2FIX // track_display_list.freeze (); - track_display_model.clear (); + track_display_model->clear (); session->foreach_route (this, &Mixer_UI::add_strip); @@ -784,7 +784,7 @@ Mixer_UI::redisplay_snapshots () return; } - snapshot_display_model.clear (); + snapshot_display_model->clear (); for (vector::iterator i = states->begin(); i != states->end(); ++i) { string statename = *(*i); diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 95296f0817..c3eecf97b2 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -508,7 +508,7 @@ RedirectBox::redirects_changed (void *src) ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::redirects_changed), src)); //redirect_display.freeze (); - model.clear (); + model->clear (); redirect_active_connections.clear (); redirect_name_connections.clear (); diff --git a/gtk2_ardour/regionview.cc b/gtk2_ardour/regionview.cc index b07869bea5..7e6caad71d 100644 --- a/gtk2_ardour/regionview.cc +++ b/gtk2_ardour/regionview.cc @@ -122,29 +122,28 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView fade_out_shape = new ArdourCanvas::Polygon (*group); fade_out_shape->property_fill_color_rgba() = fade_color; fade_out_shape->set_data ("regionview", this); - { - uint32_t r,g,b,a; - UINT_TO_RGBA(fill_color,&r,&g,&b,&a); - - - fade_in_handle = new ArdourCanvas::SimpleRect (*group); - fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,0); - fade_in_handle->property_outline_pixels() = 0; - fade_in_handle->property_y1() = 2.0; - fade_in_handle->property_y2() = 7.0; - - fade_in_handle->set_data ("regionview", this); + uint32_t r,g,b,a; + UINT_TO_RGBA(fill_color,&r,&g,&b,&a); - fade_out_handle = new ArdourCanvas::SimpleRect (*group); - fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,0); - fade_out_handle->property_outline_pixels() = 0; - fade_out_handle->property_y1() = 2.0; - fade_out_handle->property_y2() = 7.0; - gtk_object_set_data (GTK_OBJECT(fade_out_handle), "regionview", this); + fade_in_handle = new ArdourCanvas::SimpleRect (*group); + fade_in_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,0); + fade_in_handle->property_outline_pixels() = 0; + fade_in_handle->property_y1() = 2.0; + fade_in_handle->property_y2() = 7.0; + + fade_in_handle->set_data ("regionview", this); + + fade_out_handle = new ArdourCanvas::SimpleRect (*group); + fade_out_handle->property_fill_color_rgba() = RGBA_TO_UINT(r,g,b,0); + fade_out_handle->property_outline_pixels() = 0; + fade_out_handle->property_y1() = 2.0; + fade_out_handle->property_y2() = 7.0; + + fade_out_handle->set_data ("regionview", this); } string foo = region.name(); @@ -186,7 +185,6 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, AudioTimeAxisView set_colors (); /* XXX sync mark drag? */ - } AudioRegionView::~AudioRegionView () diff --git a/gtk2_ardour/regionview.h b/gtk2_ardour/regionview.h index 5468abaaf8..9a7adf2719 100644 --- a/gtk2_ardour/regionview.h +++ b/gtk2_ardour/regionview.h @@ -48,15 +48,15 @@ class AutomationTimeAxisView; class AudioRegionView : public TimeAxisViewItem { public: - AudioRegionView (ArdourCanvas::Group *, - AudioTimeAxisView&, - ARDOUR::AudioRegion&, - double initial_samples_per_unit, - double amplitude_above_axis, - Gdk::Color& base_color, - bool wait_for_waves); - ~AudioRegionView (); - + AudioRegionView (ArdourCanvas::Group *, + AudioTimeAxisView&, + ARDOUR::AudioRegion&, + double initial_samples_per_unit, + double amplitude_above_axis, + Gdk::Color& base_color, + bool wait_for_waves); + ~AudioRegionView (); + ARDOUR::AudioRegion& region; // ok, let 'em have it bool is_valid() const { return valid; } void set_valid (bool yn) { valid = yn; } diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index 359ddc370e..7987496a81 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -364,7 +364,7 @@ RouteParams_UI::set_session (Session *sess) // GTK2FIX // route_select_list.freeze (); - route_display_model.clear(); + route_display_model->clear(); if (session) { session->foreach_route (this, &RouteParams_UI::add_route); @@ -386,7 +386,7 @@ RouteParams_UI::session_gone () { ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::session_gone)); - route_display_model.clear(); + route_display_model->clear(); cleanup_io_frames(); cleanup_pre_view(); diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 7ad23bb0ee..4213bc8431 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -23,6 +23,7 @@ #include "crossfade_view.h" #include "rgb_macros.h" #include "gui_thread.h" +#include "utils.h" using namespace ARDOUR; using namespace Editing; @@ -94,7 +95,7 @@ StreamView::StreamView (AudioTimeAxisView& tv) StreamView::~StreamView () { undisplay_diskstream (); - gtk_object_destroy (GTK_OBJECT(canvas_group)); + delete canvas_group; } void @@ -123,7 +124,7 @@ StreamView::set_height (gdouble h) return -1; } - gtk_object_set (GTK_OBJECT(canvas_rect), "y2", h, NULL); + canvas_rect->property_y2() = h; for (AudioRegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) { (*i)->set_height (h); @@ -135,7 +136,7 @@ StreamView::set_height (gdouble h) for (vector::iterator i = rec_rects.begin(); i != rec_rects.end(); ++i) { RecBoxInfo &recbox = (*i); - gtk_object_set (GTK_OBJECT( recbox.rectangle ), "y2", h - 1, NULL); + recbox.rectangle->property_y2() = h - 1.0; } return 0; @@ -740,7 +741,7 @@ StreamView::setup_rec_box () /* transport stopped, clear boxes */ for (vector::iterator iter=rec_rects.begin(); iter != rec_rects.end(); ++iter) { RecBoxInfo &rect = (*iter); - gtk_object_destroy (GTK_OBJECT(rect.rectangle)); + delete rect.rectangle; } rec_rects.clear(); @@ -829,7 +830,7 @@ StreamView::update_rec_regions () tmp = iter; ++tmp; - if ((GTK_OBJECT_FLAGS(GTK_OBJECT(rec_rects[n].rectangle)) & GNOME_CANVAS_ITEM_VISIBLE) == 0) { + if (!canvas_item_visible (rec_rects[n].rectangle)) { /* rect already hidden, this region is done */ iter = tmp; continue; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 47156bf672..6c97e24199 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -47,6 +47,7 @@ #include "selection.h" #include "keyboard.h" #include "rgb_macros.h" +#include "utils.h" #include "i18n.h" @@ -142,15 +143,16 @@ TimeAxisView::~TimeAxisView() } for (list::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) { - gtk_object_destroy (GTK_OBJECT((*i)->rect)); - gtk_object_destroy (GTK_OBJECT((*i)->start_trim)); - gtk_object_destroy (GTK_OBJECT((*i)->end_trim)); + delete (*i)->rect; + delete (*i)->start_trim; + delete (*i)->end_trim; + } for (list::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) { - gtk_object_destroy (GTK_OBJECT((*i)->rect)); - gtk_object_destroy (GTK_OBJECT((*i)->start_trim)); - gtk_object_destroy (GTK_OBJECT((*i)->end_trim)); + delete (*i)->rect; + delete (*i)->start_trim; + delete (*i)->end_trim; } if (selection_group) { @@ -219,7 +221,7 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent) (*i)->canvas_display->show(); } - if (GTK_OBJECT_FLAGS(GTK_OBJECT((*i)->canvas_display)) & GNOME_CANVAS_ITEM_VISIBLE) { + if (canvas_item_visible ((*i)->canvas_display)) { ++nth; effective_height += (*i)->show_at (y + effective_height, nth, parent); } @@ -342,7 +344,7 @@ TimeAxisView::set_height (TrackHeight h) height = (guint32) h; controls_frame.set_size_request (-1, height); - if (GTK_OBJECT_FLAGS(GTK_OBJECT(selection_group)) & GNOME_CANVAS_ITEM_VISIBLE) { + if (canvas_item_visible (selection_group)) { /* resize the selection rect */ show_selection (editor.get_selection().time); } @@ -495,7 +497,7 @@ TimeAxisView::show_selection (TimeSelection& ts) (*i)->show_selection (ts); } - if (GTK_OBJECT_FLAGS(GTK_OBJECT(selection_group)) & GNOME_CANVAS_ITEM_VISIBLE) { + if (canvas_item_visible (selection_group)) { while (!used_selection_rects.empty()) { free_selection_rects.push_front (used_selection_rects.front()); used_selection_rects.pop_front(); @@ -522,28 +524,24 @@ TimeAxisView::show_selection (TimeSelection& ts) x2 = (start + cnt - 1) / editor.get_current_zoom(); y2 = height; - gtk_object_set (GTK_OBJECT(rect->rect), - "x1", x1, - "y1", 1.0, - "x2", x2, - "y2", y2, - NULL); + rect->rect->property_x1() = x1; + rect->rect->property_y1() = 1.0; + rect->rect->property_x2() = x2; + rect->rect->property_y2() = y2; // trim boxes are at the top for selections if (x2 > x1) { - gtk_object_set (GTK_OBJECT(rect->start_trim), - "x1", x1, - "y1", 1.0, - "x2", x1 + trim_handle_size, - "y2", 1.0 + trim_handle_size, - NULL); - gtk_object_set (GTK_OBJECT(rect->end_trim), - "x1", x2 - trim_handle_size, - "y1", 1.0, - "x2", x2, - "y2", 1.0 + trim_handle_size, - NULL); + 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() = 1.0 + trim_handle_size; + + 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() = 1.0 + trim_handle_size; + rect->start_trim->show(); rect->end_trim->show(); } else { @@ -569,7 +567,7 @@ TimeAxisView::reshow_selection (TimeSelection& ts) void TimeAxisView::hide_selection () { - if (GTK_OBJECT_FLAGS(GTK_OBJECT(selection_group)) & GNOME_CANVAS_ITEM_VISIBLE) { + if (canvas_item_visible (selection_group)) { while (!used_selection_rects.empty()) { free_selection_rects.push_front (used_selection_rects.front()); used_selection_rects.pop_front(); diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index a25067c35e..8998b56229 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -34,6 +34,7 @@ #include "utils.h" #include "i18n.h" #include "rgb_macros.h" +#include "canvas_impl.h" using namespace std; using namespace Gtk; @@ -502,3 +503,8 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a) return (uint32_t) RGBA_TO_UINT(r,g,b,a); } +bool +canvas_item_visible (ArdourCanvas::Item* item) +{ + return (item->gobj()->object.flags & GNOME_CANVAS_ITEM_VISIBLE) ? true : false; +} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 8463b67bb3..3853edf7d4 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -28,6 +28,7 @@ #include #include #include "canvas.h" + namespace Gtk { class Window; class ComboBoxText; @@ -73,4 +74,6 @@ uint32_t rgba_from_style (std::string style, uint32_t, uint32_t, uint32_t, uint3 void decorate (Gtk::Window& w, Gdk::WMDecoration d); +bool canvas_item_visible (ArdourCanvas::Item* item); + #endif /* __ardour_gtk_utils_h__ */ -- 2.30.2