the buttons will submit to my rule! prelight-when-active, be gonecd /usr/local/music/src/ardour

git-svn-id: svn://localhost/ardour2/trunk@1451 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-02-13 14:25:17 +00:00
parent 8e79cd5610
commit d405df54ec
7 changed files with 141 additions and 185 deletions

View file

@ -185,13 +185,33 @@ style "small_red_active_and_selected_button" = "small_button"
}
style "track_rec_enable_button" = "small_button"
{
}
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[PRELIGHT] = { 0.0, 0.0, 0.0 }
fg[NORMAL] = { 0.0, 0.0, 0.0 }
bg[NORMAL] = { 1.0, 0.0, 0.0 } # actively recording
bg[ACTIVE] = { 1.0, 0.0, 0.0 } # actively recording
bg[SELECTED] = { 1.0, 0.0, 0.0 } # actively recording
bg[PRELIGHT] = { 1.0, 0.0, 0.0 } # actively recording
}
style "track_rec_enable_button_alternate" = "small_button"
{
fg[SELECTED] = { 0.0, 0.0, 0.0 }
fg[ACTIVE] = { 0.0, 0.0, 0.0 }
fg[PRELIGHT] = { 0.0, 0.0, 0.0 }
fg[NORMAL] = { 0.0, 0.0, 0.0 }
bg[NORMAL] = { 0.91, 0.68, 0.68} # enabled, not active
bg[ACTIVE] = { 0.91, 0.68, 0.68} # enabled, not active
bg[SELECTED] = { 0.91, 0.68, 0.68} # enabled, not active
bg[PRELIGHT] = { 0.91, 0.68, 0.68} # enabled, not active
}
style "gain_fader"
@ -209,50 +229,75 @@ style "mixer_rec_enable_button" = "track_rec_enable_button"
style "solo_button" = "small_button"
{
bg[PRELIGHT] = { 0, 1.0, 0 }
bg[ACTIVE] = { 0.66, 0.97, 0.19 }
# font_name = "sans 7"
# xthickness = 0
# ythickness = 0
}
style "solo_button_alternate" = "small_button"
{
# font_name = "sans 7"
# xthickness = 0
# ythickness = 0
bg[NORMAL] = { 0.19, 0.97, 0.69 } # solo-safe
bg[ACTIVE] = { 0.19, 0.97, 0.69 } # solo-safe
bg[SELECTED] = { 0.19, 0.97, 0.69 } # solo-safe
bg[PRELIGHT] = { 0.19, 0.97, 0.69 } # solo-safe
fg[PRELIGHT] = { 0, 0, 0 }
fg[ACTIVE] = { 0, 0, 0 }
}
style "safe_solo_button" = "small_button"
{
bg[PRELIGHT] = { 0, 1.0, 0 }
bg[ACTIVE] = { 0.19, 0.97, 0.69 }
fg[SELECTED] = { 0, 0, 0 }
fg[NORMAL] = { 0, 0, 0 }
fg[PRELIGHT] = { 0, 0, 0 }
}
style "solo_button_active" = "small_button"
{
# font_name = "sans 7"
# xthickness = 0
# ythickness = 0
bg[NORMAL] = { 0.66, 0.97, 0.19 } # solo
bg[ACTIVE] = { 0.66, 0.97, 0.19 } # solo
bg[SELECTED] = { 0.66, 0.97, 0.19 } # solo
bg[PRELIGHT] = { 0.66, 0.97, 0.19 } # solo
fg[ACTIVE] = { 0, 0, 0 }
fg[SELECTED] = { 0, 0, 0 }
fg[NORMAL] = { 0, 0, 0 }
fg[PRELIGHT] = { 0, 0, 0 }
}
style "mixer_solo_button" = "solo_button"
{
font_name = "sans 7"
xthickness = 0
ythickness = 0
}
style "mixer_safe_solo_button" = "safe_solo_button"
{
font_name = "sans 7"
xthickness = 0
ythickness = 0
}
style "mute_button" = "small_button"
{
bg[PRELIGHT] = { 1.0, 0.65, 0.13 }
bg[ACTIVE] = { 1.0, 0.98, 0.53 }
bg[SELECTED] = { 0.90, 0.89, 0.73 }
fg[PRELIGHT] = { 0, 0, 0 }
fg[SELECTED] = { 0, 0, 0 }
fg[ACTIVE] = { 0, 0, 0 }
}
style "mute_button_alternate" = "small_button"
{
bg[ACTIVE] = { 1.0, 0.98, 0.53 }
bg[NORMAL] = { 1.0, 0.98, 0.53 }
bg[SELECTED] = { 1.0, 0.98, 0.53 }
bg[PRELIGHT] = { 1.0, 0.98, 0.53 }
fg[SELECTED] = { 0, 0, 0 }
fg[ACTIVE] = { 0, 0, 0 }
fg[NORMAL] = { 0, 0, 0 }
fg[PRELIGHT] = { 0, 0, 0 }
}
style "mute_button_active" = "small_button"
{
bg[NORMAL] = { 0.90, 0.89, 0.73 }
bg[ACTIVE] = { 0.90, 0.89, 0.73 }
bg[PRELIGHT] = { 0.90, 0.89, 0.73 }
bg[SELECTED] = { 0.90, 0.89, 0.73 }
fg[SELECTED] = { 0, 0, 0 }
fg[ACTIVE] = { 0, 0, 0 }
fg[NORMAL] = { 0, 0, 0 }
fg[PRELIGHT] = { 0, 0, 0 }
}
style "multiline_combo" = "small_button"
{
@ -291,9 +336,19 @@ style "time_button" = "default_buttons_menus"
style "transport_button"
{
}
style "transport_button_active"
{
bg[NORMAL] = { 0.50, 1.0, 0.50 }
bg[ACTIVE] = { 0.50, 1.0, 0.50 }
fg[ACTIVE] = { 1, 1, 1 }
fg[PRELIGHT] = { 1, 1, 1 }
bg[SELECTED] = { 0.50, 1.0, 0.50 }
bg[PRELIGHT] = { 0.50, 1.0, 0.50 }
fg[NORMAL] = { 0, 0, 0 }
fg[PRELIGHT] = { 0, 0, 0 }
fg[SELECTED] = { 0, 0, 0 }
fg[ACTIVE] = { 0, 0, 0 }
}
style "transport_rec_button"
@ -1077,16 +1132,18 @@ widget "*MixerSendSwitch*" style "very_small_red_active_and_selected_button"
widget "*OptionEditorToggleButton" style "small_red_active_and_selected_button"
widget "*NewSessionDialogButton" style "small_red_active_and_selected_button"
widget "*RecordEnableButton" style "track_rec_enable_button"
widget "*RecordEnableButton*" style "track_rec_enable_button"
widget "*RecordEnableButton-active" style "track_rec_enable_button_active"
widget "*RecordEnableButton-alternate" style "track_rec_enable_button_alternate"
widget "*MuteButton*" style "mute_button"
widget "*MuteButton-alternate*" style "mute_button_alternate"
widget "*MuteButton-active*" style "mute_button_active"
widget "*TrackLoopButton*" style "track_loop_button"
widget "*PanAutomationLineSelector*" style "multiline_combo"
widget "*EditorTimeButton*" style "time_button"
widget "*EditorMixerButton*" style "default_buttons_menus"
widget "*SoloButton*" style "solo_button"
widget "*SoloButton.*" style "solo_button"
widget "*SafeSoloButton*" style "safe_solo_button"
widget "*SafeSoloButton.*" style "safe_solo_button"
widget "*SoloButton-alternate*" style "solo_button_alternate"
widget "*SoloButton-active*" style "solo_button_active"
widget "*MixerPhaseInvertButton*" style "very_small_button"
widget "*MixerPhaseInvertButton.*" style "very_small_button"
widget "*MixerAutomationRecordingButton*" style "very_small_button"
@ -1104,7 +1161,7 @@ widget "*MixerCommentButton*" style "very_small_button"
widget "*EditGroupButton" style "very_small_button"
widget "*EditGroupButtonLabel" style "very_small_button"
widget "*TransportButton" style "transport_button"
widget "*TransportButton*" style "transport_button"
widget "*TransportButton-active" style "transport_button_active"
widget "*ShuttleButton" style "transport_button"
widget "*ShuttleButton*" style "transport_button"
widget "*ShuttleDisplay" style "transport_button"

View file

@ -1489,7 +1489,7 @@ ARDOUR_UI::_blink (void *arg)
void
ARDOUR_UI::blink ()
{
Blink (blink_on = !blink_on); /* EMIT_SIGNAL */
// Blink (blink_on = !blink_on); /* EMIT_SIGNAL */
}
void

View file

@ -223,50 +223,14 @@ ARDOUR_UI::setup_transport ()
rec_button.set_name ("TransportRecButton");
auto_loop_button.set_name ("TransportButton");
vector<Gdk::Color> colors;
Gdk::Color c;
set_color(c, rgba_from_style ("TransportButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_ACTIVE, false ));
colors.push_back (c);
auto_return_button.set_name ("TransportButton");
auto_return_button.set_colors (colors);
auto_play_button.set_name ("TransportButton");
auto_play_button.set_colors (colors);
auto_input_button.set_name ("TransportButton");
auto_input_button.set_colors (colors);
punch_in_button.set_name ("TransportButton");
punch_in_button.set_colors (colors);
punch_out_button.set_name ("TransportButton");
punch_out_button.set_colors (colors);
click_button.set_name ("TransportButton");
click_button.set_colors (colors);
time_master_button.set_name ("TransportButton");
time_master_button.set_colors (colors);
colors.clear ();
/* record button has 3 color states, so we set 2 extra here */
set_color(c, rgba_from_style ("TransportRecButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_PRELIGHT, false ));
colors.push_back (c);
set_color(c, rgba_from_style ("TransportRecButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_ACTIVE, false ));
colors.push_back (c);
rec_button.set_colors (colors);
colors.clear ();
/* other buttons get 2 color states, so add one here */
set_color(c, rgba_from_style ("TransportButton", 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
colors.push_back (c);
stop_button.set_colors (colors);
roll_button.set_colors (colors);
auto_loop_button.set_colors (colors);
play_selection_button.set_colors (colors);
goto_start_button.set_colors (colors);
goto_end_button.set_colors (colors);
stop_button.set_size_request(29, -1);
roll_button.set_size_request(29, -1);
auto_loop_button.set_size_request(29, -1);

View file

@ -77,26 +77,11 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co
mute_button->set_self_managed (true);
solo_button = manage (new BindableToggleButton (_route->solo_control(), s_name ));
solo_button->set_self_managed (true);
mute_button->set_name ("MuteButton");
solo_button->set_name ("SoloButton");
vector<Gdk::Color> colors;
Gdk::Color c;
::set_color(c, rgba_from_style (X_("MuteButton"), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_SELECTED, false ));
colors.push_back (c);
::set_color(c, rgba_from_style (X_("MuteButton"), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
colors.push_back (c);
mute_button->set_colors (colors);
colors.clear ();
/* mute+solo buttons get 2 color states, so add one here to supplement the existing one */
::set_color(c, rgba_from_style (X_("SoloButton"), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
colors.push_back (c);
solo_button->set_colors (colors);
_route->mute_changed.connect (mem_fun(*this, &RouteUI::mute_changed));
_route->solo_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
_route->solo_safe_changed.connect (mem_fun(*this, &RouteUI::solo_changed));
@ -116,24 +101,8 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co
_session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed));
rec_enable_button = manage (new BindableToggleButton (t->rec_enable_control(), r_name ));
/* we manage colors for the rec button, since it has 3 (disabled,enabled,recording),
not just 2 (active&inactive)
*/
rec_enable_button->set_self_managed (true);
colors.clear ();
/* record button has 3 color states, so we set 2 extra here */
::set_color(c, rgba_from_style (X_("RecordEnableButton"), 0xff, 0, 0, 0, "bg", Gtk::STATE_SELECTED, false ));
colors.push_back (c);
::set_color(c, rgba_from_style (X_("RecordEnableButton"), 0xff, 0, 0, 0, "bg", Gtk::STATE_ACTIVE, false ));
colors.push_back (c);
rec_enable_button->set_colors (colors);
update_rec_display ();
}
@ -382,32 +351,22 @@ void
RouteUI::update_solo_display ()
{
bool x;
vector<Gdk::Color> colors;
vector<Gdk::Color> fg_colors;
Gdk::Color c;
if (_route->solo_safe() != was_solo_safe){
if (_route->solo_safe()) {
/* show solo safe */
::set_color(c, rgba_from_style (safe_solo_button_name(), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
solo_button->set_name(safe_solo_button_name());
} else {
::set_color(c, rgba_from_style (solo_button_name(), 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
solo_button->set_name(solo_button_name());
}
colors.push_back (c);
solo_button->set_colors (colors);
was_solo_safe = !was_solo_safe;
}
if (solo_button->get_active() != (x = _route->soloed())){
ignore_toggle = true;
solo_button->set_active(x);
ignore_toggle = false;
}
if (_route->solo_safe()) {
solo_button->set_visual_state (2);
} else if (_route->soloed()) {
solo_button->set_visual_state (1);
} else {
solo_button->set_visual_state (0);
}
}
void
@ -492,14 +451,15 @@ RouteUI::update_rec_display ()
if (model) {
switch (_session.record_status ()) {
case Session::Disabled:
case Session::Enabled:
case Session::Recording:
rec_enable_button->set_visual_state (1);
break;
case Session::Recording:
case Session::Disabled:
case Session::Enabled:
rec_enable_button->set_visual_state (2);
break;
}
} else {

View file

@ -263,6 +263,7 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a, s
r = waverc->fg[state].red / 257;
g = waverc->fg[state].green / 257;
b = waverc->fg[state].blue / 257;
/* what a hack ... "a" is for "active" */
if (state == Gtk::STATE_NORMAL && rgba) {
a = waverc->fg[GTK_STATE_ACTIVE].red / 257;

View file

@ -33,19 +33,17 @@ class StateButton
StateButton();
virtual ~StateButton() {}
void set_colors (const std::vector<Gdk::Color>& colors);
void set_visual_state (int);
int get_visual_state () { return visual_state; }
void set_self_managed (bool yn) { _self_managed = yn; }
protected:
std::vector<Gdk::Color> colors;
int visual_state;
Gdk::Color saved_bg;
bool have_saved_bg;
bool _self_managed;
bool _is_realized;
virtual void bg_modify (Gtk::StateType, Gdk::Color) = 0;
virtual std::string get_widget_name() const = 0;
virtual void set_widget_name (std::string) = 0;
};
@ -60,9 +58,8 @@ class StatefulToggleButton : public StateButton, public Gtk::ToggleButton
void on_realize ();
void on_toggled ();
void bg_modify (Gtk::StateType state, Gdk::Color col) {
modify_bg (state, col);
}
std::string get_widget_name() const { return get_name(); }
void set_widget_name (std::string name) { set_name (name); get_child()->set_name (name); }
};
class StatefulButton : public StateButton, public Gtk::Button
@ -75,9 +72,8 @@ class StatefulButton : public StateButton, public Gtk::Button
protected:
void on_realize ();
void bg_modify (Gtk::StateType state, Gdk::Color col) {
modify_bg (state, col);
}
std::string get_widget_name() const { return get_name(); }
void set_widget_name (std::string name) { set_name (name); get_child()->set_name (name); }
};
};

View file

@ -12,22 +12,14 @@ using namespace std;
StateButton::StateButton ()
{
_is_realized = false;
visual_state = 0;
have_saved_bg = false;
}
void
StateButton::set_colors (const vector<Gdk::Color>& c)
{
colors = c;
visual_state++; // to force transition
set_visual_state (visual_state - 1);
}
void
StateButton::set_visual_state (int n)
{
if (!have_saved_bg) {
if (!_is_realized) {
/* not yet realized */
visual_state = n;
return;
@ -36,29 +28,23 @@ StateButton::set_visual_state (int n)
if (n == visual_state) {
return;
}
if (n == 0) {
/* back to the default color */
if (have_saved_bg) {
bg_modify (STATE_NORMAL, saved_bg);
bg_modify (STATE_ACTIVE, saved_bg);
bg_modify (STATE_SELECTED, saved_bg);
bg_modify (STATE_PRELIGHT, saved_bg);
}
} else {
int index = (n-1) % colors.size ();
bg_modify (STATE_NORMAL, colors[index]);
bg_modify (STATE_ACTIVE, colors[index]);
bg_modify (STATE_SELECTED, colors[index]);
bg_modify (STATE_PRELIGHT, colors[index]);
}
string name = get_widget_name ();
name = name.substr (0, name.find_last_of ('-'));
switch (n) {
case 0:
name += "-normal";
break;
case 1:
name += "-active";
break;
case 2:
name += "-alternate";
break;
}
set_widget_name (name);
visual_state = n;
}
@ -69,11 +55,7 @@ StatefulToggleButton::on_realize ()
{
ToggleButton::on_realize ();
if (!have_saved_bg) {
saved_bg = get_style()->get_bg (STATE_NORMAL);
have_saved_bg = true;
}
_is_realized = true;
visual_state++; // to force transition
set_visual_state (visual_state - 1);
}
@ -83,11 +65,7 @@ StatefulButton::on_realize ()
{
Button::on_realize ();
if (!have_saved_bg) {
saved_bg = get_style()->get_bg (STATE_NORMAL);
have_saved_bg = true;
}
_is_realized = true;
visual_state++; // to force transition
set_visual_state (visual_state - 1);
}