From: Michael Meeks Date: Wed, 4 Aug 1999 21:18:20 +0000 (+0000) Subject: Page navigation. X-Git-Tag: ChangeLog~32 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=bd7dce23fec36adeb1713c164d594bbc0436b346;p=evince.git Page navigation. --- diff --git a/pdf/xpdf/Makefile.in b/pdf/xpdf/Makefile.in index 1f5fea0f..dc96dadf 100644 --- a/pdf/xpdf/Makefile.in +++ b/pdf/xpdf/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4a from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -46,9 +46,10 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : @@ -96,6 +97,7 @@ PACKAGE = @PACKAGE@ PTHREAD_LIB = @PTHREAD_LIB@ RANLIB = @RANLIB@ STRIP = @STRIP@ +USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@ VERSION = @VERSION@ XPM_LIBS = @XPM_LIBS@ YACC = @YACC@ @@ -223,7 +225,7 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best DEP_FILES = .deps/Array.P .deps/Catalog.P .deps/Dict.P .deps/Error.P \ .deps/GOutputDev.P .deps/Gfx.P .deps/GfxFont.P .deps/GfxState.P \ @@ -261,8 +263,8 @@ install-binPROGRAMS: $(bin_PROGRAMS) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done @@ -397,7 +399,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -477,7 +479,7 @@ uninstall: uninstall-am all-am: Makefile $(PROGRAMS) $(DATA) all-redirect: all-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(gladedir) diff --git a/pdf/xpdf/gpdf.cc b/pdf/xpdf/gpdf.cc index 21ffb7f7..da85e0fc 100644 --- a/pdf/xpdf/gpdf.cc +++ b/pdf/xpdf/gpdf.cc @@ -43,9 +43,6 @@ poptContext ctx; #define DEV_DEBUG 0 -double zoom = 86.0; -gint page = 2; - #define DOC_ROOT_TAG "xpdf_doc_root" struct DOC_ROOT { GString *title; @@ -58,6 +55,9 @@ struct DOC_ROOT { GtkScrolledWindow *scroll; GtkWidget *mainframe; GladeXML *gui; + + double zoom; + gint page; }; GList *documents = NULL; @@ -85,8 +85,8 @@ setup_pixmap (DOC_ROOT *doc, GdkWindow *window) int w, h; GdkPixmap *pixmap = NULL; - w = (int)((pdf->getPageWidth (page) * zoom) / 72.0); - h = (int)((pdf->getPageHeight (page) * zoom) / 72.0); + w = (int)((pdf->getPageWidth (doc->page) * doc->zoom) / 72.0); + h = (int)((pdf->getPageHeight (doc->page) * doc->zoom) / 72.0); pixmap = gdk_pixmap_new (window, w, h, -1); @@ -109,9 +109,9 @@ setup_pixmap (DOC_ROOT *doc, GdkWindow *window) } static void -show_page (DOC_ROOT *doc, gint page) +render_page (DOC_ROOT *doc) { - doc->pdf->displayPage(doc->out, page, zoom, 0, gTrue); + doc->pdf->displayPage(doc->out, doc->page, doc->zoom, 0, gTrue); } /*static void displayPage(int page1, int zoom1, int rotate1) { @@ -186,6 +186,9 @@ doc_root_new (GString *fileName) return NULL; } + doc->zoom = 86.0; + doc->page = 1; + connect_signals (doc); gtk_object_set_data (GTK_OBJECT (doc->mainframe), DOC_ROOT_TAG, doc); @@ -195,7 +198,7 @@ doc_root_new (GString *fileName) doc->scroll = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL)); gtk_scrolled_window_set_policy (doc->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - show_page (doc, page); + render_page (doc); gtk_scrolled_window_add_with_viewport (doc->scroll, GTK_WIDGET (doc->pixmap)); gtk_box_pack_start (GTK_BOX (pane), GTK_WIDGET (doc->scroll), TRUE, TRUE, 0); @@ -249,19 +252,101 @@ extern "C" { } static void - simple_connect (DOC_ROOT *doc, const char *name, GtkSignalFunc func) + do_forward_button (GtkWidget *w, DOC_ROOT *doc) + { + if (doc->page < doc->pdf->getNumPages()) { + doc->page++; + render_page (doc); + gtk_widget_queue_draw (GTK_WIDGET (doc->scroll)); + } + } + + static void + do_back_button (GtkWidget *w, DOC_ROOT *doc) + { + if (doc->page > 1) { + doc->page--; + render_page (doc); + gtk_widget_queue_draw (GTK_WIDGET (doc->pixmap)); + } + } + + static void + do_first_button (GtkWidget *w, DOC_ROOT *doc) + { + if (doc->page != 1) { + doc->page = 1; + render_page (doc); + gtk_widget_queue_draw (GTK_WIDGET (doc->pixmap)); + } + } + + static void + do_last_button (GtkWidget *w, DOC_ROOT *doc) + { + if (doc->page != doc->pdf->getNumPages()) { + doc->page = doc->pdf->getNumPages(); + render_page (doc); + gtk_widget_queue_draw (GTK_WIDGET (doc->pixmap)); + } + } + + static void + do_larger_button (GtkWidget *w, DOC_ROOT *doc) + { + if (doc->zoom < 200) { + doc->zoom *= 1.2; + render_page (doc); + gtk_widget_queue_draw (GTK_WIDGET (doc->pixmap)); + } + } + + static void + do_smaller_button (GtkWidget *w, DOC_ROOT *doc) + { + if (doc->zoom < 200) { + doc->zoom /= 1.2; + render_page (doc); + gtk_widget_queue_draw (GTK_WIDGET (doc->pixmap)); + } + } + + static void + simple_menu_connect (DOC_ROOT *doc, const char *name, GtkSignalFunc func) { GtkWidget *w; w = glade_xml_get_widget (doc->gui, name); + g_return_if_fail (w); gtk_signal_connect (GTK_OBJECT (w), "activate", func, doc); } + static void + simple_button_connect (DOC_ROOT *doc, const char *name, GtkSignalFunc func) + { + GtkWidget *w; + w = glade_xml_get_widget (doc->gui, name); + g_return_if_fail (w); + gtk_signal_connect (GTK_OBJECT (w), "clicked", func, doc); + } + static void connect_signals (DOC_ROOT *doc) { - simple_connect (doc, "about_menu", GTK_SIGNAL_FUNC (do_about_box)); - simple_connect (doc, "close_menu", GTK_SIGNAL_FUNC (do_close)); - simple_connect (doc, "exit_menu", GTK_SIGNAL_FUNC (do_exit)); + GtkWidget *w; + + simple_menu_connect (doc, "about_menu", GTK_SIGNAL_FUNC (do_about_box)); + simple_menu_connect (doc, "close_menu", GTK_SIGNAL_FUNC (do_close)); + simple_menu_connect (doc, "exit_menu", GTK_SIGNAL_FUNC (do_exit)); + + simple_button_connect (doc, "forward", GTK_SIGNAL_FUNC (do_forward_button)); + simple_button_connect (doc, "back", GTK_SIGNAL_FUNC (do_back_button)); + simple_button_connect (doc, "first", GTK_SIGNAL_FUNC (do_first_button)); + simple_button_connect (doc, "last", GTK_SIGNAL_FUNC (do_last_button)); +/* simple_button_connect (doc, "larger", GTK_SIGNAL_FUNC (do_larger_button)); need to resize the gtkpixmap... + simple_button_connect (doc, "smaller", GTK_SIGNAL_FUNC (do_smaller_button)); but bed first. */ + + gtk_signal_connect (GTK_OBJECT (doc->mainframe), "destroy", + GTK_SIGNAL_FUNC (do_close), doc); } }