projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add sampo's synthesize_sources perl script to tools; add scroll-playhead-{forward...
[ardour.git]
/
gtk2_ardour
/
panner2d.cc
diff --git
a/gtk2_ardour/panner2d.cc
b/gtk2_ardour/panner2d.cc
index 0c04337b871f1da827dd33df6cfecf86af321d51..1e6e4c16c943497925d5c2a9b047a6b745c25b99 100644
(file)
--- a/
gtk2_ardour/panner2d.cc
+++ b/
gtk2_ardour/panner2d.cc
@@
-22,6
+22,9
@@
#include <climits>
#include <string.h>
#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>
#include <pbd/error.h>
#include <ardour/panner.h>
#include <gtkmm2ext/gtk_ui.h>
@@
-36,6
+39,7
@@
using namespace std;
using namespace Gtk;
using namespace sigc;
using namespace ARDOUR;
using namespace Gtk;
using namespace sigc;
using namespace ARDOUR;
+using namespace PBD;
Panner2d::Target::Target (float xa, float ya, const char *txt)
: x (xa), y (ya), text (txt ? strdup (txt) : 0)
Panner2d::Target::Target (float xa, float ya, const char *txt)
: x (xa), y (ya), text (txt ? strdup (txt) : 0)
@@
-124,12
+128,12
@@
Panner2d::reset (uint32_t n_inputs)
}
void
}
void
-Panner2d::
size_allocate_impl (GtkAllocation *
alloc)
+Panner2d::
on_size_allocate (Gtk::Allocation&
alloc)
{
{
- width = alloc
->width
;
- height = alloc
->height
;
+ width = alloc
.get_width()
;
+ height = alloc
.get_height()
;
- DrawingArea::
size_allocate_impl
(alloc);
+ DrawingArea::
on_size_allocate
(alloc);
}
int
}
int
@@
-352,8
+356,8
@@
Panner2d::find_closest_object (gdouble x, gdouble y, int& which, bool& is_puck)
return closest;
}
return closest;
}
-gint
-Panner2d::
motion_notify_event_impl
(GdkEventMotion *ev)
+bool
+Panner2d::
on_motion_notify_event
(GdkEventMotion *ev)
{
gint x, y;
GdkModifierType state;
{
gint x, y;
GdkModifierType state;
@@
-419,15
+423,20
@@
Panner2d::handle_motion (gint evx, gint evy, GdkModifierType state)
return TRUE;
}
return TRUE;
}
-gint
-Panner2d::
expose_event_impl
(GdkEventExpose *event)
+bool
+Panner2d::
on_expose_event
(GdkEventExpose *event)
{
gint x, y;
float fx, fy;
{
gint x, y;
float fx, fy;
+ if (layout == 0) {
+ layout = create_pango_layout ("");
+ layout->set_font_description (get_style()->get_font());
+ }
+
/* redraw the background */
/* 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);
true,
event->area.x, event->area.y,
event->area.width, event->area.height);
@@
-450,16
+459,15
@@
Panner2d::expose_event_impl (GdkEventExpose *event)
fy = max (fy, -1.0f);
y = (gint) floor (height * fy - 4);
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);
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
+488,7
@@
Panner2d::expose_event_impl (GdkEventExpose *event)
fy = max (fy, -1.0f);
y = (gint) floor ((height - 8) * fy);
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);
true,
x, y,
4, 4);
@@
-491,8
+499,8
@@
Panner2d::expose_event_impl (GdkEventExpose *event)
return TRUE;
}
return TRUE;
}
-gint
-Panner2d::
button_press_event_impl
(GdkEventButton *ev)
+bool
+Panner2d::
on_button_press_event
(GdkEventButton *ev)
{
switch (ev->button) {
case 1:
{
switch (ev->button) {
case 1:
@@
-514,8
+522,8
@@
Panner2d::button_press_event_impl (GdkEventButton *ev)
return FALSE;
}
return FALSE;
}
-gint
-Panner2d::
button_release_event_impl
(GdkEventButton *ev)
+bool
+Panner2d::
on_button_release_event
(GdkEventButton *ev)
{
switch (ev->button) {
case 1:
{
switch (ev->button) {
case 1:
@@
-579,13
+587,13
@@
Panner2d::show_context_menu ()
MenuList& items = context_menu->items();
items.push_back (CheckMenuElem (_("Bypass")));
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));
}
bypass_menu_item->set_active (panner.bypassed());
}
bypass_menu_item->set_active (panner.bypassed());
- context_menu->popup (1,
0
);
+ context_menu->popup (1,
gtk_get_current_event_time()
);
}
void
}
void