#define BASELINESTRETCH (1.25)
#define TRACKHEADERBTNW (3.10)
-using namespace Gdk;
using namespace Gtk;
using namespace Glib;
using namespace PBD;
* ARDOUR_UI_UTILS::render_vector_icon()
*/
void
-ArdourButton::render (cairo_t* cr, cairo_rectangle_t *)
+ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
+
uint32_t text_color;
uint32_t led_color;
float char_avg_pixel_width() { if (_char_pixel_width < 1) recalc_char_pixel_geometry() ; return _char_avg_pixel_width; }
protected:
- void render (cairo_t *, cairo_rectangle_t *);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void on_size_request (Gtk::Requisition* req);
void on_size_allocate (Gtk::Allocation&);
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
#include "pbd/i18n.h"
using namespace Gtkmm2ext;
-using namespace Gdk;
using namespace Gtk;
using namespace Glib;
using namespace PBD;
}
void
-ArdourKnob::render (cairo_t* cr, cairo_rectangle_t *)
+ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
cairo_pattern_t* shade_pattern;
float width = get_width();
void color_handler ();
protected:
- void render (cairo_t *, cairo_rectangle_t *);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void on_size_request (Gtk::Requisition* req);
void on_size_allocate (Gtk::Allocation&);
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
ArdourVSpacer (float r = 0.75f) : CairoWidget (), ratio (r) {}
protected:
- void render (cairo_t* cr, cairo_rectangle_t* r) {
+ void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* r) {
float h = r->height * ratio;
float t = .5f * (r->height - h);
- cairo_rectangle (cr, 0, t, 1, h);
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_fill (cr);
+ ctx->rectangle (0, t, 1, h);
+ ctx->set_source_rgb (0, 0, 0);
+ ctx->fill ();
}
void on_size_request (Gtk::Requisition* req) {
}
void
-AudioClock::render (cairo_t* cr, cairo_rectangle_t*)
+AudioClock::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
/* main layout: rounded rect, plus the text */
if (_need_bg) {
static std::vector<AudioClock*> clocks;
protected:
- void render (cairo_t*, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
bool get_is_duration () const { return is_duration; } ;
virtual void build_ops_menu ();
}
void
-ButtonJoiner::render (cairo_t* cr, cairo_rectangle_t*)
+ButtonJoiner::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
double h = get_height();
if (!get_active()) {
void set_active_state (Gtkmm2ext::ActiveState);
protected:
- void render (cairo_t*, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
bool on_button_release_event (GdkEventButton*);
void on_size_request (Gtk::Requisition*);
void on_size_allocate (Gtk::Allocation&);
* @param cr Context.
*/
void
-EditorSummary::render (cairo_t* cr, cairo_rectangle_t*)
+EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
if (_session == 0) {
return;
bool on_leave_notify_event (GdkEventCrossing*);
void centre_on_click (GdkEventButton *);
- void render (cairo_t *, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void render_region (RegionView*, cairo_t*, double) const;
void get_editor (std::pair<double, double> *, std::pair<double, double> *) const;
void set_editor (double, double);
virtual void overlay (cairo_t* cr, cairo_rectangle_t* r) {}
- virtual void render (cairo_t* cr, cairo_rectangle_t* r)
+ virtual void render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* r)
{
- cairo_rectangle (cr, r->x, r->y, r->width, r->height);
- cairo_clip (cr);
- background (cr, r);
- overlay (cr, r);
+ ctx->rectangle (r->x, r->y, r->width, r->height);
+ ctx->clip ();
+ background (ctx->cobj(), r);
+ overlay (ctx->cobj(), r);
}
Cairo::RefPtr<Cairo::ImageSurface> _surface;
}
void
-GroupTabs::render (cairo_t* cr, cairo_rectangle_t*)
+GroupTabs::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
if (_dragging == 0) {
_tabs = compute_tabs ();
}
void disable_all ();
void remove_group (ARDOUR::RouteGroup *);
- void render (cairo_t *, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void on_size_request (Gtk::Requisition *);
bool on_button_press_event (GdkEventButton *);
bool on_motion_notify_event (GdkEventMotion *);
}
void
-LED::render (cairo_t* cr, cairo_rectangle_t*)
+LED::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
if (!_fixed_diameter) {
_diameter = std::min (get_width(), get_height());
}
void set_diameter (float);
protected:
- void render (cairo_t *, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void on_size_request (Gtk::Requisition* req);
void on_realize ();
};
void
-MiniTimeline::render (cairo_t* cr, cairo_rectangle_t*)
+MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
// TODO cache, set_colors()
ArdourCanvas::Color base = UIConfiguration::instance().color ("ruler base");
ArdourCanvas::Color text = UIConfiguration::instance().color ("ruler text");
void draw_dots (cairo_t*, int left, int right, int y, ArdourCanvas::Color);
int draw_mark (cairo_t*, int x0, int x1, const std::string&, bool& prelight);
- void render (cairo_t*, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void format_time (framepos_t when);
bool on_button_press_event (GdkEventButton*);
}
void
-ShuttleControl::render (cairo_t* cr, cairo_rectangle_t*)
+ShuttleControl::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
// center slider line
float yc = get_height() / 2;
float lw = 3;
bool on_scroll_event (GdkEventScroll*);
bool on_motion_notify_event(GdkEventMotion*);
- void render (cairo_t *, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
void on_size_allocate (Gtk::Allocation&);
bool on_query_tooltip (int, int, bool, const Glib::RefPtr<Gtk::Tooltip>&);
//context->rectangle (draw.x0, draw.y0, draw.width(), draw.height());
//context->clip ();
- _widget.render (context->cobj(), &crect);
+ _widget.render (context, &crect);
context->restore ();
}
cr->fill ();
}
- render (cr->cobj(), &expose_area);
+ render (cr, &expose_area);
#ifdef USE_CAIRO_IMAGE_SURFACE_FOR_CAIRO_WIDGET
if(get_visible_window ()) {
expose_area.width = ev->area.width;
expose_area.height = ev->area.height;
- render (cr->cobj(), &expose_area);
+ render (cr, &expose_area);
#ifdef OPTIONAL_CAIRO_IMAGE_SURFACE
if (getenv("ARDOUR_IMAGE_SURFACE")) {
}
void
-Fader::render (cairo_t* cr, cairo_rectangle_t*)
+Fader::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
{
+ cairo_t* cr = ctx->cobj();
double xscale = 1.0;
double yscale = 1.0;
}
void
-FastMeter::render (cairo_t* cr, cairo_rectangle_t* area)
+FastMeter::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* area)
{
if (orientation == Vertical) {
- return vertical_expose (cr, area);
+ return vertical_expose (ctx->cobj(), area);
} else {
- return horizontal_expose (cr, area);
+ return horizontal_expose (ctx->cobj(), area);
}
}
#ifndef __gtk2_ardour_cairo_widget_h__
#define __gtk2_ardour_cairo_widget_h__
+#include <cairomm/context.h>
#include <cairomm/surface.h>
#include <gtkmm/eventbox.h>
static void provide_background_for_cairo_widget (Gtk::Widget& w, const Gdk::Color& bg);
- virtual void render (cairo_t *, cairo_rectangle_t*) = 0;
-
- virtual void render (Cairo::RefPtr<Cairo::Context> const & ctx, cairo_rectangle_t* r) {
- render (ctx->cobj(), r);
- }
-
uint32_t background_color ();
static void set_flat_buttons (bool yn);
void on_size_request (GtkRequisition*);
void on_size_allocate (Gtk::Allocation& alloc);
- void render (cairo_t* cr, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
bool on_motion_notify_event (GdkEventMotion*);
void set_hold_count (long);
void set_highlight (bool);
bool get_highlight () { return highlight; }
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
protected:
- void render (cairo_t *, cairo_rectangle_t*);
void on_size_request (GtkRequisition*);
void on_size_allocate (Gtk::Allocation&);
private:
void on_size_request (GtkRequisition*);
void on_size_allocate (Gtk::Allocation& alloc);
- void render (cairo_t *, cairo_rectangle_t*);
+ void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
bool on_grab_broken_event (GdkEventGrabBroken*);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
}
void
-PixFader::render (cairo_t *cr, cairo_rectangle_t* area)
+PixFader::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* area)
{
+ cairo_t* cr = ctx->cobj();
+
if (!_pattern) {
create_patterns();
}
}
void
-FastMeter::render (cairo_t* cr, cairo_rectangle_t* area)
+FastMeter::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* area)
{
if (orientation == Vertical) {
- return vertical_expose (cr, area);
+ return vertical_expose (cr->cobj(), area);
} else {
- return horizontal_expose (cr, area);
+ return horizontal_expose (cr->cobj(), area);
}
}