diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-10-13 17:11:38 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-10-13 17:18:54 -0400 |
commit | 1552547f650a82487ac72615c8533fd25b4ffc39 (patch) | |
tree | 68a07a8a2ec756b4052a8a2f0215e95f4a808eb2 /libs/surfaces | |
parent | 228556ab9c7356b868c33da47fcdc6362e4b5a93 (diff) |
stop using gkd_pango_context_get() in ArdourCanvas::Canvas and require concrete instances to supply a Pango::Context; do this for GtkCanvas and Push2Canvas
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/push2/canvas.cc | 27 | ||||
-rw-r--r-- | libs/surfaces/push2/canvas.h | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libs/surfaces/push2/canvas.cc b/libs/surfaces/push2/canvas.cc index 52a8534f5e..6a8d046aa9 100644 --- a/libs/surfaces/push2/canvas.cc +++ b/libs/surfaces/push2/canvas.cc @@ -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; +} diff --git a/libs/surfaces/push2/canvas.h b/libs/surfaces/push2/canvas.h index e3343e3296..fe419f44ba 100644 --- a/libs/surfaces/push2/canvas.h +++ b/libs/surfaces/push2/canvas.h @@ -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 (); |