make ArdourButtons be MIDI-learnable; tweaks to ArdourButton design and implementation; use ArdourButtons (all gray for now) in the Monitor section.

git-svn-id: svn://localhost/ardour2/branches/3.0@10338 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-10-29 15:54:30 +00:00
parent d7b685cc5f
commit bde8437387
7 changed files with 429 additions and 117 deletions

View file

@ -22,11 +22,14 @@
#include <stdint.h>
#include <gtkmm/activatable.h>
#include <gtkmm/action.h>
#include "pbd/signals.h"
#include "gtkmm2ext/binding_proxy.h"
#include "cairo_widget.h"
class ArdourButton : public CairoWidget, Gtk::Activatable
class ArdourButton : public CairoWidget
{
public:
enum Element {
@ -39,6 +42,7 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
static Element default_elements;
static Element led_default_elements;
static Element just_led_default_elements;
ArdourButton (Element e = default_elements);
virtual ~ArdourButton ();
@ -57,6 +61,12 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
sigc::signal<void> signal_led_clicked;
boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
void watch ();
void set_related_action (Glib::RefPtr<Gtk::Action>);
protected:
void render (cairo_t *);
void on_size_request (Gtk::Requisition* req);
@ -64,10 +74,15 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
void controllable_changed ();
PBD::ScopedConnection watch_connection;
private:
Glib::RefPtr<Pango::Layout> _layout;
std::string _text;
Element _elements;
BindingProxy binding_proxy;
bool _act_on_release;
int _text_width;
int _text_height;
@ -96,6 +111,10 @@ class ArdourButton : public CairoWidget, Gtk::Activatable
void set_colors ();
void color_handler ();
void state_handler ();
Glib::RefPtr<Gtk::Action> _action;
void action_activated ();
void action_toggled ();
};
#endif /* __gtk2_ardour_ardour_button_h__ */