X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_axis_view.cc;h=6c97e2419947e982bc3f3e2e8da005c216dab84f;hb=2b49b2433b6dc06a52b0848af62373c747f18ac9;hp=c89d3e8436ea347db0f98ff25038b25abda9920d;hpb=ab91bcfdace8f4c3e76de3a9ffbfff93102997fb;p=ardour.git diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index c89d3e8436..6c97e24199 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -24,6 +24,10 @@ #include #include +#include +#include +#include + #include #include @@ -43,6 +47,7 @@ #include "selection.h" #include "keyboard.h" #include "rgb_macros.h" +#include "utils.h" #include "i18n.h" @@ -50,7 +55,7 @@ using namespace Gtk; using namespace sigc; using namespace ARDOUR; using namespace Editing; -using namespace Gnome::Canvas; +using namespace ArdourCanvas; const double trim_handle_size = 6.0; /* pixels */ @@ -84,9 +89,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie name_entry.signal_button_release_event().connect (mem_fun (*this, &TimeAxisView::name_entry_button_release)); name_entry.signal_button_press_event().connect (mem_fun (*this, &TimeAxisView::name_entry_button_press)); - name_entry.signal_focus_in_event().connect (sigc::ptr_fun (ARDOUR_UI::generic_focus_in_event)); - name_entry.signal_focus_out_event().connect (sigc::ptr_fun (ARDOUR_UI::generic_focus_out_event)); - Gtkmm2ext::set_size_request_to_display_given_text (name_entry, N_("gTortnam"), 10, 10); // just represents a short name name_label.set_name ("TrackLabel"); @@ -141,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) { @@ -218,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); } @@ -341,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); } @@ -494,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(); @@ -521,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 { @@ -568,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(); @@ -585,7 +584,7 @@ TimeAxisView::hide_selection () } void -TimeAxisView::order_selection_trims (Gnome::Canvas::Item *item, bool put_start_on_top) +TimeAxisView::order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top) { /* find the selection rect this is for. we have the item corresponding to one of the trim handles. @@ -657,9 +656,9 @@ TimeAxisView::get_selection_rect (uint32_t id) free_selection_rects.push_front (rect); - rect->rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_rect_event), rect)); - rect->start_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_start_trim_event), rect)); - rect->end_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_end_trim_event), rect)); + rect->rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect)); + rect->start_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect)); + rect->end_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect)); } rect = free_selection_rects.front();