13
0

Tweak colouring in the processor list.

git-svn-id: svn://localhost/ardour2/branches/3.0@8507 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-01-14 15:48:45 +00:00
parent db847eea33
commit 93b25e1f13
4 changed files with 117 additions and 36 deletions

View File

@ -1212,10 +1212,7 @@ style "processor_list"
# Basic background colour
bg[NORMAL] = { 0, 0, 0 }
# A selected processor
bg[SELECTED] = { 0, 0.5, 0.9 }
# A send processor whose level is being controlled by the fader
# Colours for sends whose level is being controller by the fader
bg[ACTIVE] = { 0.19, 0.97, 0.69 }
fg[ACTIVE] = { 0.0, 0.0, 0.0 }
@ -1223,37 +1220,49 @@ style "processor_list"
GtkCheckButton::indicator-spacing = 0
}
# Colour of the frame of the fader in the processor list
style "processor_fader_frame"
# Colour of a processor frame when it is selected
style "processor_frame_selected"
{
bg[NORMAL] = { 0.5, 0.5, 0.5 }
bg[NORMAL] = { 0.9, 0.8, 0.2 }
}
# A pre-fader processor's background
style "processor_prefader"
# Colour of a processor frame when it is a send whose level is being controller by the fader
style "processor_frame_active_send"
{
bg[NORMAL] = { 0.3, 0.0, 0.0 }
bg[NORMAL] = { 0.19, 0.97, 0.69 }
}
# A pre-fader processor's frame
style "processor_prefader_frame"
{
bg[NORMAL] = { 0.5, 0.0, 0.0 }
}
# The fader processor
# Fader processor's background
style "processor_fader"
{
bg[NORMAL] = { 0.4, 0.4, 0.4 }
}
# A post-fader processor's background
# Fader processor's frame
style "processor_fader_frame"
{
bg[NORMAL] = { 0.5, 0.5, 0.5 }
}
# Pre-fader processor's background
style "processor_prefader"
{
bg[NORMAL] = { 0.3, 0.0, 0.0 }
}
# Pre-fader processor's frame
style "processor_prefader_frame"
{
bg[NORMAL] = { 0.5, 0.0, 0.0 }
}
# Post-fader processor's background
style "processor_postfader"
{
bg[NORMAL] = { 0.1, 0.3, 0.1 }
}
# A post-fader processor's frame
# Post-fader processor's frame
style "processor_postfader_frame"
{
bg[NORMAL] = { 0.1, 0.5, 0.1 }
@ -1893,7 +1902,9 @@ widget "*OddPortGroups" style:highest "odd_port_groups"
widget "*EvenPortGroups" style:highest "even_port_groups"
widget "*MidiListView*" style:highest "white_tree_view"
widget "*ProcessorList*" style:highest "processor_list"
widget "*ProcessorFaderFrame*" style:highest "processor_fader_frame"
widget "*ProcessorFrameSelected" style:highest "processor_frame_selected"
widget "*ProcessorFrameActiveSend" style:highest "processor_frame_active_send"
widget "*ProcessorFaderFrame" style:highest "processor_fader_frame"
widget "*ProcessorPreFader" style:highest "processor_prefader"
widget "*ProcessorPreFaderFrame" style:highest "processor_prefader_frame"
widget "*ProcessorFader" style:highest "processor_fader"

View File

@ -96,6 +96,8 @@ Glib::RefPtr<Gdk::Pixbuf> SendProcessorEntry::_slider;
ProcessorEntry::ProcessorEntry (boost::shared_ptr<Processor> p, Width w)
: _processor (p)
, _width (w)
, _visual_state (Gtk::STATE_NORMAL)
, _position (PreFader)
{
_hbox.pack_start (_active, false, false);
_event_box.add (_name);
@ -139,6 +141,64 @@ ProcessorEntry::drag_text () const
return name ();
}
void
ProcessorEntry::set_visual_state (Gtk::StateType t)
{
_visual_state = t;
setup_visuals ();
}
void
ProcessorEntry::set_position (Position p)
{
_position = p;
setup_visuals ();
}
void
ProcessorEntry::setup_visuals ()
{
switch (_position) {
case PreFader:
_event_box.set_name ("ProcessorPreFader");
if (_visual_state == Gtk::STATE_NORMAL) {
_frame.set_name ("ProcessorPreFaderFrame");
}
break;
case Fader:
_event_box.set_name ("ProcessorFader");
if (_visual_state == Gtk::STATE_NORMAL) {
_frame.set_name ("ProcessorFaderFrame");
}
break;
case PostFader:
_event_box.set_name ("ProcessorPostFader");
if (_visual_state == Gtk::STATE_NORMAL) {
_frame.set_name ("ProcessorPostFaderFrame");
}
break;
}
switch (_visual_state) {
case Gtk::STATE_NORMAL:
/* _frame has been set up above */
_event_box.set_state (Gtk::STATE_NORMAL);
break;
case Gtk::STATE_SELECTED:
_frame.set_name ("ProcessorFrameSelected");
/* don't change the background of the box when it is selected */
_event_box.set_state (Gtk::STATE_NORMAL);
break;
case Gtk::STATE_ACTIVE:
_frame.set_name ("ProcessorFrameActiveSend");
_event_box.set_state (Gtk::STATE_ACTIVE);
break;
}
}
boost::shared_ptr<Processor>
ProcessorEntry::processor () const
{
@ -994,7 +1054,7 @@ ProcessorBox::redisplay_processors ()
i = j;
}
setup_entry_widget_names ();
setup_entry_positions ();
}
/** Add a ProcessorWindowProxy for a processor to our list, if that processor does
@ -1085,29 +1145,24 @@ void
ProcessorBox::reordered ()
{
compute_processor_sort_keys ();
setup_entry_widget_names ();
setup_entry_positions ();
}
/* Name the Entry widgets according to pre- or post-fader so that they get coloured right */
void
ProcessorBox::setup_entry_widget_names ()
ProcessorBox::setup_entry_positions ()
{
/* It just so happens that the action_widget() is the event box (which gives the background
* colour) and the widget() is the frame, more by good luck than good judgement.
*/
list<ProcessorEntry*> children = processor_display.children ();
bool pre_fader = true;
for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
if (boost::dynamic_pointer_cast<Amp>((*i)->processor())) {
pre_fader = false;
(*i)->set_position (ProcessorEntry::Fader);
} else {
if (pre_fader) {
(*i)->action_widget().set_name ("ProcessorPreFader");
(*i)->widget().set_name ("ProcessorPreFaderFrame");
(*i)->set_position (ProcessorEntry::PreFader);
} else {
(*i)->action_widget().set_name ("ProcessorPostFader");
(*i)->widget().set_name ("ProcessorPostFaderFrame");
(*i)->set_position (ProcessorEntry::PostFader);
}
}
}

View File

@ -106,6 +106,15 @@ public:
Gtk::EventBox& action_widget ();
Gtk::Widget& widget ();
std::string drag_text () const;
void set_visual_state (Gtk::StateType);
enum Position {
PreFader,
Fader,
PostFader
};
void set_position (Position);
boost::shared_ptr<ARDOUR::Processor> processor () const;
void set_enum_width (Width);
virtual void set_pixel_width (int) {}
@ -120,6 +129,7 @@ private:
void processor_active_changed ();
void processor_property_changed (const PBD::PropertyChange&);
std::string name () const;
void setup_visuals ();
Gtk::Frame _frame;
Gtk::EventBox _event_box;
@ -128,6 +138,8 @@ private:
Gtk::CheckButton _active;
boost::shared_ptr<ARDOUR::Processor> _processor;
Width _width;
Gtk::StateType _visual_state;
Position _position;
PBD::ScopedConnection active_connection;
PBD::ScopedConnection name_connection;
};
@ -293,7 +305,7 @@ class ProcessorBox : public Gtk::HBox, public PluginInterestedObject, public ARD
void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams);
void on_size_allocate (Gtk::Allocation &);
void setup_entry_widget_names ();
void setup_entry_positions ();
static ProcessorBox* _current_processor_box;

View File

@ -35,6 +35,9 @@ public:
/** @return Text to use in the icon that is dragged */
virtual std::string drag_text () const = 0;
/** Set the child's visual state */
virtual void set_visual_state (Gtk::StateType) = 0;
};
/** A VBox whose contents can be dragged and dropped */
@ -495,11 +498,11 @@ private:
assert (c);
if (c == _active) {
c->action_widget().set_state (Gtk::STATE_ACTIVE);
c->set_visual_state (Gtk::STATE_ACTIVE);
} else if (selected (c)) {
c->action_widget().set_state (Gtk::STATE_SELECTED);
c->set_visual_state (Gtk::STATE_SELECTED);
} else {
c->action_widget().set_state (Gtk::STATE_NORMAL);
c->set_visual_state (Gtk::STATE_NORMAL);
}
}