stop using gkd_pango_context_get() in ArdourCanvas::Canvas and require concrete instances to supply a Pango::Context; do this for GtkCanvas and Push2Canvas
This commit is contained in:
@@ -1259,6 +1259,12 @@ GtkCanvas::hide_tooltip ()
|
||||
}
|
||||
}
|
||||
|
||||
Glib::RefPtr<Pango::Context>
|
||||
GtkCanvas::get_pango_context ()
|
||||
{
|
||||
return Glib::wrap (gdk_pango_context_get());
|
||||
}
|
||||
|
||||
/** Create a GtkCanvaSViewport.
|
||||
* @param hadj Adjustment to use for horizontal scrolling.
|
||||
* @param vadj Adjustment to use for vertica scrolling.
|
||||
|
||||
@@ -43,6 +43,10 @@ namespace Gtk {
|
||||
class Label;
|
||||
}
|
||||
|
||||
namespace Pango {
|
||||
class Context;
|
||||
}
|
||||
|
||||
namespace ArdourCanvas
|
||||
{
|
||||
struct Rect;
|
||||
@@ -154,7 +158,9 @@ public:
|
||||
*/
|
||||
static void set_tooltip_timeout (uint32_t msecs);
|
||||
|
||||
protected:
|
||||
virtual Glib::RefPtr<Pango::Context> get_pango_context() = 0;
|
||||
|
||||
protected:
|
||||
Root _root;
|
||||
Color _bg_color;
|
||||
|
||||
@@ -195,7 +201,9 @@ public:
|
||||
void start_tooltip_timeout (Item*);
|
||||
void stop_tooltip_timeout ();
|
||||
|
||||
protected:
|
||||
Glib::RefPtr<Pango::Context> get_pango_context();
|
||||
|
||||
protected:
|
||||
void on_size_allocate (Gtk::Allocation&);
|
||||
bool on_scroll_event (GdkEventScroll *);
|
||||
bool on_expose_event (GdkEventExpose *);
|
||||
|
||||
@@ -106,7 +106,8 @@ void
|
||||
Text::_redraw () const
|
||||
{
|
||||
assert (!_text.empty());
|
||||
Glib::RefPtr<Pango::Context> context = Glib::wrap (gdk_pango_context_get());
|
||||
assert (_canvas);
|
||||
Glib::RefPtr<Pango::Context> context = _canvas->get_pango_context();
|
||||
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <cairomm/region.h>
|
||||
#include <cairomm/surface.h>
|
||||
#include <cairomm/context.h>
|
||||
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
#include "ardour/debug.h"
|
||||
|
||||
@@ -233,3 +237,26 @@ Push2Canvas::visible_area () const
|
||||
/* may need to get more sophisticated once we do scrolling */
|
||||
return Rect (0, 0, 960, 160);
|
||||
}
|
||||
|
||||
Glib::RefPtr<Pango::Context>
|
||||
Push2Canvas::get_pango_context ()
|
||||
{
|
||||
if (!pango_context) {
|
||||
PangoFontMap* map = pango_cairo_font_map_get_default ();
|
||||
if (!map) {
|
||||
error << _("Default Cairo font map is null!") << endmsg;
|
||||
return Glib::RefPtr<Pango::Context> ();
|
||||
}
|
||||
|
||||
PangoContext* context = pango_font_map_create_context (map);
|
||||
|
||||
if (!context) {
|
||||
error << _("cannot create new PangoContext from cairo font map") << endmsg;
|
||||
return Glib::RefPtr<Pango::Context> ();
|
||||
}
|
||||
|
||||
pango_context = Glib::wrap (context);
|
||||
}
|
||||
|
||||
return pango_context;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ class Push2Canvas : public ArdourCanvas::Canvas
|
||||
void pick_current_item (ArdourCanvas::Duple const &, int) {}
|
||||
bool get_mouse_position (ArdourCanvas::Duple&) const { return false; }
|
||||
|
||||
Glib::RefPtr<Pango::Context> get_pango_context ();
|
||||
|
||||
private:
|
||||
Push2& p2;
|
||||
int _cols;
|
||||
@@ -83,6 +85,7 @@ class Push2Canvas : public ArdourCanvas::Canvas
|
||||
Cairo::RefPtr<Cairo::ImageSurface> frame_buffer;
|
||||
Cairo::RefPtr<Cairo::Context> context;
|
||||
Cairo::RefPtr<Cairo::Region> expose_region;
|
||||
Glib::RefPtr<Pango::Context> pango_context;
|
||||
|
||||
bool expose ();
|
||||
int blit_to_device_frame_buffer ();
|
||||
|
||||
Reference in New Issue
Block a user