Only allow LV2 touch events for control inputs
[ardour.git] / gtk2_ardour / sys_ex.cc
1 /*
2     Copyright (C) 2009 Paul Davis
3     Author: Hans Baier
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <iostream>
21 #include "canvas/flag.h"
22 #include "sys_ex.h"
23 #include "ui_config.h"
24
25 using namespace std;
26
27 SysEx::SysEx (
28         MidiRegionView&             region,
29         ArdourCanvas::Container*    parent,
30         string&                     text,
31         double                      height,
32         double                      x,
33         double                      y,
34         ARDOUR::MidiModel::SysExPtr sysex)
35         : _sysex (sysex)
36 {
37         _flag = new ArdourCanvas::Flag (
38                 parent,
39                 height,
40                 UIConfiguration::instance().color ("midi sysex outline"),
41                 UIConfiguration::instance().color_mod ("midi sysex fill", "midi sysex fill"),
42                 ArdourCanvas::Duple (x, y)
43                 );
44
45         _flag->set_text (text);
46 }
47
48 SysEx::~SysEx()
49 {
50         /* do not delete flag because it was added to a parent/container which
51            will delete it.
52         */
53         _flag = 0;
54 }
55
56 bool
57 SysEx::event_handler (GdkEvent* ev)
58 {
59         switch (ev->type) {
60         case GDK_BUTTON_PRESS:
61                 if (ev->button.button == 3) {
62                         return true;
63                 }
64                 break;
65
66         case GDK_SCROLL:
67                 if (ev->scroll.direction == GDK_SCROLL_UP) {
68                         return true;
69                 } else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
70                         return true;
71                 }
72                 break;
73
74         default:
75                 break;
76         }
77
78         return false;
79 }
80
81 void
82 SysEx::hide ()
83 {
84         _flag->hide ();
85 }
86
87 void
88 SysEx::show ()
89 {
90         _flag->show ();
91 }