ardour
panner_interface.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #include <gtkmm.h>
21 #include "gtkmm2ext/keyboard.h"
23 #include "panner_interface.h"
24 #include "panner_editor.h"
25 #include "global_signals.h"
26 
27 #include "i18n.h"
28 
29 using namespace std;
30 using namespace Gtk;
31 using namespace ARDOUR;
32 using namespace Gtkmm2ext;
33 
35  : _panner (p)
36  , _tooltip (this)
37  , _send_mode (false)
38  , _editor (0)
39 {
40  set_flags (Gtk::CAN_FOCUS);
41 
42  add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|
43  Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|
44  Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|
45  Gdk::SCROLL_MASK|
46  Gdk::POINTER_MOTION_MASK);
47 
48 }
49 
51 {
52  delete _editor;
53 }
54 
55 bool
57 {
58  grab_focus ();
59  Keyboard::magic_widget_grab_focus ();
60  return false;
61 }
62 
63 bool
65 {
66  Keyboard::magic_widget_drop_focus ();
67  return false;
68 }
69 
70 bool
72 {
73  return false;
74 }
75 
76 void
78 {
79  set_tooltip ();
80  queue_draw ();
81 }
82 
83 bool
85 {
87  edit ();
88  return true;
89  }
90 
91  return false;
92 }
93 
94 bool
96 {
98  /* We edited on the press, so claim the release */
99  return true;
100  }
101 
102  return false;
103 }
104 
105 void
107 {
108  delete _editor;
109  _editor = editor ();
110  _editor->show ();
111 }
112 
113 void
115  if (_send_mode != onoff) {
116  _send_mode = onoff;
117  queue_draw ();
118  }
119 }
120 
122  : PersistentTooltip (w)
123  , _dragging (false)
124 {
125 
126 }
127 
128 void
130 {
131  _dragging = true;
132 }
133 
134 void
136 {
137  _dragging = false;
138 }
139 
140 bool
142 {
143  return _dragging;
144 }
PannerEditor * _editor
bool on_button_release_event(GdkEventButton *)
Definition: ardour_ui.h:130
Definition: Beats.hpp:239
PannerInterface(boost::shared_ptr< ARDOUR::Panner >)
virtual PannerEditor * editor()=0
Definition: amp.h:29
virtual void set_tooltip()=0
bool on_button_press_event(GdkEventButton *)
bool on_key_release_event(GdkEventKey *)
static bool is_edit_event(GdkEventButton *)
Definition: keyboard.cc:470
void set_send_drawing_mode(bool)
virtual ~PannerInterface()
bool on_leave_notify_event(GdkEventCrossing *)
PannerPersistentTooltip(Gtk::Widget *w)
bool on_enter_notify_event(GdkEventCrossing *)