From ce374f34eb996ca3688fe67f8b660fa59cb02a8a Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Sat, 26 Dec 2009 16:08:33 +0100 Subject: [PATCH] Add struct for PDF functioanlity --- config.mk | 4 +- zathura.c | 112 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 68 insertions(+), 48 deletions(-) diff --git a/config.mk b/config.mk index c8d83b1..d62e8ca 100644 --- a/config.mk +++ b/config.mk @@ -8,8 +8,8 @@ PREFIX = /usr MANPREFIX = ${PREFIX}/share/man # libs -GTK_INC = $(shell pkg-config --cflags gtk+-2.0) -GTK_LIB = $(shell pkg-config --libs gtk+-2.0) +GTK_INC = $(shell pkg-config --cflags gtk+-2.0 poppler-glib) +GTK_LIB = $(shell pkg-config --libs gtk+-2.0 poppler-glib) INCS = -I. -I/usr/include ${GTK_INC} LIBS = -L/usr/lib -lc ${GTK_LIB} diff --git a/zathura.c b/zathura.c index a435edf..6af44d2 100644 --- a/zathura.c +++ b/zathura.c @@ -4,6 +4,9 @@ #include #include +#include +#include + #include #include @@ -18,52 +21,6 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, FORWARD, BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH }; -/* zathura */ -struct -{ - struct - { - GtkWindow *window; - GtkBox *box; - GtkScrolledWindow *view; - GtkWidget *statusbar; - GtkBox *statusbar_entries; - GtkEntry *inputbar; - } UI; - - struct - { - GdkColor default_fg; - GdkColor default_bg; - GdkColor inputbar_fg; - GdkColor inputbar_bg; - GdkColor statusbar_fg; - GdkColor statusbar_bg; - GdkColor completion_fg; - GdkColor completion_bg; - GdkColor completion_g_bg; - GdkColor completion_g_fg; - GdkColor completion_hl_fg; - GdkColor completion_hl_bg; - GdkColor notification_e_fg; - GdkColor notification_e_bg; - GdkColor notification_w_fg; - GdkColor notification_w_bg; - PangoFontDescription *font; - } Style; - - struct - { - GString *buffer; - GList *history; - int mode; - GtkLabel *status_text; - GtkLabel *status_buffer; - GtkLabel *status_state; - } Global; - -} Zathura; - /* typedefs */ struct CElement { @@ -144,6 +101,69 @@ typedef struct Argument argument; } SpecialCommand; +typedef struct +{ + PopplerPage *page; + cairo_surface_t *surface; + double scale; + int rotate; +} Page; + +/* zathura */ +struct +{ + struct + { + GtkWindow *window; + GtkBox *box; + GtkScrolledWindow *view; + GtkWidget *statusbar; + GtkBox *statusbar_entries; + GtkEntry *inputbar; + } UI; + + struct + { + GdkColor default_fg; + GdkColor default_bg; + GdkColor inputbar_fg; + GdkColor inputbar_bg; + GdkColor statusbar_fg; + GdkColor statusbar_bg; + GdkColor completion_fg; + GdkColor completion_bg; + GdkColor completion_g_bg; + GdkColor completion_g_fg; + GdkColor completion_hl_fg; + GdkColor completion_hl_bg; + GdkColor notification_e_fg; + GdkColor notification_e_bg; + GdkColor notification_w_fg; + GdkColor notification_w_bg; + PangoFontDescription *font; + } Style; + + struct + { + GString *buffer; + GList *history; + int mode; + GtkLabel *status_text; + GtkLabel *status_buffer; + GtkLabel *status_state; + } Global; + + struct + { + PopplerDocument *document; + char *file; + Page *pages; + int page_number; + int number_of_pages; + } PDF; + +} Zathura; + /* function declarations */ void init_zathura(); void change_mode(int);