catchup on previous commit relating to who owns ActiveState and VisualState

git-svn-id: svn://localhost/ardour2/branches/3.0@10372 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-11-01 01:22:08 +00:00
parent 0fdb513786
commit 521937a9d1
9 changed files with 40 additions and 79 deletions

View File

@ -204,7 +204,7 @@ ArdourButton::render (cairo_t* cr)
/* a partially transparent gray layer to indicate insensitivity */
if ((visual_state() & Insensitive)) {
if ((visual_state() & Gtkmm2ext::Insensitive)) {
cairo_rectangle (cr, 0, 0, _width, _height);
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.5);
cairo_fill (cr);
@ -285,7 +285,7 @@ ArdourButton::set_colors ()
if (_elements & Edge) {
edge_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _height);
if (visual_state() & CairoWidget::Selected) {
if (visual_state() & Gtkmm2ext::Selected) {
start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 border start selected", get_name()));
end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 border end selected", get_name()));
} else {
@ -309,10 +309,10 @@ ArdourButton::set_colors ()
if (_elements & Body) {
fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _height);
if (active_state() == Mid) {
if (active_state() == Gtkmm2ext::Mid) {
start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 fill start mid", get_name()));
end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 fill end mid", get_name()));
} else if (active_state() == Active) {
} else if (active_state() == Gtkmm2ext::Active) {
start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 fill start active", get_name()));
end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 fill end active", get_name()));
} else {
@ -345,10 +345,10 @@ ArdourButton::set_colors ()
/* text and LED colors depend on Active/Normal/Mid */
if (active_state() == Active) {
if (active_state() == Gtkmm2ext::Active) {
text_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 text active", get_name()));
led_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 led active", get_name()));
} else if (active_state() == Mid) {
} else if (active_state() == Gtkmm2ext::Mid) {
text_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 text mid", get_name()));
led_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1 led active", get_name()));
} else {
@ -379,19 +379,10 @@ ArdourButton::set_led_left (bool yn)
bool
ArdourButton::on_button_press_event (GdkEventButton *ev)
{
#if 0
cerr << "OBPE, rect = " << _led_rect << ' ' << _led_rect->x << ' ' << _led_rect->y << ' ' << _led_rect->width << ' ' << _led_rect->height
<< " event at " << ev->x << ", " << ev->y
<< endl;
#endif
if ((_elements & Indicator) && _led_rect && _distinct_led_click) {
if (ev->x >= _led_rect->x && ev->x < _led_rect->x + _led_rect->width &&
ev->y >= _led_rect->y && ev->y < _led_rect->y + _led_rect->height) {
cerr << "LED PRESS\n";
return true;
} else {
cerr << "missed LED\n";
}
}
@ -478,7 +469,7 @@ ArdourButton::controllable_changed ()
float val = binding_proxy.get_controllable()->get_value();
if (fabs (val) >= 0.5f) {
set_active_state (CairoWidget::Active);
set_active_state (Gtkmm2ext::Active);
} else {
unset_active_state ();
}
@ -502,7 +493,7 @@ ArdourButton::action_toggled ()
if (tact) {
if (tact->get_active()) {
set_active_state (CairoWidget::Active);
set_active_state (Gtkmm2ext::Active);
} else {
unset_active_state ();
}

View File

@ -23,8 +23,8 @@
CairoWidget::CairoWidget ()
: _width (1)
, _height (1)
, _active_state (CairoWidget::ActiveState (0))
, _visual_state (CairoWidget::VisualState (0))
, _active_state (Gtkmm2ext::ActiveState (0))
, _visual_state (Gtkmm2ext::VisualState (0))
{
}
@ -89,7 +89,7 @@ CairoWidget::get_parent_bg ()
}
void
CairoWidget::set_active_state (CairoWidget::ActiveState s)
CairoWidget::set_active_state (Gtkmm2ext::ActiveState s)
{
if (_active_state != s) {
_active_state = s;
@ -98,7 +98,7 @@ CairoWidget::set_active_state (CairoWidget::ActiveState s)
}
void
CairoWidget::set_visual_state (CairoWidget::VisualState s)
CairoWidget::set_visual_state (Gtkmm2ext::VisualState s)
{
if (_visual_state != s) {
_visual_state = s;

View File

@ -21,6 +21,7 @@
#define __gtk2_ardour_cairo_widget_h__
#include <gtkmm/eventbox.h>
#include "gtkmm2ext/widget_state.h"
/** A parent class for widgets that are rendered using Cairo.
*/
@ -33,28 +34,12 @@ public:
void set_dirty ();
/* widget states: unlike GTK, visual states like "Selected" or "Prelight"
are orthogonal to active states.
*/
enum ActiveState {
Active = 1,
Mid,
};
enum VisualState {
/* these can be OR-ed together */
Selected = 0x1,
Prelight = 0x2,
Insensitive = 0x4,
};
ActiveState active_state() const { return _active_state; }
VisualState visual_state() const { return _visual_state; }
virtual void set_active_state (ActiveState);
virtual void set_visual_state (VisualState);
virtual void unset_active_state () { set_active_state (ActiveState (0)); }
virtual void unset_visual_state () { set_visual_state (VisualState (0)); }
Gtkmm2ext::ActiveState active_state() const { return _active_state; }
Gtkmm2ext::VisualState visual_state() const { return _visual_state; }
virtual void set_active_state (Gtkmm2ext::ActiveState);
virtual void set_visual_state (Gtkmm2ext::VisualState);
virtual void unset_active_state () { set_active_state (Gtkmm2ext::ActiveState (0)); }
virtual void unset_visual_state () { set_visual_state (Gtkmm2ext::VisualState (0)); }
sigc::signal<void> StateChanged;
@ -67,8 +52,8 @@ protected:
int _width; ///< pixmap width
int _height; ///< pixmap height
ActiveState _active_state;
VisualState _visual_state;
Gtkmm2ext::ActiveState _active_state;
Gtkmm2ext::VisualState _visual_state;
private:
GdkPixmap* _pixmap; ///< our pixmap

View File

@ -26,6 +26,7 @@
using namespace Gdk;
using namespace Gtk;
using namespace Glib;
using namespace Gtkmm2ext;
LED::LED()
: _diameter (0.0)

View File

@ -35,7 +35,6 @@ Glib::RefPtr<Gdk::Pixbuf> MonitorSection::little_knob_pixbuf;
MonitorSection::MonitorSection (Session* s)
: AxisView (s)
, RouteUI (s)
, main_table (2, 3)
, _tearoff (0)
, gain_control (0)
, dim_control (0)
@ -901,7 +900,7 @@ MonitorSection::audition_blink (bool onoff)
if (_session->is_auditioning()) {
if (onoff) {
rude_audition_button.set_active_state (CairoWidget::Active);
rude_audition_button.set_active_state (Gtkmm2ext::Active);
} else {
rude_audition_button.unset_active_state ();
}
@ -919,14 +918,14 @@ MonitorSection::solo_blink (bool onoff)
if (_session->soloing() || _session->listening()) {
if (onoff) {
rude_solo_button.set_active_state (CairoWidget::Active);
rude_solo_button.set_active_state (Gtkmm2ext::Active);
} else {
rude_solo_button.unset_active_state ();
}
if (_session->soloing()) {
if (_session->solo_isolated()) {
rude_iso_button.set_active_state (CairoWidget::Active);
rude_iso_button.set_active_state (Gtkmm2ext::Active);
}
}

View File

@ -106,7 +106,7 @@ ProcessorEntry::ProcessorEntry (boost::shared_ptr<Processor> p, Width w)
_vbox.show ();
if (_processor->active()) {
_button.set_active_state (CairoWidget::Active);
_button.set_active_state (Gtkmm2ext::Active);
}
_button.set_diameter (3);
_button.set_distinct_led_click (true);
@ -147,23 +147,12 @@ ProcessorEntry::set_position (Position p)
}
void
ProcessorEntry::set_visual_state (Gtk::StateType t)
ProcessorEntry::set_visual_state (Gtkmm2ext::VisualState s, bool yn)
{
/* map from GTK state to CairoWidget */
switch (t) {
case Gtk::STATE_ACTIVE:
_button.unset_visual_state ();
break;
case Gtk::STATE_SELECTED:
_button.set_visual_state (CairoWidget::Selected);
break;
case Gtk::STATE_NORMAL:
default:
_button.unset_visual_state ();
break;
if (yn) {
_button.set_visual_state (Gtkmm2ext::VisualState (_button.visual_state() | s));
} else {
_button.set_visual_state (Gtkmm2ext::VisualState (_button.visual_state() & ~s));
}
}
@ -201,7 +190,7 @@ ProcessorEntry::set_enum_width (Width w)
void
ProcessorEntry::led_clicked()
{
if (_button.active_state() == CairoWidget::Active) {
if (_button.active_state() == Gtkmm2ext::Active) {
_processor->deactivate ();
} else {
_processor->activate ();
@ -212,7 +201,7 @@ void
ProcessorEntry::processor_active_changed ()
{
if (_processor->active()) {
_button.set_active_state (CairoWidget::Active);
_button.set_active_state (Gtkmm2ext::Active);
} else {
_button.unset_active_state ();
}
@ -817,8 +806,6 @@ ProcessorBox::processor_key_release_event (GdkEventKey *ev)
bool
ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry* child)
{
cerr << "PBPE\n";
boost::shared_ptr<Processor> processor;
if (child) {
processor = child->processor ();

View File

@ -107,7 +107,7 @@ public:
Gtk::EventBox& action_widget ();
Gtk::Widget& widget ();
std::string drag_text () const;
void set_visual_state (Gtk::StateType);
void set_visual_state (Gtkmm2ext::VisualState, bool);
enum Position {
PreFader,

View File

@ -608,20 +608,20 @@ RouteUI::update_monitoring_display ()
MonitorState ms = t->monitoring_state();
if (t->monitoring_choice() & MonitorInput) {
monitor_input_button->set_active_state (CairoWidget::Active);
monitor_input_button->set_active_state (Gtkmm2ext::Active);
} else {
if (ms & MonitoringInput) {
monitor_input_button->set_active_state (CairoWidget::Mid);
monitor_input_button->set_active_state (Gtkmm2ext::Mid);
} else {
monitor_input_button->unset_active_state ();
}
}
if (t->monitoring_choice() & MonitorDisk) {
monitor_disk_button->set_active_state (CairoWidget::Active);
monitor_disk_button->set_active_state (Gtkmm2ext::Active);
} else {
if (ms & MonitoringDisk) {
monitor_disk_button->set_active_state (CairoWidget::Mid);
monitor_disk_button->set_active_state (Gtkmm2ext::Mid);
} else {
monitor_disk_button->unset_active_state ();
}
@ -1063,7 +1063,7 @@ RouteUI::update_solo_display ()
if (solo_isolated_led) {
if (_route->solo_isolated()) {
solo_isolated_led->set_active_state (CairoWidget::Active);
solo_isolated_led->set_active_state (Gtkmm2ext::Active);
} else {
solo_isolated_led->unset_active_state ();
}
@ -1071,7 +1071,7 @@ RouteUI::update_solo_display ()
if (solo_safe_led) {
if (_route->solo_safe()) {
solo_safe_led->set_active_state (CairoWidget::Active);
solo_safe_led->set_active_state (Gtkmm2ext::Active);
} else {
solo_safe_led->unset_active_state ();
}

View File

@ -269,8 +269,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
));
add_option (_("Misc"), new OptionEditorHeading (_("MIDI Note Overlaps")));
ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
"insert-merge-policy",
_("Policy for handling same note\nand channel overlaps"),