From b3fe26e023d4f1cafbadd383574bc0971291f784 Mon Sep 17 00:00:00 2001 From: auroux Date: Thu, 23 Mar 2006 05:19:23 +0000 Subject: [PATCH] Commit of current source code (post 0.2 release) - Denis. --- ChangeLog | 6 +++++- configure.in | 2 +- html-doc/manual.html | 5 ++--- src/TODO | 7 ++++++- src/main.c | 3 ++- src/xo-callbacks.c | 2 +- src/xo-file.c | 34 +++++++++++++++++++++++++++------- 7 files changed, 44 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 190f6d1..7627fdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version ?: + - can specify on command line a PDF file to annotate + - fixed a bug in XInput initialization (thanks to Luca de Cicco) + Version 0.2 (Jan 29, 2006): - PDF file annotation using xpdf's pdftoppm (PDF backgrounds updated asynchronously at all resolutions) @@ -5,7 +9,7 @@ Version 0.2 (Jan 29, 2006): - option to antialias and filter bitmap backgrounds when zooming - option to emulate eraser tip with right mouse button - binary installer allows non-root installation without compiling - - full-screen mode + - full-screen mode (patch contributed by Luca De Cicco) Version 0.1.1 (Jan 5, 2006): - two bugfixes diff --git a/configure.in b/configure.in index 84d40c4..d7e52a9 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(configure.in) -AM_INIT_AUTOMAKE(xournal, 0.2) +AM_INIT_AUTOMAKE(xournal, 0.2.1) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/html-doc/manual.html b/html-doc/manual.html index 44681d3..a7bfcc4 100644 --- a/html-doc/manual.html +++ b/html-doc/manual.html @@ -44,8 +44,7 @@ Xournal can be downloaded at Xournal aims to provide superior graphical quality (subpixel resolution) and overall functionality; however it lacks the collaborative features of Jarnal. Since Xournal is still in its early development stages, it may not - be fully stable, and some features have not been implemented yet - (in particular, freeform selection and PDF backgrounds are missing). + be fully stable, and some features have not been implemented yet.

Table of contents

@@ -458,7 +457,7 @@ Version 0.2 (January 29, 2006):

  • option to antialias and filter bitmap backgrounds when zooming
  • option to emulate eraser tip with right mouse button
  • binary installer allows non-root installation without compiling
  • -
  • full-screen mode
  • +
  • full-screen mode (patch contributed by Luca De Cicco)
  • diff --git a/src/TODO b/src/TODO index 659ceab..39ab5a6 100644 --- a/src/TODO +++ b/src/TODO @@ -1,3 +1,4 @@ +- non-attached annotation => suggest a derived filename for save-as - lasso selection tool - prefs file, save prefs - recent files list @@ -5,12 +6,13 @@ - flatten (incl undo/redo...) - enabled only if nlayers>1 - bg: apply to all pages - recolor selection +- resize selection - move selection to another page by drag-drop (should apply to vertspacer when origin moves to another page, but in the up direction only do so when all the stuff fits on prev page) - text tool, font chooser, default font -- color chooser (papercolor, pen color) +- color chooser (papercolor, pen color); maybe more default colors - printing: print-to-PDF? (with & without pdf background to merge) opacity issue for highlighter strokes (maybe print them below ?) save gnome printer settings (throughout a session, and on disk) @@ -19,4 +21,7 @@ - file print-options, own print-to-ps/pdf - help index - pressure sensitivity +- insert images (screen capture or from file), not as full-page backgrounds +- more pen/highlighter shapes (chisel) - convert to/from Jarnal format +- recalibration upon screen resize / compensation for miscalibration diff --git a/src/main.c b/src/main.c index 125ebb6..52b889c 100644 --- a/src/main.c +++ b/src/main.c @@ -174,7 +174,7 @@ void init_stuff (int argc, char *argv[]) dev_list = gdk_devices_list(); while (dev_list != NULL) { device = (GdkDevice *)dev_list->data; - if (device->source == GDK_SOURCE_PEN || device->source == GDK_SOURCE_ERASER) { + if (device->source != GDK_SOURCE_MOUSE) { /* get around a GDK bug: map the valuator range CORRECTLY to [0,1] */ #if ENABLE_XINPUT_BUGFIX gdk_device_set_axis_use(device, 0, GDK_AXIS_IGNORE); @@ -183,6 +183,7 @@ void init_stuff (int argc, char *argv[]) gdk_device_set_mode(device, GDK_MODE_SCREEN); can_xinput = TRUE; } + else gdk_device_set_mode(device, GDK_MODE_DISABLED); dev_list = dev_list->next; } if (!can_xinput) diff --git a/src/xo-callbacks.c b/src/xo-callbacks.c index f2e6e3f..88b61ac 100644 --- a/src/xo-callbacks.c +++ b/src/xo-callbacks.c @@ -134,7 +134,7 @@ on_fileOpen_activate (GtkMenuItem *menuitem, set_cursor_busy(TRUE); success = open_journal(filename); set_cursor_busy(FALSE); - if (success) return; + if (success) { g_free(filename); return; } /* open failed */ dialog = gtk_message_dialog_new(GTK_WINDOW (winMain), GTK_DIALOG_DESTROY_WITH_PARENT, diff --git a/src/xo-file.c b/src/xo-file.c index 23678eb..a052475 100644 --- a/src/xo-file.c +++ b/src/xo-file.c @@ -560,6 +560,7 @@ gboolean open_journal(char *filename) char buffer[1000]; int len; gchar *tmpfn; + gboolean maybe_pdf; f = gzopen(filename, "r"); if (f==NULL) return FALSE; @@ -575,10 +576,14 @@ gboolean open_journal(char *filename) tmpFilename = filename; error = NULL; tmpBg_pdf = NULL; + maybe_pdf = TRUE; while (valid && !gzeof(f)) { len = gzread(f, buffer, 1000); if (len<0) valid = FALSE; + if (maybe_pdf && len>=4 && !strncmp(buffer, "%PDF", 4)) + { valid = FALSE; break; } // most likely pdf + else maybe_pdf = FALSE; if (len<=0) break; valid = g_markup_parse_context_parse(context, buffer, len, &error); } @@ -586,9 +591,19 @@ gboolean open_journal(char *filename) if (valid) valid = g_markup_parse_context_end_parse(context, &error); if (tmpJournal.npages == 0) valid = FALSE; g_markup_parse_context_free(context); + if (!valid) { delete_journal(&tmpJournal); - return FALSE; + if (!maybe_pdf) return FALSE; + // essentially same as on_fileNewBackground from here on + ui.saved = TRUE; + close_journal(); + while (bgpdf.status != STATUS_NOT_INIT) gtk_main_iteration(); + new_journal(); + ui.zoom = DEFAULT_ZOOM; + gnome_canvas_set_pixels_per_unit(canvas, ui.zoom); + update_page_stuff(); + return init_bgpdf(filename, TRUE, DOMAIN_ABSOLUTE); } ui.saved = TRUE; // force close_journal() to do its job @@ -631,7 +646,7 @@ gboolean open_journal(char *filename) ui.cur_layer = (struct Layer *)(g_list_last(ui.cur_page->layers)->data); ui.saved = TRUE; ui.zoom = DEFAULT_ZOOM; - update_file_name(filename); + update_file_name(g_strdup(filename)); gnome_canvas_set_pixels_per_unit(canvas, ui.zoom); make_canvas_items(); update_page_stuff(); @@ -781,8 +796,11 @@ struct Background *attempt_screenshot_bg(void) void end_bgpdf_shutdown(void) { if (bgpdf.tmpdir!=NULL) { - g_unlink(bgpdf.tmpfile_copy); - g_free(bgpdf.tmpfile_copy); + if (bgpdf.tmpfile_copy!=NULL) { + g_unlink(bgpdf.tmpfile_copy); + g_free(bgpdf.tmpfile_copy); + bgpdf.tmpfile_copy = NULL; + } g_rmdir(bgpdf.tmpdir); g_free(bgpdf.tmpdir); bgpdf.tmpdir = NULL; @@ -1006,16 +1024,18 @@ gboolean init_bgpdf(char *pdfname, gboolean create_pages, int file_domain) gsize filelen; if (bgpdf.status != STATUS_NOT_INIT) return FALSE; + bgpdf.tmpfile_copy = NULL; bgpdf.tmpdir = mkdtemp(g_strdup(TMPDIR_TEMPLATE)); if (!bgpdf.tmpdir) return FALSE; // make a local copy and check if it's a PDF - if (!g_file_get_contents(pdfname, &filebuf, &filelen, NULL)) return FALSE; + if (!g_file_get_contents(pdfname, &filebuf, &filelen, NULL)) + { end_bgpdf_shutdown(); return FALSE; } if (filelen < 4 || strncmp(filebuf, "%PDF", 4)) - { g_free(filebuf); return FALSE; } + { g_free(filebuf); end_bgpdf_shutdown(); return FALSE; } bgpdf.tmpfile_copy = g_strdup_printf("%s/bg.pdf", bgpdf.tmpdir); f = fopen(bgpdf.tmpfile_copy, "w"); if (f == NULL || fwrite(filebuf, 1, filelen, f) != filelen) - { g_free(filebuf); return FALSE; } + { g_free(filebuf); end_bgpdf_shutdown(); return FALSE; } fclose(f); g_free(filebuf); bgpdf.status = STATUS_IDLE; -- 2.39.2