style "track_rec_enable_button" = "small_button"
{
+ fg[ACTIVE] = { 0.0, 0.0, 0.0 }
+ bg[ACTIVE] = { 1.0, 0.0, 0.0 }
}
style "track_rec_enable_button_active" = "small_button"
{
- fg[SELECTED] = { 0.0, 0.0, 0.0 }
fg[ACTIVE] = { 0.0, 0.0, 0.0 }
+ fg[SELECTED] = { 0.0, 0.0, 0.0 }
fg[PRELIGHT] = { 0.0, 0.0, 0.0 }
fg[NORMAL] = { 0.0, 0.0, 0.0 }
style "solo_button" = "small_button"
{
+ bg[ACTIVE] = { 0.66, 0.97, 0.19 } # solo
+ fg[ACTIVE] = { 0, 0, 0 }
}
style "solo_button_alternate" = "small_button"
ythickness = 0
}
+style "monitor_section_button" = "small_button"
+{
+ bg[ACTIVE] = { 1.0, 0, 0 }
+ fg[ACTIVE] = { 0, 0, 0 }
+}
+
style "mute_button" = "small_button"
{
+ bg[ACTIVE] = { 0.90, 0.89, 0.73 }
+ fg[ACTIVE] = { 0, 0, 0 }
}
style "mute_button_alternate" = "small_button"
fg[PRELIGHT] = { 0, 0, 0 }
}
-style "mixer_mute_button_alternate" = "mute_button_alternate"
+style "mixer_mute_button" = "mute_button"
{
font_name = "@FONT_SMALLER@"
xthickness = 0
ythickness = 0
}
-style "mixer_mute_button_active" = "mute_button_active"
+style "mixer_mute_button_alternate" = "mute_button_alternate"
{
font_name = "@FONT_SMALLER@"
xthickness = 0
ythickness = 0
}
-style "multiline_combo" = "small_button"
+style "mixer_mute_button_active" = "mute_button_active"
{
- font_name = "@FONT_NORMAL@"
+ font_name = "@FONT_SMALLER@"
xthickness = 0
ythickness = 0
}
-style "mixer_mute_button" = "mute_button"
+style "multiline_combo" = "small_button"
{
- font_name = "@FONT_SMALLER@"
+ font_name = "@FONT_NORMAL@"
xthickness = 0
ythickness = 0
}
+
style "track_loop_button" = "small_button"
{
bg[ACTIVE] = { 1.0, 0.98, 0.53 }
style "transport_button"
{
+ bg[ACTIVE] = { 0.50, 1.0, 0.50 }
+ fg[ACTIVE] = { 0, 0, 0 }
}
style "transport_button_active"
style "transport_rec_button"
{
+ bg[ACTIVE] = { 1.0, 0, 0 }
}
style "transport_rec_button_active"
widget "*MixerMonoButton*" style:highest "very_small_button"
widget "*EditGroupButton" style:highest "very_small_button"
widget "*EditGroupButtonLabel" style:highest "very_small_button"
-widget "*TransportButton" style:highest "transport_rec_button"
+widget "*TransportButton" style:highest "transport_button"
widget "*TransportButton-active" style:highest "transport_button_active"
widget "*TransportSyncButton" style:highest "transport_button"
widget "*TransportSyncButton*" style:highest "transport_button"
widget "*MixerStripFrame" style:highest "base_frame"
widget "*HWMonitorButton" style:highest "red_when_active"
widget "*HWMonitorButton*" style:highest "red_when_active"
+widget "*MonitorSectionButton" style:highest "monitor_section_button"
+widget "*MonitorSectionButton*" style:highest "monitor_section_button"
widget "*BypassButton" style:highest "red_when_active"
widget "*BypassButton*" style:highest "red_when_active"
widget "*TransportSoloAlert" style:highest "flashing_alert"
if (!rolling) {
_session->request_transport_speed (1.0f);
}
-
- map_transport_state ();
}
void
_session->request_transport_speed (1.0f);
}
}
-
- map_transport_state ();
}
void
play_selection_button.set_visual_state (0);
auto_loop_button.set_visual_state (0);
}
-
}
void
CanvasNoteEvent::~CanvasNoteEvent()
{
+ cerr << "Destroying CNE @ " << this << endl;
+
if (_text) {
_text->hide();
delete _text;
}
if (_selection.insert (ev).second) {
+ cerr << "Added CNE to selection, size now " << _selection.size() << endl;
ev->selected (true);
play_midi_note ((ev)->note());
}
{
Notes notes;
+ cerr << "Convert selection of " << _selection.size() << " into a cut buffer\n";
+
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
- notes.insert (boost::shared_ptr<NoteType> (new NoteType (*((*i)->note().get()))));
+ NoteType* n = (*i)->note().get();
+ cerr << "CNE's note is " << n << endl;
+ notes.insert (boost::shared_ptr<NoteType> (new NoteType (*n)));
}
MidiCutBuffer* cb = new MidiCutBuffer (trackview.session());
Glib::RefPtr<Gdk::Pixbuf> MonitorSection::big_knob_pixbuf;
Glib::RefPtr<Gdk::Pixbuf> MonitorSection::little_knob_pixbuf;
-static bool
-fixup_prelight (GdkEventCrossing* /* ignored */, GtkWidget* widget)
-{
- GtkRcStyle* style = gtk_rc_style_copy (gtk_widget_get_modifier_style (widget));
- int current = gtk_widget_get_state (widget);
-
- style->fg[GTK_STATE_PRELIGHT] = style->fg[current];
- style->bg[GTK_STATE_PRELIGHT] = style->bg[current];
-
- gtk_widget_modify_style(widget, style);
- g_object_unref(style);
-
- return false;
-}
-
-static void
-block_prelight (Gtk::Widget& w)
-{
- w.signal_enter_notify_event().connect (sigc::bind (sigc::ptr_fun (fixup_prelight), w.gobj()), false);
-}
-
MonitorSection::MonitorSection (Session* s)
: AxisView (s)
, RouteUI (s)
, main_table (2, 3)
, _tearoff (0)
- , gain_adjustment (1.0, 0.0, 1.0, 0.01, 0.1)
+ , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // initial value is unity gain
, gain_control (0)
, dim_adjustment (0.2, 0.0, 1.0, 0.01, 0.1)
, dim_control (0)
- , solo_boost_adjustment (1.0, 1.0, 2.0, 0.01, 0.1)
+ , solo_boost_adjustment (1.0, 1.0, 3.0, 0.01, 0.1)
, solo_boost_control (0)
, solo_cut_adjustment (0.0, 0.0, 1.0, 0.01, 0.1)
, solo_cut_control (0)
rude_solo_button.set_name ("TransportSoloAlert");
rude_solo_button.show ();
- block_prelight (rude_solo_button);
ARDOUR_UI::Blink.connect (sigc::mem_fun (*this, &MonitorSection::solo_blink));
rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false);
act->connect_proxy (mono_button);
}
+ cut_all_button.set_name (X_("MixerMuteButton"));
+ cut_all_button.unset_flags (Gtk::CAN_FOCUS);
cut_all_button.set_size_request (50,50);
cut_all_button.show ();
bbox->pack_start (mono_button, true, true);
bbox->pack_start (dim_all_button, true, true);
+ dim_all_button.set_name (X_("MonitorSectionButton"));
+ dim_all_button.unset_flags (Gtk::CAN_FOCUS);
+ mono_button.set_name (X_("MonitorSectionButton"));
+ mono_button.unset_flags (Gtk::CAN_FOCUS);
+
lower_packer.set_spacing (12);
lower_packer.pack_start (*bbox, false, false);
lower_packer.pack_start (cut_all_button, false, false);
cut.set_name (X_("MixerMuteButton"));
dim.set_name (X_("MixerMuteButton"));
solo.set_name (X_("MixerSoloButton"));
+ invert.set_name (X_("MonitorSectionButton"));
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (cut.gobj()), false);
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (dim.gobj()), false);
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (invert.gobj()), false);
gtk_activatable_set_use_action_appearance (GTK_ACTIVATABLE (solo.gobj()), false);
- block_prelight (cut);
- block_prelight (dim);
- block_prelight (solo);
- block_prelight (invert);
+ cut.unset_flags (Gtk::CAN_FOCUS);
+ dim.unset_flags (Gtk::CAN_FOCUS);
+ solo.unset_flags (Gtk::CAN_FOCUS);
+ invert.unset_flags (Gtk::CAN_FOCUS);
}
void
multiple_solo_change = false;
mute_button = manage (new BindableToggleButton ());
- mute_button->set_self_managed (true);
+ // mute_button->set_self_managed (true);
mute_button->set_name ("MuteButton");
mute_button->add (mute_button_label);
mute_button_label.show ();
UI::instance()->set_tip (mute_button, _("Mute this track"), "");
solo_button = manage (new BindableToggleButton ());
- solo_button->set_self_managed (true);
+ // solo_button->set_self_managed (true);
solo_button->set_name ("SoloButton");
solo_button->add (solo_button_label);
solo_button_label.show ();
rec_enable_button = manage (new BindableToggleButton ());
rec_enable_button->set_name ("RecordEnableButton");
- rec_enable_button->set_self_managed (true);
+ // rec_enable_button->set_self_managed (true);
rec_enable_button->add (rec_enable_button_label);
rec_enable_button_label.show ();
UI::instance()->set_tip (rec_enable_button, _("Enable recording on this track"), "");
show_sends_button = manage (new BindableToggleButton (""));
show_sends_button->set_name ("SendAlert");
- show_sends_button->set_self_managed (true);
+ // show_sends_button->set_self_managed (true);
UI::instance()->set_tip (show_sends_button, _("make mixer strips show sends to this bus"), "");
_session->SoloChanged.connect (_session_connections, boost::bind (&RouteUI::solo_changed_so_update_mute, this), gui_context());
int visual_state;
bool _self_managed;
bool _is_realized;
+ bool style_changing;
+ Gtk::StateType state_before_prelight;
+ bool is_toggle;
- virtual std::string get_widget_name() const = 0;
- virtual void set_widget_name (const std::string&) = 0;
- virtual int get_widget_state() = 0;
+ virtual std::string get_widget_name() const = 0;
+ virtual void set_widget_name (const std::string& name) = 0;
+ virtual Gtk::Widget* get_child_widget () = 0;
+
+ void avoid_prelight_on_style_changed (const Glib::RefPtr<Gtk::Style>& style, GtkWidget* widget);
+ void avoid_prelight_on_state_changed (Gtk::StateType old_state, GtkWidget* widget);
};
class StatefulToggleButton : public StateButton, public Gtk::ToggleButton
{
public:
- StatefulToggleButton() {}
- explicit StatefulToggleButton(const std::string &label) : Gtk::ToggleButton (label) {}
+ StatefulToggleButton();
+ explicit StatefulToggleButton(const std::string &label);
~StatefulToggleButton() {}
protected:
void on_realize ();
void on_toggled ();
+ void on_style_changed (const Glib::RefPtr<Gtk::Style>& style);
+ void on_state_changed (Gtk::StateType old_state);
+ Gtk::Widget* get_child_widget ();
std::string get_widget_name() const { return get_name(); }
void set_widget_name (const std::string& name);
- int get_widget_state() { return get_state(); }
};
class StatefulButton : public StateButton, public Gtk::Button
{
public:
- StatefulButton() {}
- explicit StatefulButton(const std::string &label) : Gtk::Button (label) {}
+ StatefulButton();
+ explicit StatefulButton(const std::string &label);
virtual ~StatefulButton() {}
-
+
protected:
void on_realize ();
-
+ void on_style_changed (const Glib::RefPtr<Gtk::Style>& style);
+ void on_state_changed (Gtk::StateType old_state);
+
+ Gtk::Widget* get_child_widget ();
std::string get_widget_name() const { return get_name(); }
void set_widget_name (const std::string& name);
- int get_widget_state() { return get_state(); }
};
};
#include <string>
#include <iostream>
+
#include <gtkmm/main.h>
#include <gtkmm2ext/stateful_button.h>
using namespace Gtkmm2ext;
using namespace std;
-StateButton::StateButton () : visual_state (0), _self_managed (false), _is_realized (false)
+StateButton::StateButton ()
+ : visual_state (0)
+ , _self_managed (false)
+ , _is_realized (false)
+ , style_changing (false)
+ , state_before_prelight (Gtk::STATE_NORMAL)
+ , is_toggle (false)
{
-
}
void
/* relax */
break;
case 1:
- name += "-active";
+ name += "-active";
break;
+
case 2:
name += "-alternate";
break;
visual_state = n;
}
+void
+StateButton::avoid_prelight_on_style_changed (const Glib::RefPtr<Gtk::Style>& /* old_style */, GtkWidget* widget)
+{
+ /* don't go into an endless recursive loop if we're changing
+ the style in response to an existing style change.
+ */
+
+ if (style_changing) {
+ return;
+ }
+
+ if (gtk_widget_get_state (widget) == GTK_STATE_PRELIGHT) {
+
+ /* avoid PRELIGHT: make sure that the prelight colors in this new style match
+ the colors of the new style in whatever state we were in
+ before we switched to prelight.
+ */
+
+ GtkRcStyle* rcstyle = gtk_widget_get_modifier_style (widget);
+ GtkStyle* style = gtk_widget_get_style (widget);
+
+ rcstyle->fg[GTK_STATE_PRELIGHT] = style->fg[state_before_prelight];
+ rcstyle->bg[GTK_STATE_PRELIGHT] = style->bg[state_before_prelight];
+ rcstyle->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) (GTK_RC_FG|GTK_RC_BG);
+
+ style_changing = true;
+ g_object_ref (rcstyle);
+ gtk_widget_modify_style (widget, rcstyle);
+
+ Widget* child = get_child_widget();
+ if (child) {
+ gtk_widget_modify_style (GTK_WIDGET(child->gobj()), rcstyle);
+ }
+
+ g_object_unref (rcstyle);
+ style_changing = false;
+ }
+}
+
+void
+StateButton::avoid_prelight_on_state_changed (Gtk::StateType old_state, GtkWidget* widget)
+{
+ GtkStateType state = gtk_widget_get_state (widget);
+
+ if (state == GTK_STATE_PRELIGHT) {
+
+ state_before_prelight = old_state;
+
+
+ /* avoid PRELIGHT when currently ACTIVE:
+ if we just went into PRELIGHT, make sure that the colors
+ match those of whatever state we were in before.
+ */
+
+ GtkRcStyle* rcstyle = gtk_widget_get_modifier_style (widget);
+ GtkStyle* style = gtk_widget_get_style (widget);
+
+ rcstyle->fg[GTK_STATE_PRELIGHT] = style->fg[old_state];
+ rcstyle->bg[GTK_STATE_PRELIGHT] = style->bg[old_state];
+ rcstyle->color_flags[GTK_STATE_PRELIGHT] = (GtkRcFlags) (GTK_RC_FG|GTK_RC_BG);
+
+ g_object_ref (rcstyle);
+ gtk_widget_modify_style (widget, rcstyle);
+
+ Widget* child = get_child_widget ();
+
+ if (child) {
+ gtk_widget_modify_style (GTK_WIDGET(child->gobj()), rcstyle);
+ }
+
+ g_object_unref (rcstyle);
+
+ }
+}
+
/* ----------------------------------------------------------------- */
+StatefulToggleButton::StatefulToggleButton ()
+{
+ is_toggle = true;
+}
+
+StatefulToggleButton::StatefulToggleButton (const std::string& label)
+ : ToggleButton (label)
+{
+ is_toggle = true;
+}
+
void
StatefulToggleButton::on_realize ()
{
{
if (!_self_managed) {
if (get_active()) {
- set_visual_state (1);
+ set_state (Gtk::STATE_ACTIVE);
} else {
- set_visual_state (0);
+ set_state (Gtk::STATE_NORMAL);
}
}
}
+
+void
+StatefulToggleButton::on_style_changed (const Glib::RefPtr<Gtk::Style>& style)
+{
+ avoid_prelight_on_style_changed (style, GTK_WIDGET(gobj()));
+ Button::on_style_changed (style);
+}
+
+void
+StatefulToggleButton::on_state_changed (Gtk::StateType old_state)
+{
+ avoid_prelight_on_state_changed (old_state, GTK_WIDGET(gobj()));
+ Button::on_state_changed (old_state);
+}
+
+Widget*
+StatefulToggleButton::get_child_widget ()
+{
+ return get_child();
+}
+
void
StatefulToggleButton::set_widget_name (const std::string& name)
{
}
}
+/*--------------------------------------------- */
+
+StatefulButton::StatefulButton ()
+{
+}
+
+StatefulButton::StatefulButton (const std::string& label)
+ : Button (label)
+{
+}
+
+void
+StatefulButton::on_style_changed (const Glib::RefPtr<Gtk::Style>& style)
+{
+ avoid_prelight_on_style_changed (style, GTK_WIDGET(gobj()));
+ Button::on_style_changed (style);
+}
+
+void
+StatefulButton::on_state_changed (Gtk::StateType old_state)
+{
+ avoid_prelight_on_state_changed (old_state, GTK_WIDGET(gobj()));
+ Button::on_state_changed (old_state);
+}
+
+Widget*
+StatefulButton::get_child_widget ()
+{
+ return get_child();
+}
+
void
StatefulButton::set_widget_name (const std::string& name)
{