X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fxournal.h;h=3ef9b27b873593c54b16a17444710ae376dd6e97;hb=69037d6ddbe7e90d13d8a7a088d8c209a926190e;hp=aadc1ea4a5c23c5d1f19d904f8538351ab504502;hpb=dcbb0ab8521a5e166f257d86884407eb98ef63f0;p=xournal.git
diff --git a/src/xournal.h b/src/xournal.h
index aadc1ea..3ef9b27 100644
--- a/src/xournal.h
+++ b/src/xournal.h
@@ -1,15 +1,36 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
#include
#include
+#include
-/* #define INPUT_DEBUG */
+// #define INPUT_DEBUG
/* uncomment this line if you experience event-processing problems
and want to list the input events received by xournal. Caution, lots
of output (redirect to a file). */
-#define ENABLE_XINPUT_BUGFIX
-/* comment out this line if you are experiencing calibration problems with
- XInput and want to try things differently. This will probably break
- on-the-fly display rotation after application startup, though. */
+// #define ENABLE_XINPUT_BUGFIX
+/* uncomment this line if you are experiencing calibration problems with
+ XInput and want to try things differently. Especially useful on older
+ distributions (up to around 2010). */
+
+#define FILE_DIALOG_SIZE_BUGFIX
+/* ugly, but should help users with versions of GTK+ that suffer from the
+ "tiny file dialog" syndrome, without hurting those with well-behaved
+ versions of GTK+. Comment out if you'd prefer not to include this fix. */
// PREF FILES INFO
@@ -18,6 +39,14 @@
#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
@@ -27,6 +56,7 @@
#define DISPLAY_DPI_DEFAULT 96.0
#define MIN_ZOOM 0.2
#define RESIZE_MARGIN 6.0
+#define MAX_SAFE_RENDER_DPI 720 // max dpi at which PDF bg's get rendered
#define VBOX_MAIN_NITEMS 5 // number of interface items in vboxMain
@@ -53,9 +83,9 @@ typedef struct Background {
Refstring *filename;
int file_domain;
int file_page_seq;
- int pixbuf_dpi; // for PDF only - the *current* dpi value
double pixbuf_scale; // for PIXMAP, this is the *current* zoom value
// for PDF, this is the *requested* zoom value
+ int pixel_height, pixel_width; // PDF only: pixel size of current pixbuf
} Background;
#define BG_SOLID 0
@@ -113,8 +143,9 @@ extern guint predef_bgcolors_rgba[COLOR_MAX];
#define TOOL_SELECTRECT 5
#define TOOL_VERTSPACE 6
#define TOOL_HAND 7
+#define TOOL_IMAGE 8
#define NUM_STROKE_TOOLS 3
-#define NUM_TOOLS 8
+#define NUM_TOOLS 9
#define NUM_BUTTONS 3
#define TOOLOPT_ERASER_STANDARD 0
@@ -132,7 +163,7 @@ struct UndoErasureData;
typedef struct Item {
int type;
struct Brush brush; // the brush to use, if ITEM_STROKE
- // 'brush" also contains color info for text items
+ // 'brush' also contains color info for text items
GnomeCanvasPoints *path;
gdouble *widths;
GnomeCanvasItem *canvas_item; // the corresponding canvas item, or NULL
@@ -143,6 +174,10 @@ typedef struct Item {
gchar *font_name;
gdouble font_size;
GtkWidget *widget; // the widget while text is being edited (ITEM_TEMP_TEXT)
+ // the following fields for ITEM_IMAGE:
+ GdkPixbuf *image; // the image
+ gchar *image_png; // PNG of original image, for save and clipboard
+ gsize image_png_len;
} Item;
// item type values for Item.type, UndoItem.type, ui.cur_item_type ...
@@ -171,6 +206,8 @@ typedef struct Item {
#define ITEM_TEXT_ATTRIB 21
#define ITEM_RESIZESEL 22
#define ITEM_RECOGNIZER 23
+#define ITEM_IMAGE 24
+#define ITEM_SELECTREGION 25
typedef struct Layer {
GList *items; // the items on the layer, from bottom to top
@@ -194,7 +231,7 @@ typedef struct Journal {
} Journal;
typedef struct Selection {
- int type; // ITEM_SELECTRECT, ITEM_MOVESEL_VERT
+ int type; // ITEM_SELECTRECT, ITEM_MOVESEL_VERT, ITEM_SELECTREGION
BBox bbox; // the rectangle bbox of the selection
struct Layer *layer; // the layer on which the selection lives
double anchor_x, anchor_y, last_x, last_y; // for selection motion
@@ -218,8 +255,10 @@ typedef struct UIData {
struct Brush default_brushes[NUM_STROKE_TOOLS]; // the default ones
int linked_brush[NUM_BUTTONS+1]; // whether brushes are linked across buttons
int cur_mapping; // the current button number for mappings
+ gboolean button_switch_mapping; // button clicks switch button 1 mappings
gboolean use_erasertip;
int which_mouse_button; // the mouse button drawing the current path
+ int which_unswitch_button; // if button_switch_mapping, the mouse button that switched the mapping
struct Page default_page; // the model for the default page
int layerbox_length; // the number of entries registered in the layers combo-box
struct Item *cur_item; // the item being drawn, or NULL
@@ -235,18 +274,21 @@ typedef struct UIData {
gboolean pressure_sensitivity; // use pen pressure to control stroke width?
double width_minimum_multiplier, width_maximum_multiplier; // calibration for pressure sensitivity
gboolean is_corestroke; // this stroke is painted with core pointer
+ gboolean saved_is_corestroke;
+ GdkDevice *stroke_device; // who's painting this stroke
int screen_width, screen_height; // initial screen size, for XInput events
double hand_refpt[2];
int hand_scrollto_cx, hand_scrollto_cy;
gboolean hand_scrollto_pending;
char *filename;
gchar *default_path; // default path for new notes
+ gchar *default_image; // path for previous image
gboolean view_continuous, fullscreen, maximize_at_start;
gboolean in_update_page_stuff; // semaphore to avoid scrollbar retroaction
struct Selection *selection;
GdkCursor *cursor;
- gboolean antialias_bg; // bilinear interpolation on bg pixmaps
- gboolean progressive_bg; // rescale bg's one at a time
+ GdkPixbuf *pen_cursor_pix, *hiliter_cursor_pix;
+ gboolean progressive_bg; // update PDF bg's one at a time
char *mrufile, *configfile; // file names for MRU & config
char *mru[MRU_SIZE]; // MRU data
GtkWidget *mrumenu[MRU_SIZE];
@@ -258,6 +300,7 @@ typedef struct UIData {
int zoom_step_increment; // the increment in the zoom dialog box
double zoom_step_factor; // the multiplicative factor in zoom in/out
double startup_zoom;
+ gboolean autoload_pdf_xoj;
#if GLIB_CHECK_VERSION(2,6,0)
GKeyFile *config_data;
#endif
@@ -272,6 +315,11 @@ 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
+ gboolean poppler_force_cairo; // force poppler to use cairo
} UIData;
#define BRUSH_LINKED 0
@@ -287,8 +335,8 @@ typedef struct UndoErasureData {
typedef struct UndoItem {
int type;
- struct Item *item; // for ITEM_STROKE, ITEM_TEXT, ITEM_TEXT_EDIT, ITEM_TEXT_ATTRIB
- struct Layer *layer; // for ITEM_STROKE, ITEM_ERASURE, ITEM_PASTE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_MOVESEL, ITEM_TEXT, ITEM_TEXT_EDIT, ITEM_RECOGNIZER
+ struct Item *item; // for ITEM_STROKE, ITEM_TEXT, ITEM_TEXT_EDIT, ITEM_TEXT_ATTRIB, ITEM_IMAGE
+ struct Layer *layer; // for ITEM_STROKE, ITEM_ERASURE, ITEM_PASTE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_MOVESEL, ITEM_TEXT, ITEM_TEXT_EDIT, ITEM_RECOGNIZER, ITEM_IMAGE
struct Layer *layer2; // for ITEM_DELETE_LAYER with val=-1, ITEM_MOVESEL
struct Page *page; // for ITEM_NEW_BG_ONE/RESIZE, ITEM_NEW_PAGE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_DELETE_PAGE
GList *erasurelist; // for ITEM_ERASURE, ITEM_RECOGNIZER
@@ -310,35 +358,32 @@ typedef struct UndoItem {
typedef struct BgPdfRequest {
int pageno;
- int dpi;
- gboolean initial_request; // if so, loop over page numbers
- gboolean is_printing; // this is for printing, not for display
+ double dpi;
} BgPdfRequest;
typedef struct BgPdfPage {
- int dpi;
+ double dpi;
GdkPixbuf *pixbuf;
+ int pixel_height, pixel_width; // pixel size of pixbuf
} BgPdfPage;
typedef struct BgPdf {
int status; // the rest only makes sense if this is not STATUS_NOT_INIT
- int pid; // PID of the converter process
+ guint pid; // the identifier of the idle callback
Refstring *filename;
int file_domain;
- gchar *tmpfile_copy; // the temporary work copy of the file (in tmpdir)
+ gchar *file_contents; // buffer containing a copy of file data
+ gsize file_length; // size of above buffer
int npages;
GList *pages; // a list of BgPdfPage structures
GList *requests; // a list of BgPdfRequest structures
- gchar *tmpdir; // where to look for pages coming from pdf converter
- gboolean create_pages; // create journal pages as we find stuff in PDF
gboolean has_failed; // has failed in the past...
+ PopplerDocument *document; // the poppler document
} BgPdf;
#define STATUS_NOT_INIT 0
-#define STATUS_IDLE 1
-#define STATUS_RUNNING 2 // currently running child process on head(requests)
-#define STATUS_ABORTED 3 // child process running, but head(requests) aborted
-#define STATUS_SHUTDOWN 4 // waiting for child process to shut down
+#define STATUS_READY 1 // things are initialized and can work
+// there used to be more possible values, things got streamlined...
// UTILITY MACROS