diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf
index 9b16d54339..0f8064165f 100644
--- a/gtk2_ardour/ardour3_ui_default.conf
+++ b/gtk2_ardour/ardour3_ui_default.conf
@@ -151,14 +151,10 @@
-
-
-
-
@@ -167,14 +163,10 @@
-
-
-
-
@@ -183,14 +175,10 @@
-
-
-
-
@@ -199,30 +187,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -231,14 +211,10 @@
-
-
-
-
@@ -247,14 +223,10 @@
-
-
-
-
@@ -263,14 +235,10 @@
-
-
-
-
@@ -279,14 +247,10 @@
-
-
-
-
@@ -295,14 +259,10 @@
-
-
-
-
@@ -311,14 +271,10 @@
-
-
-
-
@@ -327,14 +283,10 @@
-
-
-
-
@@ -343,14 +295,10 @@
-
-
-
-
@@ -359,14 +307,10 @@
-
-
-
-
@@ -375,14 +319,10 @@
-
-
-
-
@@ -391,14 +331,10 @@
-
-
-
-
@@ -407,14 +343,10 @@
-
-
-
-
@@ -423,14 +355,10 @@
-
-
-
-
@@ -439,46 +367,34 @@
-
-
-
-
-
+
-
-
-
-
+
-
-
+
-
-
-
-
@@ -487,14 +403,10 @@
-
-
-
-
@@ -503,14 +415,10 @@
-
-
-
-
@@ -519,11 +427,8 @@
-
-
-
@@ -534,14 +439,10 @@
-
-
-
-
@@ -550,14 +451,10 @@
-
-
-
-
@@ -566,14 +463,10 @@
-
-
-
-
@@ -582,14 +475,10 @@
-
-
-
-
@@ -598,14 +487,10 @@
-
-
-
-
@@ -614,14 +499,10 @@
-
-
-
-
@@ -630,14 +511,10 @@
-
-
-
-
@@ -646,14 +523,10 @@
-
-
-
-
@@ -662,14 +535,10 @@
-
-
-
-
@@ -678,14 +547,10 @@
-
-
-
-
@@ -694,14 +559,10 @@
-
-
-
-
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 9ed7b98254..d8a2e276bb 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -49,6 +49,59 @@ using namespace std;
ArdourButton::Element ArdourButton::default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text);
ArdourButton::Element ArdourButton::led_default_elements = ArdourButton::Element (ArdourButton::default_elements|ArdourButton::Indicator);
ArdourButton::Element ArdourButton::just_led_default_elements = ArdourButton::Element (ArdourButton::Edge|ArdourButton::Body|ArdourButton::Indicator);
+cairo_pattern_t* ArdourButton::mid_mask = 0;
+
+void
+ArdourButton::create_mid_mask ()
+{
+ cairo_surface_t *surface;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_A8, 32, 32);
+
+ cairo_t* cr2 = cairo_create (surface);
+
+ cairo_set_source_rgba (cr2, 1.0, 0.0, 0.0, 1.0);
+ cairo_set_line_join (cr2, CAIRO_LINE_JOIN_MITER);
+
+ /* some of these lines extend outside the image surface - we just rely
+ * on cairo clipping them since it makes the math easier to visualize
+ * (at least for paul)
+ */
+
+ cairo_move_to (cr2, 0.0, 4.0);
+ cairo_line_to (cr2, 4.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 12.0);
+ cairo_line_to (cr2, 12.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 20.0);
+ cairo_line_to (cr2, 20.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 28.0);
+ cairo_line_to (cr2, 28.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 28.0);
+ cairo_line_to (cr2, 28.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 36.0);
+ cairo_line_to (cr2, 36.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 44.0);
+ cairo_line_to (cr2, 44.0, 0.0);
+
+ cairo_move_to (cr2, 0.0, 52.0);
+ cairo_line_to (cr2, 52.0, 0.0);
+
+ cairo_set_line_width (cr2, 3.0);
+ cairo_stroke (cr2);
+
+ mid_mask = cairo_pattern_create_for_surface (surface);
+ cairo_pattern_set_extend (mid_mask, CAIRO_EXTEND_REPEAT);
+ cairo_pattern_set_filter (mid_mask, CAIRO_FILTER_NEAREST);
+
+ cairo_surface_destroy (surface);
+ cairo_destroy (cr2);
+}
ArdourButton::ArdourButton (Element e)
: _elements (e)
@@ -59,7 +112,8 @@ ArdourButton::ArdourButton (Element e)
, _corner_radius (9.0)
, _corner_mask (0xf)
, edge_pattern (0)
- , fill_pattern (0)
+ , active_pattern (0)
+ , inactive_pattern (0)
, led_inset_pattern (0)
, reflection_pattern (0)
, _led_rect (0)
@@ -70,6 +124,9 @@ ArdourButton::ArdourButton (Element e)
, _hovering (false)
{
ColorsChanged.connect (sigc::mem_fun (*this, &ArdourButton::color_handler));
+ if (!mid_mask) {
+ create_mid_mask ();
+ }
}
ArdourButton::ArdourButton (const std::string& str, Element e)
@@ -79,7 +136,8 @@ ArdourButton::ArdourButton (const std::string& str, Element e)
, _diameter (11.0)
, _corner_radius (9.0)
, edge_pattern (0)
- , fill_pattern (0)
+ , active_pattern (0)
+ , inactive_pattern (0)
, led_inset_pattern (0)
, reflection_pattern (0)
, _led_rect (0)
@@ -90,11 +148,27 @@ ArdourButton::ArdourButton (const std::string& str, Element e)
, _hovering (false)
{
set_text (str);
+
+ if (!mid_mask) {
+ create_mid_mask ();
+ }
}
ArdourButton::~ArdourButton()
{
delete _led_rect;
+
+ if (edge_pattern) {
+ cairo_pattern_destroy (edge_pattern);
+ }
+
+ if (active_pattern) {
+ cairo_pattern_destroy (active_pattern);
+ }
+
+ if (inactive_pattern) {
+ cairo_pattern_destroy (inactive_pattern);
+ }
}
void
@@ -164,8 +238,20 @@ ArdourButton::render (cairo_t* cr)
} else {
rounded_function (cr, 0, 0, get_width(), get_height(), _corner_radius - 1.0);
}
- cairo_set_source (cr, fill_pattern);
- cairo_fill (cr);
+
+ if (active_state() == Gtkmm2ext::ImplicitActive) {
+ cairo_set_source (cr, inactive_pattern);
+ cairo_fill_preserve (cr);
+ cairo_set_line_width (cr, 2.0);
+ cairo_set_source (cr, active_pattern);
+ cairo_stroke (cr);
+ } else if (active_state() == Gtkmm2ext::ExplicitActive) {
+ cairo_set_source (cr, active_pattern);
+ cairo_fill (cr);
+ } else {
+ cairo_set_source (cr, inactive_pattern);
+ cairo_fill (cr);
+ }
}
if (_pixbuf) {
@@ -191,7 +277,7 @@ ArdourButton::render (cairo_t* cr)
if ((_elements & Text) && !_text.empty()) {
- cairo_set_source_rgba (cr, text_r, text_g, text_b, text_a);
+ cairo_new_path (cr);
if (_elements & Indicator) {
if (_led_left) {
@@ -204,6 +290,7 @@ ArdourButton::render (cairo_t* cr)
cairo_move_to (cr, (get_width() - _text_width)/2.0, get_height()/2.0 - _text_height/2.0);
}
+ cairo_set_source_rgba (cr, text_r, text_g, text_b, text_a);
pango_cairo_show_layout (cr, _layout->gobj());
}
@@ -364,32 +451,39 @@ ArdourButton::set_colors ()
cairo_pattern_add_color_stop_rgba (edge_pattern, 1, r/255.0,g/255.0,b/255.0, 0.7);
}
+ if (active_pattern) {
+ cairo_pattern_destroy (active_pattern);
+ active_pattern = 0;
+ }
- /* the fill pattern is used to indicate Normal/Active/Mid state
- */
-
- if (fill_pattern) {
- cairo_pattern_destroy (fill_pattern);
- fill_pattern = 0;
+ if (inactive_pattern) {
+ cairo_pattern_destroy (inactive_pattern);
+ inactive_pattern = 0;
}
if (_elements & Body) {
- fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
-
- 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() == 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 {
- start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start", get_name()));
- end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", get_name()));
- }
+
+ active_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
+ 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()));
UINT_TO_RGBA (start_color, &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgba (fill_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0);
+
+ active_r = r/255.0;
+ active_g = g/255.0;
+ active_b = b/255.0;
+ active_a = a/255.0;
+
+ cairo_pattern_add_color_stop_rgba (active_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0);
UINT_TO_RGBA (end_color, &r, &g, &b, &a);
- cairo_pattern_add_color_stop_rgba (fill_pattern, 1, r/255.0,g/255.0,b/255.0, a/255.0);
+ cairo_pattern_add_color_stop_rgba (active_pattern, 1, r/255.0,g/255.0,b/255.0, a/255.0);
+
+ inactive_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
+ start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start", get_name()));
+ end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill end", get_name()));
+ UINT_TO_RGBA (start_color, &r, &g, &b, &a);
+ cairo_pattern_add_color_stop_rgba (inactive_pattern, 0, r/255.0,g/255.0,b/255.0, a/255.0);
+ UINT_TO_RGBA (end_color, &r, &g, &b, &a);
+ cairo_pattern_add_color_stop_rgba (inactive_pattern, 1, r/255.0,g/255.0,b/255.0, a/255.0);
}
if (led_inset_pattern) {
@@ -410,14 +504,11 @@ ArdourButton::set_colors ()
cairo_pattern_add_color_stop_rgba (reflection_pattern, 1, 1,1,1, 0.0);
}
- /* text and LED colors depend on Active/Normal/Mid */
+ /* text and LED colors */
- if (active_state() == Gtkmm2ext::Active) {
+ if (active_state() == Gtkmm2ext::ExplicitActive) {
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() == 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 mid", get_name()));
} else {
text_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: text", get_name()));
led_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: led", get_name()));
@@ -454,7 +545,7 @@ ArdourButton::on_button_press_event (GdkEventButton *ev)
}
if (_tweaks & ShowClick) {
- set_active_state (Gtkmm2ext::Active);
+ set_active_state (Gtkmm2ext::ExplicitActive);
}
if (binding_proxy.button_press_handler (ev)) {
@@ -547,7 +638,7 @@ ArdourButton::controllable_changed ()
float val = binding_proxy.get_controllable()->get_value();
if (fabs (val) >= 0.5f) {
- set_active_state (Gtkmm2ext::Active);
+ set_active_state (Gtkmm2ext::ExplicitActive);
} else {
unset_active_state ();
}
@@ -581,7 +672,7 @@ ArdourButton::action_toggled ()
if (tact) {
if (tact->get_active()) {
- set_active_state (Gtkmm2ext::Active);
+ set_active_state (Gtkmm2ext::ExplicitActive);
} else {
unset_active_state ();
}
diff --git a/gtk2_ardour/ardour_button.h b/gtk2_ardour/ardour_button.h
index 574e8b5a41..c09a05fc8c 100644
--- a/gtk2_ardour/ardour_button.h
+++ b/gtk2_ardour/ardour_button.h
@@ -114,7 +114,8 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
int _corner_mask;
cairo_pattern_t* edge_pattern;
- cairo_pattern_t* fill_pattern;
+ cairo_pattern_t* active_pattern;
+ cairo_pattern_t* inactive_pattern;
cairo_pattern_t* led_inset_pattern;
cairo_pattern_t* reflection_pattern;
@@ -130,6 +131,11 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
double led_b;
double led_a;
+ double active_r;
+ double active_g;
+ double active_b;
+ double active_a;
+
bool _act_on_release;
bool _led_left;
bool _fixed_diameter;
@@ -145,6 +151,9 @@ class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
void action_sensitivity_changed ();
void action_visibility_changed ();
void action_tooltip_changed ();
+
+ static cairo_pattern_t* mid_mask;
+ static void create_mid_mask ();
};
#endif /* __gtk2_ardour_ardour_button_h__ */
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index fbec7212ea..306d0c2482 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1929,7 +1929,7 @@ ARDOUR_UI::map_transport_state ()
auto_loop_button.unset_active_state ();
play_selection_button.unset_active_state ();
roll_button.unset_active_state ();
- stop_button.set_active_state (Gtkmm2ext::Active);
+ stop_button.set_active_state (Gtkmm2ext::ExplicitActive);
return;
}
@@ -1943,37 +1943,37 @@ ARDOUR_UI::map_transport_state ()
if (_session->get_play_range()) {
- play_selection_button.set_active_state (Gtkmm2ext::Active);
+ play_selection_button.set_active_state (Gtkmm2ext::ExplicitActive);
roll_button.unset_active_state ();
auto_loop_button.unset_active_state ();
} else if (_session->get_play_loop ()) {
- auto_loop_button.set_active_state (Gtkmm2ext::Active);
- play_selection_button.unset_active_state ();
- roll_button.unset_active_state ();
+ auto_loop_button.set_active (true);
+ play_selection_button.set_active (false);
+ roll_button.set_active (false);
} else {
- roll_button.set_active_state (Gtkmm2ext::Active);
- play_selection_button.unset_active_state ();
- auto_loop_button.unset_active_state ();
+ roll_button.set_active (true);
+ play_selection_button.set_active (false);
+ auto_loop_button.set_active (false);
}
if (Config->get_always_play_range()) {
/* light up both roll and play-selection if they are joined */
- roll_button.set_active_state (Gtkmm2ext::Active);
- play_selection_button.set_active_state (Gtkmm2ext::Active);
+ roll_button.set_active (true);
+ play_selection_button.set_active (true);
}
- stop_button.unset_active_state ();
+ stop_button.set_active (false);
} else {
- stop_button.set_active_state (Gtkmm2ext::Active);
- roll_button.unset_active_state ();
- play_selection_button.unset_active_state ();
- auto_loop_button.unset_active_state ();
+ stop_button.set_active (true);
+ roll_button.set_active (false);
+ play_selection_button.set_active (false);
+ auto_loop_button.set_active (false);
update_disk_space ();
}
}
@@ -2384,12 +2384,12 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
if (r == Session::Enabled || (r == Session::Recording && !h)) {
if (onoff) {
- rec_button.set_active_state (Active);
+ rec_button.set_active_state (Gtkmm2ext::ExplicitActive);
} else {
- rec_button.set_active_state (Mid);
+ rec_button.set_active_state (Gtkmm2ext::ImplicitActive);
}
} else if (r == Session::Recording && h) {
- rec_button.set_active_state (Mid);
+ rec_button.set_active_state (Gtkmm2ext::ImplicitActive);
} else {
rec_button.unset_active_state ();
}
@@ -3600,7 +3600,7 @@ ARDOUR_UI::step_edit_status_change (bool yn)
// we make insensitive
if (yn) {
- rec_button.set_active_state (Mid);
+ rec_button.set_active_state (Gtkmm2ext::ImplicitActive);
rec_button.set_sensitive (false);
} else {
rec_button.unset_active_state ();;
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index 6013dca222..a90ffc30a0 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -261,7 +261,7 @@ ARDOUR_UI::setup_transport ()
click_button.set_name ("transport active option button");
sync_button.set_name ("transport active option button");
- stop_button.set_active_state (Active);
+ stop_button.set_active (true);
goto_start_button.set_image (get_icon (X_("transport_start")));
goto_end_button.set_image (get_icon (X_("transport_end")));
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index e172f40fc9..586e2aef18 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -252,7 +252,7 @@ AutomationTimeAxisView::auto_clicked ()
MenuList& items (automation_menu->items());
items.push_back (MenuElem (S_("Automation|Manual"), sigc::bind (sigc::mem_fun(*this,
- &AutomationTimeAxisView::set_automation_state), (AutoState) Off)));
+ &AutomationTimeAxisView::set_automation_state), (AutoState) ARDOUR::Off)));
items.push_back (MenuElem (_("Play"), sigc::bind (sigc::mem_fun(*this,
&AutomationTimeAxisView::set_automation_state), (AutoState) Play)));
items.push_back (MenuElem (_("Write"), sigc::bind (sigc::mem_fun(*this,
@@ -298,11 +298,11 @@ AutomationTimeAxisView::automation_state_changed ()
assert (_control);
state = _control->alist()->automation_state ();
} else {
- state = Off;
+ state = ARDOUR::Off;
}
- switch (state & (Off|Play|Touch|Write)) {
- case Off:
+ switch (state & (ARDOUR::Off|Play|Touch|Write)) {
+ case ARDOUR::Off:
auto_button.set_label (S_("Automation|Manual"));
if (auto_off_item) {
ignore_state_request = true;
@@ -505,7 +505,7 @@ AutomationTimeAxisView::build_display_menu ()
as_items.push_back (CheckMenuElem (S_("Automation|Manual"), sigc::bind (
sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
- (AutoState) Off)));
+ (AutoState) ARDOUR::Off)));
auto_off_item = dynamic_cast(&as_items.back());
as_items.push_back (CheckMenuElem (_("Play"), sigc::bind (
diff --git a/gtk2_ardour/button_joiner.cc b/gtk2_ardour/button_joiner.cc
index 8df5e1fc4b..fffe874f03 100644
--- a/gtk2_ardour/button_joiner.cc
+++ b/gtk2_ardour/button_joiner.cc
@@ -67,7 +67,7 @@ ButtonJoiner::render (cairo_t* cr)
{
double h = get_height();
- if (_active_state == Gtkmm2ext::ActiveState (0)) {
+ if (!get_active()) {
cairo_set_source (cr, inactive_fill_pattern);
} else {
cairo_set_source (cr, active_fill_pattern);
@@ -169,11 +169,7 @@ ButtonJoiner::action_toggled ()
Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (_action);
if (tact) {
- if (tact->get_active()) {
- set_active_state (Gtkmm2ext::Active);
- } else {
- unset_active_state ();
- }
+ set_active (tact->get_active());
}
}
diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h
index 408330216e..fb374692f3 100644
--- a/gtk2_ardour/canvas_vars.h
+++ b/gtk2_ardour/canvas_vars.h
@@ -147,20 +147,16 @@ CANVAS_VARIABLE(canvasvar_ ## root ## FillStart, name ": fill start") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillEnd, name ": fill end") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillStartActive, name ": fill start active") \
CANVAS_VARIABLE(canvasvar_ ## root ## FillEndActive, name ": fill end active") \
-CANVAS_VARIABLE(canvasvar_ ## root ## FillStartMid, name ": fill start mid") \
-CANVAS_VARIABLE(canvasvar_ ## root ## FillEndMid, name ": fill end mid") \
CANVAS_VARIABLE(canvasvar_ ## root ## LED, name ": led") \
CANVAS_VARIABLE(canvasvar_ ## root ## LEDActive, name ": led active") \
-CANVAS_VARIABLE(canvasvar_ ## root ## LEDMid, name ": led mid") \
CANVAS_VARIABLE(canvasvar_ ## root ## Text, name ": text") \
CANVAS_VARIABLE(canvasvar_ ## root ## TextActive, name ": text active") \
-CANVAS_VARIABLE(canvasvar_ ## root ## TextMid, name ": text mid")
BUTTON_VARS(ProcessorPreFader, "processor prefader")
BUTTON_VARS(ProcessorFader, "processor fader")
BUTTON_VARS(ProcessorPostFader, "processor postfader")
BUTTON_VARS(ProcessorControlButton, "processor control button")
-BUTTON_VARS(MonitorButton, "monitor")
+BUTTON_VARS(MonitorButton, "monitor button")
BUTTON_VARS(SoloIsolateButton, "solo isolate")
BUTTON_VARS(SoloSafeButton, "solo safe")
BUTTON_VARS(MonitorSectionCutButton, "monitor section cut")
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 8f7dd23abf..17a5c5b440 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -121,9 +121,9 @@ EditorRoutes::EditorRoutes (Editor* e)
// Mute enable toggle
CellRendererPixbufMulti* mute_col_renderer = manage (new CellRendererPixbufMulti());
- mute_col_renderer->set_pixbuf (ActiveState(0), ::get_icon("mute-disabled"));
- mute_col_renderer->set_pixbuf (Mid, ::get_icon("muted-by-others"));
- mute_col_renderer->set_pixbuf (Active, ::get_icon("mute-enabled"));
+ mute_col_renderer->set_pixbuf (Gtkmm2ext::Off, ::get_icon("mute-disabled"));
+ mute_col_renderer->set_pixbuf (Gtkmm2ext::ImplicitActive, ::get_icon("muted-by-others"));
+ mute_col_renderer->set_pixbuf (Gtkmm2ext::ExplicitActive, ::get_icon("mute-enabled"));
mute_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_mute_enable_toggled));
TreeViewColumn* mute_state_column = manage (new TreeViewColumn("M", *mute_col_renderer));
@@ -137,9 +137,9 @@ EditorRoutes::EditorRoutes (Editor* e)
// Solo enable toggle
CellRendererPixbufMulti* solo_col_renderer = manage (new CellRendererPixbufMulti());
- solo_col_renderer->set_pixbuf (ActiveState(0), ::get_icon("solo-disabled"));
- solo_col_renderer->set_pixbuf (Active, ::get_icon("solo-enabled"));
- solo_col_renderer->set_pixbuf (Mid, ::get_icon("soloed-by-others"));
+ solo_col_renderer->set_pixbuf (Gtkmm2ext::Off, ::get_icon("solo-disabled"));
+ solo_col_renderer->set_pixbuf (Gtkmm2ext::ExplicitActive, ::get_icon("solo-enabled"));
+ solo_col_renderer->set_pixbuf (Gtkmm2ext::ImplicitActive, ::get_icon("soloed-by-others"));
solo_col_renderer->signal_changed().connect (sigc::mem_fun (*this, &EditorRoutes::on_tv_solo_enable_toggled));
TreeViewColumn* solo_state_column = manage (new TreeViewColumn("S", *solo_col_renderer));
@@ -641,7 +641,7 @@ EditorRoutes::routes_added (list routes)
row[_columns.is_midi] = false;
}
- row[_columns.mute_state] = (*x)->route()->muted() ? Active : ActiveState (0);
+ row[_columns.mute_state] = (*x)->route()->muted() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off;
row[_columns.solo_state] = RouteUI::solo_active_state ((*x)->route());
row[_columns.solo_visible] = !(*x)->route()->is_master ();
row[_columns.solo_isolate_state] = (*x)->route()->solo_isolated();
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc
index 0324f3d93c..d651604df9 100644
--- a/gtk2_ardour/gain_meter.cc
+++ b/gtk2_ardour/gain_meter.cc
@@ -206,7 +206,7 @@ GainMeterBase::set_controls (boost::shared_ptr r,
gain_astate_menu.items().push_back (MenuElem (S_("Automation|Manual"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
- Evoral::Parameter(GainAutomation), (AutoState) Off)));
+ Evoral::Parameter(GainAutomation), (AutoState) ARDOUR::Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
sigc::bind (sigc::mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
Evoral::Parameter(GainAutomation), (AutoState) Play)));
@@ -710,7 +710,7 @@ GainMeterBase::_astate_string (AutoState state, bool shrt)
string sstr;
switch (state) {
- case Off:
+ case ARDOUR::Off:
sstr = (shrt ? "M" : _("M"));
break;
case Play:
@@ -780,7 +780,7 @@ GainMeterBase::gain_automation_state_changed ()
break;
}
- x = (_amp->gain_control()->alist()->automation_state() != Off);
+ x = (_amp->gain_control()->alist()->automation_state() != ARDOUR::Off);
if (gain_automation_state_button.get_active() != x) {
ignore_toggle = true;
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc
index f7110740ee..52e583a4f8 100644
--- a/gtk2_ardour/generic_pluginui.cc
+++ b/gtk2_ardour/generic_pluginui.cc
@@ -127,11 +127,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol
pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr(pi)), gui_context());
- if (!pi->active()) {
- bypass_button.set_active_state (Gtkmm2ext::Active);
- } else {
- bypass_button.unset_active_state ();
- }
+ bypass_button.set_active (!pi->active());
prefheight = 0;
build ();
@@ -443,9 +439,8 @@ GenericPluginUI::automation_state_changed (ControlUI* cui)
// don't lock to avoid deadlock because we're triggered by
// AutomationControl::Changed() while the automation lock is taken
- switch (insert->get_parameter_automation_state (cui->parameter())
- & (Off|Play|Touch|Write)) {
- case Off:
+ switch (insert->get_parameter_automation_state (cui->parameter()) & (ARDOUR::Off|Play|Touch|Write)) {
+ case ARDOUR::Off:
cui->automate_button.set_label (S_("Automation|Manual"));
break;
case Play:
@@ -698,7 +693,7 @@ GenericPluginUI::astate_clicked (ControlUI* cui, uint32_t /*port*/)
items.clear ();
items.push_back (MenuElem (S_("Automation|Manual"),
- sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Off, cui)));
+ sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) ARDOUR::Off, cui)));
items.push_back (MenuElem (_("Play"),
sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Play, cui)));
items.push_back (MenuElem (_("Write"),
diff --git a/gtk2_ardour/led.cc b/gtk2_ardour/led.cc
index 83fdc3e46c..9a71ad736e 100644
--- a/gtk2_ardour/led.cc
+++ b/gtk2_ardour/led.cc
@@ -92,7 +92,7 @@ LED::render (cairo_t* cr)
cairo_fill(cr);
//knob color
- cairo_set_source_rgba (cr, _red, _green, _blue, (active_state() == Active) ? 0.8 : 0.2);
+ cairo_set_source_rgba (cr, _red, _green, _blue, (active_state() == Gtkmm2ext::ExplicitActive) ? 0.8 : 0.2);
cairo_arc (cr, 0, 0, _diameter/2-3, 0, 2 * M_PI);
cairo_fill(cr);
diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc
index 11d6b6925c..3b78e34612 100644
--- a/gtk2_ardour/monitor_section.cc
+++ b/gtk2_ardour/monitor_section.cc
@@ -959,13 +959,9 @@ MonitorSection::audition_blink (bool onoff)
}
if (_session->is_auditioning()) {
- if (onoff) {
- rude_audition_button.set_active_state (Gtkmm2ext::Active);
- } else {
- rude_audition_button.unset_active_state ();
- }
+ rude_audition_button.set_active (onoff);
} else {
- rude_audition_button.unset_active_state ();
+ rude_audition_button.set_active (false);
}
}
@@ -977,22 +973,17 @@ MonitorSection::solo_blink (bool onoff)
}
if (_session->soloing() || _session->listening()) {
- if (onoff) {
- rude_solo_button.set_active_state (Gtkmm2ext::Active);
- } else {
- rude_solo_button.unset_active_state ();
- }
+ rude_solo_button.set_active (onoff);
if (_session->soloing()) {
if (_session->solo_isolated()) {
- rude_iso_button.set_active_state (Gtkmm2ext::Active);
+ rude_iso_button.set_active (false);
}
- }
+ }
} else {
- // rude_solo_button.set_active (false);
- rude_solo_button.unset_active_state ();
- rude_iso_button.unset_active_state ();
+ rude_solo_button.set_active (false);
+ rude_iso_button.set_active (false);
}
}
diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc
index 6c594b4260..51255d3291 100644
--- a/gtk2_ardour/panner_ui.cc
+++ b/gtk2_ardour/panner_ui.cc
@@ -149,7 +149,7 @@ PannerUI::build_astate_menu ()
*/
pan_astate_menu->items().push_back (MenuElem (S_("Automation|Manual"), sigc::bind (
sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
- (AutoState) Off)));
+ (AutoState) ARDOUR::Off)));
pan_astate_menu->items().push_back (MenuElem (_("Play"), sigc::bind (
sigc::mem_fun (_panner.get(), &Panner::set_automation_state),
(AutoState) Play)));
@@ -515,7 +515,7 @@ PannerUI::pan_automation_state_changed ()
break;
}
- bool x = (pannable->automation_state() != Off);
+ bool x = (pannable->automation_state() != ARDOUR::Off);
if (pan_automation_state_button.get_active() != x) {
ignore_toggle = true;
@@ -552,7 +552,7 @@ PannerUI::_astate_string (AutoState state, bool shrt)
string sstr;
switch (state) {
- case Off:
+ case ARDOUR::Off:
sstr = (shrt ? "M" : _("M"));
break;
case Play:
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index d382748918..272abcb831 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -481,13 +481,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi)
bypass_button.set_name ("plugin bypass button");
bypass_button.set_text (_("Bypass"));
-
- if (!pi->active()) {
- bypass_button.set_active_state (Gtkmm2ext::Active);
- } else {
- bypass_button.unset_active_state ();
- }
-
+ bypass_button.set_active (!pi->active());
bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release));
focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
@@ -567,11 +561,7 @@ PlugUIBase::processor_active_changed (boost::weak_ptr weak_p)
boost::shared_ptr p (weak_p.lock());
if (p) {
- if (!p->active()) {
- bypass_button.set_active_state (Gtkmm2ext::Active);
- } else {
- bypass_button.unset_active_state ();
- }
+ bypass_button.set_active (!p->active());
}
}
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index beea3c8211..5c0b3c74fa 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -115,10 +115,7 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptractive()) {
- _button.set_active_state (Gtkmm2ext::Active);
- }
-
+ _button.set_active (_processor->active());
_button.show ();
_processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context());
@@ -225,7 +222,7 @@ void
ProcessorEntry::led_clicked()
{
if (_processor) {
- if (_button.active_state() == Gtkmm2ext::Active) {
+ if (_button.get_active ()) {
_processor->deactivate ();
} else {
_processor->activate ();
@@ -237,11 +234,7 @@ void
ProcessorEntry::processor_active_changed ()
{
if (_processor) {
- if (_processor->active()) {
- _button.set_active_state (Gtkmm2ext::Active);
- } else {
- _button.unset_active_state ();
- }
+ _button.set_active (_processor->active());
}
}
@@ -485,10 +478,10 @@ ProcessorEntry::Control::button_clicked ()
return;
}
- bool const n = _button.active_state() == Gtkmm2ext::Active ? false : true;
-
- c->set_value (n ? 1 : 0);
- _button.set_active_state (n ? Gtkmm2ext::Active : Gtkmm2ext::ActiveState (0));
+ bool const n = _button.get_active ();
+
+ c->set_value (n ? 0 : 1);
+ _button.set_active (!n);
}
void
@@ -503,7 +496,7 @@ ProcessorEntry::Control::control_changed ()
if (c->toggled ()) {
- _button.set_active_state (c->get_value() > 0.5 ? Gtkmm2ext::Active : Gtkmm2ext::ActiveState (0));
+ _button.set_active (c->get_value() > 0.5);
} else {
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index d2debd1979..42e383f630 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -129,14 +129,14 @@ RouteUI::init ()
show_sends_button->set_name ("send alert button");
UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), "");
- monitor_input_button = manage (new ArdourButton (ArdourButton::led_default_elements));
- monitor_input_button->set_name ("monitor");
+ monitor_input_button = manage (new ArdourButton (ArdourButton::default_elements));
+ monitor_input_button->set_name ("monitor button");
monitor_input_button->set_text (_("In"));
UI::instance()->set_tip (monitor_input_button, _("Monitor input"), "");
monitor_input_button->set_no_show_all (true);
-
- monitor_disk_button = manage (new ArdourButton (ArdourButton::led_default_elements));
- monitor_disk_button->set_name ("monitor");
+
+ monitor_disk_button = manage (new ArdourButton (ArdourButton::default_elements));
+ monitor_disk_button->set_name ("monitor button");
monitor_disk_button->set_text (_("Disk"));
UI::instance()->set_tip (monitor_disk_button, _("Monitor playback"), "");
monitor_disk_button->set_no_show_all (true);
@@ -608,20 +608,20 @@ RouteUI::update_monitoring_display ()
MonitorState ms = t->monitoring_state();
if (t->monitoring_choice() & MonitorInput) {
- monitor_input_button->set_active_state (Gtkmm2ext::Active);
+ monitor_input_button->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
if (ms & MonitoringInput) {
- monitor_input_button->set_active_state (Gtkmm2ext::Mid);
+ monitor_input_button->set_active_state (Gtkmm2ext::ImplicitActive);
} else {
monitor_input_button->unset_active_state ();
}
}
if (t->monitoring_choice() & MonitorDisk) {
- monitor_disk_button->set_active_state (Gtkmm2ext::Active);
+ monitor_disk_button->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
if (ms & MonitoringDisk) {
- monitor_disk_button->set_active_state (Gtkmm2ext::Mid);
+ monitor_disk_button->set_active_state (Gtkmm2ext::ImplicitActive);
} else {
monitor_disk_button->unset_active_state ();
}
@@ -744,7 +744,7 @@ RouteUI::step_edit_changed (bool yn)
{
if (yn) {
if (rec_enable_button) {
- rec_enable_button->set_active_state (Active);
+ rec_enable_button->set_active_state (Gtkmm2ext::ExplicitActive);
}
start_step_editing ();
@@ -923,7 +923,7 @@ RouteUI::send_blink (bool onoff)
}
if (onoff) {
- show_sends_button->set_active_state (Gtkmm2ext::Active);
+ show_sends_button->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
show_sends_button->unset_active_state ();
}
@@ -933,27 +933,27 @@ Gtkmm2ext::ActiveState
RouteUI::solo_active_state (boost::shared_ptr r)
{
if (r->is_master() || r->is_monitor()) {
- return ActiveState (0);
+ return Gtkmm2ext::Off;
}
if (Config->get_solo_control_is_listen_control()) {
if (r->listening_via_monitor()) {
- return Active;
+ return Gtkmm2ext::ExplicitActive;
} else {
- return ActiveState (0);
+ return Gtkmm2ext::Off;
}
}
if (r->soloed()) {
if (!r->self_soloed()) {
- return Mid;
+ return Gtkmm2ext::ImplicitActive;
} else {
- return Active;
+ return Gtkmm2ext::ExplicitActive;
}
} else {
- return ActiveState(0);
+ return Gtkmm2ext::Off;
}
}
@@ -961,13 +961,13 @@ Gtkmm2ext::ActiveState
RouteUI::solo_isolate_active_state (boost::shared_ptr r)
{
if (r->is_master() || r->is_monitor()) {
- return ActiveState (0);
+ return Gtkmm2ext::Off;
}
if (r->solo_isolated()) {
- return Active;
+ return Gtkmm2ext::ExplicitActive;
} else {
- return ActiveState(0);
+ return Gtkmm2ext::Off;
}
}
@@ -975,13 +975,13 @@ Gtkmm2ext::ActiveState
RouteUI::solo_safe_active_state (boost::shared_ptr r)
{
if (r->is_master() || r->is_monitor()) {
- return ActiveState (0);
+ return Gtkmm2ext::Off;
}
if (r->solo_safe()) {
- return Active;
+ return Gtkmm2ext::ExplicitActive;
} else {
- return ActiveState (0);
+ return Gtkmm2ext::Off;
}
}
@@ -1004,7 +1004,7 @@ RouteUI::update_solo_display ()
if (solo_isolated_led) {
if (_route->solo_isolated()) {
- solo_isolated_led->set_active_state (Gtkmm2ext::Active);
+ solo_isolated_led->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
solo_isolated_led->unset_active_state ();
}
@@ -1012,7 +1012,7 @@ RouteUI::update_solo_display ()
if (solo_safe_led) {
if (_route->solo_safe()) {
- solo_safe_led->set_active_state (Gtkmm2ext::Active);
+ solo_safe_led->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
solo_safe_led->unset_active_state ();
}
@@ -1050,23 +1050,23 @@ RouteUI::mute_active_state (Session* s, boost::shared_ptr r)
if (r->muted ()) {
/* full mute */
- return Active;
+ return Gtkmm2ext::ExplicitActive;
} else if (!r->is_master() && s->soloing() && !r->soloed() && !r->solo_isolated()) {
/* master is NEVER muted by others */
- return Mid;
+ return Gtkmm2ext::ImplicitActive;
} else {
/* no mute at all */
- return ActiveState(0);
+ return Gtkmm2ext::Off;
}
} else {
if (r->muted()) {
/* full mute */
- return Active;
+ return Gtkmm2ext::ExplicitActive;
} else {
/* no mute at all */
- return ActiveState(0);
+ return Gtkmm2ext::Off;
}
}
@@ -1107,12 +1107,12 @@ RouteUI::update_rec_display ()
if (_route->record_enabled()) {
switch (_session->record_status ()) {
case Session::Recording:
- rec_enable_button->set_active_state (Active);
+ rec_enable_button->set_active_state (Gtkmm2ext::ExplicitActive);
break;
case Session::Disabled:
case Session::Enabled:
- rec_enable_button->set_active_state (Mid);
+ rec_enable_button->set_active_state (Gtkmm2ext::ImplicitActive);
break;
}
@@ -1907,10 +1907,10 @@ void
RouteUI::bus_send_display_changed (boost::shared_ptr send_to)
{
if (_route == send_to) {
- show_sends_button->set_active_state (Gtkmm2ext::Active);
+ show_sends_button->set_active (true);
send_blink_connection = ARDOUR_UI::instance()->Blink.connect (sigc::mem_fun (*this, &RouteUI::send_blink));
} else {
- show_sends_button->unset_active_state ();
+ show_sends_button->set_active (false);
send_blink_connection.disconnect ();
}
}
diff --git a/gtk2_ardour/vst_plugin_ui.cc b/gtk2_ardour/vst_plugin_ui.cc
index 4c1fc6eade..303fb8b8dd 100644
--- a/gtk2_ardour/vst_plugin_ui.cc
+++ b/gtk2_ardour/vst_plugin_ui.cc
@@ -36,11 +36,7 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr insert, boost:
box->pack_end (add_button, false, false);
box->pack_end (_preset_combo, false, false);
- if (!insert->active ()) {
- bypass_button.set_active_state (Gtkmm2ext::Active);
- } else {
- bypass_button.unset_active_state ();
- }
+ bypass_button.set_active (!insert->active ());
pack_start (*box, false, false);
pack_start (_socket, true, true);
diff --git a/libs/gtkmm2ext/cairo_widget.cc b/libs/gtkmm2ext/cairo_widget.cc
index b6717252ab..e2149b9238 100644
--- a/libs/gtkmm2ext/cairo_widget.cc
+++ b/libs/gtkmm2ext/cairo_widget.cc
@@ -23,8 +23,8 @@
static const char* has_cairo_widget_background_info = "has_cairo_widget_background_info";
CairoWidget::CairoWidget ()
- : _active_state (Gtkmm2ext::ActiveState (0))
- , _visual_state (Gtkmm2ext::VisualState (0))
+ : _active_state (Gtkmm2ext::Off)
+ , _visual_state (Gtkmm2ext::NoVisualState)
, _need_bg (true)
{
@@ -134,7 +134,7 @@ CairoWidget::set_active (bool yn)
*/
if (yn) {
- set_active_state (Gtkmm2ext::Active);
+ set_active_state (Gtkmm2ext::ExplicitActive);
} else {
unset_active_state ();
}
diff --git a/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h b/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h
index e3ef7bafad..eb741b7e98 100644
--- a/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h
+++ b/libs/gtkmm2ext/gtkmm2ext/cairo_widget.h
@@ -44,14 +44,14 @@ public:
virtual void set_active_state (Gtkmm2ext::ActiveState);
virtual void set_visual_state (Gtkmm2ext::VisualState);
- void unset_active_state () { set_active_state (Gtkmm2ext::ActiveState (0)); }
- void unset_visual_state () { set_visual_state (Gtkmm2ext::VisualState (0)); }
+ void unset_active_state () { set_active_state (Gtkmm2ext::Off); }
+ void unset_visual_state () { set_visual_state (Gtkmm2ext::NoVisualState); }
/* this is an API simplification for widgets
that only use the Active and Normal active states.
*/
void set_active (bool);
- bool get_active () { return active_state() != Gtkmm2ext::ActiveState (0); }
+ bool get_active () { return active_state() != Gtkmm2ext::Off; }
/* widgets can be told to only draw their "foreground, and thus leave
in place whatever background is drawn by their parent. the default
diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h
index bf9c5ff405..97c6e7758b 100644
--- a/libs/gtkmm2ext/gtkmm2ext/utils.h
+++ b/libs/gtkmm2ext/gtkmm2ext/utils.h
@@ -96,11 +96,16 @@ namespace Gtkmm2ext {
void rounded_top_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r=10);
void rounded_top_left_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r=10);
void rounded_top_right_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r=10);
+ void rounded_top_half_rectangle (Cairo::RefPtr, double x, double y, double w, double h, double r=10);
+ void rounded_bottom_half_rectangle (Cairo::RefPtr, double x, double y, double w, double h, double r=10);
void rounded_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
void rounded_top_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
void rounded_top_left_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
void rounded_top_right_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+
+ void rounded_top_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
+ void rounded_bottom_half_rectangle (cairo_t*, double x, double y, double w, double h, double r=10);
};
#endif /* __gtkmm2ext_utils_h__ */
diff --git a/libs/gtkmm2ext/gtkmm2ext/widget_state.h b/libs/gtkmm2ext/gtkmm2ext/widget_state.h
index e3fd410d9d..6067b0f2ce 100644
--- a/libs/gtkmm2ext/gtkmm2ext/widget_state.h
+++ b/libs/gtkmm2ext/gtkmm2ext/widget_state.h
@@ -8,12 +8,14 @@ namespace Gtkmm2ext {
*/
enum ActiveState {
- Active = 1,
- Mid,
+ Off,
+ ExplicitActive,
+ ImplicitActive,
};
enum VisualState {
/* these can be OR-ed together */
+ NoVisualState = 0x0,
Selected = 0x1,
Prelight = 0x2,
Insensitive = 0x4,
diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc
index 7d14896438..7ecb481e33 100644
--- a/libs/gtkmm2ext/utils.cc
+++ b/libs/gtkmm2ext/utils.cc
@@ -382,36 +382,40 @@ Gtkmm2ext::container_clear (Gtk::Container& c)
}
}
-#if 1
void
Gtkmm2ext::rounded_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r)
{
rounded_rectangle (context->cobj(), x, y, w, h, r);
}
-
void
Gtkmm2ext::rounded_top_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r)
{
rounded_top_rectangle (context->cobj(), x, y, w, h, r);
}
-
void
Gtkmm2ext::rounded_top_left_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r)
{
rounded_top_left_rectangle (context->cobj(), x, y, w, h, r);
}
-
void
Gtkmm2ext::rounded_top_right_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r)
{
rounded_top_right_rectangle (context->cobj(), x, y, w, h, r);
}
+void
+Gtkmm2ext::rounded_top_half_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r)
+{
+ rounded_top_half_rectangle (context->cobj(), x, y, w, h, r);
+}
+void
+Gtkmm2ext::rounded_bottom_half_rectangle (Cairo::RefPtr context, double x, double y, double w, double h, double r)
+{
+ rounded_bottom_half_rectangle (context->cobj(), x, y, w, h, r);
+}
void
Gtkmm2ext::rounded_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
{
- /* renders small shapes better than most others */
-
/* A****BQ
H C
* *
@@ -429,11 +433,46 @@ Gtkmm2ext::rounded_rectangle (cairo_t* cr, double x, double y, double w, double
cairo_curve_to (cr, x,y,x,y,x+r,y); // Curve to A
}
+void
+Gtkmm2ext::rounded_top_half_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
+{
+/* A****BQ
+ H C
+ * *
+ G D
+ F****E
+*/
+ cairo_move_to (cr, x+r,y); // Move to A
+ cairo_line_to (cr, x+w-r,y); // Straight line to B
+ cairo_curve_to (cr, x+w,y,x+w,y,x+w,y+r); // Curve to C, Control points are both at Q
+ cairo_line_to (cr, x+w,y+h); // Move to E
+ cairo_line_to (cr, x,y+h); // Line to F
+ cairo_line_to (cr, x,y+r); // Line to H
+ cairo_curve_to (cr, x,y,x,y,x+r,y); // Curve to A
+}
+
+void
+Gtkmm2ext::rounded_bottom_half_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
+{
+/* A****BQ
+ H C
+ * *
+ G D
+ F****E
+*/
+ cairo_move_to (cr, x,y); // Move to A
+ cairo_line_to (cr, x+w,y); // Straight line to B
+ cairo_line_to (cr, x+w,y+h-r); // Move to D
+ cairo_curve_to (cr, x+w,y+h,x+w,y+h,x+w-r,y+h); // Curve to E
+ cairo_line_to (cr, x+r,y+h); // Line to F
+ cairo_curve_to (cr, x,y+h,x,y+h,x,y+h-r); // Curve to G
+ cairo_line_to (cr, x,y); // Line to A
+}
+
+
void
Gtkmm2ext::rounded_top_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
{
- /* renders small shapes better than most others */
-
/* A****BQ
H C
* *
@@ -452,8 +491,6 @@ Gtkmm2ext::rounded_top_rectangle (cairo_t* cr, double x, double y, double w, dou
void
Gtkmm2ext::rounded_top_left_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
{
- /* renders small shapes better than most others */
-
/* A****B
H *
* *
@@ -471,15 +508,13 @@ Gtkmm2ext::rounded_top_left_rectangle (cairo_t* cr, double x, double y, double w
void
Gtkmm2ext::rounded_top_right_rectangle (cairo_t* cr, double x, double y, double w, double h, double r)
{
- /* renders small shapes better than most others */
-
/* A****BQ
* C
* *
* *
F****E
*/
- cairo_move_to (cr, x+r,y); // Move to A
+ cairo_move_to (cr, x,y); // Move to A
cairo_line_to (cr, x+w-r,y); // Straight line to B
cairo_curve_to (cr, x+w,y,x+w,y,x+w,y+r); // Curve to C, Control points are both at Q
cairo_line_to (cr, x+w,y+h); // Move to E
@@ -487,65 +522,6 @@ Gtkmm2ext::rounded_top_right_rectangle (cairo_t* cr, double x, double y, double
cairo_line_to (cr, x,y); // Line to A
}
-#else
-
-void
-Gtkmm2ext::rounded_rectangle (Cairo::RefPtr context, double x, double y, double width, double height, double radius)
-{
- /* doesn't render small shapes well at all, and does not absolutely honor width & height */
-
- double x0 = x+radius/2.0;
- double y0 = y+radius/2.0;
- double rect_width = width - radius;
- double rect_height = height - radius;
-
- context->save();
-
- double x1=x0+rect_width;
- double y1=y0+rect_height;
-
- if (rect_width/2move_to (x0, (y0 + y1)/2);
- context->curve_to (x0 ,y0, x0, y0, (x0 + x1)/2, y0);
- context->curve_to (x1, y0, x1, y0, x1, (y0 + y1)/2);
- context->curve_to (x1, y1, x1, y1, (x1 + x0)/2, y1);
- context->curve_to (x0, y1, x0, y1, x0, (y0 + y1)/2);
- } else {
- context->move_to (x0, y0 + radius);
- context->curve_to (x0 ,y0, x0, y0, (x0 + x1)/2, y0);
- context->curve_to (x1, y0, x1, y0, x1, y0 + radius);
- context->line_to (x1 , y1 - radius);
- context->curve_to (x1, y1, x1, y1, (x1 + x0)/2, y1);
- context->curve_to (x0, y1, x0, y1, x0, y1- radius);
- }
- } else {
- if (rect_height/2move_to (x0, (y0 + y1)/2);
- context->curve_to (x0 , y0, x0 , y0, x0 + radius, y0);
- context->line_to (x1 - radius, y0);
- context->curve_to (x1, y0, x1, y0, x1, (y0 + y1)/2);
- context->curve_to (x1, y1, x1, y1, x1 - radius, y1);
- context->line_to (x0 + radius, y1);
- context->curve_to (x0, y1, x0, y1, x0, (y0 + y1)/2);
- } else {
- context->move_to (x0, y0 + radius);
- context->curve_to (x0 , y0, x0 , y0, x0 + radius, y0);
- context->line_to (x1 - radius, y0);
- context->curve_to (x1, y0, x1, y0, x1, y0 + radius);
- context->line_to (x1 , y1 - radius);
- context->curve_to (x1, y1, x1, y1, x1 - radius, y1);
- context->line_to (x0 + radius, y1);
- context->curve_to (x0, y1, x0, y1, x0, y1- radius);
- }
- }
-
- context->close_path ();
- context->restore();
-}
-
-#endif
-
Glib::RefPtr
Gtkmm2ext::window_to_draw_on (Gtk::Widget& w, Gtk::Widget** parent)
{