Commit 7aaa4d3f authored by Kristian Høgsberg's avatar Kristian Høgsberg
Browse files

2006-05-30 Kristian Høgsberg <krh@redhat.com>

	* test/gtk-cairo-test.cc: Add --page option to gtk-cairo-test.
parent f7c1d519
2006-05-30 Kristian Høgsberg <krh@redhat.com>
* test/gtk-cairo-test.cc: Add --page option to gtk-cairo-test.
2006-05-29 Jeff Muizelaar <jeff@infidigm.net> 2006-05-29 Jeff Muizelaar <jeff@infidigm.net>
* poppler/CairoFontEngine.cc: * poppler/CairoFontEngine.cc:
......
...@@ -26,6 +26,7 @@ typedef struct ...@@ -26,6 +26,7 @@ typedef struct
GtkWidget *window; GtkWidget *window;
GtkWidget *sw; GtkWidget *sw;
GtkWidget *drawing_area; GtkWidget *drawing_area;
GtkWidget *spin_button;
PopplerPage *page; PopplerPage *page;
PopplerDocument *document; PopplerDocument *document;
cairo_surface_t *surface; cairo_surface_t *surface;
...@@ -69,6 +70,7 @@ view_set_page (View *v, int page) ...@@ -69,6 +70,7 @@ view_set_page (View *v, int page)
cairo_destroy (cr); cairo_destroy (cr);
gtk_widget_set_size_request (v->drawing_area, w, h); gtk_widget_set_size_request (v->drawing_area, w, h);
gtk_widget_queue_draw (v->drawing_area); gtk_widget_queue_draw (v->drawing_area);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (v->spin_button), page);
} }
static void static void
...@@ -140,6 +142,7 @@ view_new (const char *filename, int *window_count) ...@@ -140,6 +142,7 @@ view_new (const char *filename, int *window_count)
v->drawing_area = drawing_area; v->drawing_area = drawing_area;
v->sw = sw; v->sw = sw;
v->window_count = window_count; v->window_count = window_count;
v->spin_button = spin_button;
g_signal_connect (drawing_area, g_signal_connect (drawing_area,
"expose_event", "expose_event",
...@@ -154,17 +157,29 @@ view_new (const char *filename, int *window_count) ...@@ -154,17 +157,29 @@ view_new (const char *filename, int *window_count)
return v; return v;
} }
static int option_page = 0;
static GOptionEntry demo_options[] = {
{ "page", 0, 0, G_OPTION_ARG_INT, &option_page, "Page number", "PAGE" },
{ NULL }
};
int int
main (int argc, char *argv []) main (int argc, char *argv [])
{ {
View *v; View *v;
int i, window_count; int i, window_count;
GOptionContext *ctx;
ctx = g_option_context_new("FILENAME ...");
g_option_context_add_main_entries(ctx, demo_options, "main");
g_option_context_parse(ctx, &argc, &argv, NULL);
g_option_context_free(ctx);
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
if (argc == 1) if (argc == 1)
{ {
fprintf (stderr, "usage: %s PDF-FILES...\n", argv[0]); fprintf (stderr, "usage: %s PDF-FILES...\n", g_basename (argv[0]));
return -1; return -1;
} }
...@@ -176,7 +191,7 @@ main (int argc, char *argv []) ...@@ -176,7 +191,7 @@ main (int argc, char *argv [])
continue; continue;
} }
view_set_page (v, 0); view_set_page (v, option_page);
window_count++; window_count++;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment