#include <climits>
#include <string.h>
+#include <gtkmm/menu.h>
+#include <gtkmm/checkmenuitem.h>
+
#include <pbd/error.h>
#include <ardour/panner.h>
#include <gtkmm2ext/gtk_ui.h>
}
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);
}
return closest;
}
-gint
+bool
Panner2d::on_motion_notify_event (GdkEventMotion *ev)
{
gint x, y;
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);
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);
}
}
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);
return TRUE;
}
-gint
+bool
Panner2d::on_button_press_event (GdkEventButton *ev)
{
switch (ev->button) {
return FALSE;
}
-gint
+bool
Panner2d::on_button_release_event (GdkEventButton *ev)
{
switch (ev->button) {
MenuList& items = context_menu->items();
items.push_back (CheckMenuElem (_("Bypass")));
- bypass_menu_item = static_cast<CheckMenuItem*> (items.back());
- bypass_menu_item->toggled.connect (mem_fun(*this, &Panner2d::toggle_bypass));
+ bypass_menu_item = static_cast<CheckMenuItem*> (&items.back());
+ bypass_menu_item->signal_toggled().connect (mem_fun(*this, &Panner2d::toggle_bypass));
}