summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-07-14 03:43:32 +0000
committerDavid Robillard <d@drobilla.net>2006-07-14 03:43:32 +0000
commit50a3102b9b533d7f8786d220f8df67421b9227c8 (patch)
tree669f84631ba1d9a1d312e3f76b226ca938c75c0f /libs/gtkmm2ext
parentedd841895b873b14c4aa814a80de5dc20ff30618 (diff)
Merge big changes (mostly Controllable) from trunk
git-svn-id: svn://localhost/ardour2/branches/midi@682 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r--libs/gtkmm2ext/SConscript5
-rw-r--r--libs/gtkmm2ext/barcontroller.cc103
-rw-r--r--libs/gtkmm2ext/binding_proxy.cc89
-rw-r--r--libs/gtkmm2ext/controller.cc92
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/barcontroller.h23
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/bindable_button.h50
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/binding_proxy.h54
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/controller.h59
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/slider_controller.h42
-rw-r--r--libs/gtkmm2ext/po/el_GR.po4
-rw-r--r--libs/gtkmm2ext/po/es_ES.po4
-rw-r--r--libs/gtkmm2ext/po/pt_BR.po4
-rw-r--r--libs/gtkmm2ext/po/ru_RU.po4
-rw-r--r--libs/gtkmm2ext/popup.cc14
-rw-r--r--libs/gtkmm2ext/slider_controller.cc116
15 files changed, 212 insertions, 451 deletions
diff --git a/libs/gtkmm2ext/SConscript b/libs/gtkmm2ext/SConscript
index 5d8489f103..bb28945641 100644
--- a/libs/gtkmm2ext/SConscript
+++ b/libs/gtkmm2ext/SConscript
@@ -10,7 +10,6 @@ gtkmm2ext = env.Copy()
gtkmm2ext.Merge ([
libraries['sigc2'],
libraries['pbd'],
- libraries['midi++2'],
libraries['gtk2'],
libraries['glibmm2'],
libraries['pangomm'],
@@ -28,16 +27,16 @@ domain = 'libgtkmm2ext'
gtkmm2ext.Append(DOMAIN=domain,MAJOR=0,MINOR=8,MICRO=2)
gtkmm2ext.Append(CXXFLAGS="-DPACKAGE=\\\"" + domain + "\\\"")
gtkmm2ext.Append(CXXFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
+gtkmm2ext.Append(CPPPATH='#libs/surfaces/control_protocol')
gtkmm2ext.Append(PACKAGE=domain)
gtkmm2ext.Append(POTFILE=domain + '.pot')
gtkmm2ext_files = Split("""
auto_spin.cc
barcontroller.cc
-bindable_button.cc
+binding_proxy.cc
choice.cc
click_box.cc
-controller.cc
dndtreeview.cc
fastmeter.cc
gtk_ui.cc
diff --git a/libs/gtkmm2ext/barcontroller.cc b/libs/gtkmm2ext/barcontroller.cc
index c977f3e5f7..eefe6ca843 100644
--- a/libs/gtkmm2ext/barcontroller.cc
+++ b/libs/gtkmm2ext/barcontroller.cc
@@ -23,7 +23,7 @@
#include <cmath>
#include <algorithm>
-#include <midi++/controllable.h>
+#include <pbd/controllable.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/utils.h>
@@ -36,16 +36,13 @@ using namespace Gtk;
using namespace Gtkmm2ext;
BarController::BarController (Gtk::Adjustment& adj,
- MIDI::Controllable *mc,
+ PBD::Controllable& mc,
sigc::slot<void,char*,unsigned int> lc)
: adjustment (adj),
- prompter (Gtk::WIN_POS_MOUSE, 30000, false),
- midi_control (mc),
+ binding_proxy (mc),
label_callback (lc),
- spinner (adjustment),
- bind_button (2),
- bind_statemask (Gdk::CONTROL_MASK)
+ spinner (adjustment)
{
_style = LeftToRight;
@@ -77,16 +74,6 @@ BarController::BarController (Gtk::Adjustment& adj,
darea.signal_button_release_event().connect (mem_fun (*this, &BarController::button_release));
darea.signal_scroll_event().connect (mem_fun (*this, &BarController::scroll));
- prompter.signal_unmap_event().connect (mem_fun (*this, &BarController::prompter_hiding));
-
- prompting = false;
- unprompting = false;
-
- if (mc) {
- mc->learning_started.connect (mem_fun (*this, &BarController::midicontrol_prompt));
- mc->learning_stopped.connect (mem_fun (*this, &BarController::midicontrol_unprompt));
- }
-
spinner.signal_activate().connect (mem_fun (*this, &BarController::entry_activated));
spinner.signal_focus_out_event().connect (mem_fun (*this, &BarController::entry_focus_out));
spinner.set_digits (3);
@@ -95,24 +82,13 @@ BarController::BarController (Gtk::Adjustment& adj,
show_all ();
}
-void
-BarController::set_bind_button_state (guint button, guint statemask)
-{
- bind_button = button;
- bind_statemask = statemask;
-}
-
-void
-BarController::get_bind_button_state (guint &button, guint &statemask)
-{
- button = bind_button;
- statemask = bind_statemask;
-}
-
-
bool
BarController::button_press (GdkEventButton* ev)
{
+ if (binding_proxy.button_press_handler (ev)) {
+ return true;
+ }
+
switch (ev->button) {
case 1:
if (ev->type == GDK_2BUTTON_PRESS) {
@@ -174,8 +150,8 @@ BarController::button_release (GdkEventButton* ev)
break;
case 2:
- if ((ev->state & bind_statemask) && bind_button == 2) {
- midi_learn ();
+ if (true) { // XXX FIX ME
+ /* relax */
} else {
double fract;
fract = ev->x / (darea.get_width() - 2.0);
@@ -185,10 +161,6 @@ BarController::button_release (GdkEventButton* ev)
return true;
case 3:
- if ((ev->state & bind_statemask) && bind_button == 3) {
- midi_learn ();
- return TRUE;
- }
return false;
default:
@@ -408,61 +380,6 @@ BarController::set_with_text (bool yn)
}
void
-BarController::midicontrol_set_tip ()
-{
- if (midi_control) {
- // Gtkmm2ext::UI::instance()->set_tip (&darea, midi_control->control_description());
- }
-}
-
-void
-BarController::midi_learn()
-{
- if (midi_control) {
- prompting = true;
- midi_control->learn_about_external_control ();
- }
-}
-
-
-void
-BarController::midicontrol_prompt ()
-{
- if (prompting) {
- string prompt = _("operate MIDI controller now");
- prompter.set_text (prompt);
- Gtkmm2ext::UI::instance()->touch_display (&prompter);
-
- unprompting = true;
- prompting = false;
- }
-}
-
-void
-BarController::midicontrol_unprompt ()
-{
- if (unprompting) {
- Gtkmm2ext::UI::instance()->touch_display (&prompter);
-
- unprompting = false;
- }
-}
-
-gint
-BarController::prompter_hiding (GdkEventAny *ev)
-{
- if (unprompting) {
- if (midi_control) {
- midi_control->stop_learning();
- }
- unprompting = false;
- }
-
- return FALSE;
-}
-
-
-void
BarController::set_style (Style s)
{
_style = s;
diff --git a/libs/gtkmm2ext/binding_proxy.cc b/libs/gtkmm2ext/binding_proxy.cc
new file mode 100644
index 0000000000..3a2f5bbbc8
--- /dev/null
+++ b/libs/gtkmm2ext/binding_proxy.cc
@@ -0,0 +1,89 @@
+/*
+ Copyright (C) 2006 Paul Davis
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
+*/
+
+#include <string>
+#include <climits>
+#include <iostream>
+
+#include <pbd/controllable.h>
+
+#include <gtkmm2ext/binding_proxy.h>
+
+#include "i18n.h"
+
+using namespace Gtkmm2ext;
+using namespace std;
+using namespace PBD;
+
+BindingProxy::BindingProxy (Controllable& c)
+ : prompter (Gtk::WIN_POS_MOUSE, 30000, false),
+ controllable (c),
+ bind_button (2),
+ bind_statemask (Gdk::CONTROL_MASK)
+
+{
+ prompter.signal_unmap_event().connect (mem_fun (*this, &BindingProxy::prompter_hiding));
+}
+
+void
+BindingProxy::set_bind_button_state (guint button, guint statemask)
+{
+ bind_button = button;
+ bind_statemask = statemask;
+}
+
+void
+BindingProxy::get_bind_button_state (guint &button, guint &statemask)
+{
+ button = bind_button;
+ statemask = bind_statemask;
+}
+
+bool
+BindingProxy::button_press_handler (GdkEventButton *ev)
+{
+ if ((ev->state & bind_statemask) && ev->button == bind_button) {
+ if (Controllable::StartLearning (&controllable)) {
+ string prompt = _("operate controller now");
+ prompter.set_text (prompt);
+ prompter.touch (); // shows popup
+ learning_connection = controllable.LearningFinished.connect (mem_fun (*this, &BindingProxy::learning_finished));
+ }
+ return true;
+ }
+
+ return false;
+}
+
+void
+BindingProxy::learning_finished ()
+{
+ learning_connection.disconnect ();
+ prompter.touch (); // hides popup
+}
+
+
+bool
+BindingProxy::prompter_hiding (GdkEventAny *ev)
+{
+ learning_connection.disconnect ();
+ Controllable::StopLearning (&controllable);
+ return false;
+}
+
diff --git a/libs/gtkmm2ext/controller.cc b/libs/gtkmm2ext/controller.cc
deleted file mode 100644
index 98d5566c69..0000000000
--- a/libs/gtkmm2ext/controller.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Davis
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id$
-*/
-
-#include <string>
-#include <climits>
-
-#include <midi++/channel.h>
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/controller.h>
-
-#include "i18n.h"
-
-using namespace Gtkmm2ext;
-
-Controller::Controller (Gtk::Adjustment *adj, MIDI::Port *p)
- : MIDI::Controllable (p),
- adjustment (adj),
- prompter (Gtk::WIN_POS_MOUSE, 30000, false)
-{
- new_value_pending = false;
-
- /* hear about MIDI control learning */
-
- learning_started.connect
- (mem_fun (*this, &Controller::midicontrol_prompt));
- learning_stopped.connect
- (mem_fun (*this, &Controller::midicontrol_unprompt));
-}
-
-void
-Controller::midicontrol_prompt ()
-
-{
- string prompt = _("operate MIDI controller now");
-
- prompter.set_text (prompt);
- Gtkmm2ext::UI::instance()->touch_display (&prompter);
-}
-
-void
-Controller::midicontrol_unprompt ()
-
-{
- Gtkmm2ext::UI::instance()->touch_display (&prompter);
-}
-
-int
-Controller::update_controller_value (void *arg)
-
-{
- Controller *c = (Controller *) arg;
-
- c->adjustment->set_value (c->new_value);
- c->new_value_pending = false;
-
- return FALSE;
-}
-
-void
-Controller::set_value (float v)
-
-{
- /* This is called from a MIDI callback. It could happen
- a thousand times a second, or more. Therefore, instead
- of going straight to the X server, which may not work for
- thread-related reasons, simply request an update whenever
- the GTK main loop is idle.
- */
-
- new_value = v;
-
- if (!new_value_pending) {
- new_value_pending = true;
- Gtkmm2ext::UI::instance()->idle_add (update_controller_value, this);
- }
-}
diff --git a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h
index 67c8221a55..ebce4e2de9 100644
--- a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h
+++ b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h
@@ -21,9 +21,9 @@
#define __gtkmm2ext_bar_controller_h__
#include <gtkmm.h>
-#include <gtkmm2ext/popup.h>
+#include <gtkmm2ext/binding_proxy.h>
-namespace MIDI {
+namespace ARDOUR {
class Controllable;
}
@@ -32,14 +32,9 @@ namespace Gtkmm2ext {
class BarController : public Gtk::Frame
{
public:
- BarController (Gtk::Adjustment& adj, MIDI::Controllable*, sigc::slot<void,char*,unsigned int>);
+ BarController (Gtk::Adjustment& adj, PBD::Controllable&, sigc::slot<void,char*,unsigned int>);
virtual ~BarController () {}
- void set_bind_button_state (guint button, guint statemask);
- void get_bind_button_state (guint &button, guint &statemask);
- void midicontrol_set_tip ();
- void midi_learn ();
-
void set_sensitive (bool yn) {
darea.set_sensitive (yn);
}
@@ -69,9 +64,8 @@ class BarController : public Gtk::Frame
protected:
Gtk::Adjustment& adjustment;
+ BindingProxy binding_proxy;
Gtk::DrawingArea darea;
- Gtkmm2ext::PopUp prompter;
- MIDI::Controllable* midi_control;
sigc::slot<void,char*,unsigned int> label_callback;
Glib::RefPtr<Pango::Layout> layout;
Style _style;
@@ -85,10 +79,6 @@ class BarController : public Gtk::Frame
Gtk::SpinButton spinner;
bool use_parent;
- guint bind_button;
- guint bind_statemask;
- bool prompting, unprompting;
-
bool button_press (GdkEventButton *);
bool button_release (GdkEventButton *);
bool motion (GdkEventMotion *);
@@ -98,11 +88,6 @@ class BarController : public Gtk::Frame
gint mouse_control (double x, GdkWindow* w, double scaling);
- gint prompter_hiding (GdkEventAny *);
- void midicontrol_prompt ();
- void midicontrol_unprompt ();
- void update_midi_control ();
-
gint switch_to_bar ();
gint switch_to_spinner ();
diff --git a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h
index 7400cf15d0..1936125405 100644
--- a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h
+++ b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h
@@ -18,59 +18,31 @@
$Id$
*/
-#ifndef __pbd_gtkmm_bindable_button_h__
-#define __pbd_gtkmm_bindable_button_h__
+#ifndef __bindable_button_h__
+#define __bindable_button_h__
#include <string>
#include <gtkmm2ext/stateful_button.h>
-#include <gtkmm2ext/popup.h>
+#include "binding_proxy.h"
-namespace MIDI {
+namespace PBD {
class Controllable;
}
-namespace Gtkmm2ext {
-
class BindableToggleButton : public Gtk::ToggleButton
{
public:
- BindableToggleButton(MIDI::Controllable *);
-
- //: Create a check button with a label.
- //- You won't be able
- //- to add a widget in this button since it already has a {\class Gtk_Label}
- //- in it.
- explicit BindableToggleButton(MIDI::Controllable *, const std::string &label);
-
+ BindableToggleButton (PBD::Controllable& c) : binding_proxy (c) {}
+ explicit BindableToggleButton (PBD::Controllable& c, const std::string &label) : Gtk::ToggleButton (label), binding_proxy (c) {}
virtual ~BindableToggleButton() {}
- void set_bind_button_state (guint button, guint statemask);
- void get_bind_button_state (guint &button, guint &statemask);
-
- void midicontrol_set_tip ();
-
- void midi_learn ();
-
- protected:
-
- Gtkmm2ext::PopUp prompter;
-
- MIDI::Controllable* midi_control;
-
- guint bind_button;
- guint bind_statemask;
-
- bool prompting, unprompting;
-
- void init_events ();
- bool prompter_hiding (GdkEventAny *);
- void midicontrol_prompt ();
- void midicontrol_unprompt ();
-
- bool on_button_press_event (GdkEventButton *);
-};
+ bool on_button_press_event (GdkEventButton *ev) {
+ return binding_proxy.button_press_handler (ev);
+ }
+ private:
+ BindingProxy binding_proxy;
};
#endif
diff --git a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
new file mode 100644
index 0000000000..a26c8ace2a
--- /dev/null
+++ b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h
@@ -0,0 +1,54 @@
+/*
+ Copyright (C) 2006 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
+*/
+
+#ifndef __binding_proxy__
+#define __binding_proxy__
+
+#include <string>
+
+#include <gtkmm2ext/popup.h>
+
+namespace PBD {
+ class Controllable;
+}
+
+class BindingProxy : public sigc::trackable
+{
+ public:
+ BindingProxy (PBD::Controllable&);
+ virtual ~BindingProxy() {}
+
+ void set_bind_button_state (guint button, guint statemask);
+ void get_bind_button_state (guint &button, guint &statemask);
+
+ bool button_press_handler (GdkEventButton *);
+
+ protected:
+
+ Gtkmm2ext::PopUp prompter;
+ PBD::Controllable& controllable;
+ guint bind_button;
+ guint bind_statemask;
+ sigc::connection learning_connection;
+ void learning_finished ();
+ bool prompter_hiding (GdkEventAny *);
+};
+
+#endif
diff --git a/libs/gtkmm2ext/gtkmm2ext/controller.h b/libs/gtkmm2ext/gtkmm2ext/controller.h
deleted file mode 100644
index b72f6c7ed7..0000000000
--- a/libs/gtkmm2ext/gtkmm2ext/controller.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- Copyright (C) 1998-99 Paul Davis
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id$
-*/
-
-#ifndef __gtkmm2ext_controller_h__
-#define __gtkmm2ext_controller_h__
-
-#include <gtkmm.h>
-#include <gtkmm2ext/popup.h>
-#include <midi++/controllable.h>
-
-namespace Gtkmm2ext {
-
-class Controller : public MIDI::Controllable
-
-{
- public:
- Controller (Gtk::Adjustment *, MIDI::Port *);
- virtual ~Controller () {}
-
- void set_value (float);
- float lower () { return adjustment->get_lower(); }
- float upper () { return adjustment->get_upper(); }
- float range () { return upper() - lower() /* XXX +1 ??? */ ; }
-
- void midicontrol_prompt ();
- void midicontrol_unprompt ();
-
- protected:
- Gtk::Adjustment *adjustment;
-
- private:
- Gtkmm2ext::PopUp prompter;
- gfloat new_value;
- bool new_value_pending;
-
- static gint update_controller_value (void *);
-};
-
-}; /* namespace */
-
-#endif // __gtkmm2ext_controller_h__
-
-
diff --git a/libs/gtkmm2ext/gtkmm2ext/slider_controller.h b/libs/gtkmm2ext/gtkmm2ext/slider_controller.h
index 7abaf285d1..f0f645eab7 100644
--- a/libs/gtkmm2ext/gtkmm2ext/slider_controller.h
+++ b/libs/gtkmm2ext/gtkmm2ext/slider_controller.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1998-99 Paul Davis
+ Copyright (C) 1998-2006 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -17,18 +17,19 @@
$Id$
*/
-#ifndef __gtkmm2ext_motion_controller_h__
-#define __gtkmm2ext_motion_controller_h__
+#ifndef __gtkmm2ext_slider_controller_h__
+#define __gtkmm2ext_slider_controller_h__
#include <gtkmm.h>
#include <gtkmm2ext/popup.h>
#include <gtkmm2ext/pixscroller.h>
+#include <gtkmm2ext/binding_proxy.h>
namespace Gtkmm2ext {
class Pix;
}
-namespace MIDI {
+namespace PBD {
class Controllable;
}
@@ -40,41 +41,24 @@ class SliderController : public Gtkmm2ext::PixScroller
SliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
Glib::RefPtr<Gdk::Pixbuf> rail,
Gtk::Adjustment* adj,
- MIDI::Controllable*,
+ PBD::Controllable&,
bool with_numeric = true);
virtual ~SliderController () {}
- void set_bind_button_state (guint button, guint statemask);
- void get_bind_button_state (guint &button, guint &statemask);
- void midicontrol_set_tip ();
- void midi_learn ();
-
void set_value (float);
- // void set_sensitive (bool yn) {
- // spin.set_sensitive (yn);
- // }
- Gtk::SpinButton & get_spin_button () { return spin; }
+ Gtk::SpinButton& get_spin_button () { return spin; }
+ bool on_button_press_event (GdkEventButton *ev);
+
protected:
+ BindingProxy binding_proxy;
Glib::RefPtr<Gdk::Pixbuf> slider;
Glib::RefPtr<Gdk::Pixbuf> rail;
Gtk::SpinButton spin;
Gtk::Frame spin_frame;
Gtk::HBox spin_hbox;
- Gtkmm2ext::PopUp prompter;
- MIDI::Controllable* midi_control;
-
- guint bind_button;
- guint bind_statemask;
- bool prompting, unprompting;
-
- bool button_press (GdkEventButton *);
- bool prompter_hiding (GdkEventAny *);
- void midicontrol_prompt ();
- void midicontrol_unprompt ();
- void update_midi_control ();
};
class VSliderController : public SliderController
@@ -83,7 +67,7 @@ class VSliderController : public SliderController
VSliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
Glib::RefPtr<Gdk::Pixbuf> rail,
Gtk::Adjustment *adj,
- MIDI::Controllable *,
+ PBD::Controllable&,
bool with_numeric = true);
};
@@ -93,11 +77,11 @@ class HSliderController : public SliderController
HSliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
Glib::RefPtr<Gdk::Pixbuf> rail,
Gtk::Adjustment *adj,
- MIDI::Controllable *,
+ PBD::Controllable&,
bool with_numeric = true);
};
}; /* namespace */
-#endif // __gtkmm2ext_motion_controller_h__
+#endif // __gtkmm2ext_slider_controller_h__
diff --git a/libs/gtkmm2ext/po/el_GR.po b/libs/gtkmm2ext/po/el_GR.po
index 20ddfab7e4..cc10981aa8 100644
--- a/libs/gtkmm2ext/po/el_GR.po
+++ b/libs/gtkmm2ext/po/el_GR.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.99beta23\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-06-20 16:25-0400\n"
+"POT-Creation-Date: 2006-06-21 15:09-0400\n"
"PO-Revision-Date: 2005-01-11\n"
"Last-Translator: Muadibas\n"
"Language-Team: Hellenic(Greek) <LL@li.org>\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "operate MIDI controller now"
msgstr "λειτουργία ελεγκτή MIDI τώρα"
-#: libs/gtkmm2ext/gtk_ui.cc:509
+#: libs/gtkmm2ext/gtk_ui.cc:510
msgid "Press To Exit"
msgstr ""
diff --git a/libs/gtkmm2ext/po/es_ES.po b/libs/gtkmm2ext/po/es_ES.po
index ccc7933755..8b7dc8804d 100644
--- a/libs/gtkmm2ext/po/es_ES.po
+++ b/libs/gtkmm2ext/po/es_ES.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gtkmm2ext\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-06-20 16:25-0400\n"
+"POT-Creation-Date: 2006-06-21 15:09-0400\n"
"PO-Revision-Date: 2004-02-13 00:35+0300\n"
"Last-Translator: Alex Krohn alexkrohn@fastmail.fm\n"
"Language-Team: Spanish\n"
@@ -19,7 +19,7 @@ msgstr ""
msgid "operate MIDI controller now"
msgstr "Operar controladora de MIDI ahora"
-#: libs/gtkmm2ext/gtk_ui.cc:509
+#: libs/gtkmm2ext/gtk_ui.cc:510
msgid "Press To Exit"
msgstr ""
diff --git a/libs/gtkmm2ext/po/pt_BR.po b/libs/gtkmm2ext/po/pt_BR.po
index 4cf068dc7a..66381c2d37 100644
--- a/libs/gtkmm2ext/po/pt_BR.po
+++ b/libs/gtkmm2ext/po/pt_BR.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gtkmm2ext\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-06-20 16:25-0400\n"
+"POT-Creation-Date: 2006-06-21 15:09-0400\n"
"PO-Revision-Date: 2004-05-17 20:36+0200\n"
"Last-Translator: Chris Ross <chris.ross@tebibyte.org>\n"
"Language-Team: Portuguese\n"
@@ -20,7 +20,7 @@ msgstr ""
msgid "operate MIDI controller now"
msgstr "Operar controladora de MIDI agora"
-#: libs/gtkmm2ext/gtk_ui.cc:509
+#: libs/gtkmm2ext/gtk_ui.cc:510
msgid "Press To Exit"
msgstr ""
diff --git a/libs/gtkmm2ext/po/ru_RU.po b/libs/gtkmm2ext/po/ru_RU.po
index 5bfb6eb73c..4a3edcef5c 100644
--- a/libs/gtkmm2ext/po/ru_RU.po
+++ b/libs/gtkmm2ext/po/ru_RU.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gtkmm2ext\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-06-20 16:25-0400\n"
+"POT-Creation-Date: 2006-06-21 15:09-0400\n"
"PO-Revision-Date: 2004-02-13 00:35+0300\n"
"Last-Translator: Igor Blinov pitstop@nm.ru\n"
"Language-Team: Russian\n"
@@ -19,7 +19,7 @@ msgstr ""
msgid "operate MIDI controller now"
msgstr " MIDI-"
-#: libs/gtkmm2ext/gtk_ui.cc:509
+#: libs/gtkmm2ext/gtk_ui.cc:510
msgid "Press To Exit"
msgstr ""
diff --git a/libs/gtkmm2ext/popup.cc b/libs/gtkmm2ext/popup.cc
index 0a48ebfc59..a8ffc4af66 100644
--- a/libs/gtkmm2ext/popup.cc
+++ b/libs/gtkmm2ext/popup.cc
@@ -73,11 +73,12 @@ PopUp::remove ()
{
hide ();
+ if (popdown_time != 0 && timeout != -1) {
+ gtk_timeout_remove (timeout);
+ }
+
if (delete_on_hide) {
std::cerr << "deleting prompter\n";
- if (popdown_time != 0 && timeout != -1) {
- gtk_timeout_remove (timeout);
- }
gtk_idle_add (idle_delete, this);
}
}
@@ -125,11 +126,12 @@ PopUp::on_delete_event (GdkEventAny* ev)
{
hide();
+ if (popdown_time != 0 && timeout != -1) {
+ gtk_timeout_remove (timeout);
+ }
+
if (delete_on_hide) {
std::cerr << "deleting prompter\n" << endl;
- if (popdown_time != 0 && timeout != -1) {
- gtk_timeout_remove (timeout);
- }
gtk_idle_add (idle_delete, this);
}
diff --git a/libs/gtkmm2ext/slider_controller.cc b/libs/gtkmm2ext/slider_controller.cc
index 734d5eb62f..e524eba1cb 100644
--- a/libs/gtkmm2ext/slider_controller.cc
+++ b/libs/gtkmm2ext/slider_controller.cc
@@ -18,47 +18,30 @@
*/
#include <string>
-#include <climits>
-
-#include <midi++/controllable.h>
#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/slider_controller.h>
#include <gtkmm2ext/pixscroller.h>
+#include <gtkmm2ext/slider_controller.h>
#include "i18n.h"
using namespace Gtkmm2ext;
+using namespace PBD;
SliderController::SliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
Glib::RefPtr<Gdk::Pixbuf> rail,
Gtk::Adjustment *adj,
- MIDI::Controllable *mc,
+ Controllable& c,
bool with_numeric)
: PixScroller (*adj, slide, rail),
- spin (*adj, 0, 2),
- prompter (Gtk::WIN_POS_MOUSE, 30000, false),
- midi_control (mc),
- bind_button (2),
- bind_statemask (Gdk::CONTROL_MASK)
-
+ binding_proxy (c),
+ spin (*adj, 0, 2)
{
- signal_button_press_event().connect (mem_fun (this, &SliderController::button_press));
spin.set_name ("SliderControllerValue");
spin.set_size_request (70,-1); // should be based on font size somehow
spin.set_numeric (true);
spin.set_snap_to_ticks (false);
-
- prompter.signal_unmap_event().connect (mem_fun (*this, &SliderController::prompter_hiding));
-
- prompting = false;
- unprompting = false;
-
- if (mc) {
- mc->learning_started.connect (mem_fun (*this, &SliderController::midicontrol_prompt));
- mc->learning_stopped.connect (mem_fun (*this, &SliderController::midicontrol_unprompt));
- }
}
void
@@ -67,95 +50,22 @@ SliderController::set_value (float v)
adj.set_value (v);
}
-void
-SliderController::set_bind_button_state (guint button, guint statemask)
-{
- bind_button = button;
- bind_statemask = statemask;
-}
-
-void
-SliderController::get_bind_button_state (guint &button, guint &statemask)
-{
- button = bind_button;
- statemask = bind_statemask;
-}
-
-void
-SliderController::midi_learn()
-{
- if (midi_control) {
- prompting = true;
- midi_control->learn_about_external_control ();
- }
-}
-
-bool
-SliderController::button_press (GdkEventButton *ev)
+bool
+SliderController::on_button_press_event (GdkEventButton *ev)
{
- if ((ev->state & bind_statemask) && ev->button == bind_button) {
- midi_learn ();
+ if (binding_proxy.button_press_handler (ev)) {
return true;
}
-
- return false;
-}
-
-void
-SliderController::midicontrol_set_tip ()
-
-{
- if (midi_control) {
- // Gtkmm2ext::UI::instance()->set_tip (this, midi_control->control_description());
- }
-}
-
-bool
-SliderController::prompter_hiding (GdkEventAny *ev)
-{
- if (unprompting) {
- if (midi_control) {
- midi_control->stop_learning();
- }
- unprompting = false;
- }
-
- return false;
-}
-
-void
-SliderController::midicontrol_prompt ()
-
-{
- if (prompting) {
-
- string prompt = _("operate MIDI controller now");
- prompter.set_text (prompt);
- Gtkmm2ext::UI::instance()->touch_display (&prompter);
-
- unprompting = true;
- prompting = false;
- }
-}
-
-void
-SliderController::midicontrol_unprompt ()
-
-{
- if (unprompting) {
- Gtkmm2ext::UI::instance()->touch_display (&prompter);
- unprompting = false;
- }
+ return PixScroller::on_button_press_event (ev);
}
-
VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
Glib::RefPtr<Gdk::Pixbuf> rail,
Gtk::Adjustment *adj,
- MIDI::Controllable *mcontrol,
+ Controllable& control,
bool with_numeric)
- : SliderController (slide, rail, adj, mcontrol, with_numeric)
+ : SliderController (slide, rail, adj, control, with_numeric)
{
if (with_numeric) {
spin_frame.add (spin);
@@ -169,10 +79,10 @@ VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
Glib::RefPtr<Gdk::Pixbuf> rail,
Gtk::Adjustment *adj,
- MIDI::Controllable *mcontrol,
+ Controllable& control,
bool with_numeric)
- : SliderController (slide, rail, adj, mcontrol, with_numeric)
+ : SliderController (slide, rail, adj, control, with_numeric)
{
if (with_numeric) {
spin_frame.add (spin);