Fix horizontal positioning of PC flags.
[ardour.git] / gtk2_ardour / canvas-sysex.cc
1 #include <iostream>
2
3 #include "ardour_ui.h"
4
5 #include "canvas-sysex.h"
6
7 using namespace Gnome::Canvas;
8 using namespace std;
9
10 template<typename Time>
11 CanvasSysEx<Time>::CanvasSysEx(
12                 MidiRegionView&                       region,
13                 Group&                                parent,
14                 string&                               text,
15                 double                                height,
16                 double                                x,
17                 double                                y,
18                 boost::shared_ptr<Evoral::MIDIEvent<Time> > event
19                 )
20         : CanvasFlag(
21                         region, 
22                         parent, 
23                         height, 
24                         ARDOUR_UI::config()->canvasvar_MidiSysExOutline.get(), 
25                         ARDOUR_UI::config()->canvasvar_MidiSysExFill.get(),
26                         x,
27                         y
28                 )
29 {
30         set_text(text);
31 }
32
33 template<typename Time>
34 CanvasSysEx<Time>::~CanvasSysEx()
35 {
36 }
37
38 template<typename Time>
39 bool
40 CanvasSysEx<Time>::on_event(GdkEvent* ev)
41 {
42         switch (ev->type) {
43         case GDK_BUTTON_PRESS:
44                 if (ev->button.button == 3) {
45                         return true;
46                 }
47                 break;
48                 
49         case GDK_SCROLL:
50                 if (ev->scroll.direction == GDK_SCROLL_UP) {
51                         return true;
52                 } else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
53                         return true;
54                 } 
55                 break;
56                 
57         default:
58                 break;
59         }
60         
61         return false;
62 }
63
64 template class CanvasSysEx<nframes_t>;