X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fpanner2d.cc;h=c6b2bad6c952bcd25197b5840bd90c20deac5897;hb=0faaa3ad7bf0cedf68eda1dd43e232363b9f7f04;hp=a228821e9dcdc17098b4ceb01b36b409b1dff28e;hpb=25ac88fcae679cb8c1355fee1b4932122dc5fe36;p=ardour.git diff --git a/gtk2_ardour/panner2d.cc b/gtk2_ardour/panner2d.cc index a228821e9d..c6b2bad6c9 100644 --- a/gtk2_ardour/panner2d.cc +++ b/gtk2_ardour/panner2d.cc @@ -22,6 +22,9 @@ #include #include +#include +#include + #include #include #include @@ -124,10 +127,10 @@ Panner2d::reset (uint32_t n_inputs) } void -Panner2d::on_size_allocate (GtkAllocation *alloc) +Panner2d::on_size_allocate (Gtk::Allocation alloc) { - width = alloc->width; - height = alloc->height; + width = alloc.get_width(); + height = alloc.get_height(); DrawingArea::on_size_allocate (alloc); } @@ -352,7 +355,7 @@ Panner2d::find_closest_object (gdouble x, gdouble y, int& which, bool& is_puck) return closest; } -gint +bool Panner2d::on_motion_notify_event (GdkEventMotion *ev) { gint x, y; @@ -419,15 +422,20 @@ Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state) return TRUE; } -gint +bool Panner2d::on_expose_event (GdkEventExpose *event) { gint x, y; float fx, fy; + if (layout == 0) { + layout = create_pango_layout (""); + layout->set_font_description (get_style()->get_font()); + } + /* redraw the background */ - get_window().draw_rectangle (get_style()->get_bg_gc(get_state()), + get_window()->draw_rectangle (get_style()->get_bg_gc(get_state()), true, event->area.x, event->area.y, event->area.width, event->area.height); @@ -450,16 +458,15 @@ Panner2d::on_expose_event (GdkEventExpose *event) fy = max (fy, -1.0f); y = (gint) floor (height * fy - 4); - get_window().draw_arc (get_style()->get_fg_gc(Gtk::STATE_NORMAL), + get_window()->draw_arc (get_style()->get_fg_gc(Gtk::STATE_NORMAL), true, x, y, 8, 8, 0, 360 * 64); - get_window().draw_text (get_style()->get_font(), - get_style()->get_fg_gc(Gtk::STATE_NORMAL), - x + 6, y + 6, - puck->text, - puck->textlen); + + layout->set_text (puck->text); + + get_window()->draw_layout (get_style()->get_fg_gc (STATE_NORMAL), x+6, y+6, layout); } } @@ -480,7 +487,7 @@ Panner2d::on_expose_event (GdkEventExpose *event) fy = max (fy, -1.0f); y = (gint) floor ((height - 8) * fy); - get_window().draw_rectangle (get_style()->get_fg_gc(GTK_STATE_ACTIVE), + get_window()->draw_rectangle (get_style()->get_fg_gc(Gtk::STATE_ACTIVE), true, x, y, 4, 4); @@ -491,7 +498,7 @@ Panner2d::on_expose_event (GdkEventExpose *event) return TRUE; } -gint +bool Panner2d::on_button_press_event (GdkEventButton *ev) { switch (ev->button) { @@ -514,7 +521,7 @@ Panner2d::on_button_press_event (GdkEventButton *ev) return FALSE; } -gint +bool Panner2d::on_button_release_event (GdkEventButton *ev) { switch (ev->button) { @@ -579,8 +586,8 @@ Panner2d::show_context_menu () MenuList& items = context_menu->items(); items.push_back (CheckMenuElem (_("Bypass"))); - bypass_menu_item = static_cast (items.back()); - bypass_menu_item->toggled.connect (mem_fun(*this, &Panner2d::toggle_bypass)); + bypass_menu_item = static_cast (&items.back()); + bypass_menu_item->signal_toggled().connect (mem_fun(*this, &Panner2d::toggle_bypass)); }