diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-03-16 16:57:58 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-03-16 16:57:58 -0400 |
commit | 69e1f7921525c2849d937b5a822475007a4f9a2f (patch) | |
tree | 13d5c49b60d70c742020e64d8a0744158567e2b8 /pango-view/viewer-pangocairo.c | |
parent | 56ff9ed93d1cc9fd091da609304bd153d706d818 (diff) | |
download | pango-69e1f7921525c2849d937b5a822475007a4f9a2f.tar.gz |
Bug 502804 – pango-view or pangocairo-view option to annotate
Added --annotate.
Also fixes:
Bug 502801 – per-backend pango-view options
Diffstat (limited to 'pango-view/viewer-pangocairo.c')
-rw-r--r-- | pango-view/viewer-pangocairo.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/pango-view/viewer-pangocairo.c b/pango-view/viewer-pangocairo.c index e834540d..3d19668e 100644 --- a/pango-view/viewer-pangocairo.c +++ b/pango-view/viewer-pangocairo.c @@ -26,6 +26,8 @@ #include <pango/pangocairo.h> +static int opt_annotate = 0; + typedef struct { const CairoViewerIface *iface; @@ -136,7 +138,7 @@ render_callback (PangoLayout *layout, gpointer state) { cairo_t *cr = (cairo_t *) context; - int annotate = GPOINTER_TO_INT (state) % 3; + int annotate = (GPOINTER_TO_INT (state) + opt_annotate) % 3; cairo_save (cr); cairo_translate (cr, x, y); @@ -406,6 +408,30 @@ pangocairo_view_display (gpointer instance, state); } +static GOptionGroup * +pangocairo_view_get_option_group (const PangoViewer *klass G_GNUC_UNUSED) +{ + GOptionEntry entries[] = + { + {"annotate", 0, 0, G_OPTION_ARG_INT, &opt_annotate, + "Annotate the output", "1 or 2"}, + {NULL} + }; + GOptionGroup *group; + + group = g_option_group_new ("cairo", + "Cairo backend options:", + "Options understood by the cairo backend", + NULL, + NULL); + + g_option_group_add_entries (group, entries); + + cairo_viewer_add_options (group); + + return group; +} + const PangoViewer pangocairo_viewer = { "PangoCairo", "cairo", @@ -427,5 +453,8 @@ const PangoViewer pangocairo_viewer = { #endif pangocairo_view_create_window, pangocairo_view_destroy_window, - pangocairo_view_display + pangocairo_view_display, + NULL, + NULL, + pangocairo_view_get_option_group }; |