]> git.donarmstrong.com Git - xournal.git/commitdiff
Win32 portability
authorauroux <auroux>
Mon, 2 Nov 2009 05:08:21 +0000 (05:08 +0000)
committerauroux <auroux>
Mon, 2 Nov 2009 05:08:21 +0000 (05:08 +0000)
16 files changed:
ChangeLog
Makefile.in
configure
configure.in
src/Makefile.am
src/Makefile.in
src/TODO
src/win32/Makefile [new file with mode: 0644]
src/win32/xournal.ico [new file with mode: 0644]
src/win32/xournal.rc [new file with mode: 0644]
src/xo-callbacks.c
src/xo-file.c
src/xo-misc.c
src/xo-paint.c
src/xo-print.c
src/xournal.h

index 6c19ddb5a18164d03f3c7beec8c14c0ed7459101..85fce2adcd121008df3f986ddf3018cf33241e08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+This version:
+  - win32 portability code (contributed by Dirk Gerrits)
+
 Version 0.4.5 (Oct 2, 2009):
   - bugfixes for GTK+ 2.16/2.17 issues with xinput events
   - various minor UI bugfixes
index 5c95f1eec4c920f4ab120f2096c35347e36f8faf..88e8ec1f339a582dce5b6dd11240bfb103b852d4 100644 (file)
@@ -31,11 +31,14 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in $(srcdir)/config.h.in \
        $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
-       depcomp install-sh missing mkinstalldirs
+       config.guess config.sub depcomp install-sh missing \
+       mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -175,14 +178,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index 893a46fd35cb166a186554665be4946d32b84fea..92a9db10c84a54235cbf33c5347e074c34e42e82 100755 (executable)
--- a/configure
+++ b/configure
@@ -656,6 +656,16 @@ MSGFMT_OPTS
 MSGFMT
 USE_NLS
 GETTEXT_PACKAGE
+WIN32_FALSE
+WIN32_TRUE
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
 PACKAGE_LIBS
 PACKAGE_CFLAGS
 PKG_CONFIG
@@ -1373,6 +1383,10 @@ Program names:
   --program-prefix=PREFIX            prepend PREFIX to installed program names
   --program-suffix=SUFFIX            append SUFFIX to installed program names
   --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
 _ACEOF
 fi
 
@@ -5865,7 +5879,7 @@ _ACEOF
 fi
 
 
-pkg_modules="gtk+-2.0 >= 2.10.0 libgnomecanvas-2.0 >= 2.4.0 poppler-glib >= 0.5.4"
+pkg_modules="gtk+-2.0 >= 2.10.0 libgnomecanvas-2.0 >= 2.4.0 poppler-glib >= 0.5.4 pangoft2 >= 1.0"
 
 
 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
@@ -6094,6 +6108,108 @@ fi
 
 
 
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking for Win32 environment" >&5
+$as_echo_n "checking for Win32 environment... " >&6; }
+case "$host" in
+ *-*-mingw*)
+   os_win32=yes;;
+ *)
+   os_win32=no;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $os_win32" >&5
+$as_echo "$os_win32" >&6; }
+ if test "$os_win32" = "yes"; then
+  WIN32_TRUE=
+  WIN32_FALSE='#'
+else
+  WIN32_TRUE='#'
+  WIN32_FALSE=
+fi
+
+
 GETTEXT_PACKAGE=xournal
 
 
@@ -7904,6 +8020,13 @@ $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${WIN32_TRUE}" && test -z "${WIN32_FALSE}"; then
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WIN32\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"WIN32\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
index afb03e3f5c88c21e1d469b1425d9f9bd5cf9cf9c..4d74a8a3ccf1e9ae4b138ecd3593d15eca1e2ebd 100644 (file)
@@ -11,11 +11,23 @@ AM_PROG_CC_STDC
 AC_PROG_RANLIB
 AC_HEADER_STDC
 
-pkg_modules="gtk+-2.0 >= 2.10.0 libgnomecanvas-2.0 >= 2.4.0 poppler-glib >= 0.5.4"
+pkg_modules="gtk+-2.0 >= 2.10.0 libgnomecanvas-2.0 >= 2.4.0 poppler-glib >= 0.5.4 pangoft2 >= 1.0"
 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
 AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(PACKAGE_LIBS)
 
+dnl detect Win32 environment...
+AC_CANONICAL_HOST
+AC_MSG_CHECKING([for Win32 environment])
+case "$host" in
+ *-*-mingw*)
+   os_win32=yes;;
+ *)
+   os_win32=no;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL(WIN32, test "$os_win32" = "yes")
+
 GETTEXT_PACKAGE=xournal
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
index aef9a77ad7ebd3ce3734145293816c8f899306db..4a2823fe324835353827a4919509ee795bc314b4 100644 (file)
@@ -1,6 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = ttsubset
+if WIN32
+  SUBDIRS = ttsubset win32
+else
+  SUBDIRS = ttsubset
+endif
 
 INCLUDES = \
        -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
@@ -20,5 +24,10 @@ xournal_SOURCES = \
        xo-callbacks.c xo-callbacks.h \
        xo-shapes.c xo-shapes.h
 
-xournal_LDADD = ttsubset/libttsubset.a @PACKAGE_LIBS@ $(INTLLIBS)
+if WIN32
+  xournal_LDFLAGS = -mwindows
+  xournal_LDADD = win32/xournal.res ttsubset/libttsubset.a @PACKAGE_LIBS@ $(INTLLIBS) -lz
+else
+  xournal_LDADD = ttsubset/libttsubset.a @PACKAGE_LIBS@ $(INTLLIBS)
+endif
 
index b9859f94836111b709ff8e348913d511b4a7893d..8557b93374356987153226a38f6fc5c9ef513870 100644 (file)
@@ -32,6 +32,8 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
 bin_PROGRAMS = xournal$(EXEEXT)
 subdir = src
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO
@@ -51,7 +53,12 @@ am_xournal_OBJECTS = main.$(OBJEXT) xo-misc.$(OBJEXT) \
        xo-callbacks.$(OBJEXT) xo-shapes.$(OBJEXT)
 xournal_OBJECTS = $(am_xournal_OBJECTS)
 am__DEPENDENCIES_1 =
-xournal_DEPENDENCIES = ttsubset/libttsubset.a $(am__DEPENDENCIES_1)
+@WIN32_FALSE@xournal_DEPENDENCIES = ttsubset/libttsubset.a \
+@WIN32_FALSE@  $(am__DEPENDENCIES_1)
+@WIN32_TRUE@xournal_DEPENDENCIES = win32/xournal.res \
+@WIN32_TRUE@   ttsubset/libttsubset.a $(am__DEPENDENCIES_1)
+xournal_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(xournal_LDFLAGS) \
+       $(LDFLAGS) -o $@
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -76,7 +83,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
        distdir
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
+DIST_SUBDIRS = ttsubset win32
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -179,14 +186,22 @@ am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
 bindir = @bindir@
+build = @build@
 build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
 builddir = @builddir@
 datadir = @datadir@
 datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
@@ -210,7 +225,8 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = ttsubset
+@WIN32_FALSE@SUBDIRS = ttsubset
+@WIN32_TRUE@SUBDIRS = ttsubset win32
 INCLUDES = \
        -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
        -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@@ -227,7 +243,9 @@ xournal_SOURCES = \
        xo-callbacks.c xo-callbacks.h \
        xo-shapes.c xo-shapes.h
 
-xournal_LDADD = ttsubset/libttsubset.a @PACKAGE_LIBS@ $(INTLLIBS)
+@WIN32_TRUE@xournal_LDFLAGS = -mwindows
+@WIN32_FALSE@xournal_LDADD = ttsubset/libttsubset.a @PACKAGE_LIBS@ $(INTLLIBS)
+@WIN32_TRUE@xournal_LDADD = win32/xournal.res ttsubset/libttsubset.a @PACKAGE_LIBS@ $(INTLLIBS) -lz
 all: all-recursive
 
 .SUFFIXES:
@@ -301,7 +319,7 @@ clean-binPROGRAMS:
        -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
 xournal$(EXEEXT): $(xournal_OBJECTS) $(xournal_DEPENDENCIES) 
        @rm -f xournal$(EXEEXT)
-       $(LINK) $(xournal_OBJECTS) $(xournal_LDADD) $(LIBS)
+       $(xournal_LINK) $(xournal_OBJECTS) $(xournal_LDADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
index 3472890466166dee474c20dd9fa9651fcac9236c..e58e73bb401b1b35e7b339f8b8d3920ce860e516 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -1,56 +1,8 @@
 List of features to be implemented (not in any particular order)
 ----------------------------------------------------------------
 
-THINGS DONE IN THIS RELEASE:
-
-DONE: fix GTK+ 2.16/2.17 XInput issues with scrollbars and menus
-DONE: fix bug 2826845 (shape recognizer accel doesn't work in fullscreen mode)
-DONE: bug affecting resize zone in statusbar
-DONE: page spinbutton wide enough for 3 digits; avoid "deprecated" warning
-DONE: edit->paste command should refresh toolbar to unselect color/thickness
-      (so can repaint sel)
-DONE: cursor doesn't reset properly after selection operation if primary
-      tool is select mode (stays with arrow cursor instead of pointer)
-DONE: device with "eraser" at the end of its name is of type ERASER
-      (Edward Yang)
-DONE: fix_xinput_coords() replaces buggy xinput events by core pointer 
-      coordinates
-DONE: use poppler to render PDF backgrounds (after patches contributed
-      by Mike Ter Louw and Bob McElrath)
-DONE: gettext internationalization (contributed by David Planella)
-DONE: Catalan translation (by David Planella); French translation
-DONE: fix unresponsiveness to button events in text edition box (GTK+ 2.17)
-      and segfaults when dragging text or using Layers combobox (GTK+ 2.17)
-DONE: Esc leaves text box if editing; and leaves fullscreen mode
-DONE: package our own copy of the ttsubset library (to remove a dependency
-      on libgnomeprint), and create TT subfonts in memory
-DONE: use gtk-print instead of libgnomeprint
-DONE: remove deprecated "antialias bg" option
-DONE: fix fix_xinput_coords so it works ok without ENABLE_XINPUT_BUGFIX ?
-DONE: disable ctrl-left/right accelerators during text edition
-DONE: custom color chooser button (after a patch contributed by Alex Ray)
-DONE: remember last used directory (after a patch contributed by Lu Zhihe)
-DONE: discard Alt-click and Control-click events
-DONE: option to have buttons *toggle* the tool rather than act as tool
-       (ie button 2 causes button 1 to map to tool 2) [Dylan Thurston]
-DONE: patch to fix focus + allow up/dn in single page mode (Bob McElrath)
-DONE: patch to fix underscores in MRU filename display (Bob McElrath)
-DONE: patch to avoid tiny file dialogs (Bob McElrath)
-DONE: further fixes for focus; can Esc out of page selection box
-DONE: further fixes for xinput under GTK+ 2.17
-DONE: option to auto-load *.pdf.xoj instead of *.pdf (Bob McElrath)
-DONE: look for PDF backgrounds in path of xoj file before prompting user
-DONE: paper color chooser (after a patch by ojb)
-DONE: remove "Discard core events" from options menu
-DONE: get_pressure_multiplier() accesses correct members of event union
-DONE: address recognizer bug on single-segment strokes (division by 0)
-DONE: remove binary installer (poppler is binary incompatible across versions)
-      but provide configure script
-
-REMAINING THINGS TO DO:
-
 - collaborative editing (see discussion with Erik Demaine)
-- porting to Win32 and MacOS; merge Nokia port
+- porting to MacOS; merge Nokia port
 - multiple-scenario undo history
 
 - collaborative: allow non-x86 endianness (for ints, for floats?)
@@ -65,6 +17,21 @@ REMAINING THINGS TO DO:
    or see if removing the GTK bugfix would help? -- e.g. by recalling an
    internal gtk init function?
 
+BUGS:
+** lingering issues with synaptics touchpads? (#2872667)
+     - add patch 0.4.5-fix-synaptics-v1.patch (fix ButtonDown events)
+     - set device to Absolute mode at startup? (GDK doesn't expose API,
+       cf XSetDeviceMode() in /usr/include/X11/extensions/XInput.h)
+** color picker into canvas doesn't work in GTK+ 2.16 (should disable
+   xinput first?)
+
+WIN32:
+- test further
+- write an installer
+
+PATCHES TO INCORPORATE:
+** Italian translation (add_it_po.patch unless updated on tracker)
+   (by Marco Poletti)
 
 ** patch: ortho/snap (revised Apr 13 2009)
    xournal_ortho_snap_patch_4 (by Josef Pavlicek)
@@ -72,10 +39,12 @@ REMAINING THINGS TO DO:
 ** patch (Ian-Woo Kim): multicolumn mode + LASSO SELECTION
    xournal_lasso_multipage_zoom_button_20090620.patch
 
-** autosave patch (Edward Yang) (fix: optional only, w/ menu + cfgfile
+** autosave patch (Edward Yang) (should fix: optional only, w/ menu + cfgfile
    entries; fix: should clean up autosave.xoj.bg* files too; config interval)
    0001-Implement-autosave-for-documents-revised.patch (2 seconds after
    modification, vs original 5 seconds)
+   *** NEW VERSION: #2881919 (autosave for 0.4.5, w/ some changes)
+   NB: last modif should be triggered by prepare_new_undo() and undo/redo?
 
 - PDF bg memory usage throttling / delete oldest pdf backgrounds
 - replace ttsubset by something more modern? (eg. from cairo ?)
@@ -119,13 +88,11 @@ REMAINING THINGS TO DO:
 
 - allow toolbar to go vertical
 - toolbar buttons should react to button 2/3 click to modify settings
-  for that tool?
+  for that tool!!
 
 - paste text directly into xournal, from xournal?
     (instead of starting a text item and pasting into/from it)
 - insert links (to URLs; within document/to other xoj? hand mode navigates)
-- increase width of spinPageNo to fit 3 digits
-- should escape '_' to '__' in MRU menu entries (else become mnemonics)
 - a command + keyboard shortcut to switch mappings (1<->2, 1<->3, 2<->3)
      (A. Rechnitzer Sept 11, 2007)
 - modify encoding of TrueType font subsets or provide cmap so pdf text
@@ -145,9 +112,9 @@ REMAINING THINGS TO DO:
 - export as SVG, as bitmap (use Cairo for this)
 - improved PDF viewer features (search text, hyperlink, page borders...)
    (using full poppler api ?)
+- search text: among PDF background (using poppler); among text annotations
 
 - use system paper size as default (/etc/papersize)
-- autoload *.pdf.xoj if present when opening *.pdf ???
 - sticky notes (anchor visually text box to a bg location)
 - use relative paths for bg documents (e.g. annotated PDF)
 - flush display queue when drawing over a slow X server?
@@ -164,8 +131,8 @@ REMAINING THINGS TO DO:
 - lasso selection tool (see shoffsta patch)
      (http://shoffsta.afraid.org/Projects/Xournal/)
 - flatten (incl undo/redo...) - enabled only if nlayers>1
-- color chooser (papercolor, pen color); maybe more default colors
-  cf. ojb patch #2083103 adds paper color chooser
+- color chooser (papercolor, pen color); have default colors and a history
+  appear as palette in there!
 - printing: print-options, save printer settings (throughout a session,
    and on disk) (maybe a separate config file .xournal/gnome-print-settings)
 - help index
diff --git a/src/win32/Makefile b/src/win32/Makefile
new file mode 100644 (file)
index 0000000..97821d3
--- /dev/null
@@ -0,0 +1,7 @@
+all: xournal.res
+all-recursive: all
+install-recursive:
+install:
+
+xournal.res: xournal.rc
+       windres xournal.rc -O coff -o xournal.res
diff --git a/src/win32/xournal.ico b/src/win32/xournal.ico
new file mode 100644 (file)
index 0000000..ad184de
Binary files /dev/null and b/src/win32/xournal.ico differ
diff --git a/src/win32/xournal.rc b/src/win32/xournal.rc
new file mode 100644 (file)
index 0000000..40ad5c7
--- /dev/null
@@ -0,0 +1 @@
+id ICON "xournal.ico"
index d98cd4304b1b072192b11e27756ea454b92dcc24..7bc531a4cd0943bf31ccb7a5ee1779ac4a3cd671 100644 (file)
@@ -221,7 +221,7 @@ on_fileSaveAs_activate                 (GtkMenuItem     *menuitem,
   }
   else {
     curtime = time(NULL);
-    strftime(stime, 30, "%F-Note-%H-%M.xoj", localtime(&curtime));
+    strftime(stime, 30, "%Y-%m-%d-Note-%H-%M.xoj", localtime(&curtime));
     if (ui.default_path!=NULL)
       gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), ui.default_path);
     gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), stime);
@@ -374,7 +374,7 @@ on_filePrintPDF_activate               (GtkMenuItem     *menuitem,
     gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), g_basename(in_fn));
   } else {
     curtime = time(NULL);
-    strftime(stime, 30, "%F-Note-%H-%M.pdf", localtime(&curtime));
+    strftime(stime, 30, "%Y-%m-%d-Note-%H-%M.pdf", localtime(&curtime));
     if (ui.default_path!=NULL)
       gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), ui.default_path);
     gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), stime);
@@ -2258,7 +2258,7 @@ on_helpAbout_activate                  (GtkMenuItem     *menuitem,
   aboutDialog = create_aboutDialog ();
   labelTitle = GTK_LABEL(g_object_get_data(G_OBJECT(aboutDialog), "labelTitle"));
   gtk_label_set_markup(labelTitle, 
-    "<span size=\"xx-large\" weight=\"bold\">Xournal " VERSION "</span>");
+    "<span size=\"xx-large\" weight=\"bold\">Xournal " VERSION_STRING "</span>");
   gtk_dialog_run (GTK_DIALOG(aboutDialog));
   gtk_widget_destroy(aboutDialog);
 }
@@ -2370,6 +2370,8 @@ on_canvas_button_press_event           (GtkWidget       *widget,
   }
   if ((event->state & (GDK_CONTROL_MASK|GDK_MOD1_MASK)) != 0) return FALSE;
     // no control-clicking or alt-clicking
+  if (!is_core) gdk_device_get_state(event->device, event->window, event->axes, NULL);
+    // synaptics touchpads send bogus axis values with ButtonDown
   if (!is_core)
     fix_xinput_coords((GdkEvent *)event);
 
@@ -2443,6 +2445,9 @@ on_canvas_button_press_event           (GtkWidget       *widget,
   
   ui.which_mouse_button = event->button;
   switch_mapping(mapping);
+#ifdef WIN32
+  update_cursor();
+#endif
 
   // in text tool, clicking in a text area edits it
   if (ui.toolno[mapping] == TOOL_TEXT) {
index 7ff79749542b2dec4834df12d09d439cf6d970fa..2743a28c1db5c743226583c273ebd3e2624bacdf 100644 (file)
 #include <libgnomecanvas/libgnomecanvas.h>
 #include <zlib.h>
 #include <math.h>
-#include <gdk/gdkx.h>
-#include <X11/Xlib.h>
 #include <locale.h>
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <poppler/glib/poppler.h>
 
+#ifndef WIN32
+ #include <gdk/gdkx.h>
+ #include <X11/Xlib.h>
+#endif
+
 #include "xournal.h"
 #include "xo-interface.h"
 #include "xo-support.h"
@@ -83,7 +86,7 @@ gboolean save_journal(const char *filename)
   GList *pagelist, *layerlist, *itemlist, *list;
   GtkWidget *dialog;
   
-  f = gzopen(filename, "w");
+  f = gzopen(filename, "wb");
   if (f==NULL) return FALSE;
   chk_attach_names();
 
@@ -143,7 +146,7 @@ gboolean save_journal(const char *filename)
           success = FALSE;
           if (bgpdf.status != STATUS_NOT_INIT && bgpdf.file_contents != NULL)
           {
-            tmpf = fopen(tmpfn, "w");
+            tmpf = fopen(tmpfn, "wb");
             if (tmpf != NULL && fwrite(bgpdf.file_contents, 1, bgpdf.file_length, tmpf) == bgpdf.file_length)
               success = TRUE;
             fclose(tmpf);
@@ -715,7 +718,7 @@ gboolean open_journal(char *filename)
   }
   g_free(tmpfn);
 
-  f = gzopen(filename, "r");
+  f = gzopen(filename, "rb");
   if (f==NULL) return FALSE;
   if (filename[0]=='/') {
     if (ui.default_path != NULL) g_free(ui.default_path);
@@ -864,7 +867,7 @@ GList *attempt_load_gv_bg(char *filename)
   char *pipename;
   int buflen, remnlen, file_pageno;
   
-  f = fopen(filename, "r");
+  f = fopen(filename, "rb");
   if (f == NULL) return NULL;
   buf = g_malloc(BUFSIZE); // a reasonable buffer size
   if (fread(buf, 1, 4, f) !=4 ||
@@ -876,7 +879,7 @@ GList *attempt_load_gv_bg(char *filename)
   
   fclose(f);
   pipename = g_strdup_printf(GS_CMDLINE, (double)GS_BITMAP_DPI, filename);
-  gs_pipe = popen(pipename, "r");
+  gs_pipe = popen(pipename, "rb");
   g_free(pipename);
   
   bg_list = NULL;
@@ -922,6 +925,7 @@ GList *attempt_load_gv_bg(char *filename)
 
 struct Background *attempt_screenshot_bg(void)
 {
+#ifndef WIN32
   struct Background *bg;
   GdkPixbuf *pix;
   XEvent x_event;
@@ -958,6 +962,10 @@ struct Background *attempt_screenshot_bg(void)
   bg->filename = new_refstring(NULL);
   bg->file_domain = DOMAIN_ATTACH;
   return bg;
+#else
+  // not implemented under WIN32
+  return FALSE;
+#endif
 }
 
 /************** pdf annotation ***************/
index cf63de78c3e2cfc1c8377f53bd7ac2d4b96f6b32..cb8fd485ef75db7753d207aa64bf80a5f6b80d1e 100644 (file)
@@ -7,7 +7,6 @@
 #include <gtk/gtk.h>
 #include <libgnomecanvas/libgnomecanvas.h>
 #include <gdk/gdkkeysyms.h>
-#include <X11/Xlib.h>
 
 #include "xournal.h"
 #include "xo-interface.h"
@@ -2040,6 +2039,11 @@ void hide_unimplemented(void)
   if (gtk_check_version(2, 10, 0)) {
     gtk_widget_hide(GET_COMPONENT("filePrint"));
   }  
+  
+  /* screenshot feature doesn't work yet in Win32 */
+#ifdef WIN32
+  gtk_widget_hide(GET_COMPONENT("journalScreenshot"));
+#endif
 }  
 
 // toggle fullscreen mode
@@ -2052,9 +2056,23 @@ void do_fullscreen(gboolean active)
   gtk_toggle_tool_button_set_active(
     GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonFullscreen")), ui.fullscreen);
 
-  if (ui.fullscreen) gtk_window_fullscreen(GTK_WINDOW(winMain));
-  else gtk_window_unfullscreen(GTK_WINDOW(winMain));
-  
+  if (ui.fullscreen) {
+#ifdef WIN32
+    gtk_window_get_size(GTK_WINDOW(winMain), &ui.pre_fullscreen_width, &ui.pre_fullscreen_height);
+    gtk_widget_set_size_request(GTK_WIDGET(winMain), gdk_screen_width(),
+                                                     gdk_screen_height());
+#endif
+    gtk_window_fullscreen(GTK_WINDOW(winMain));
+  }
+  else {
+#ifdef WIN32
+    gtk_widget_set_size_request(GTK_WIDGET(winMain), -1, -1);
+    gtk_window_resize(GTK_WINDOW(winMain), ui.pre_fullscreen_width,
+                                           ui.pre_fullscreen_height);
+#endif
+    gtk_window_unfullscreen(GTK_WINDOW(winMain));
+  }
+
   update_vbox_order(ui.vertical_order[ui.fullscreen?1:0]);
 }
 
index 7ab18469f3006edaa2eacc5e3f523cc4f0fbed75..6361af72e2d30cdc83dba3b189f89859330c1a2d 100644 (file)
 #include "xo-misc.h"
 #include "xo-paint.h"
 
+/***** Win32 fix for gdk_cursor_new_from_pixmap() by Dirk Gerrits ****/
+
+#ifdef WIN32
+gboolean colors_too_similar(const GdkColor *colora, const GdkColor *colorb)
+{
+  return (abs(colora->red - colorb->red) < 256 &&
+          abs(colora->green - colorb->green) < 256 &&
+          abs(colora->blue - colorb->blue) < 256);
+}
+
+/* gdk_cursor_new_from_pixmap is broken on Windows.
+   this is a workaround using gdk_cursor_new_from_pixbuf. */
+GdkCursor* fixed_gdk_cursor_new_from_pixmap(GdkPixmap *source, GdkPixmap *mask,
+                                           const GdkColor *fg, const GdkColor *bg,
+                                           gint x, gint y)
+{
+  GdkPixmap *rgb_pixmap;
+  GdkGC *gc;
+  GdkPixbuf *rgb_pixbuf, *rgba_pixbuf;
+  GdkCursor *cursor;
+  int width, height;
+
+  /* HACK!  It seems impossible to work with RGBA pixmaps directly in
+     GDK-Win32.  Instead we pick some third color, different from fg
+     and bg, and use that as the 'transparent color'.  We do this using
+     colors_too_similar (see above) because two colors could be
+     unequal in GdkColor's 16-bit/sample, but equal in GdkPixbuf's
+     8-bit/sample. */
+  GdkColor candidates[3] = {{0,65535,0,0}, {0,0,65535,0}, {0,0,0,65535}};
+  GdkColor *trans = &candidates[0];
+  if (colors_too_similar(trans, fg) || colors_too_similar(trans, bg)) {
+    trans = &candidates[1];
+    if (colors_too_similar(trans, fg) || colors_too_similar(trans, bg)) {
+      trans = &candidates[2];
+    }
+  } /* trans is now guaranteed to be unique from fg and bg */
+
+  /* create an empty pixmap to hold the cursor image */
+  gdk_drawable_get_size(source, &width, &height);
+  rgb_pixmap = gdk_pixmap_new(NULL, width, height, 24);
+
+  /* blit the bitmaps defining the cursor onto a transparent background */
+  gc = gdk_gc_new(rgb_pixmap);
+  gdk_gc_set_fill(gc, GDK_SOLID);
+  gdk_gc_set_rgb_fg_color(gc, trans);
+  gdk_draw_rectangle(rgb_pixmap, gc, TRUE, 0, 0, width, height);
+  gdk_gc_set_fill(gc, GDK_OPAQUE_STIPPLED);
+  gdk_gc_set_stipple(gc, source);
+  gdk_gc_set_clip_mask(gc, mask);
+  gdk_gc_set_rgb_fg_color(gc, fg);
+  gdk_gc_set_rgb_bg_color(gc, bg);
+  gdk_draw_rectangle(rgb_pixmap, gc, TRUE, 0, 0, width, height);
+  gdk_gc_unref(gc);
+
+  /* create a cursor out of the created pixmap */
+  rgb_pixbuf = gdk_pixbuf_get_from_drawable(
+    NULL, rgb_pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, width, height);
+  gdk_pixmap_unref(rgb_pixmap);
+  rgba_pixbuf = gdk_pixbuf_add_alpha(
+    rgb_pixbuf, TRUE, trans->red, trans->green, trans->blue);
+  gdk_pixbuf_unref(rgb_pixbuf);
+  cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), rgba_pixbuf, x, y);
+  gdk_pixbuf_unref(rgba_pixbuf);
+
+  return cursor;
+}
+#define gdk_cursor_new_from_pixmap fixed_gdk_cursor_new_from_pixmap
+#endif
+
+
 /************** drawing nice cursors *********/
 
 static char cursor_pen_bits[] = {
index bb80653a926bdb7b57e9e7d20f39f5dc362cd56f..6340ca3aedc9a539f6e4740921c99331e9ab16fd 100644 (file)
@@ -1191,7 +1191,7 @@ gboolean print_to_pdf(char *filename)
   struct PdfFont *font;
   char *tmpbuf;
   
-  f = fopen(filename, "w");
+  f = fopen(filename, "wb");
   if (f == NULL) return FALSE;
   setlocale(LC_NUMERIC, "C");
   annot = FALSE;
index 48ae81a9f63158d731872214797550b5fb78819b..15906cdf6a257fe4298e94b6bebc60e706ea5492 100644 (file)
 #define MRU_SIZE 8 
 #define CONFIG_FILE "config"
 
+// version string for about box
+
+#ifdef WIN32
+#define VERSION_STRING VERSION "-win32"
+#else
+#define VERSION_STRING VERSION
+#endif
+
 // DATA STRUCTURES AND CONSTANTS
 
 #define PIXEL_MOTION_THRESHOLD 0.3
@@ -282,6 +290,7 @@ typedef struct UIData {
   gboolean shorten_menus; // shorten menus ?
   gchar *shorten_menu_items; // which items to hide
   gboolean is_sel_cursor; // displaying a selection-related cursor
+  gint pre_fullscreen_width, pre_fullscreen_height; // for win32 fullscreen
 #if GTK_CHECK_VERSION(2,10,0)
   GtkPrintSettings *print_settings;
 #endif