]> git.donarmstrong.com Git - xournal.git/blobdiff - src/xournal.h
Release 0.4
[xournal.git] / src / xournal.h
index 6ed265a2759a19ce5bd0fde5693ebdefa89fa884..38bb95be8bdb4de3570c35e1987a5679c1b367e7 100644 (file)
@@ -1,11 +1,17 @@
 #include <gtk/gtk.h>
 #include <libgnomecanvas/libgnomecanvas.h>
 
+#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. */
+
 // PREF FILES INFO
 
 #define CONFIG_DIR ".xournal"
 #define MRU_FILE "recent-files"
 #define MRU_SIZE 8 
+#define CONFIG_FILE "config"
 
 // DATA STRUCTURES AND CONSTANTS
 
 #define MAX_AXES 12
 #define EPSILON 1E-7
 #define MAX_ZOOM 20.0
-#define DEFAULT_ZOOM 1.3333333333
+#define DISPLAY_DPI_DEFAULT 96.0
 #define MIN_ZOOM 0.2
 
+#define VBOX_MAIN_NITEMS 5 // number of interface items in vboxMain
+
 /* a string (+ aux data) that maintains a refcount */
 
 typedef struct Refstring {
@@ -99,14 +107,13 @@ extern guint predef_bgcolors_rgba[COLOR_MAX];
 #define TOOL_VERTSPACE    6
 #define TOOL_HAND         7
 #define NUM_STROKE_TOOLS  3
+#define NUM_TOOLS         8
 #define NUM_BUTTONS       3
 
 #define TOOLOPT_ERASER_STANDARD     0
 #define TOOLOPT_ERASER_WHITEOUT     1
 #define TOOLOPT_ERASER_STROKES      2
 
-#define HILITER_ALPHA_MASK 0xffffff80
-
 extern double predef_thickness[NUM_STROKE_TOOLS][THICKNESS_MAX];
 
 typedef struct BBox {
@@ -118,10 +125,16 @@ 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
   GnomeCanvasPoints *path;
   GnomeCanvasItem *canvas_item; // the corresponding canvas item, or NULL
   struct BBox bbox;
   struct UndoErasureData *erasure; // for temporary use during erasures
+  // the following fields for ITEM_TEXT:
+  gchar *text;
+  gchar *font_name;
+  gdouble font_size;
+  GtkWidget *widget; // the widget while text is being edited (ITEM_TEMP_TEXT)
 } Item;
 
 // item type values for Item.type, UndoItem.type, ui.cur_item_type ...
@@ -144,6 +157,10 @@ typedef struct Item {
 #define ITEM_REPAINTSEL 15
 #define ITEM_MOVESEL_VERT 16
 #define ITEM_HAND 17
+#define ITEM_TEXT 18
+#define ITEM_TEMP_TEXT 19
+#define ITEM_TEXT_EDIT 20
+#define ITEM_TEXT_ATTRIB 21
 
 typedef struct Layer {
   GList *items; // the items on the layer, from bottom to top
@@ -201,19 +218,41 @@ typedef struct UIData {
   double zoom; // zoom factor, in pixels per pt
   gboolean use_xinput; // use input devices instead of core pointer
   gboolean allow_xinput; // allow use of xinput ?
+  gboolean discard_corepointer; // discard core pointer events in XInput mode
+  gboolean is_corestroke; // this stroke is painted with core pointer
   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;
-  gboolean view_continuous, fullscreen;
+  gchar *default_path; // default path for new notes
+  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
-  char *mrufile; // file for the MRU
+  char *mrufile, *configfile; // file names for MRU & config
   char *mru[MRU_SIZE]; // MRU data
   GtkWidget *mrumenu[MRU_SIZE];
   gboolean bg_apply_all_pages;
+  int window_default_width, window_default_height, scrollbar_step_increment;
+  gboolean print_ruling; // print the paper ruling ?
+  int default_unit; // the default unit for paper sizes
+  int startuptool; // the default tool at startup
+  gboolean startupruler;
+  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;
+#if GLIB_CHECK_VERSION(2,6,0)
+  GKeyFile *config_data;
+#endif
+  int vertical_order[2][VBOX_MAIN_NITEMS]; // the order of interface components
+  gchar *default_font_name, *font_name;
+  gdouble default_font_size, font_size;
+  gulong resize_signal_handler;
+  gdouble hiliter_opacity;
+  guint hiliter_alpha_mask;
 } UIData;
 
 #define BRUSH_LINKED 0
@@ -229,8 +268,8 @@ typedef struct UndoErasureData {
 
 typedef struct UndoItem {
   int type;
-  struct Item *item; // for ITEM_STROKE
-  struct Layer *layer; // for ITEM_STROKE, ITEM_ERASURE, ITEM_PASTE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_MOVESEL
+  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
   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
@@ -238,7 +277,9 @@ typedef struct UndoItem {
   GList *auxlist;   // for ITEM_REPAINTSEL (brushes), ITEM_MOVESEL (depths)
   struct Background *bg;  // for ITEM_NEW_BG_ONE/RESIZE, ITEM_NEW_DEFAULT_BG
   int val; // for ITEM_NEW_PAGE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_DELETE_PAGE
-  double val_x, val_y; // for ITEM_MOVESEL, ITEM_NEW_BG_RESIZE, ITEM_PAPER_RESIZE, ITEM_NEW_DEFAULT_BG
+  double val_x, val_y; // for ITEM_MOVESEL, ITEM_NEW_BG_RESIZE, ITEM_PAPER_RESIZE, ITEM_NEW_DEFAULT_BG, ITEM_TEXT_ATTRIB
+  gchar *str; // for ITEM_TEXT_EDIT, ITEM_TEXT_ATTRIB
+  struct Brush *brush; // for ITEM_TEXT_ATTRIB
   struct UndoItem *next;
   int multiop;
 } UndoItem;
@@ -301,3 +342,10 @@ extern struct Journal journal;
 extern struct UIData ui;
 extern struct BgPdf bgpdf;
 extern struct UndoItem *undo, *redo;
+
+extern double DEFAULT_ZOOM;
+
+#define UNIT_CM 0
+#define UNIT_IN 1
+#define UNIT_PX 2
+#define UNIT_PT 3