pixbufs instead of pixmaps; function-scope local fd's for reading from a FileSource
git-svn-id: svn://localhost/trunk/ardour2@395 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
ee873ee896
commit
4d2afdd0f7
@ -36,7 +36,6 @@
|
||||
#include <pbd/pathscanner.h>
|
||||
#include <pbd/failed_constructor.h>
|
||||
#include <gtkmm2ext/gtk_ui.h>
|
||||
#include <gtkmm2ext/pix.h>
|
||||
#include <gtkmm2ext/utils.h>
|
||||
#include <gtkmm2ext/click_box.h>
|
||||
#include <gtkmm2ext/fastmeter.h>
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/fastlog.h>
|
||||
#include <gtkmm2ext/pix.h>
|
||||
#include <gtkmm2ext/utils.h>
|
||||
#include <gtkmm2ext/click_box.h>
|
||||
#include <gtkmm2ext/tearoff.h>
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <ardour/dB.h>
|
||||
|
||||
#include <gtkmm2ext/utils.h>
|
||||
#include <gtkmm2ext/pix.h>
|
||||
#include <gtkmm2ext/fastmeter.h>
|
||||
#include <gtkmm2ext/stop_signal.h>
|
||||
#include <gtkmm2ext/barcontroller.h>
|
||||
@ -55,18 +54,27 @@ using namespace std;
|
||||
|
||||
sigc::signal<void> GainMeter::ResetAllPeakDisplays;
|
||||
sigc::signal<void,RouteGroup*> GainMeter::ResetGroupPeakDisplays;
|
||||
Pix* GainMeter::slider_pix = 0;
|
||||
Glib::RefPtr<Gdk::Pixbuf> GainMeter::slider;
|
||||
Glib::RefPtr<Gdk::Pixbuf> GainMeter::rail;
|
||||
map<string,Glib::RefPtr<Gdk::Pixmap> > GainMeter::metric_pixmaps;
|
||||
|
||||
int
|
||||
GainMeter::setup_slider_pix ()
|
||||
{
|
||||
if ((slider_pix = get_pix (ARDOUR::find_data_file("pixmaps"), "vslider02", false)) == 0) {
|
||||
error << _("Cannot create slider pixmaps") << endmsg;
|
||||
string path = ARDOUR::find_data_file("vslider02_slider.xpm", "pixmaps");
|
||||
if (path.empty()) {
|
||||
error << _("cannot find images for fader slider") << endmsg;
|
||||
return -1;
|
||||
}
|
||||
slider = Gdk::Pixbuf::create_from_file (path);
|
||||
|
||||
path = ARDOUR::find_data_file("vslider02_rail.xpm", "pixmaps");
|
||||
if (path.empty()) {
|
||||
error << _("cannot find images for fader rail") << endmsg;
|
||||
return -1;
|
||||
}
|
||||
rail = Gdk::Pixbuf::create_from_file (path);
|
||||
|
||||
slider_pix->ref ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -95,14 +103,14 @@ GainMeter::GainMeter (IO& io, Session& s)
|
||||
top_table (1, 2)
|
||||
|
||||
{
|
||||
if (slider_pix == 0) {
|
||||
if (slider == 0) {
|
||||
setup_slider_pix ();
|
||||
}
|
||||
|
||||
ignore_toggle = false;
|
||||
meter_menu = 0;
|
||||
|
||||
gain_slider = manage (new VSliderController (slider_pix,
|
||||
gain_slider = manage (new VSliderController (slider, rail,
|
||||
&gain_adjustment,
|
||||
& _io.midi_gain_control(),
|
||||
false));
|
||||
|
@ -49,7 +49,6 @@ namespace ARDOUR {
|
||||
namespace Gtkmm2ext {
|
||||
class FastMeter;
|
||||
class BarController;
|
||||
class Pix;
|
||||
}
|
||||
namespace Gtk {
|
||||
class Menu;
|
||||
@ -161,7 +160,8 @@ class GainMeter : public Gtk::VBox
|
||||
static sigc::signal<void> ResetAllPeakDisplays;
|
||||
static sigc::signal<void,ARDOUR::RouteGroup*> ResetGroupPeakDisplays;
|
||||
|
||||
static Gtkmm2ext::Pix* slider_pix;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> rail;
|
||||
static int setup_slider_pix ();
|
||||
};
|
||||
|
||||
|
@ -740,7 +740,7 @@ FileSource::read_header (bool silent)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (::pread (fd, &header.data, sizeof (header.data), info->offset) != sizeof (header.data)) {
|
||||
if (::pread64 (fd, &header.data, sizeof (header.data), info->offset) != sizeof (header.data)) {
|
||||
error << _("FileSource: can't read data chunk") << endmsg;
|
||||
return -1;
|
||||
}
|
||||
@ -757,7 +757,7 @@ FileSource::read_broadcast_data (ChunkInfo& info)
|
||||
{
|
||||
int32_t coding_history_size;
|
||||
|
||||
if (::pread (fd, (char *) &header.bext, sizeof (header.bext), info.offset + sizeof (GenericChunk)) != sizeof (header.bext)) {
|
||||
if (::pread64 (fd, (char *) &header.bext, sizeof (header.bext), info.offset + sizeof (GenericChunk)) != sizeof (header.bext)) {
|
||||
error << string_compose(_("FileSource: cannot read Broadcast Wave data from existing audio file \"%1\" (%2)"),
|
||||
_path, strerror (errno)) << endmsg;
|
||||
return -1;
|
||||
@ -773,7 +773,7 @@ FileSource::read_broadcast_data (ChunkInfo& info)
|
||||
|
||||
char data[coding_history_size];
|
||||
|
||||
if (::pread (fd, data, coding_history_size, info.offset + sizeof (BroadcastChunk)) != coding_history_size) {
|
||||
if (::pread64 (fd, data, coding_history_size, info.offset + sizeof (BroadcastChunk)) != coding_history_size) {
|
||||
error << string_compose(_("FileSource: cannot read Broadcast Wave coding history from audio file \"%1\" (%2)"),
|
||||
_path, strerror (errno)) << endmsg;
|
||||
return -1;
|
||||
@ -1076,9 +1076,20 @@ FileSource::read_float (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, c
|
||||
{
|
||||
ssize_t nread;
|
||||
ssize_t byte_cnt = (ssize_t) cnt * sizeof (Sample);
|
||||
int readfd;
|
||||
|
||||
/* open, read, close */
|
||||
|
||||
if ((readfd = open64 (_path.c_str(), O_RDONLY)) < 0) {
|
||||
error << string_compose(_("FileSource: could not open \"%1\": (%2)"), _path, strerror (errno)) << endmsg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((nread = pread (fd, (char *) dst, byte_cnt, data_offset + (start * _sample_size))) != byte_cnt) {
|
||||
|
||||
nread = ::pread64 (readfd, (char *) dst, byte_cnt, data_offset + (start * _sample_size));
|
||||
close (readfd);
|
||||
|
||||
if (nread != byte_cnt) {
|
||||
|
||||
cerr << "FileSource: \""
|
||||
<< _path
|
||||
<< "\" bad read at frame "
|
||||
@ -1102,8 +1113,7 @@ FileSource::read_float (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, c
|
||||
|
||||
if (nread > 0) {
|
||||
return nread / _sample_size;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return nread;
|
||||
}
|
||||
}
|
||||
@ -1149,9 +1159,20 @@ FileSource::read_pcm_24 (Sample *dst, jack_nframes_t start, jack_nframes_t cnt,
|
||||
{
|
||||
ssize_t nread;
|
||||
ssize_t byte_cnt = (ssize_t) cnt * _sample_size;
|
||||
int readfd;
|
||||
|
||||
/* open, read, close */
|
||||
|
||||
if ((readfd = open64 (_path.c_str(), O_RDONLY)) < 0) {
|
||||
error << string_compose(_("FileSource: could not open \"%1\": (%2)"), _path, strerror (errno)) << endmsg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
nread = ::pread64 (readfd, (char *) workbuf, byte_cnt, data_offset + (start * _sample_size));
|
||||
close (readfd);
|
||||
|
||||
if (nread != byte_cnt) {
|
||||
|
||||
if ((nread = pread (fd, (char *) workbuf, byte_cnt, data_offset + (start * _sample_size))) != byte_cnt) {
|
||||
|
||||
cerr << "May be OK - FileSource: \""
|
||||
<< _path
|
||||
<< "\" bad 24bit read at frame "
|
||||
|
@ -43,7 +43,6 @@ fastmeter.cc
|
||||
gtk_ui.cc
|
||||
hexentry.cc
|
||||
idle_adjustment.cc
|
||||
pix.cc
|
||||
pixscroller.cc
|
||||
popup.cc
|
||||
prompter.cc
|
||||
|
@ -34,13 +34,11 @@ using namespace std;
|
||||
|
||||
string FastMeter::v_image_path;
|
||||
string FastMeter::h_image_path;
|
||||
RefPtr<Pixmap> FastMeter::v_pixmap;
|
||||
RefPtr<Bitmap> FastMeter::v_mask;
|
||||
RefPtr<Pixbuf> FastMeter::v_pixbuf;
|
||||
gint FastMeter::v_pixheight = 0;
|
||||
gint FastMeter::v_pixwidth = 0;
|
||||
|
||||
RefPtr<Pixmap> FastMeter::h_pixmap;
|
||||
RefPtr<Bitmap> FastMeter::h_mask;
|
||||
RefPtr<Pixbuf> FastMeter::h_pixbuf;
|
||||
gint FastMeter::h_pixheight = 0;
|
||||
gint FastMeter::h_pixwidth = 0;
|
||||
|
||||
@ -58,54 +56,32 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
||||
pixrect.x = 0;
|
||||
pixrect.y = 0;
|
||||
|
||||
request_width = dimen;
|
||||
request_height = dimen;
|
||||
}
|
||||
|
||||
FastMeter::~FastMeter ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::on_realize ()
|
||||
{
|
||||
DrawingArea::on_realize ();
|
||||
|
||||
Glib::RefPtr<Gdk::Drawable> drawable = Glib::RefPtr<Gdk::Window>::cast_dynamic (get_window());
|
||||
Gdk::Color transparent;
|
||||
|
||||
if (!v_image_path.empty() && v_pixmap == 0) {
|
||||
gint w, h;
|
||||
|
||||
v_pixmap = Pixmap::create_from_xpm (drawable, Colormap::get_system(), v_mask, transparent, v_image_path);
|
||||
v_pixmap->get_size(w, h);
|
||||
|
||||
v_pixheight = h;
|
||||
v_pixwidth = w;
|
||||
if (!v_image_path.empty() && v_pixbuf == 0) {
|
||||
v_pixbuf = Pixbuf::create_from_file (v_image_path);
|
||||
v_pixheight = v_pixbuf->get_height();
|
||||
v_pixwidth = v_pixbuf->get_width();
|
||||
}
|
||||
|
||||
if (!h_image_path.empty() && h_pixmap == 0) {
|
||||
gint w, h;
|
||||
|
||||
h_pixmap = Pixmap::create_from_xpm (drawable, Colormap::get_system(), h_mask, transparent, h_image_path);
|
||||
h_pixmap->get_size(w, h);
|
||||
|
||||
h_pixheight = h;
|
||||
h_pixwidth = w;
|
||||
if (!h_image_path.empty() && h_pixbuf == 0) {
|
||||
h_pixbuf = Pixbuf::create_from_file (h_image_path);
|
||||
h_pixheight = h_pixbuf->get_height();
|
||||
h_pixwidth = h_pixbuf->get_width();
|
||||
}
|
||||
|
||||
if (orientation == Vertical) {
|
||||
pixrect.width = min (v_pixwidth, request_width);
|
||||
pixrect.width = min (v_pixwidth, (gint) dimen);
|
||||
pixrect.height = v_pixheight;
|
||||
} else {
|
||||
pixrect.width = h_pixwidth;
|
||||
pixrect.height = min (h_pixheight, request_height);
|
||||
pixrect.height = min (h_pixheight, (gint) dimen);
|
||||
}
|
||||
|
||||
request_width = pixrect.width;
|
||||
request_height= pixrect.height;
|
||||
}
|
||||
|
||||
set_size_request (request_width, request_height);
|
||||
FastMeter::~FastMeter ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
@ -177,19 +153,21 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
||||
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
||||
*/
|
||||
|
||||
get_window()->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
|
||||
intersection.x, v_pixheight - top_of_meter,
|
||||
intersection.x, v_pixheight - top_of_meter,
|
||||
intersection.width, intersection.height);
|
||||
get_window()->draw_pixbuf(get_style()->get_fg_gc(get_state()), v_pixbuf,
|
||||
intersection.x, v_pixheight - top_of_meter,
|
||||
intersection.x, v_pixheight - top_of_meter,
|
||||
intersection.width, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
/* draw peak bar */
|
||||
|
||||
if (hold_state) {
|
||||
get_window()->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
|
||||
intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||
intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||
intersection.width, 3);
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), v_pixbuf,
|
||||
intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||
intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||
intersection.width, 3,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -209,19 +187,23 @@ FastMeter::horizontal_expose (GdkEventExpose* ev)
|
||||
/* draw the part of the meter image that we need.
|
||||
*/
|
||||
|
||||
get_window()->draw_drawable(get_style()->get_fg_gc(get_state()), h_pixmap,
|
||||
intersection.x, intersection.y,
|
||||
intersection.x, intersection.y,
|
||||
intersection.width, intersection.height);
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), h_pixbuf,
|
||||
intersection.x, intersection.y,
|
||||
intersection.x, intersection.y,
|
||||
intersection.width, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
/* draw peak bar */
|
||||
|
||||
if (hold_state) {
|
||||
get_window()->draw_drawable(get_style()->get_fg_gc(get_state()), h_pixmap,
|
||||
right_of_meter, intersection.y,
|
||||
right_of_meter, intersection.y,
|
||||
3, intersection.height);
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), h_pixbuf,
|
||||
right_of_meter, intersection.y,
|
||||
right_of_meter, intersection.y,
|
||||
3, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define __gtkmm2ext_fastmeter_h__
|
||||
|
||||
#include <gtkmm/drawingarea.h>
|
||||
#include <gdkmm/pixmap.h>
|
||||
#include <gdkmm/pixbuf.h>
|
||||
|
||||
namespace Gtkmm2ext {
|
||||
|
||||
@ -52,23 +52,19 @@ class FastMeter : public Gtk::DrawingArea {
|
||||
protected:
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
void on_size_request (GtkRequisition*);
|
||||
void on_realize ();
|
||||
|
||||
private:
|
||||
static std::string h_image_path;
|
||||
static std::string v_image_path;
|
||||
static Glib::RefPtr<Gdk::Pixmap> h_pixmap;
|
||||
static Glib::RefPtr<Gdk::Bitmap> h_mask;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> h_pixbuf;
|
||||
static gint h_pixheight;
|
||||
static gint h_pixwidth;
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixmap> v_pixmap;
|
||||
static Glib::RefPtr<Gdk::Bitmap> v_mask;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> v_pixbuf;
|
||||
static gint v_pixheight;
|
||||
static gint v_pixwidth;
|
||||
|
||||
Orientation orientation;
|
||||
Glib::RefPtr<Gdk::Pixmap> backing;
|
||||
GdkRectangle pixrect;
|
||||
gint request_width;
|
||||
gint request_height;
|
||||
|
@ -5,33 +5,27 @@
|
||||
#include <gtkmm/adjustment.h>
|
||||
#include <gdkmm.h>
|
||||
|
||||
#include <gtkmm2ext/pix.h>
|
||||
|
||||
namespace Gtkmm2ext {
|
||||
|
||||
class PixScroller : public Gtk::DrawingArea
|
||||
{
|
||||
public:
|
||||
PixScroller(Gtk::Adjustment& adjustment, Pix&);
|
||||
PixScroller(Gtk::Adjustment& adjustment,
|
||||
Glib::RefPtr<Gdk::Pixbuf> slider,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail);
|
||||
|
||||
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
bool on_motion_notify_event (GdkEventMotion*);
|
||||
bool on_button_press_event (GdkEventButton*);
|
||||
bool on_button_release_event (GdkEventButton*);
|
||||
void on_size_request (GtkRequisition*);
|
||||
void on_realize ();
|
||||
|
||||
protected:
|
||||
Gtk::Adjustment& adj;
|
||||
|
||||
private:
|
||||
Pix& pix;
|
||||
|
||||
Glib::RefPtr<Gdk::Pixmap> rail;
|
||||
Glib::RefPtr<Gdk::Pixmap> slider;
|
||||
Glib::RefPtr<Gdk::Bitmap> rail_mask;
|
||||
Glib::RefPtr<Gdk::Bitmap> slider_mask;
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail;
|
||||
Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
Gdk::Rectangle sliderrect;
|
||||
Gdk::Rectangle railrect;
|
||||
GdkWindow* grab_window;
|
||||
|
@ -37,7 +37,8 @@ namespace Gtkmm2ext {
|
||||
class SliderController : public Gtkmm2ext::PixScroller
|
||||
{
|
||||
public:
|
||||
SliderController (Gtkmm2ext::Pix* pixset,
|
||||
SliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail,
|
||||
Gtk::Adjustment* adj,
|
||||
MIDI::Controllable*,
|
||||
bool with_numeric = true);
|
||||
@ -57,6 +58,8 @@ class SliderController : public Gtkmm2ext::PixScroller
|
||||
Gtk::SpinButton & get_spin_button () { return spin; }
|
||||
|
||||
protected:
|
||||
Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail;
|
||||
Gtk::SpinButton spin;
|
||||
Gtk::Frame spin_frame;
|
||||
Gtk::HBox spin_hbox;
|
||||
@ -77,7 +80,8 @@ class SliderController : public Gtkmm2ext::PixScroller
|
||||
class VSliderController : public SliderController
|
||||
{
|
||||
public:
|
||||
VSliderController (Gtkmm2ext::Pix *pixset,
|
||||
VSliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail,
|
||||
Gtk::Adjustment *adj,
|
||||
MIDI::Controllable *,
|
||||
bool with_numeric = true);
|
||||
@ -86,7 +90,8 @@ class VSliderController : public SliderController
|
||||
class HSliderController : public SliderController
|
||||
{
|
||||
public:
|
||||
HSliderController (Gtkmm2ext::Pix *pixset,
|
||||
HSliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail,
|
||||
Gtk::Adjustment *adj,
|
||||
MIDI::Controllable *,
|
||||
bool with_numeric = true);
|
||||
|
@ -29,9 +29,12 @@ using namespace std;
|
||||
using namespace Gtk;
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
PixScroller::PixScroller (Adjustment& a, Pix& p)
|
||||
PixScroller::PixScroller (Adjustment& a,
|
||||
Glib::RefPtr<Gdk::Pixbuf> s,
|
||||
Glib::RefPtr<Gdk::Pixbuf> r)
|
||||
: adj (a),
|
||||
pix (p)
|
||||
rail (r),
|
||||
slider (s)
|
||||
{
|
||||
dragging = false;
|
||||
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
|
||||
@ -39,30 +42,10 @@ PixScroller::PixScroller (Adjustment& a, Pix& p)
|
||||
adj.signal_value_changed().connect (mem_fun (*this, &PixScroller::adjustment_changed));
|
||||
default_value = adj.get_value();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
PixScroller::on_realize ()
|
||||
{
|
||||
DrawingArea::on_realize ();
|
||||
|
||||
Glib::RefPtr<Gdk::Drawable> drawable = Glib::RefPtr<Gdk::Window>::cast_dynamic (get_window());
|
||||
|
||||
pix.generate (drawable);
|
||||
|
||||
rail = *(pix.pixmap (0));
|
||||
rail_mask = *(pix.shape_mask (0));
|
||||
slider = *(pix.pixmap (1));
|
||||
slider_mask = *(pix.shape_mask (1));
|
||||
|
||||
int w, h;
|
||||
|
||||
slider->get_size (w, h);
|
||||
sliderrect.set_width(w);
|
||||
sliderrect.set_height(h);
|
||||
rail->get_size (w, h);
|
||||
railrect.set_width(w);
|
||||
railrect.set_height(h);
|
||||
sliderrect.set_width(slider->get_width());
|
||||
sliderrect.set_height(slider->get_height());
|
||||
railrect.set_width(rail->get_width());
|
||||
railrect.set_height(rail->get_height());
|
||||
|
||||
railrect.set_y(sliderrect.get_height() / 2);
|
||||
sliderrect.set_x(0);
|
||||
@ -71,8 +54,6 @@ PixScroller::on_realize ()
|
||||
|
||||
sliderrect.set_y((int) rint ((overall_height - sliderrect.get_height()) * (adj.get_upper() - adj.get_value())));
|
||||
railrect.set_x((sliderrect.get_width() / 2) - 2);
|
||||
|
||||
set_size_request (sliderrect.get_width(), overall_height);
|
||||
}
|
||||
|
||||
void
|
||||
@ -96,32 +77,34 @@ PixScroller::on_expose_event (GdkEventExpose* ev)
|
||||
|
||||
if (gdk_rectangle_intersect (railrect.gobj(), &ev->area, &intersect)) {
|
||||
Glib::RefPtr<Gdk::GC> gc(get_style()->get_bg_gc(get_state()));
|
||||
win->draw_drawable (gc, rail,
|
||||
intersect.x - railrect.get_x(),
|
||||
intersect.y - railrect.get_y(),
|
||||
intersect.x,
|
||||
intersect.y,
|
||||
intersect.width,
|
||||
intersect.height);
|
||||
win->draw_pixbuf (gc, rail,
|
||||
intersect.x - railrect.get_x(),
|
||||
intersect.y - railrect.get_y(),
|
||||
intersect.x,
|
||||
intersect.y,
|
||||
intersect.width,
|
||||
intersect.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
if (gdk_rectangle_intersect (sliderrect.gobj(), &ev->area, &intersect)) {
|
||||
Glib::RefPtr<Gdk::GC> gc(get_style()->get_fg_gc(get_state()));
|
||||
Glib::RefPtr<Gdk::Bitmap> mask (slider_mask);
|
||||
// Glib::RefPtr<Gdk::Bitmap> mask (slider_mask);
|
||||
|
||||
GdkGCValues values;
|
||||
gdk_gc_get_values(gc->gobj(), &values);
|
||||
gc->set_clip_origin (sliderrect.get_x(), sliderrect.get_y());
|
||||
gc->set_clip_mask (mask);
|
||||
win->draw_drawable (gc, slider,
|
||||
intersect.x - sliderrect.get_x(),
|
||||
intersect.y - sliderrect.get_y(),
|
||||
intersect.x,
|
||||
intersect.y,
|
||||
intersect.width,
|
||||
intersect.height);
|
||||
// gc->set_clip_mask (mask);
|
||||
win->draw_pixbuf (gc, slider,
|
||||
intersect.x - sliderrect.get_x(),
|
||||
intersect.y - sliderrect.get_y(),
|
||||
intersect.x,
|
||||
intersect.y,
|
||||
intersect.width,
|
||||
intersect.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
gc->set_clip_origin (values.clip_x_origin, values.clip_y_origin);
|
||||
gdk_gc_set_clip_mask (gc->gobj(), values.clip_mask);
|
||||
// gdk_gc_set_clip_mask (gc->gobj(), values.clip_mask);
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,18 +24,19 @@
|
||||
|
||||
#include <gtkmm2ext/gtk_ui.h>
|
||||
#include <gtkmm2ext/slider_controller.h>
|
||||
#include <gtkmm2ext/pix.h>
|
||||
#include <gtkmm2ext/pixscroller.h>
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
SliderController::SliderController (Pix *pixset,
|
||||
SliderController::SliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail,
|
||||
Gtk::Adjustment *adj,
|
||||
MIDI::Controllable *mc,
|
||||
bool with_numeric)
|
||||
|
||||
: PixScroller (*adj, *pixset),
|
||||
: PixScroller (*adj, slide, rail),
|
||||
spin (*adj, 0, 2),
|
||||
prompter (Gtk::WIN_POS_MOUSE, 30000, false),
|
||||
midi_control (mc),
|
||||
@ -148,12 +149,13 @@ SliderController::midicontrol_unprompt ()
|
||||
}
|
||||
|
||||
|
||||
VSliderController::VSliderController (Pix *pixset,
|
||||
VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail,
|
||||
Gtk::Adjustment *adj,
|
||||
MIDI::Controllable *mcontrol,
|
||||
bool with_numeric)
|
||||
|
||||
: SliderController (pixset, adj, mcontrol, with_numeric)
|
||||
: SliderController (slide, rail, adj, mcontrol, with_numeric)
|
||||
{
|
||||
if (with_numeric) {
|
||||
spin_frame.add (spin);
|
||||
@ -164,12 +166,13 @@ VSliderController::VSliderController (Pix *pixset,
|
||||
}
|
||||
}
|
||||
|
||||
HSliderController::HSliderController (Pix *pixset,
|
||||
HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
|
||||
Glib::RefPtr<Gdk::Pixbuf> rail,
|
||||
Gtk::Adjustment *adj,
|
||||
MIDI::Controllable *mcontrol,
|
||||
bool with_numeric)
|
||||
|
||||
: SliderController (pixset, adj, mcontrol, with_numeric)
|
||||
: SliderController (slide, rail, adj, mcontrol, with_numeric)
|
||||
{
|
||||
if (with_numeric) {
|
||||
spin_frame.add (spin);
|
||||
|
Loading…
Reference in New Issue
Block a user