goodbye pixmaps and pixbufs (no longer) used by Gtkmm2ext::PixFader

git-svn-id: svn://localhost/ardour2/branches/3.0@13827 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2013-01-10 15:25:11 +00:00
parent 31172d0c71
commit b1029a3caf
13 changed files with 42 additions and 189 deletions

View file

@ -273,9 +273,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
setup_gtk_ardour_enums (); setup_gtk_ardour_enums ();
setup_profile (); setup_profile ();
GainMeter::setup_slider_pix ();
RouteTimeAxisView::setup_slider_pix ();
ProcessorEntry::setup_slider_pix ();
SessionEvent::create_per_thread_pool ("GUI", 512); SessionEvent::create_per_thread_pool ("GUI", 512);
} catch (failed_constructor& err) { } catch (failed_constructor& err) {

View file

@ -61,27 +61,8 @@ sigc::signal<void> GainMeterBase::ResetAllPeakDisplays;
sigc::signal<void,RouteGroup*> GainMeterBase::ResetGroupPeakDisplays; sigc::signal<void,RouteGroup*> GainMeterBase::ResetGroupPeakDisplays;
GainMeter::MetricPatterns GainMeter::metric_patterns; GainMeter::MetricPatterns GainMeter::metric_patterns;
Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider;
Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider_desensitised;
GainMeterBase::GainMeterBase (Session* s, bool horizontal, int fader_length)
void
GainMeter::setup_slider_pix ()
{
if ((slider = ::get_icon ("fader_belt")) == 0) {
throw failed_constructor();
}
if ((slider_desensitised = ::get_icon ("fader_belt_desensitised")) == 0) {
throw failed_constructor();
}
}
GainMeterBase::GainMeterBase (Session* s,
const Glib::RefPtr<Gdk::Pixbuf>& pix,
const Glib::RefPtr<Gdk::Pixbuf>& pix_desensitised,
bool horizontal,
int fader_length)
: gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1) : gain_adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0.0, 1.0, 0.01, 0.1)
, gain_automation_style_button ("") , gain_automation_style_button ("")
, gain_automation_state_button ("") , gain_automation_state_button ("")
@ -100,17 +81,9 @@ GainMeterBase::GainMeterBase (Session* s,
_width = Wide; _width = Wide;
if (horizontal) { if (horizontal) {
gain_slider = manage (new HSliderController (pix, gain_slider = manage (new HSliderController (&gain_adjustment, fader_length, false));
pix_desensitised,
&gain_adjustment,
fader_length,
false));
} else { } else {
gain_slider = manage (new VSliderController (pix, gain_slider = manage (new VSliderController (&gain_adjustment, fader_length, false));
pix_desensitised,
&gain_adjustment,
fader_length,
false));
} }
level_meter = new LevelMeter(_session); level_meter = new LevelMeter(_session);
@ -881,7 +854,7 @@ GainMeterBase::on_theme_changed()
} }
GainMeter::GainMeter (Session* s, int fader_length) GainMeter::GainMeter (Session* s, int fader_length)
: GainMeterBase (s, slider, slider_desensitised, false, fader_length) : GainMeterBase (s, false, fader_length)
, gain_display_box(true, 0) , gain_display_box(true, 0)
, hbox(true, 2) , hbox(true, 2)
{ {

View file

@ -67,8 +67,7 @@ namespace Gtk {
class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
{ {
public: public:
GainMeterBase (ARDOUR::Session*, const Glib::RefPtr<Gdk::Pixbuf>&, const Glib::RefPtr<Gdk::Pixbuf> &, GainMeterBase (ARDOUR::Session*, bool horizontal, int);
bool horizontal, int);
virtual ~GainMeterBase (); virtual ~GainMeterBase ();
virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route, virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
@ -211,8 +210,6 @@ class GainMeter : public GainMeterBase, public Gtk::VBox
int get_gm_width (); int get_gm_width ();
void setup_meters (int len=0); void setup_meters (int len=0);
static void setup_slider_pix ();
protected: protected:
void hide_all_meters (); void hide_all_meters ();
@ -233,9 +230,6 @@ class GainMeter : public GainMeterBase, public Gtk::VBox
Gtk::Alignment fader_alignment; Gtk::Alignment fader_alignment;
Gtk::Alignment meter_alignment; Gtk::Alignment meter_alignment;
std::vector<ARDOUR::DataType> _types; std::vector<ARDOUR::DataType> _types;
static Glib::RefPtr<Gdk::Pixbuf> slider;
static Glib::RefPtr<Gdk::Pixbuf> slider_desensitised;
}; };
#endif /* __ardour_gtk_gain_meter_h__ */ #endif /* __ardour_gtk_gain_meter_h__ */

View file

@ -224,21 +224,7 @@ FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t>
, _get (g) , _get (g)
, _set (s) , _set (s)
{ {
_pix = ::get_icon (X_("fader_belt_h")); _db_slider = manage (new HSliderController (&_db_adjustment, 115, false));
if (_pix == 0) {
throw failed_constructor ();
}
_pix_desensitised = ::get_icon (X_("fader_belt_h_desensitised"));
if (_pix_desensitised == 0) {
throw failed_constructor ();
}
_db_slider = manage (new HSliderController (_pix,
_pix_desensitised,
&_db_adjustment,
115,
false));
_label.set_text (n + ":"); _label.set_text (n + ":");
_label.set_name (X_("OptionsLabel")); _label.set_name (X_("OptionsLabel"));

View file

@ -522,8 +522,6 @@ private:
Gtk::Adjustment _db_adjustment; Gtk::Adjustment _db_adjustment;
Gtkmm2ext::HSliderController* _db_slider; Gtkmm2ext::HSliderController* _db_slider;
Glib::RefPtr<Gdk::Pixbuf> _pix;
Glib::RefPtr<Gdk::Pixbuf> _pix_desensitised;
Gtk::Entry _db_display; Gtk::Entry _db_display;
Gtk::Label _label; Gtk::Label _label;
Gtk::HBox _box; Gtk::HBox _box;

View file

@ -90,8 +90,6 @@ RefPtr<Action> ProcessorBox::cut_action;
RefPtr<Action> ProcessorBox::rename_action; RefPtr<Action> ProcessorBox::rename_action;
RefPtr<Action> ProcessorBox::edit_action; RefPtr<Action> ProcessorBox::edit_action;
RefPtr<Action> ProcessorBox::edit_generic_action; RefPtr<Action> ProcessorBox::edit_generic_action;
Glib::RefPtr<Gdk::Pixbuf> ProcessorEntry::_slider_pixbuf;
Glib::RefPtr<Gdk::Pixbuf> ProcessorEntry::_slider_pixbuf_desensitised;
ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w) ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processor> p, Width w)
: _button (ArdourButton::led_default_elements) : _button (ArdourButton::led_default_elements)
@ -122,12 +120,7 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
set<Evoral::Parameter> p = _processor->what_can_be_automated (); set<Evoral::Parameter> p = _processor->what_can_be_automated ();
for (set<Evoral::Parameter>::iterator i = p.begin(); i != p.end(); ++i) { for (set<Evoral::Parameter>::iterator i = p.begin(); i != p.end(); ++i) {
Control* c = new Control ( Control* c = new Control (_processor->automation_control (*i), _processor->describe_parameter (*i));
_slider_pixbuf,
_slider_pixbuf_desensitised,
_processor->automation_control (*i),
_processor->describe_parameter (*i)
);
_controls.push_back (c); _controls.push_back (c);
@ -303,15 +296,6 @@ ProcessorEntry::name (Width w) const
return name_display; return name_display;
} }
void
ProcessorEntry::setup_slider_pix ()
{
_slider_pixbuf = ::get_icon ("fader_belt_h_thin");
assert (_slider_pixbuf);
_slider_pixbuf_desensitised = ::get_icon ("fader_belt_h_thin_desensitised");
assert (_slider_pixbuf_desensitised);
}
void void
ProcessorEntry::set_pixel_width (int p) ProcessorEntry::set_pixel_width (int p)
{ {
@ -407,10 +391,10 @@ ProcessorEntry::toggle_control_visibility (Control* c)
_parent->update_gui_object_state (this); _parent->update_gui_object_state (this);
} }
ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, Glib::RefPtr<Gdk::Pixbuf> sd, boost::shared_ptr<AutomationControl> c, string const & n) ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string const & n)
: _control (c) : _control (c)
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
, _slider (s, sd, &_adjustment, 0, false) , _slider (&_adjustment, 0, false)
, _slider_persistant_tooltip (&_slider) , _slider_persistant_tooltip (&_slider)
, _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator)) , _button (ArdourButton::Element (ArdourButton::Text | ArdourButton::Indicator))
, _ignore_ui_adjustment (false) , _ignore_ui_adjustment (false)

View file

@ -131,8 +131,6 @@ public:
std::string state_id () const; std::string state_id () const;
Gtk::Menu* build_controls_menu (); Gtk::Menu* build_controls_menu ();
static void setup_slider_pix ();
protected: protected:
ArdourButton _button; ArdourButton _button;
Gtk::VBox _vbox; Gtk::VBox _vbox;
@ -140,9 +138,6 @@ protected:
virtual void setup_visuals (); virtual void setup_visuals ();
static Glib::RefPtr<Gdk::Pixbuf> _slider_pixbuf;
static Glib::RefPtr<Gdk::Pixbuf> _slider_pixbuf_desensitised;
private: private:
void led_clicked(); void led_clicked();
void processor_active_changed (); void processor_active_changed ();
@ -159,7 +154,7 @@ private:
class Control : public sigc::trackable { class Control : public sigc::trackable {
public: public:
Control (Glib::RefPtr<Gdk::Pixbuf>, Glib::RefPtr<Gdk::Pixbuf>, boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &); Control (boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &);
void set_pixel_width (int); void set_pixel_width (int);
void set_visible (bool); void set_visible (bool);

View file

@ -85,21 +85,6 @@ using namespace Editing;
using namespace std; using namespace std;
using std::list; using std::list;
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider_desensitised;
void
RouteTimeAxisView::setup_slider_pix ()
{
if ((slider = ::get_icon ("fader_belt_h_medium")) == 0) {
throw failed_constructor ();
}
if ((slider_desensitised = ::get_icon ("fader_belt_h_medium_desensitised")) == 0) {
throw failed_constructor ();
}
}
RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas) RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
: AxisView(sess) : AxisView(sess)
, RouteUI(sess) , RouteUI(sess)
@ -117,7 +102,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& c
, playlist_action_menu (0) , playlist_action_menu (0)
, mode_menu (0) , mode_menu (0)
, color_mode_menu (0) , color_mode_menu (0)
, gm (sess, slider, slider_desensitised, true, 125) , gm (sess, true, 125)
, _ignore_set_layer_display (false) , _ignore_set_layer_display (false)
{ {
} }

View file

@ -142,8 +142,6 @@ public:
std::string state_id() const; std::string state_id() const;
static void setup_slider_pix ();
protected: protected:
friend class StreamView; friend class StreamView;
@ -289,9 +287,6 @@ protected:
GainMeterBase gm; GainMeterBase gm;
static Glib::RefPtr<Gdk::Pixbuf> slider;
static Glib::RefPtr<Gdk::Pixbuf> slider_desensitised;
XMLNode* underlay_xml_node; XMLNode* underlay_xml_node;
bool set_underlay_state(); bool set_underlay_state();

View file

@ -32,7 +32,7 @@ namespace Gtkmm2ext {
class PixFader : public Gtk::DrawingArea class PixFader : public Gtk::DrawingArea
{ {
public: public:
PixFader (Glib::RefPtr<Gdk::Pixbuf>, Glib::RefPtr<Gdk::Pixbuf>, Gtk::Adjustment& adjustment, int orientation, int); PixFader (Gtk::Adjustment& adjustment, int orientation, int);
virtual ~PixFader (); virtual ~PixFader ();
void set_fader_length (int); void set_fader_length (int);
@ -79,12 +79,6 @@ class PixFader : public Gtk::DrawingArea
STATES STATES
}; };
#if 0
Cairo::RefPtr<Cairo::Context> belt_context[STATES];
Cairo::RefPtr<Cairo::ImageSurface> belt_surface[STATES];
Glib::RefPtr<Gdk::Pixbuf> pixbuf[STATES];
#endif
int span, girth; int span, girth;
int _orien; int _orien;
float left_r; float left_r;
@ -94,8 +88,6 @@ class PixFader : public Gtk::DrawingArea
float right_g; float right_g;
float right_b; float right_b;
GdkRectangle view;
cairo_pattern_t* pattern; cairo_pattern_t* pattern;
cairo_pattern_t* shine_pattern; cairo_pattern_t* shine_pattern;

View file

@ -39,7 +39,7 @@ namespace Gtkmm2ext {
class SliderController : public Gtkmm2ext::PixFader class SliderController : public Gtkmm2ext::PixFader
{ {
public: public:
SliderController (Glib::RefPtr<Gdk::Pixbuf>, Glib::RefPtr<Gdk::Pixbuf>, Gtk::Adjustment* adj, int orientation, int); SliderController (Gtk::Adjustment* adj, int orientation, int);
virtual ~SliderController () {} virtual ~SliderController () {}
@ -53,8 +53,6 @@ class SliderController : public Gtkmm2ext::PixFader
protected: protected:
BindingProxy binding_proxy; BindingProxy binding_proxy;
Glib::RefPtr<Gdk::Pixbuf> slider;
Glib::RefPtr<Gdk::Pixbuf> rail;
Gtk::SpinButton spin; Gtk::SpinButton spin;
Gtk::Frame spin_frame; Gtk::Frame spin_frame;
Gtk::HBox spin_hbox; Gtk::HBox spin_hbox;
@ -65,19 +63,13 @@ class SliderController : public Gtkmm2ext::PixFader
class VSliderController : public SliderController class VSliderController : public SliderController
{ {
public: public:
VSliderController (Glib::RefPtr<Gdk::Pixbuf> image, VSliderController (Gtk::Adjustment *adj, int, bool with_numeric = true);
Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj, int,
bool with_numeric = true);
}; };
class HSliderController : public SliderController class HSliderController : public SliderController
{ {
public: public:
HSliderController (Glib::RefPtr<Gdk::Pixbuf> image, HSliderController (Gtk::Adjustment *adj, int, bool with_numeric = true);
Glib::RefPtr<Gdk::Pixbuf> image_desensitised,
Gtk::Adjustment *adj, int,
bool with_numeric = true);
}; };

View file

@ -32,21 +32,10 @@ using namespace std;
#define CORNER_RADIUS 4 #define CORNER_RADIUS 4
#define FADER_RESERVE (2*CORNER_RADIUS) #define FADER_RESERVE (2*CORNER_RADIUS)
PixFader::PixFader ( PixFader::PixFader (Gtk::Adjustment& adj, int orientation, int fader_length)
Glib::RefPtr<Gdk::Pixbuf> belt, : adjustment (adj)
Glib::RefPtr<Gdk::Pixbuf> belt_desensitised, , _orien (orientation)
Gtk::Adjustment& adj,
int orientation,
int fader_length
)
: adjustment (adj),
_orien(orientation)
{ {
#if 0
pixbuf[NORMAL] = belt;
pixbuf[DESENSITISED] = belt_desensitised;
#endif
pattern = 0; pattern = 0;
shine_pattern = 0; shine_pattern = 0;
@ -55,14 +44,7 @@ PixFader::PixFader (
default_value = adjustment.get_value(); default_value = adjustment.get_value();
last_drawn = -1; last_drawn = -1;
view.x = 0; girth = 24;
view.y = 0;
if (orientation == VERT) {
view.width = girth = 24;
} else {
view.height = girth = 24;
}
set_fader_length (fader_length); set_fader_length (fader_length);
@ -71,23 +53,6 @@ PixFader::PixFader (
adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed)); adjustment.signal_value_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed)); adjustment.signal_changed().connect (mem_fun (*this, &PixFader::adjustment_changed));
#if 0
for (int i = 0; i < STATES; ++i) {
Cairo::Format format;
if (pixbuf[i]->get_has_alpha()) {
format = Cairo::FORMAT_ARGB32;
} else {
format = Cairo::FORMAT_RGB24;
}
belt_surface[i] = Cairo::ImageSurface::create (format, pixbuf[i]->get_width(), pixbuf[i]->get_height());
belt_context[i] = Cairo::Context::create (belt_surface[i]);
Gdk::Cairo::set_source_pixbuf (belt_context[i], pixbuf[i], 0.0, 0.0);
belt_context[i]->paint();
}
#endif
left_r = 0; left_r = 0;
left_g = 0; left_g = 0;
left_b = 0; left_b = 0;
@ -119,7 +84,7 @@ void
PixFader::create_patterns () PixFader::create_patterns ()
{ {
Gdk::Color c = get_style()->get_fg (get_state()); Gdk::Color c = get_style()->get_fg (get_state());
float r, g, b; float r, g, b;
r = c.get_red_p (); r = c.get_red_p ();
g = c.get_green_p (); g = c.get_green_p ();
b = c.get_blue_p (); b = c.get_blue_p ();
@ -161,7 +126,7 @@ PixFader::create_patterns ()
} }
bool bool
PixFader::on_expose_event (GdkEventExpose* ev) PixFader::on_expose_event (GdkEventExpose*)
{ {
Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context(); Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
cairo_t* cr = context->cobj(); cairo_t* cr = context->cobj();
@ -254,18 +219,24 @@ PixFader::on_expose_event (GdkEventExpose* ev)
void void
PixFader::on_size_request (GtkRequisition* req) PixFader::on_size_request (GtkRequisition* req)
{ {
req->width = view.width; if (_orien == VERT) {
req->height = view.height; req->width = girth;
req->height = span;
} else {
req->height = girth;
req->width = span;
}
} }
void void
PixFader::on_size_allocate (Gtk::Allocation& alloc) PixFader::on_size_allocate (Gtk::Allocation& alloc)
{ {
DrawingArea::on_size_allocate(alloc); DrawingArea::on_size_allocate(alloc);
if (_orien == VERT) { if (_orien == VERT) {
view.height = span = alloc.get_height(); span = alloc.get_height();
} else { } else {
view.width = span = alloc.get_width(); span = alloc.get_width();
} }
update_unity_position (); update_unity_position ();
@ -479,9 +450,9 @@ void
PixFader::set_fader_length (int l) PixFader::set_fader_length (int l)
{ {
if (_orien == VERT) { if (_orien == VERT) {
view.height = span = l; span = l;
} else { } else {
view.width = span = l; span = l;
} }
update_unity_position (); update_unity_position ();
@ -493,9 +464,9 @@ void
PixFader::update_unity_position () PixFader::update_unity_position ()
{ {
if (_orien == VERT) { if (_orien == VERT) {
unity_loc = (int) rint (view.height * (1 - (default_value / (adjustment.get_upper() - adjustment.get_lower())))) - 1; unity_loc = (int) rint (span * (1 - (default_value / (adjustment.get_upper() - adjustment.get_lower())))) - 1;
} else { } else {
unity_loc = (int) rint (default_value * view.width); unity_loc = (int) rint (default_value * span);
} }
queue_draw (); queue_draw ();

View file

@ -28,15 +28,9 @@
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace PBD; using namespace PBD;
SliderController::SliderController ( SliderController::SliderController (Gtk::Adjustment *adj, int orientation, int fader_length)
Glib::RefPtr<Gdk::Pixbuf> image, : PixFader (*adj, orientation, fader_length)
Glib::RefPtr<Gdk::Pixbuf> image_desensitised, , spin (*adj, 0, 2)
Gtk::Adjustment *adj,
int orientation,
int fader_length
)
: PixFader (image, image_desensitised, *adj, orientation, fader_length),
spin (*adj, 0, 2)
{ {
spin.set_name ("SliderControllerValue"); spin.set_name ("SliderControllerValue");
spin.set_size_request (70,-1); // should be based on font size somehow spin.set_size_request (70,-1); // should be based on font size somehow
@ -60,11 +54,9 @@ SliderController::on_button_press_event (GdkEventButton *ev)
return PixFader::on_button_press_event (ev); return PixFader::on_button_press_event (ev);
} }
VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> image, Glib::RefPtr<Gdk::Pixbuf> image_desensitised, VSliderController::VSliderController (Gtk::Adjustment *adj, int fader_length, bool with_numeric)
Gtk::Adjustment *adj, int fader_length,
bool with_numeric)
: SliderController (image, image_desensitised, adj, VERT, fader_length) : SliderController (adj, VERT, fader_length)
{ {
if (with_numeric) { if (with_numeric) {
spin_frame.add (spin); spin_frame.add (spin);
@ -75,11 +67,10 @@ VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> image, Glib::Ref
} }
} }
HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> image, Glib::RefPtr<Gdk::Pixbuf> image_desensitised, HSliderController::HSliderController (Gtk::Adjustment *adj, int fader_length,
Gtk::Adjustment *adj, int fader_length,
bool with_numeric) bool with_numeric)
: SliderController (image, image_desensitised, adj, HORIZ, fader_length) : SliderController (adj, HORIZ, fader_length)
{ {
if (with_numeric) { if (with_numeric) {
spin_frame.add (spin); spin_frame.add (spin);