more theming and layout tweaks. new faders that pre-light. fixed some spacing aroun...
authorBen Loftis <ben@glw.com>
Fri, 7 Dec 2012 22:38:49 +0000 (22:38 +0000)
committerBen Loftis <ben@glw.com>
Fri, 7 Dec 2012 22:38:49 +0000 (22:38 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@13617 d708f5d6-7413-0410-9779-e7cbd77b26cf

13 files changed:
gtk2_ardour/ardour3_ui_dark.rc.in
gtk2_ardour/ardour3_ui_default.conf
gtk2_ardour/ardour3_widget_list.rc
gtk2_ardour/editor_regions.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/gain_meter.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/route_time_axis.cc
libs/gtkmm2ext/barcontroller.cc
libs/gtkmm2ext/gtkmm2ext/pixfader.h
libs/gtkmm2ext/pixfader.cc

index 33360fb568955ceb2ee485055c5f53646692b443..2288c11ca84beb6284ba55c510f91ac87522921c 100644 (file)
@@ -201,7 +201,7 @@ style "default" = "medium_text"
 
 style "track_controls_inactive" 
 {
-       bg[NORMAL] =      { 0.60, 0.60, 0.66 }
+       bg[NORMAL] =      { 0.60, 0.20, 0.26 }
        bg[ACTIVE] =      { 0.60, 0.60, 0.66 }
        bg[INSENSITIVE] = { 0.60, 0.60, 0.66 }
        bg[SELECTED] =    { 0.60, 0.60, 0.66 }
index f74f293fea18bb559ace1825be9f2ed152d47e4a..4a4518104d8541ed12066abfa51c945be08c543d 100644 (file)
     <Option name="button border" value="000000f0"/>
     <Option name="processor prefader: fill start" value="873c3cff"/>
     <Option name="processor prefader: fill end" value="542525ff"/>
-    <Option name="processor prefader: fill start active" value="873c3cff"/>
-    <Option name="processor prefader: fill end active" value="542525ff"/>
+    <Option name="processor prefader: fill start active" value="774c4cff"/>
+    <Option name="processor prefader: fill end active" value="603535ff"/>
     <Option name="processor prefader: led" value="26550eff"/>
     <Option name="processor prefader: led active" value="78cb4eff"/>
     <Option name="processor prefader: text" value="aaaaa3ff"/>
     <Option name="processor fader: fill start" value="5d90b0ff"/>
     <Option name="processor fader: fill end" value="154c6eff"/>
     <Option name="processor fader: fill start active" value="5d90b0ff"/>
-    <Option name="processor fader: fill end active" value="154d6fff"/>
+    <Option name="processor fader: fill end active" value="256d8fff"/>
     <Option name="processor fader: led" value="26550eff"/>
     <Option name="processor fader: led active" value="78cb4eff"/>
     <Option name="processor fader: text" value="aaaaa3ff"/>
     <Option name="processor fader: text active" value="eeeeecff"/>
-    <Option name="processor postfader: fill start" value="415947ff"/>
-    <Option name="processor postfader: fill end" value="202d23ff"/>
-    <Option name="processor postfader: fill start active" value="415947ff"/>
-    <Option name="processor postfader: fill end active" value="202d23ff"/>
+    <Option name="processor postfader: fill start" value="354537ff"/>
+    <Option name="processor postfader: fill end" value="202823ff"/>
+    <Option name="processor postfader: fill start active" value="466452ff"/>
+    <Option name="processor postfader: fill end active" value="254528ff"/>
     <Option name="processor postfader: led" value="26550eff"/>
     <Option name="processor postfader: led active" value="78cb4eff"/>
     <Option name="processor postfader: text" value="aaaaa3ff"/>
     <Option name="processor control button: text" value="ffffffff"/>
     <Option name="processor control button: text active" value="ffffffff"/>
     <Option name="monitor button: fill start" value="5f5a58ff"/>
-    <Option name="monitor button: fill end" value="3f3a38ff"/>
+    <Option name="monitor button: fill end" value="4f4a48ff"/>
     <Option name="monitor button: fill start active" value="553500ff"/>
     <Option name="monitor button: fill end active" value="e58505ff"/>
     <Option name="monitor button: led" value="660000ff"/>
     <Option name="solo safe: text" value="c7c7d8ff"/>
     <Option name="solo safe: text active" value="c8c8d9ff"/>
     <Option name="monitor section cut: fill start" value="5f5a58ff"/>
-    <Option name="monitor section cut: fill end" value="3f3a38ff"/>
+    <Option name="monitor section cut: fill end" value="4f4a48ff"/>
     <Option name="monitor section cut: fill start active" value="5f4943ff"/>
     <Option name="monitor section cut: fill end active" value="ffa500ff"/>
     <Option name="monitor section cut: led" value="473812ff"/>
     <Option name="monitor section cut: text" value="c7c7d8ff"/>
     <Option name="monitor section cut: text active" value="000000ff"/>
     <Option name="monitor section dim: fill start" value="5f5a58ff"/>
-    <Option name="monitor section dim: fill end" value="3f3a38ff"/>
+    <Option name="monitor section dim: fill end" value="4f4a48ff"/>
     <Option name="monitor section dim: fill start active" value="553500ff"/>
     <Option name="monitor section dim: fill end active" value="e58505ff"/>
     <Option name="monitor section dim: led active" value="78cb4eff"/>
     <Option name="monitor section dim: text" value="c8c8d9ff"/>
     <Option name="monitor section dim: text active" value="c8c8d9ff"/>
     <Option name="monitor section solo: fill start" value="5f5a58ff"/>
-    <Option name="monitor section solo: fill end" value="3f3a38ff"/>
+    <Option name="monitor section solo: fill end" value="4f4a48ff"/>
     <Option name="monitor section solo: fill start active" value="104506ff"/>
     <Option name="monitor section solo: fill end active" value="4dbb00ff"/>
     <Option name="monitor section solo: led" value="473812ff"/>
     <Option name="monitor section solo: text" value="00000000"/>
     <Option name="monitor section solo: text active" value="00000000"/>
     <Option name="monitor section invert: fill start" value="5f5a58ff"/>
-    <Option name="monitor section invert: fill end" value="3f3a38ff"/>
+    <Option name="monitor section invert: fill end" value="4f4a48ff"/>
     <Option name="monitor section invert: fill start active" value="222260ff"/>
     <Option name="monitor section invert: fill end active" value="4242d0ff"/>
     <Option name="monitor section invert: led" value="473812ff"/>
     <Option name="monitor section invert: text" value="00000000"/>
     <Option name="monitor section invert: text active" value="00000000"/>
     <Option name="monitor section mono: fill start" value="5f5a58ff"/>
-    <Option name="monitor section mono: fill end" value="3f3a38ff"/>
+    <Option name="monitor section mono: fill end" value="4f4a48ff"/>
     <Option name="monitor section mono: fill start active" value="222260ff"/>
     <Option name="monitor section mono: fill end active" value="3232c0ff"/>
     <Option name="monitor section mono: led" value="473812ff"/>
     <Option name="mute button: fill start" value="565659ff"/>
     <Option name="mute button: fill end" value="484853ff"/>
     <Option name="mute button: fill start active" value="5f4943ff"/>
-    <Option name="mute button: fill end active" value="ffa500ff"/>
+    <Option name="mute button: fill end active" value="ffff00ff"/>
     <Option name="mute button: led" value="00000000"/>
     <Option name="mute button: led active" value="00000000"/>
-    <Option name="mute button: text" value="bfbfbfff"/>
+    <Option name="mute button: text" value="bfbfafff"/>
     <Option name="mute button: text active" value="191919ff"/>
     <Option name="solo button: fill start" value="565659ff"/>
     <Option name="solo button: fill end" value="484853ff"/>
     <Option name="solo button: fill end active" value="4dbb00ff"/>
     <Option name="solo button: led" value="00000000"/>
     <Option name="solo button: led active" value="00000000"/>
-    <Option name="solo button: text" value="bfbfbfff"/>
+    <Option name="solo button: text" value="afbfafff"/>
     <Option name="solo button: text active" value="191919ff"/>
     <Option name="invert button: fill start" value="565659ff"/>
     <Option name="invert button: fill end" value="484853ff"/>
     <Option name="route button: fill end active" value="121212ff"/>
     <Option name="route button: led" value="4f3300ff"/>
     <Option name="route button: led active" value="ffa500ff"/>
-    <Option name="route button: text" value="c7c7d8ff"/>
-    <Option name="route button: text active" value="c8c8d9ff"/>
+    <Option name="route button: text" value="bfbfbfff"/>
+    <Option name="route button: text active" value="191919ff"/>
     <Option name="mixer strip button: fill start" value="565659ff"/>
     <Option name="mixer strip button: fill end" value="484853ff"/>
     <Option name="mixer strip button: fill start active" value="5f4943ff"/>
index 63d402aca1bcc157b43d80123e5da8ed3867e77a..f969af002c1f94395972632d6bacd58a8f5ecc64 100644 (file)
@@ -224,6 +224,7 @@ widget "*ParameterValueDisplay" style:highest "medium_bold_entry"
 widget "*PluginUIClickBox" style:highest "medium_bold_entry"
 widget "*PluginUIClickBox*" style:highest "medium_bold_entry"
 widget "*PluginSlider" style:highest "plugin_slider"
+widget "*GainFader" style:highest "plugin_slider"
 widget "*MixerTrackCommentArea" style:highest "option_entry"
 widget "*MixerPanZone" style:highest "pan_zone"
 widget "*LHSList" style:highest "treeview_display"
index bb9b0cf8d96b6e5c3e40166eba6c95bd0aa4dd92..8561fbbfb53f99e7274e90408441a889ff5e13f1 100644 (file)
@@ -79,7 +79,7 @@ EditorRegions::EditorRegions (Editor* e)
 {
        _display.set_size_request (100, -1);
        _display.set_rules_hint (true);
-       _display.set_name ("LHSList");
+       _display.set_name ("EditGroupList");
 
        /* Try to prevent single mouse presses from initiating edits.
           This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
index e1a8bc645030bf6d3c9edbe5672ce1094c71fb93..fb2e67a47b19d93cc053bf202d5d613572c84921 100644 (file)
@@ -223,7 +223,7 @@ EditorRoutes::EditorRoutes (Editor* e)
        _display.get_selection()->set_mode (SELECTION_SINGLE);
        _display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
        _display.set_reorderable (true);
-       _display.set_name (X_("LHSList"));
+       _display.set_name (X_("EditGroupList"));
        _display.set_rules_hint (true);
        _display.set_size_request (100, -1);
        _display.add_object_drag (_columns.route.index(), "routes");
index fbfd769e1e97e3a5bad39d755884a8ea89f5d727..54519546d0265144ca3a73eaf01445ff638347c4 100644 (file)
@@ -135,8 +135,8 @@ GainMeterBase::GainMeterBase (Session* s,
        peak_display.set_label (_("-inf"));
        peak_display.unset_flags (Gtk::CAN_FOCUS);
 
-       gain_automation_style_button.set_name ("MixerAutomationModeButton");
-       gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
+       gain_automation_style_button.set_name ("mixer strip button");
+       gain_automation_state_button.set_name ("mixer strip button");
 
        ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
        ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
@@ -163,6 +163,16 @@ GainMeterBase::GainMeterBase (Session* s,
        UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &GainMeterBase::on_theme_changed));
        ColorsChanged.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), false));
        DPIReset.connect (sigc::bind(sigc::mem_fun (*this, &GainMeterBase::color_handler), true));
+       
+//     PBD::ScopedConnection _config_connection;
+//     Config->ParameterChanged.connect ( _config_connection, MISSING_INVALIDATOR, boost::bind(&GainMeterBase::set_flat_buttons, this, _1), gui_context() );
+}
+
+void
+GainMeterBase::set_flat_buttons ()
+{
+printf("set_flat_butt\n");
+//     gain_slider->set_flat_buttons( ARDOUR_UI::config()->flat_buttons.get() );
 }
 
 GainMeterBase::~GainMeterBase ()
@@ -771,10 +781,10 @@ GainMeterBase::gain_automation_style_changed ()
 {
        switch (_width) {
        case Wide:
-               gain_automation_style_button.set_label (astyle_string(_amp->gain_control()->alist()->automation_style()));
+               gain_automation_style_button.set_text (astyle_string(_amp->gain_control()->alist()->automation_style()));
                break;
        case Narrow:
-               gain_automation_style_button.set_label  (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
+               gain_automation_style_button.set_text  (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
                break;
        }
 }
@@ -788,10 +798,10 @@ GainMeterBase::gain_automation_state_changed ()
 
        switch (_width) {
        case Wide:
-               gain_automation_state_button.set_label (astate_string(_amp->gain_control()->alist()->automation_state()));
+               gain_automation_state_button.set_text (astate_string(_amp->gain_control()->alist()->automation_state()));
                break;
        case Narrow:
-               gain_automation_state_button.set_label (short_astate_string(_amp->gain_control()->alist()->automation_state()));
+               gain_automation_state_button.set_text (short_astate_string(_amp->gain_control()->alist()->automation_state()));
                break;
        }
 
@@ -861,13 +871,13 @@ GainMeter::GainMeter (Session* s, int fader_length)
        , gain_display_box(true, 0)
        , hbox(true, 2)
 {
-       gain_display_box.pack_start (gain_display, true, true);
+//     gain_display_box.pack_start (gain_display, true, true);
 
        meter_metric_area.set_name ("AudioTrackMetrics");
        set_size_request_to_display_given_text (meter_metric_area, "-127", 0, 0);
 
-       gain_automation_style_button.set_name ("MixerAutomationModeButton");
-       gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
+       gain_automation_style_button.set_name ("mixer strip button");
+       gain_automation_state_button.set_name ("mixer strip button");
 
        ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
        ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
@@ -908,13 +918,13 @@ GainMeter::set_controls (boost::shared_ptr<Route> r,
                hbox.remove (meter_alignment);
        }
 
-       if (peak_display.get_parent()) {
-               gain_display_box.remove (peak_display);
-       }
+//     if (peak_display.get_parent()) {
+//             gain_display_box.remove (peak_display);
+//     }
 
-       if (gain_automation_state_button.get_parent()) {
-               fader_vbox->remove (gain_automation_state_button);
-       }
+//     if (gain_automation_state_button.get_parent()) {
+//             fader_vbox->remove (gain_automation_state_button);
+//     }
 
        GainMeterBase::set_controls (r, meter, amp);
 
@@ -932,12 +942,12 @@ GainMeter::set_controls (boost::shared_ptr<Route> r,
           pack some route-dependent stuff.
        */
 
-       gain_display_box.pack_end (peak_display, true, true);
+//     gain_display_box.pack_end (peak_display, true, true);
        hbox.pack_start (meter_alignment, true, true);
 
-       if (r && !r->is_hidden()) {
-               fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
-       }
+//     if (r && !r->is_hidden()) {
+//             fader_vbox->pack_start (gain_automation_state_button, false, false, 0);
+//     }
 
        setup_meters ();
        hbox.show_all ();
index 4536bb691b5b8123acfd4c8dfe5a73e5b31db8c1..73144380ddf54459545a50b8b25e8871a62592f0 100644 (file)
@@ -38,6 +38,8 @@
 #include "ardour/types.h"
 #include "ardour/session_handle.h"
 
+#include "ardour_button.h"
+
 #include "gtkmm2ext/click_box.h"
 #include "gtkmm2ext/focus_entry.h"
 #include "gtkmm2ext/slider_controller.h"
@@ -81,6 +83,8 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
        void set_meter_strip_name (const char * name);
        void set_fader_name (const char * name);
 
+       void set_flat_buttons ();
+
        virtual void setup_meters (int len=0);
 
        boost::shared_ptr<PBD::Controllable> get_controllable();
@@ -114,8 +118,8 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
 
        sigc::connection gain_watching;
 
-       Gtk::Button gain_automation_style_button;
-       Gtk::ToggleButton gain_automation_state_button;
+       ArdourButton gain_automation_style_button;
+       ArdourButton gain_automation_state_button;
 
        Gtk::Menu gain_astate_menu;
        Gtk::Menu gain_astyle_menu;
index 0e0bf893a0c9e3a3170e5dd1e713b719a19c7340..5c6df5fa1d775e802f4300239c619dc0a99af914 100644 (file)
@@ -242,7 +242,8 @@ MixerStrip::init ()
 
        bottom_button_table.set_spacings (2);
        bottom_button_table.set_homogeneous (true);
-       bottom_button_table.attach (group_button, 0, 1, 0, 1);
+//     bottom_button_table.attach (group_button, 0, 1, 0, 1);
+       bottom_button_table.attach (gpm.gain_automation_state_button, 0, 1, 0, 1);
 
        name_button.set_name ("mixer strip button");
        name_button.set_text (" "); /* non empty text, forces creation of the layout */
@@ -399,6 +400,14 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
 
        revert_to_default_display ();
 
+       if (gpm.gain_display.get_parent()) {
+               middle_button_table.remove (gpm.gain_display);
+       }
+
+       if (gpm.peak_display.get_parent()) {
+               middle_button_table.remove (gpm.peak_display);
+       }
+
        if (solo_button->get_parent()) {
                middle_button_table.remove (*solo_button);
        }
@@ -538,6 +547,8 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
        }
 
        gpm.reset_peak_display ();
+       gpm.gain_display.show ();
+       gpm.peak_display.show ();
 
        width_button.show();
        width_hide_box.show();
@@ -554,6 +565,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
        name_button.show();
        _comment_button.show();
        group_button.show();
+       gpm.gain_automation_state_button.show();
 
        parameter_changed ("mixer-strip-visibility");
 
@@ -593,14 +605,24 @@ MixerStrip::set_width_enum (Width w, void* owner)
 
        switch (w) {
        case Wide:
+               if (!gpm.peak_display.get_parent()) {
+                       middle_button_table.attach (gpm.peak_display,1,2,1,2);
+               }
+               if (gpm.gain_display.get_parent()) {
+                       middle_button_table.remove (gpm.gain_display);
+               }
+               if (!gpm.gain_display.get_parent()) {
+                       middle_button_table.attach (gpm.gain_display,0,1,1,2);
+               }
+
                if (show_sends_button)  {
                        show_sends_button->set_text (_("Aux\nSends"));
                        show_sends_button->layout()->set_alignment (Pango::ALIGN_CENTER);
                }
 
-               ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (
+               gpm.gain_automation_style_button.set_text (
                                gpm.astyle_string(gain_automation->automation_style()));
-               ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (
+               gpm.gain_automation_state_button.set_text (
                                gpm.astate_string(gain_automation->automation_state()));
 
                if (_route->panner()) {
@@ -618,6 +640,17 @@ MixerStrip::set_width_enum (Width w, void* owner)
                break;
 
        case Narrow:
+               if (gpm.peak_display.get_parent()) {
+                       middle_button_table.remove (gpm.peak_display);
+               }
+
+               if (gpm.gain_display.get_parent()) {
+                       middle_button_table.remove (gpm.gain_display);
+               }
+               if (!gpm.gain_display.get_parent()) {
+                       middle_button_table.attach (gpm.gain_display,0,2,1,2);
+               }
+
                if (show_sends_button) {
                        show_sends_button->set_text (_("Snd"));
                }
index 560c37bb1d76cfa5a755a0896e72bf08d1cbfcf1..fc39115c33472a7835f9d7c06f873e281afcd01d 100644 (file)
@@ -123,7 +123,7 @@ Mixer_UI::Mixer_UI ()
        group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
        group_display.get_column (0)->set_expand(true);
        group_display.get_column (1)->set_expand(false);
-       group_display.set_name ("LHSList");
+       group_display.set_name ("EditGroupList");
        group_display.get_selection()->set_mode (Gtk::SELECTION_SINGLE);
        group_display.set_reorderable (true);
        group_display.set_headers_visible (true);
@@ -1791,7 +1791,7 @@ Mixer_UI::setup_track_display ()
        track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
        track_display.get_column (0)->set_expand(true);
        track_display.get_column (1)->set_expand(false);
-       track_display.set_name (X_("LHSList"));
+       track_display.set_name (X_("EditGroupList"));
        track_display.get_selection()->set_mode (Gtk::SELECTION_NONE);
        track_display.set_reorderable (true);
        track_display.set_headers_visible (true);
index 3ba36ea6aa4e1adcb2a1f5a9860f828f715c949e..0fbbd834701a335fdb7176707e22de140015a98c 100644 (file)
@@ -117,7 +117,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& c
        , playlist_action_menu (0)
        , mode_menu (0)
        , color_mode_menu (0)
-       , gm (sess, slider, slider_desensitised, true, 115)
+       , gm (sess, slider, slider_desensitised, true, 125)
        , _ignore_set_layer_display (false)
 {
 }
@@ -205,11 +205,11 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
         }
 
        controls_table.attach (route_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
-       Gtk::VBox* pad = manage (new Gtk::VBox);
-       pad->pack_start (gm.get_gain_slider(), false, false);
-       pad->pack_start (*manage (new Gtk::Label), true, true);
-       pad->show_all ();
-       controls_table.attach (*pad, 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
+//     Gtk::VBox* pad = manage (new Gtk::VBox);
+//     pad->pack_start (gm.get_gain_slider(), false, false);
+//     pad->pack_start (*manage (new Gtk::Label), true, true);
+//     pad->show_all ();
+       controls_table.attach (gm.get_gain_slider(), 0, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
 
        ARDOUR_UI::instance()->set_tip(*solo_button,_("Solo"));
        ARDOUR_UI::instance()->set_tip(*mute_button,_("Mute"));
@@ -261,7 +261,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        route_group_menu = new RouteGroupMenu (_session, plist);
 
        gm.get_gain_slider().signal_scroll_event().connect(sigc::mem_fun(*this, &RouteTimeAxisView::controls_ebox_scroll), false);
-       gm.get_gain_slider().set_name ("TrackGainFader");
+       gm.get_gain_slider().set_name ("GainFader");
 
        gm.get_level_meter().signal_scroll_event().connect (sigc::mem_fun (*this, &RouteTimeAxisView::controls_ebox_scroll), false);
 
index baa36418b1cf24eccbf697f69e9fce9884c16412..3afd0a98b939ca5c3c6e462241424075cc98280f 100644 (file)
@@ -285,8 +285,8 @@ BarController::create_patterns ()
        float rheight = darea.get_height()-2;
 
        cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, rheight);
-       cairo_pattern_add_color_stop_rgba (pat, 0, r*0.3,g*0.3,b*0.3, 1.0);
-       cairo_pattern_add_color_stop_rgba (pat, 1, r, g, b, 1.0);
+       cairo_pattern_add_color_stop_rgba (pat, 0, r*0.8,g*0.8,b*0.8, 1.0);
+       cairo_pattern_add_color_stop_rgba (pat, 1, r*0.6,g*0.6,b*0.6, 1.0);
        Cairo::RefPtr<Cairo::Pattern> p (new Cairo::Pattern (pat, false));
        pattern = p;
        cairo_pattern_destroy(pat);
@@ -439,44 +439,26 @@ BarController::expose (GdkEventExpose* /*event*/)
                w = darea.get_width() - 2;
                h = darea.get_height() - 2;
 
-               x2 = (gint) floor (w * (0.1+0.9*fract));
+               x2 = (gint) floor (w * fract);
                y2 = h;
                radius = 4;
+               if (x2 < 8) x2 = 8;
 
-                /* border */
+               /* border */
 
-                c = get_style()->get_bg (get_state());
-                r = c.get_red_p ();
-                g = c.get_green_p ();
-                b = c.get_blue_p ();
-                context->set_source_rgb (0,0,0);
-                rounded_rectangle (context, 0, 0, darea.get_width(), darea.get_height() , radius);
-                context->fill ();
+               context->set_source_rgb (0,0,0);
+               cairo_rectangle (context->cobj(), 0, 0, darea.get_width(), darea.get_height());
+               context->fill ();
 
                /* draw active box */
 
-                c = get_style()->get_fg (get_state());
-                r = c.get_red_p ();
-                g = c.get_green_p ();
-                b = c.get_blue_p ();
-                context->set_source (pattern);
-                rounded_rectangle (context, 1, 1, x2, y2, radius-1.5);
-                context->fill ();
-
-                context->set_source (shine_pattern);
-                rounded_rectangle (context, 2, 3, x2-2, y2-8, radius-2);
-                context->fill ();
-
-               /* draw inactive box */
-
-//                c = get_style()->get_fg (STATE_INSENSITIVE);
- //               r = c.get_red_p ();
-  //              g = c.get_green_p ();
-   //             b = c.get_blue_p ();
-    //            context->set_source_rgb (r, g, b);
-     //           rounded_rectangle (context, 1 + x2, 1 + y1, w - x2, y2);
-      //          context->fill ();
+               context->set_source (pattern);
+               rounded_rectangle (context, 1, 1, x2, y2, radius-1.5);
+               context->fill ();
 
+//             context->set_source (shine_pattern);
+//             rounded_rectangle (context, 2, 3, x2-2, y2-8, radius-2);
+//             context->fill ();
                break;
 
        case RightToLeft:
index fcf3c61b54ff4c031b504b999497b168c7f5dd1d..068d740272b9542eaa45b5994447f68c38ae66b0 100644 (file)
@@ -40,12 +40,11 @@ class PixFader : public Gtk::DrawingArea
 
        void set_default_value (float);
 
-       void create_patterns ();
-
   protected:
        Gtk::Adjustment& adjustment;
 
        void on_size_request (GtkRequisition*);
+       void on_size_allocate (Gtk::Allocation& alloc);
 
        bool on_expose_event (GdkEventExpose*);
        bool on_button_press_event (GdkEventButton*);
@@ -72,9 +71,6 @@ class PixFader : public Gtk::DrawingArea
         Cairo::RefPtr<Cairo::ImageSurface> belt_surface[STATES];
         Glib::RefPtr<Gdk::Pixbuf> pixbuf[STATES];
 
-       Cairo::RefPtr<Cairo::Pattern> pattern;
-       Cairo::RefPtr<Cairo::Pattern> shine_pattern;
-
        int span, girth;
        int _orien;
         float left_r;
@@ -86,6 +82,12 @@ class PixFader : public Gtk::DrawingArea
 
        GdkRectangle view;
 
+       void create_patterns();
+       cairo_pattern_t* pattern;
+       cairo_pattern_t* shine_pattern;
+
+       bool _hovering;
+
        GdkWindow* grab_window;
        double grab_loc;
        double grab_start;
index 02597f331eca14297b342635f8d3d935b2f7b349..11420159c44de8b5569cf8121f6e984a936fb553 100644 (file)
 #include "gtkmm2ext/pixfader.h"
 #include "gtkmm2ext/keyboard.h"
 #include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/utils.h"
 
 using namespace Gtkmm2ext;
 using namespace Gtk;
 using namespace std;
 
+#define CORNER_RADIUS 4
+#define FADER_RESERVE (2*CORNER_RADIUS)
+
 PixFader::PixFader (
        Glib::RefPtr<Gdk::Pixbuf> belt,
        Glib::RefPtr<Gdk::Pixbuf> belt_desensitised,
@@ -41,6 +45,10 @@ PixFader::PixFader (
        pixbuf[NORMAL] = belt;
        pixbuf[DESENSITISED] = belt_desensitised;
        
+       pattern = 0;
+       shine_pattern = 0;
+       
+       _hovering = false;
        dragging = false;
        default_value = adjustment.get_value();
        last_drawn = -1;
@@ -49,9 +57,9 @@ PixFader::PixFader (
        view.y = 0;
 
        if (orientation == VERT) {
-               view.width = girth = pixbuf[0]->get_width();
+               view.width = girth = 24;
        } else {
-               view.height = girth = pixbuf[0]->get_height();
+               view.height = girth = 24;
        }
 
        set_fader_length (fader_length);
@@ -103,66 +111,93 @@ PixFader::set_border_colors (uint32_t left, uint32_t right)
         right_b = b/255.0;
 }
 
+void
+PixFader::create_patterns ()
+{
+       Gdk::Color c = get_style()->get_fg (get_state());
+    float r, g, b;
+       r = c.get_red_p ();
+       g = c.get_green_p ();
+       b = c.get_blue_p ();
+
+       if (_orien == VERT) {
+               pattern = cairo_pattern_create_linear (0.0, 0.0, get_width(), 0);
+               cairo_pattern_add_color_stop_rgba (pattern, 0, r*0.8,g*0.8,b*0.8, 1.0);
+               cairo_pattern_add_color_stop_rgba (pattern, 1, r*0.6,g*0.6,b*0.6, 1.0);
+
+               shine_pattern = cairo_pattern_create_linear (0.0, 0.0, 15, 0);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 0, 1,1,1,0.0);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 0.2, 1,1,1,0.3);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.0);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.0);
+       } else {
+               float rheight = get_height();
+       
+               pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, rheight);
+               cairo_pattern_add_color_stop_rgba (pattern, 0, r*0.8,g*0.8,b*0.8, 1.0);
+               cairo_pattern_add_color_stop_rgba (pattern, 1, r*0.6,g*0.6,b*0.6, 1.0);
+
+               shine_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, rheight);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 0, 1,1,1,0.0);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 0.2, 1,1,1,0.3);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.0);
+               cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.0);
+       }
+       
+}
+
 bool
 PixFader::on_expose_event (GdkEventExpose* ev)
 {
-       int const pi = get_sensitive() ? NORMAL : DESENSITISED;
+       Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
+       cairo_t* cr = context->cobj();
+
+       if (!pattern) {
+               create_patterns();
+       }
+       
+//     int const pi = get_sensitive() ? NORMAL : DESENSITISED;
        
-        Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
-       int srcx, srcy;
-       int const ds = display_span ();
-       int offset_into_pixbuf = (int) floor (span / ((float) span / ds));
+       int ds = display_span ();
+
+       float w = get_width();
+       float h = get_height();
+       float radius = CORNER_RADIUS;
+
+       /* black border */
+
+       cairo_set_source_rgb (cr, 0,0,0);
+       cairo_rectangle (cr, 0, 0, w, h);
+       cairo_fill (cr);
+
+       /* draw active box */
 
-       /* account for fader lengths that are shorter than the fader pixbuf */
        if (_orien == VERT) {
-               offset_into_pixbuf += pixbuf[pi]->get_height() / 2 - view.height;
+               if (ds > h - FADER_RESERVE)
+                       ds = h - FADER_RESERVE;
+
+               cairo_set_source (cr, pattern);
+               Gtkmm2ext::rounded_rectangle (cr, 1, 1+ds, w-2, h-(1+ds)-1, radius-1.5);
+               cairo_fill (cr);
+
+//             cairo_set_source (cr, shine_pattern);
+//             Gtkmm2ext::rounded_rectangle (cr, 2, ds, w-4, h-(1+ds)-1, radius-1.5);
+//             cairo_fill (cr);
        } else {
-               offset_into_pixbuf += pixbuf[pi]->get_width() / 2 - view.width;
-       }
+               if (ds < FADER_RESERVE)
+                       ds = FADER_RESERVE;
 
-        context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
-        context->clip ();
-       
-        if (_orien == VERT) {
-                srcx = 0;
-                srcy = offset_into_pixbuf;
-        } else {
-                srcx = offset_into_pixbuf;
-                srcy = 0;
-        }
-
-        /* fader */
-
-        context->save();
-        context->set_source (belt_surface[pi], -srcx, -srcy);
-        context->rectangle (0, 0, get_width(), get_height());
-        context->clip ();
-        context->paint();
-        context->restore();
-
-        /* bounding box lines (2 colors for nicer visuals) */
-        
-        /* top and left side */
-
-        context->set_line_width (1);
-        context->set_source_rgb (left_r, left_g, left_b);
-        context->move_to (view.width - 1, 0); /* upper right */
-        context->line_to (0, 0);              /* upper left */
-        context->line_to (0, view.height - 1);/* lower left */
-        context->stroke ();
-
-        /* bottom & right side */
-
-        context->set_line_width (1);
-        context->set_source_rgb (right_r, right_g, right_b);
-        context->move_to (0, view.height - 0.5); /* lower left */
-        context->line_to (view.width - 0.5, view.height - 0.5); /* lower right */
-        context->line_to (view.width - 0.5, 0); /* upper right */
-        context->stroke ();
+               cairo_set_source (cr, pattern);
+               Gtkmm2ext::rounded_rectangle (cr, 1, 1, ds-1, h-2, radius-1.5);
+               cairo_fill (cr);
 
+//             cairo_set_source (cr, shine_pattern);
+//             Gtkmm2ext::rounded_rectangle (cr, 2, 3, ds-1, 15, radius-1.5);
+//             cairo_fill (cr);
+       }
+       
        /* always draw the unity-position line */
 
-
        if (_orien == VERT) {
                 context->set_line_width (1); 
                 context->set_source_rgb (0.0, 1.0, 0.0);
@@ -173,10 +208,18 @@ PixFader::on_expose_event (GdkEventExpose* ev)
                 context->set_line_width (1); 
                 context->set_source_rgb (0.0, 1.0, 0.0);
                 context->move_to (unity_loc, 1);
-                context->line_to (unity_loc, girth - 1);
+                context->line_to (unity_loc, girth);
                 context->stroke ();
        }
 
+//     if (Config->get_widget_prelight()) {  //pixfader does not have access to config
+               if (_hovering) {
+                       Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3);
+                       cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.2);
+                       cairo_fill (cr);
+               }
+//     }
+
        last_drawn = ds;
 
        return true;
@@ -189,6 +232,21 @@ PixFader::on_size_request (GtkRequisition* req)
        req->height = view.height;
 }
 
+void
+PixFader::on_size_allocate (Gtk::Allocation& alloc)
+{
+       DrawingArea::on_size_allocate(alloc);
+       if (_orien == VERT) {
+               view.height = span = alloc.get_height();
+       } else {
+               view.width = span = alloc.get_width();
+       }
+
+       update_unity_position ();
+
+       queue_draw ();
+}
+
 bool
 PixFader::on_button_press_event (GdkEventButton* ev)
 {
@@ -370,7 +428,14 @@ int
 PixFader::display_span ()
 {
        float fract = (adjustment.get_value () - adjustment.get_lower()) / ((adjustment.get_upper() - adjustment.get_lower()));
-       return (_orien != VERT) ? (int)floor (span * (1.0 - fract)) : (int)floor (span * fract);
+       int ds;
+       if (_orien == VERT) {
+               ds = (int)floor ( span * (1.0 - fract));
+       } else {
+               ds = (int)floor (span * fract);
+       }
+       
+       return ds;
 }
 
 void
@@ -402,14 +467,18 @@ PixFader::update_unity_position ()
 bool
 PixFader::on_enter_notify_event (GdkEventCrossing*)
 {
+       _hovering = true;
        Keyboard::magic_widget_grab_focus ();
+       queue_draw ();
        return false;
 }
 
 bool
 PixFader::on_leave_notify_event (GdkEventCrossing*)
 {
+       _hovering = false;
        Keyboard::magic_widget_drop_focus();
+       queue_draw ();
        return false;
 }