]> git.donarmstrong.com Git - xournal.git/commitdiff
Public release 0.2.2.
authorauroux <auroux>
Mon, 5 Jun 2006 22:19:10 +0000 (22:19 +0000)
committerauroux <auroux>
Mon, 5 Jun 2006 22:19:10 +0000 (22:19 +0000)
15 files changed:
ChangeLog
NEWS
README
configure.in
html-doc/manual.html
src/TODO
src/main.c
src/xo-callbacks.c
src/xo-callbacks.h
src/xo-interface.c
src/xo-misc.c
src/xo-misc.h
src/xo-paint.c
src/xournal.h
xournal.glade

index 644872b91e960c6ccc7977b6b9118815449618c2..363e2fe94a998f3daa73bc0f2bcdadaf65f09bf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Version 0.2.2 (Jun 5, 2006):
+  - mapping of tools to stylus buttons (the options menu has new entries
+    to allow the mapping of buttons 2 and 3 to arbitrary tools; the tools
+    menu and toolbar affect the settings for button 1) (see manual)
+  - moving selection by drag-and-drop works across page boundaries
+  - vertical space tool can move items to next page (only when the entire
+    block being moved has crossed the page boundary; items on the new page
+    are not moved)
+  - "apply to all pages" is now a toggle button affecting the behavior of
+    paper size, color, and style commands
+  - change in the behavior of the selection upon switching between tools
+
 Version 0.2.1 (Jun 3, 2006):
   - recently used files listed in file menu
   - can change color or thickness of pen strokes in selection
diff --git a/NEWS b/NEWS
index c1e9555fda150cab7bd800a61033849795dcb41e..952d254a0b69db9d447773c15506497279f78085 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-Version 0.2.1 (June 3, 2006)
+Version 0.2.2 (June 5, 2006)
 
 Installation:  see INSTALL
 User's manual: see html-doc/manual.html
diff --git a/README b/README
index c1e9555fda150cab7bd800a61033849795dcb41e..952d254a0b69db9d447773c15506497279f78085 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Version 0.2.1 (June 3, 2006)
+Version 0.2.2 (June 5, 2006)
 
 Installation:  see INSTALL
 User's manual: see html-doc/manual.html
index ceb6249af45c7f3514d4a0638b9d71ab509153ee..852ec0769dc52cdb979dece478503b5f304c7c15 100644 (file)
@@ -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.1)
+AM_INIT_AUTOMAKE(xournal, 0.2.2)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 
@@ -28,3 +28,4 @@ AC_OUTPUT([
 Makefile
 src/Makefile
 ])
+
index e1036cb86e2378594d171e24543fd3ac894a981b..cf97892ec9cf7329260527d4cd0285d1d12b83fa 100644 (file)
@@ -24,7 +24,7 @@
   Xournal User's Manual
 </h2>
 <p style="font-size: 0.95em; text-align: center; color: rgb(0,0,0)">
- Version 0.2.1
+ Version 0.2.2
 </p>
 <hr />
 <p>
@@ -93,12 +93,10 @@ the Pen Options submenu of the Tools menu).
 </p>
 <h3 class="subsub"><img src="pixmaps/eraser.png"> The eraser</h3>
 <p>
-The eraser lets you erase what you have drawn. If your tablet's stylus
-has an eraser tip, and if the XInput extensions are enabled, the eraser
-will be automatically selected when drawing with the eraser tip.
-Another possibility is to enable the "Emulate Eraser" option in the Options
-menu, which lets you use button 2 or 3 on the stylus (mouse middle or right button)
-as an eraser.<br />
+The eraser lets you erase what you have drawn. 
+By default, stylus buttons 2 and 3 (mouse middle or right buttons) are
+mapped to the eraser tool.
+<br />
 The eraser comes in three different thicknesses (selected using the
 <a href="manual.html#thicknesses">thickness</a> toolbar buttons),
 and can operate in three different modes (Eraser Options submenu of
@@ -160,7 +158,9 @@ the Tools menu):
   All the strokes which are entirely contained within the rectangular region
   are selected.
   The selection can be moved within its page by clicking inside the
-  selection rectangle and dragging the cursor.
+  selection rectangle and dragging the cursor. If the cursor is dragged
+  to a different page, the selection will be moved to the topmost layer of
+  that page.
 </p>
 <p>
   The selection can be cut, duplicated, etc. (including to a different page
@@ -182,6 +182,14 @@ the Tools menu):
   space, or change the page height to an appropriate value (using the
   "Paper Size" entry in the Journal menu).
 </p>
+<p>
+  If you drag the cursor below the bottom of the page (so that the
+  entire block being moved has become invisible), the items will be moved
+  to the next page (topmost layer); however, any items that were already
+  present on the next page are left unchanged. Similarly, dragging the
+  cursor above the top of the page so that the entire block being moved
+  becomes invisible results in the items being moved to the previous page.
+</p>
 <h3 class="subsub">Undo and redo</h3>
 <p>
   All operations performed on the currently open journal (drawing, erasing,
@@ -190,6 +198,36 @@ the Tools menu):
   the corresponding entries in the Edit menu.<br />
   There is no limit to the depth of the undo/redo stack. It is cleared only
   when you quit the application or open a new journal.
+</p>
+<a name="mappings"></a>
+<h3 class="subsub">Button mappings</h3>
+<p>
+  Stylus buttons 2 and 3 (mouse middle and right buttons) can be mapped
+  to different tools using the appropriate submenus in the Options menu
+  (whereas the Tools menu and the toolbar buttons affect the primary tool
+  assigned to button 1). The default mapping is the eraser.
+</p>
+<p><b>Advanced configuration:</b>
+  if a secondary button is mapped to a drawing tool (pen, eraser, or
+  highlighter), the default is to "dynamically link" its settings to those
+  of the primary tool, which means that each drawing tool has common
+  settings (color, thickness, etc.) for all buttons.
+  Dynamic linking of brush settings
+  can be disabled by selecting the "Copy of current brush" option in the
+  "Button mapping" submenu. The settings of the tool for button 2 or 3 are
+  copied from the button 1 settings at the time when you select the option,
+  and afterwards they are no longer updated when the button 1 settings are
+  modified, thus making it possible to assign pens of different colors or
+  thicknesses to different buttons.
+</p>
+<p>
+  Another option that affects button mappings is the "Eraser tip" option.
+  If this option is turned on and the XInput extensions are enabled, then
+  the eraser tip of your tablet's stylus will automatically be remapped to
+  the eraser tool. This behavior, which overrides all other button mappings,
+  is most useful if your X server is configured to map the eraser tip of
+  your tablet's stylus to button 1.
+</p>
 <hr />
 <a name="pages-layers"></a>
 <h2 class="subtitle">Pages, layers, and backgrounds</h2>
@@ -439,17 +477,36 @@ List of known bugs/misfeatures (no need to report them again):
  <li> print settings are not saved from one print command to the next.</li>
  <li> printing to PDF and/or printing page backgrounds generates large files.</li>
  <li> preferences are not saved on disk.</li>
- <li> selection cannot be dragged across page boundaries.</li>
 </ul>
 If you find a sequence of operations which crashes Xournal in a reproducible
 manner, please send detailed instructions on how to reproduce the crash. 
 A core file may also be helpful.
 </p>
+<p>
+Bug reports and suggestions can also be submitted on Xournal's
+<a href="http://www.sourceforge.net/projects/xournal/">SourceForge page.</a>
+</p>
 <hr />
 <a name="changelog"></a>
 <h2 class="subtitle">Version history</h2>
 <p>
-Version 0.2.1 (Jun 3, 2006):
+Version 0.2.2 (June 5, 2006):
+<ul>
+ <li>mapping of tools to stylus buttons (the options menu has new entries
+    to allow the mapping of buttons 2 and 3 to arbitrary tools; the tools
+    menu and toolbar affect the settings for button 1)
+    (see <a href="manual.html#mappings">here</a>)</li>
+ <li>moving selection by drag-and-drop works across page boundaries</li>
+ <li>vertical space tool can move items to next page (only when the entire
+    block being moved has crossed the page boundary; items on the new page
+    are not moved)</li>
+ <li>"apply to all pages" is now a toggle button affecting the behavior of
+    paper size, color, and style commands</li>
+ <li>change in the behavior of the selection upon switching between tools</li>
+</ul>
+</p>
+<p>
+Version 0.2.1 (June 3, 2006):
 <ul>
  <li>recently used files listed in file menu</li>
  <li>can change color or thickness of pen strokes in selection</li>
@@ -488,9 +545,9 @@ Version 0.1 (January 2, 2006): initial release.
 Features yet to be implemented:
 <ul>
  <li>freeform selection tool</li>
- <li>preferences file; persistent printer settings; recent files list</li>
+ <li>preferences file; persistent printer settings</li>
  <li>native PDF print feature</li>
- <li>various functionalities (flatten layers, drag-and-drop across pages, ...)</li>
+ <li>various functionalities (flatten layers, ...)</li>
 </ul>
 </p>
 <hr />
index 8323a095b19711d834026c7a4c126099b88c7fb0..b821bf95cab57e88c45dfb1bb9b77c3970bc714e 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -1,12 +1,6 @@
 List of features to be implemented (not in any particular order)
 ----------------------------------------------------------------
 
-- map tools to stylus buttons (maybe: btn click on toolbar item affects
-  the corresponding tool; tool switching cleaner than for eraser)
-- 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)
-   (SEE ALSO FEATURE REQUEST 1472482 and reply to it - optional behavior too?)
 - lasso selection tool
 - prefs file, save prefs
 - flatten (incl undo/redo...) - enabled only if nlayers>1
@@ -25,3 +19,6 @@ List of features to be implemented (not in any particular order)
 - more pen/highlighter shapes (chisel)
 - convert to/from Jarnal format; to/from MS Journal format???
 - recalibration upon screen resize / compensation for miscalibration
+- find a better behavior for vertical space tool across page boundaries ?
+- document the file format
+
index 7a5e641410865dcee879546b57a8e7aaed2f7d65..188d1ea352aca86b277c10ac075b6f2a6be4a5c5 100644 (file)
@@ -33,8 +33,12 @@ void hide_unimplemented(void)
   gtk_widget_hide(GET_COMPONENT("papercolorOther"));
   gtk_widget_hide(GET_COMPONENT("toolsText"));
   gtk_widget_hide(GET_COMPONENT("buttonText"));
+  gtk_widget_hide(GET_COMPONENT("button2Text"));
+  gtk_widget_hide(GET_COMPONENT("button3Text"));
   gtk_widget_hide(GET_COMPONENT("toolsSelectRegion"));
   gtk_widget_hide(GET_COMPONENT("buttonSelectRegion"));
+  gtk_widget_hide(GET_COMPONENT("button2SelectRegion"));
+  gtk_widget_hide(GET_COMPONENT("button3SelectRegion"));
   gtk_widget_hide(GET_COMPONENT("colorOther"));
   gtk_widget_hide(GET_COMPONENT("toolsTextFont"));
   gtk_widget_hide(GET_COMPONENT("toolsDefaultText"));
@@ -48,7 +52,7 @@ void init_stuff (int argc, char *argv[])
   GList *dev_list;
   GdkDevice *device;
   GdkScreen *screen;
-  int i;
+  int i, j;
   struct Brush *b;
   gboolean can_xinput, success;
   gchar *tmppath, *tmpfn;
@@ -98,17 +102,23 @@ void init_stuff (int argc, char *argv[])
   ui.cur_path.coords = NULL;
   ui.cur_path_storage_alloc = 0;
   ui.cur_path.ref_count = 1;
-  ui.toolno = TOOL_PEN;
-  ui.cur_brush = ui.brushes + TOOL_PEN;
-  ui.ruler = FALSE;
+
   ui.selection = NULL;
   ui.cursor = NULL;
+  ui.bg_apply_all_pages = FALSE;
 
-  ui.brushes[TOOL_PEN].color_no = COLOR_BLACK;
-  ui.brushes[TOOL_ERASER].color_no = COLOR_WHITE;
-  ui.brushes[TOOL_HIGHLIGHTER].color_no = COLOR_YELLOW;
+  ui.cur_brush = &(ui.brushes[0][TOOL_PEN]);
+  ui.toolno[0] = TOOL_PEN;
+  for (i=1; i<=NUM_BUTTONS; i++) ui.toolno[i] = TOOL_ERASER;
+  for (i=0; i<=NUM_BUTTONS; i++) {
+    ui.ruler[i] = FALSE;
+    ui.linked_brush[i] = BRUSH_LINKED;
+  }
+  ui.brushes[0][TOOL_PEN].color_no = COLOR_BLACK;
+  ui.brushes[0][TOOL_ERASER].color_no = COLOR_WHITE;
+  ui.brushes[0][TOOL_HIGHLIGHTER].color_no = COLOR_YELLOW;
   for (i=0; i < NUM_STROKE_TOOLS; i++) {
-    b = ui.brushes + i;
+    b = &(ui.brushes[0][i]);
     b->tool_type = i;
     b->color_rgba = predef_colors_rgba[b->color_no];
     if (i == TOOL_HIGHLIGHTER) {
@@ -117,13 +127,18 @@ void init_stuff (int argc, char *argv[])
     b->thickness_no = THICKNESS_MEDIUM;
     b->thickness = predef_thickness[i][b->thickness_no];
     b->tool_options = 0;
-    g_memmove(ui.default_brushes+i, ui.brushes+i, sizeof(struct Brush));
+    g_memmove(ui.default_brushes+i, b, sizeof(struct Brush));
+    for (j=1; j<=NUM_BUTTONS; j++) 
+      g_memmove(&(ui.brushes[j][i]), b, sizeof(struct Brush));
   }
+  ui.cur_mapping = 0;
+  ui.use_erasertip = FALSE;
 
   // initialize various interface elements
   
   gtk_window_set_default_size(GTK_WINDOW (winMain), 720, 480);
   update_toolbar_and_menu();
+
   // set up and initialize the canvas
 
   gtk_widget_show (GTK_WIDGET (canvas));
@@ -167,8 +182,6 @@ void init_stuff (int argc, char *argv[])
   ui.screen_width = gdk_screen_get_width(screen);
   ui.screen_height = gdk_screen_get_height(screen);
   
-  ui.saved_toolno = -1;
-
   can_xinput = FALSE;
   dev_list = gdk_devices_list();
   while (dev_list != NULL) {
@@ -190,7 +203,6 @@ void init_stuff (int argc, char *argv[])
 
   ui.use_xinput = ui.allow_xinput && can_xinput;
   ui.antialias_bg = TRUE;
-  ui.emulate_eraser = FALSE;
   ui.progressive_bg = TRUE;
 
   gtk_check_menu_item_set_active(
@@ -199,8 +211,6 @@ void init_stuff (int argc, char *argv[])
     GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsAntialiasBG")), ui.antialias_bg);
   gtk_check_menu_item_set_active(
     GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsProgressiveBG")), ui.progressive_bg);
-  gtk_check_menu_item_set_active(
-    GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsEmulateEraser")), ui.emulate_eraser);
 
   hide_unimplemented();
     
index 032a5c8b648ac777fc3f39361cd84098d122127d..6fe75d9991b277efe761fdf8b8e54cb91134ead7 100644 (file)
@@ -530,10 +530,14 @@ on_editUndo_activate                   (GtkMenuItem     *menuitem,
   else if (undo->type == ITEM_MOVESEL) {
     for (itemlist = undo->itemlist; itemlist != NULL; itemlist = itemlist->next) {
       it = (struct Item *)itemlist->data;
-      if (it->canvas_item != NULL)
+      if (it->canvas_item != NULL) {
+        if (undo->layer != undo->layer2)
+          gnome_canvas_item_reparent(it->canvas_item, undo->layer->group);
         gnome_canvas_item_move(it->canvas_item, -undo->val_x, -undo->val_y);
+      }
     }
-    move_journal_items_by(undo->itemlist, -undo->val_x, -undo->val_y);
+    move_journal_items_by(undo->itemlist, -undo->val_x, -undo->val_y,
+                            undo->layer2, undo->layer, undo->auxlist);
   }
   else if (undo->type == ITEM_PASTE) {
     for (itemlist = undo->itemlist; itemlist != NULL; itemlist = itemlist->next) {
@@ -726,10 +730,14 @@ on_editRedo_activate                   (GtkMenuItem     *menuitem,
   else if (redo->type == ITEM_MOVESEL) {
     for (itemlist = redo->itemlist; itemlist != NULL; itemlist = itemlist->next) {
       it = (struct Item *)itemlist->data;
-      if (it->canvas_item != NULL)
+      if (it->canvas_item != NULL) {
+        if (redo->layer != redo->layer2)
+          gnome_canvas_item_reparent(it->canvas_item, redo->layer2->group);
         gnome_canvas_item_move(it->canvas_item, redo->val_x, redo->val_y);
+      }
     }
-    move_journal_items_by(redo->itemlist, redo->val_x, redo->val_y);
+    move_journal_items_by(redo->itemlist, redo->val_x, redo->val_y,
+                            redo->layer, redo->layer2, NULL);
   }
   else if (redo->type == ITEM_PASTE) {
     for (itemlist = redo->itemlist; itemlist != NULL; itemlist = itemlist->next) {
@@ -1176,6 +1184,8 @@ on_journalPaperSize_activate           (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
   int i, response;
+  struct Page *pg;
+  GList *pglist;
   
   papersize_dialog = create_papersizeDialog();
   papersize_width = ui.cur_page->width;
@@ -1198,18 +1208,25 @@ on_journalPaperSize_activate           (GtkMenuItem     *menuitem,
   response = gtk_dialog_run(GTK_DIALOG(papersize_dialog));
   gtk_widget_destroy(papersize_dialog);
   if (response != GTK_RESPONSE_OK) return;
-  
-  prepare_new_undo();
-  undo->type = ITEM_PAPER_RESIZE;
-  undo->page = ui.cur_page;
-  undo->val_x = ui.cur_page->width;
-  undo->val_y = ui.cur_page->height;
 
-  if (papersize_width_valid) ui.cur_page->width = papersize_width;
-  if (papersize_height_valid) ui.cur_page->height = papersize_height;
-
-  make_page_clipbox(ui.cur_page);
-  update_canvas_bg(ui.cur_page);
+  pg = ui.cur_page;
+  for (pglist = journal.pages; pglist!=NULL; pglist = pglist->next) {
+    if (ui.bg_apply_all_pages) pg = (struct Page *)pglist->data;
+    prepare_new_undo();
+    if (ui.bg_apply_all_pages) {
+      if (pglist->next!=NULL) undo->multiop |= MULTIOP_CONT_REDO;
+      if (pglist->prev!=NULL) undo->multiop |= MULTIOP_CONT_UNDO;
+    }
+    undo->type = ITEM_PAPER_RESIZE;
+    undo->page = pg;
+    undo->val_x = pg->width;
+    undo->val_y = pg->height;
+    if (papersize_width_valid) pg->width = papersize_width;
+    if (papersize_height_valid) pg->height = papersize_height;
+    make_page_clipbox(pg);
+    update_canvas_bg(pg);
+    if (!ui.bg_apply_all_pages) break;
+  }
   do_switch_page(ui.pageno, TRUE, TRUE);
 }
 
@@ -1466,6 +1483,14 @@ void
 on_journalApplyAllPages_activate       (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
+  gboolean active;
+  
+  active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
+  if (active == ui.bg_apply_all_pages) return;
+  ui.bg_apply_all_pages = active;
+  update_page_stuff();
+  
+/* THIS IS THE OLD VERSION OF THE FEATURE -- APPLIED CURRENT BG TO ALL
   struct Page *page;
   GList *pglist;
   
@@ -1491,6 +1516,8 @@ on_journalApplyAllPages_activate       (GtkMenuItem     *menuitem,
     update_canvas_bg(page);
   }
   do_switch_page(ui.pageno, TRUE, TRUE);
+*/
+
 }
 
 
@@ -1506,12 +1533,14 @@ on_toolsPen_activate                   (GtkMenuItem     *menuitem,
       return;
   }
   
-  if (ui.toolno == TOOL_PEN) return;
-  
+  if (ui.cur_mapping != 0) return;
+  if (ui.toolno[0] == TOOL_PEN) return;
+
   reset_selection();
-  ui.toolno = TOOL_PEN;
-  ui.ruler = FALSE;
-  ui.cur_brush = ui.brushes+TOOL_PEN;
+  ui.toolno[0] = TOOL_PEN;
+  ui.ruler[0] = FALSE;
+  ui.cur_brush = &(ui.brushes[0][TOOL_PEN]);
+  update_mapping_linkings(TOOL_PEN);
   update_tool_buttons();
   update_tool_menu();
   update_color_menu();
@@ -1531,12 +1560,14 @@ on_toolsEraser_activate                (GtkMenuItem     *menuitem,
       return;
   }
   
-  if (ui.toolno == TOOL_ERASER) return;
+  if (ui.cur_mapping != 0) return;
+  if (ui.toolno[0] == TOOL_ERASER) return;
   
   reset_selection();
-  ui.toolno = TOOL_ERASER;
-  ui.ruler = FALSE;
-  ui.cur_brush = ui.brushes+TOOL_ERASER;
+  ui.toolno[0] = TOOL_ERASER;
+  ui.ruler[0] = FALSE;
+  ui.cur_brush = &(ui.brushes[0][TOOL_ERASER]);
+  update_mapping_linkings(TOOL_ERASER);
   update_tool_buttons();
   update_tool_menu();
   update_color_menu();
@@ -1556,12 +1587,14 @@ on_toolsHighlighter_activate           (GtkMenuItem     *menuitem,
       return;
   }
   
-  if (ui.toolno == TOOL_HIGHLIGHTER) return;
+  if (ui.cur_mapping != 0) return; // not user-generated
+  if (ui.toolno[0] == TOOL_HIGHLIGHTER) return;
   
   reset_selection();
-  ui.toolno = TOOL_HIGHLIGHTER;
-  ui.ruler = FALSE;
-  ui.cur_brush = ui.brushes+TOOL_HIGHLIGHTER;
+  ui.toolno[0] = TOOL_HIGHLIGHTER;
+  ui.ruler[0] = FALSE;
+  ui.cur_brush = &(ui.brushes[0][TOOL_HIGHLIGHTER]);
+  update_mapping_linkings(TOOL_HIGHLIGHTER);
   update_tool_buttons();
   update_tool_menu();
   update_color_menu();
@@ -1597,10 +1630,12 @@ on_toolsSelectRectangle_activate       (GtkMenuItem     *menuitem,
       return;
   }
   
-  if (ui.toolno == TOOL_SELECTRECT) return;
+  if (ui.cur_mapping != 0) return; // not user-generated
+  if (ui.toolno[0] == TOOL_SELECTRECT) return;
   
-  ui.toolno = TOOL_SELECTRECT;
-  ui.ruler = FALSE;
+  ui.toolno[0] = TOOL_SELECTRECT;
+  ui.ruler[0] = FALSE;
+  update_mapping_linkings(-1);
   update_tool_buttons();
   update_tool_menu();
   update_color_menu();
@@ -1620,11 +1655,13 @@ on_toolsVerticalSpace_activate         (GtkMenuItem     *menuitem,
       return;
   }
   
-  if (ui.toolno == TOOL_VERTSPACE) return;
+  if (ui.cur_mapping != 0) return; // not user-generated
+  if (ui.toolno[0] == TOOL_VERTSPACE) return;
   
   reset_selection();
-  ui.toolno = TOOL_VERTSPACE;
-  ui.ruler = FALSE;
+  ui.toolno[0] = TOOL_VERTSPACE;
+  ui.ruler[0] = FALSE;
+  update_mapping_linkings(-1);
   update_tool_buttons();
   update_tool_menu();
   update_color_menu();
@@ -1798,7 +1835,8 @@ on_eraserStandard_activate             (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
   if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
-  ui.brushes[TOOL_ERASER].tool_options = TOOLOPT_ERASER_STANDARD;
+  ui.brushes[0][TOOL_ERASER].tool_options = TOOLOPT_ERASER_STANDARD;
+  update_mapping_linkings(TOOL_ERASER);
 }
 
 
@@ -1807,7 +1845,8 @@ on_eraserWhiteout_activate             (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
   if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
-  ui.brushes[TOOL_ERASER].tool_options = TOOLOPT_ERASER_WHITEOUT;
+  ui.brushes[0][TOOL_ERASER].tool_options = TOOLOPT_ERASER_WHITEOUT;
+  update_mapping_linkings(TOOL_ERASER);
 }
 
 
@@ -1816,7 +1855,8 @@ on_eraserDeleteStrokes_activate        (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
   if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
-  ui.brushes[TOOL_ERASER].tool_options = TOOLOPT_ERASER_STROKES;
+  ui.brushes[0][TOOL_ERASER].tool_options = TOOLOPT_ERASER_STROKES;
+  update_mapping_linkings(TOOL_ERASER);
 }
 
 
@@ -1856,10 +1896,13 @@ void
 on_toolsDefaultPen_activate            (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
+  switch_mapping(0);
   reset_selection();
-  g_memmove(ui.brushes+TOOL_PEN, ui.default_brushes+TOOL_PEN, sizeof(struct Brush));
-  ui.toolno = TOOL_PEN;
-  ui.cur_brush = ui.brushes+TOOL_PEN;
+  g_memmove(&(ui.brushes[0][TOOL_PEN]), ui.default_brushes+TOOL_PEN, sizeof(struct Brush));
+  ui.toolno[0] = TOOL_PEN;
+  ui.cur_brush = &(ui.brushes[0][TOOL_PEN]);
+  ui.ruler[0] = FALSE;
+  update_mapping_linkings(TOOL_PEN);
   update_tool_buttons();
   update_tool_menu();
   update_pen_props_menu();
@@ -1872,10 +1915,13 @@ void
 on_toolsDefaultEraser_activate         (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
+  switch_mapping(0);
   reset_selection();
-  g_memmove(ui.brushes+TOOL_ERASER, ui.default_brushes+TOOL_ERASER, sizeof(struct Brush));
-  ui.toolno = TOOL_ERASER;
-  ui.cur_brush = ui.brushes+TOOL_ERASER;
+  g_memmove(&(ui.brushes[0][TOOL_ERASER]), ui.default_brushes+TOOL_ERASER, sizeof(struct Brush));
+  ui.toolno[0] = TOOL_ERASER;
+  ui.cur_brush = &(ui.brushes[0][TOOL_ERASER]);
+  ui.ruler[0] = FALSE;
+  update_mapping_linkings(TOOL_ERASER);
   update_tool_buttons();
   update_tool_menu();
   update_eraser_props_menu();
@@ -1888,10 +1934,13 @@ void
 on_toolsDefaultHighlighter_activate    (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
+  switch_mapping(0);
   reset_selection();
-  g_memmove(ui.brushes+TOOL_HIGHLIGHTER, ui.default_brushes+TOOL_HIGHLIGHTER, sizeof(struct Brush));
-  ui.toolno = TOOL_HIGHLIGHTER;
-  ui.cur_brush = ui.brushes+TOOL_HIGHLIGHTER;
+  g_memmove(&(ui.brushes[0][TOOL_HIGHLIGHTER]), ui.default_brushes+TOOL_HIGHLIGHTER, sizeof(struct Brush));
+  ui.toolno[0] = TOOL_HIGHLIGHTER;
+  ui.cur_brush = &(ui.brushes[0][TOOL_HIGHLIGHTER]);
+  ui.ruler[0] = FALSE;
+  update_mapping_linkings(TOOL_HIGHLIGHTER);
   update_tool_buttons();
   update_tool_menu();
   update_highlighter_props_menu();
@@ -1911,8 +1960,9 @@ void
 on_toolsSetAsDefault_activate          (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-  if (ui.toolno < NUM_STROKE_TOOLS)
-    g_memmove(ui.default_brushes+ui.toolno, ui.brushes+ui.toolno, sizeof(struct Brush));
+  if (ui.cur_mapping!=0) return;
+  if (ui.toolno[0] < NUM_STROKE_TOOLS)
+    g_memmove(ui.default_brushes+ui.toolno[0], &(ui.brushes[0][ui.toolno[0]]), sizeof(struct Brush));
 }
 
 
@@ -1927,19 +1977,21 @@ on_toolsRuler_activate                 (GtkMenuItem     *menuitem,
   else
     active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON (menuitem));
 
-  if (active == ui.ruler) return;
+  if (ui.cur_mapping != 0) return;
+  if (active == ui.ruler[0]) return;
   
-  if (active && (ui.toolno!=TOOL_PEN && ui.toolno!=TOOL_HIGHLIGHTER)) {
+  if (active && (ui.toolno[0]!=TOOL_PEN && ui.toolno[0]!=TOOL_HIGHLIGHTER)) {
     reset_selection();
-    ui.toolno = TOOL_PEN;
-    ui.cur_brush = ui.brushes+TOOL_PEN;
+    ui.toolno[0] = TOOL_PEN;
+    ui.cur_brush = &(ui.brushes[0][TOOL_PEN]);
     update_color_menu();
     update_tool_buttons();
     update_tool_menu();
     update_cursor();
   }
   
-  ui.ruler = active;
+  ui.ruler[0] = active;
+  update_mapping_linkings(ui.toolno[0]);
   update_ruler_indicator();
 }
 
@@ -1980,14 +2032,17 @@ void
 on_buttonToolDefault_clicked           (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
-  if (ui.toolno < NUM_STROKE_TOOLS) {
-    g_memmove(ui.brushes+ui.toolno, ui.default_brushes+ui.toolno, sizeof(struct Brush));
+  switch_mapping(0);
+  if (ui.toolno[0] < NUM_STROKE_TOOLS) {
+    g_memmove(&(ui.brushes[0][ui.toolno[0]]), ui.default_brushes+ui.toolno[0], sizeof(struct Brush));
+    ui.ruler[0] = FALSE;
+    update_mapping_linkings(ui.toolno[0]);
     update_thickness_buttons();
     update_color_buttons();
     update_color_menu();
-    if (ui.toolno == TOOL_PEN) update_pen_props_menu();
-    if (ui.toolno == TOOL_ERASER) update_eraser_props_menu();
-    if (ui.toolno == TOOL_HIGHLIGHTER) update_highlighter_props_menu();
+    if (ui.toolno[0] == TOOL_PEN) update_pen_props_menu();
+    if (ui.toolno[0] == TOOL_ERASER) update_eraser_props_menu();
+    if (ui.toolno[0] == TOOL_HIGHLIGHTER) update_highlighter_props_menu();
     update_cursor();
   }
 }
@@ -1997,7 +2052,8 @@ void
 on_buttonFine_clicked                  (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
-  process_thickness_activate((GtkMenuItem*)toolbutton, ui.toolno, THICKNESS_FINE);
+  if (ui.cur_mapping != 0) return;
+  process_thickness_activate((GtkMenuItem*)toolbutton, ui.toolno[0], THICKNESS_FINE);
 }
 
 
@@ -2005,7 +2061,8 @@ void
 on_buttonMedium_clicked                (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
-  process_thickness_activate((GtkMenuItem*)toolbutton, ui.toolno, THICKNESS_MEDIUM);
+  if (ui.cur_mapping != 0) return;
+  process_thickness_activate((GtkMenuItem*)toolbutton, ui.toolno[0], THICKNESS_MEDIUM);
 }
 
 
@@ -2013,7 +2070,8 @@ void
 on_buttonThick_clicked                 (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
-  process_thickness_activate((GtkMenuItem*)toolbutton, ui.toolno, THICKNESS_THICK);
+  if (ui.cur_mapping != 0) return;
+  process_thickness_activate((GtkMenuItem*)toolbutton, ui.toolno[0], THICKNESS_THICK);
 }
 
 
@@ -2026,6 +2084,7 @@ on_canvas_button_press_event           (GtkWidget       *widget,
   gboolean page_change;
   struct Page *tmppage;
   GtkWidget *dialog;
+  int mapping;
   
   if (ui.cur_item_type != ITEM_NONE) return FALSE; // we're already doing something
   if (event->button > 3) return FALSE; // no painting with the mouse wheel!
@@ -2038,19 +2097,9 @@ on_canvas_button_press_event           (GtkWidget       *widget,
   }
   else if (event->device->source != GDK_SOURCE_MOUSE) return FALSE;
 
-  if ((ui.use_xinput && event->device->source == GDK_SOURCE_ERASER) ||
-      (ui.emulate_eraser && event->button >= 2)) {
-    ui.saved_toolno = ui.toolno;
-    ui.saved_ruler = ui.ruler;
-    reset_selection();
-    ui.toolno = TOOL_ERASER;
-    ui.ruler = FALSE;
-    ui.cur_brush = ui.brushes + TOOL_ERASER;
-    update_tool_buttons();
-    update_tool_menu();
-    update_color_menu();
-    update_cursor();
-  }
+  if (ui.use_erasertip && event->device->source == GDK_SOURCE_ERASER)
+       mapping = NUM_BUTTONS;
+  else mapping = event->button-1;
 
   // check whether we're in a page
   page_change = FALSE;
@@ -2075,16 +2124,6 @@ on_canvas_button_press_event           (GtkWidget       *widget,
   // can't paint on the background...
 
   if (ui.cur_layer == NULL) {
-    if (ui.saved_toolno >=0) {
-      ui.toolno = ui.saved_toolno;
-      ui.ruler = ui.saved_ruler;
-      ui.saved_toolno = -1;
-      if (ui.toolno < NUM_STROKE_TOOLS) ui.cur_brush = ui.brushes + ui.toolno;
-      update_tool_buttons();
-      update_tool_menu();
-      update_color_menu();
-      update_cursor();
-    }
     /* warn */
     dialog = gtk_message_dialog_new(GTK_WINDOW(winMain), GTK_DIALOG_MODAL,
       GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Drawing is not allowed on the "
@@ -2094,24 +2133,33 @@ on_canvas_button_press_event           (GtkWidget       *widget,
     on_viewShowLayer_activate(NULL, NULL);
     return;
   }
+
+  // switch mappings if needed
   
-  // process the event
   ui.which_mouse_button = event->button;
+  switch_mapping(mapping);
+
+  // if this can be a selection move, then it takes precedence over anything else  
+  if (start_movesel((GdkEvent *)event)) return FALSE;
   
-  if (ui.toolno == TOOL_PEN || ui.toolno == TOOL_HIGHLIGHTER ||
-     (ui.toolno == TOOL_ERASER && ui.cur_brush->tool_options == TOOLOPT_ERASER_WHITEOUT)) {
+  if (ui.toolno[mapping] != TOOL_SELECTREGION && ui.toolno[mapping] != TOOL_SELECTRECT)
+    reset_selection();
+
+  // process the event
+  
+  if (ui.toolno[mapping] == TOOL_PEN || ui.toolno[mapping] == TOOL_HIGHLIGHTER ||
+        (ui.toolno[mapping] == TOOL_ERASER && ui.cur_brush->tool_options == TOOLOPT_ERASER_WHITEOUT)) {
     create_new_stroke((GdkEvent *)event);
   } 
-  else if (ui.toolno == TOOL_ERASER) {
+  else if (ui.toolno[mapping] == TOOL_ERASER) {
     ui.cur_item_type = ITEM_ERASURE;
     do_eraser((GdkEvent *)event, ui.cur_brush->thickness/2,
                ui.cur_brush->tool_options == TOOLOPT_ERASER_STROKES);
   }
-  else if (ui.toolno == TOOL_SELECTRECT) {
-    if (!start_movesel((GdkEvent *)event))
-      start_selectrect((GdkEvent *)event);
+  else if (ui.toolno[mapping] == TOOL_SELECTRECT) {
+    start_selectrect((GdkEvent *)event);
   }
-  else if (ui.toolno == TOOL_VERTSPACE) {
+  else if (ui.toolno[mapping] == TOOL_VERTSPACE) {
     start_vertspace((GdkEvent *)event);
   }
   return FALSE;
@@ -2133,17 +2181,6 @@ on_canvas_button_release_event         (GtkWidget       *widget,
   }
   else if (event->device->source != GDK_SOURCE_MOUSE) return FALSE;
 
-  if (ui.saved_toolno >= 0) {
-    ui.toolno = ui.saved_toolno;
-    ui.ruler = ui.saved_ruler;
-    ui.saved_toolno = -1;
-    if (ui.toolno < NUM_STROKE_TOOLS) ui.cur_brush = ui.brushes + ui.toolno;
-    update_tool_buttons();
-    update_tool_menu();
-    update_color_menu();
-    update_cursor();
-  }
-  
   if (ui.cur_item_type == ITEM_STROKE) {
     finalize_stroke();
   }
@@ -2153,10 +2190,11 @@ on_canvas_button_release_event         (GtkWidget       *widget,
   else if (ui.cur_item_type == ITEM_SELECTRECT) {
     finalize_selectrect();
   }
-  else if (ui.cur_item_type == ITEM_MOVESEL) {
+  else if (ui.cur_item_type == ITEM_MOVESEL || ui.cur_item_type == ITEM_MOVESEL_VERT) {
     finalize_movesel();
   }
-  
+
+  switch_mapping(0);
   return FALSE;
 }
 
@@ -2219,9 +2257,10 @@ on_canvas_motion_notify_event          (GtkWidget       *widget,
     else if (ui.cur_item_type == ITEM_SELECTRECT) {
       finalize_selectrect();
     }
-    else if (ui.cur_item_type == ITEM_MOVESEL) {
+    else if (ui.cur_item_type == ITEM_MOVESEL || ui.cur_item_type == ITEM_MOVESEL_VERT) {
       finalize_movesel();
     }
+    switch_mapping(0);
     return FALSE;
   }
   
@@ -2239,7 +2278,7 @@ on_canvas_motion_notify_event          (GtkWidget       *widget,
     gnome_canvas_item_set(ui.selection->canvas_item,
                                "x2", pt[0], "y2", pt[1], NULL);
   }
-  else if (ui.cur_item_type == ITEM_MOVESEL) {
+  else if (ui.cur_item_type == ITEM_MOVESEL || ui.cur_item_type == ITEM_MOVESEL_VERT) {
     continue_movesel((GdkEvent *)event);
   }
   
@@ -2530,11 +2569,12 @@ on_viewFullscreen_activate             (GtkMenuItem     *menuitem,
 
 
 void
-on_optionsEmulateEraser_activate       (GtkMenuItem     *menuitem,
+on_optionsButtonMappings_activate      (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-  ui.emulate_eraser =
+  ui.use_erasertip =
     gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
+  update_mappings_menu();
 }
 
 
@@ -2592,3 +2632,175 @@ on_mru_activate                        (GtkMenuItem     *menuitem,
   delete_mru_entry(which);
 }
 
+
+void
+on_button2Pen_activate                 (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 1, TOOL_PEN);
+}
+
+
+void
+on_button2Eraser_activate              (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 1, TOOL_ERASER);
+}
+
+
+void
+on_button2Highlighter_activate         (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 1, TOOL_HIGHLIGHTER);
+}
+
+
+void
+on_button2Text_activate                (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+
+}
+
+
+void
+on_button2SelectRegion_activate        (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 1, TOOL_SELECTREGION);
+}
+
+
+void
+on_button2SelectRectangle_activate     (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 1, TOOL_SELECTRECT);
+}
+
+
+void
+on_button2VerticalSpace_activate       (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 1, TOOL_VERTSPACE);
+}
+
+
+void
+on_button2LinkBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  int i;
+  
+  if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
+  ui.linked_brush[1] = BRUSH_LINKED;
+  for (i=0;i<NUM_STROKE_TOOLS;i++) update_mapping_linkings(i);
+}
+
+
+void
+on_button2CopyBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
+  if (ui.toolno[1] >= NUM_STROKE_TOOLS) {
+    ui.linked_brush[1] = BRUSH_STATIC;
+    update_mappings_menu_linkings();
+    return;
+  }
+  ui.linked_brush[1] = BRUSH_COPIED;
+  g_memmove(&(ui.brushes[1][ui.toolno[1]]), &(ui.brushes[0][ui.toolno[1]]), sizeof(struct Brush));
+  ui.ruler[1] = ui.ruler[0];
+  if (ui.toolno[1]!=TOOL_PEN && ui.toolno[1]!=TOOL_HIGHLIGHTER)
+    ui.ruler[1] = FALSE;
+}
+
+
+void
+on_button3Pen_activate                 (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 2, TOOL_PEN);
+}
+
+
+void
+on_button3Eraser_activate              (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 2, TOOL_ERASER);
+}
+
+
+void
+on_button3Highlighter_activate         (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 2, TOOL_HIGHLIGHTER);
+}
+
+
+void
+on_button3Text_activate                (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+
+}
+
+
+void
+on_button3SelectRegion_activate        (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 2, TOOL_SELECTREGION);
+}
+
+
+void
+on_button3SelectRectangle_activate     (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 2, TOOL_SELECTRECT);
+}
+
+
+void
+on_button3VerticalSpace_activate       (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  process_mapping_activate(menuitem, 2, TOOL_VERTSPACE);
+}
+
+
+void
+on_button3LinkBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  int i;
+  
+  if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
+  ui.linked_brush[2] = BRUSH_LINKED;
+  for (i=0;i<NUM_STROKE_TOOLS;i++) update_mapping_linkings(i);
+}
+
+
+void
+on_button3CopyBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+  if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
+  if (ui.toolno[2] >= NUM_STROKE_TOOLS) {
+    ui.linked_brush[2] = BRUSH_STATIC;
+    update_mappings_menu_linkings();
+    return;
+  }
+  ui.linked_brush[2] = BRUSH_COPIED;
+  g_memmove(&(ui.brushes[2][ui.toolno[2]]), &(ui.brushes[0][ui.toolno[2]]), sizeof(struct Brush));
+  ui.ruler[2] = ui.ruler[0];
+  if (ui.toolno[2]!=TOOL_PEN && ui.toolno[2]!=TOOL_HIGHLIGHTER)
+    ui.ruler[2] = FALSE;
+}
+
index 622a25e25039c73f23ef0717095da27ee3b18be0..4234703e16dc4e946cb7e2cb20b5b8e9e46cfd8c 100644 (file)
@@ -468,7 +468,7 @@ on_viewFullscreen_activate             (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 
 void
-on_optionsEmulateEraser_activate       (GtkMenuItem     *menuitem,
+on_optionsButtonMappings_activate      (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 
 void
@@ -483,3 +483,76 @@ on_optionsProgressiveBG_activate       (GtkMenuItem     *menuitem,
 void
 on_mru_activate                        (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
+
+void
+on_button2Pen_activate                 (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2Eraser_activate              (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2Highlighter_activate         (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2Text_activate                (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2SelectRegion_activate        (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2SelectRectangle_activate     (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2VerticalSpace_activate       (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2LinkBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button2CopyBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3Pen_activate                 (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3Eraser_activate              (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3Highlighter_activate         (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3Text_activate                (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3SelectRegion_activate        (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3SelectRectangle_activate     (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3VerticalSpace_activate       (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3LinkBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
+on_button3CopyBrush_activate           (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
index 1efc4952446ba990c1d517f2f9711e84215f08ea..fbde53fcba39d0514d4bbcfe448f789c076454f3 100644 (file)
@@ -36,7 +36,7 @@ create_winMain (void)
   GtkWidget *menuFile_menu;
   GtkWidget *fileNew;
   GtkWidget *fileNewBackground;
-  GtkWidget *image533;
+  GtkWidget *image577;
   GtkWidget *fileOpen;
   GtkWidget *fileSave;
   GtkWidget *fileSaveAs;
@@ -53,7 +53,7 @@ create_winMain (void)
   GtkWidget *mru7;
   GtkWidget *separator22;
   GtkWidget *filePrintOptions;
-  GtkWidget *image534;
+  GtkWidget *image578;
   GtkWidget *filePrint;
   GtkWidget *filePrintPDF;
   GtkWidget *separator2;
@@ -79,21 +79,21 @@ create_winMain (void)
   GtkWidget *viewZoomOut;
   GtkWidget *viewNormalSize;
   GtkWidget *viewPageWidth;
-  GtkWidget *image535;
+  GtkWidget *image579;
   GtkWidget *separator5;
   GtkWidget *viewFirstPage;
-  GtkWidget *image536;
+  GtkWidget *image580;
   GtkWidget *viewPreviousPage;
-  GtkWidget *image537;
+  GtkWidget *image581;
   GtkWidget *viewNextPage;
-  GtkWidget *image538;
+  GtkWidget *image582;
   GtkWidget *viewLastPage;
-  GtkWidget *image539;
+  GtkWidget *image583;
   GtkWidget *separator6;
   GtkWidget *viewShowLayer;
-  GtkWidget *image540;
+  GtkWidget *image584;
   GtkWidget *viewHideLayer;
-  GtkWidget *image541;
+  GtkWidget *image585;
   GtkWidget *menuJournal;
   GtkWidget *menuJournal_menu;
   GtkWidget *journalNewPageBefore;
@@ -125,10 +125,11 @@ create_winMain (void)
   GtkWidget *paperstyleRuled;
   GtkWidget *paperstyleGraph;
   GtkWidget *paperstyleNA;
+  GtkWidget *journalApplyAllPages;
+  GtkWidget *separator23;
   GtkWidget *journalLoadBackground;
-  GtkWidget *image542;
+  GtkWidget *image586;
   GtkWidget *journalScreenshot;
-  GtkWidget *journalApplyAllPages;
   GtkWidget *separator19;
   GtkWidget *journalDefaultBackground;
   GtkWidget *journalSetAsDefault;
@@ -145,7 +146,7 @@ create_winMain (void)
   GtkWidget *toolsVerticalSpace;
   GtkWidget *separator16;
   GtkWidget *toolsColor;
-  GtkWidget *image543;
+  GtkWidget *image587;
   GtkWidget *toolsColor_menu;
   GSList *colorBlack_group = NULL;
   GtkWidget *colorBlack;
@@ -188,7 +189,7 @@ create_winMain (void)
   GtkWidget *highlighterMedium;
   GtkWidget *highlighterThick;
   GtkWidget *toolsTextFont;
-  GtkWidget *image544;
+  GtkWidget *image588;
   GtkWidget *separator10;
   GtkWidget *toolsDefaultPen;
   GtkWidget *toolsDefaultEraser;
@@ -200,7 +201,37 @@ create_winMain (void)
   GtkWidget *menuOptions;
   GtkWidget *menuOptions_menu;
   GtkWidget *optionsUseXInput;
-  GtkWidget *optionsEmulateEraser;
+  GtkWidget *optionsButtonMappings;
+  GtkWidget *button2_mapping;
+  GtkWidget *button2_mapping_menu;
+  GSList *button2Pen_group = NULL;
+  GtkWidget *button2Pen;
+  GtkWidget *button2Eraser;
+  GtkWidget *button2Highlighter;
+  GtkWidget *button2Text;
+  GtkWidget *button2SelectRegion;
+  GtkWidget *button2SelectRectangle;
+  GtkWidget *button2VerticalSpace;
+  GtkWidget *separator24;
+  GSList *button2LinkBrush_group = NULL;
+  GtkWidget *button2LinkBrush;
+  GtkWidget *button2CopyBrush;
+  GtkWidget *button2NABrush;
+  GtkWidget *button3_mapping;
+  GtkWidget *button3_mapping_menu;
+  GSList *button3Pen_group = NULL;
+  GtkWidget *button3Pen;
+  GtkWidget *button3Eraser;
+  GtkWidget *button3Highlighter;
+  GtkWidget *button3Text;
+  GtkWidget *button3SelectRegion;
+  GtkWidget *button3SelectRectangle;
+  GtkWidget *button3VerticalSpace;
+  GtkWidget *separator25;
+  GSList *button3LinkBrush_group = NULL;
+  GtkWidget *button3LinkBrush;
+  GtkWidget *button3CopyBrush;
+  GtkWidget *button3NABrush;
   GtkWidget *separator18;
   GtkWidget *optionsAntialiasBG;
   GtkWidget *optionsProgressiveBG;
@@ -317,9 +348,9 @@ create_winMain (void)
   gtk_widget_show (fileNewBackground);
   gtk_container_add (GTK_CONTAINER (menuFile_menu), fileNewBackground);
 
-  image533 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image533);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (fileNewBackground), image533);
+  image577 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image577);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (fileNewBackground), image577);
 
   fileOpen = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
   gtk_widget_show (fileOpen);
@@ -386,9 +417,9 @@ create_winMain (void)
   gtk_widget_show (filePrintOptions);
   gtk_container_add (GTK_CONTAINER (menuFile_menu), filePrintOptions);
 
-  image534 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image534);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (filePrintOptions), image534);
+  image578 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image578);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (filePrintOptions), image578);
 
   filePrint = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group);
   gtk_widget_show (filePrint);
@@ -454,7 +485,6 @@ create_winMain (void)
   viewContinuous_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (viewContinuous));
   gtk_widget_show (viewContinuous);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewContinuous);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (viewContinuous), TRUE);
 
   viewOnePage = gtk_radio_menu_item_new_with_mnemonic (viewContinuous_group, "One Page");
   viewContinuous_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (viewOnePage));
@@ -492,9 +522,9 @@ create_winMain (void)
   gtk_widget_show (viewPageWidth);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewPageWidth);
 
-  image535 = gtk_image_new_from_stock ("gtk-zoom-fit", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image535);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewPageWidth), image535);
+  image579 = gtk_image_new_from_stock ("gtk-zoom-fit", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image579);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewPageWidth), image579);
 
   separator5 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator5);
@@ -505,33 +535,33 @@ create_winMain (void)
   gtk_widget_show (viewFirstPage);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewFirstPage);
 
-  image536 = gtk_image_new_from_stock ("gtk-goto-first", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image536);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewFirstPage), image536);
+  image580 = gtk_image_new_from_stock ("gtk-goto-first", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image580);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewFirstPage), image580);
 
   viewPreviousPage = gtk_image_menu_item_new_with_mnemonic ("Previous Page");
   gtk_widget_show (viewPreviousPage);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewPreviousPage);
 
-  image537 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image537);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewPreviousPage), image537);
+  image581 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image581);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewPreviousPage), image581);
 
   viewNextPage = gtk_image_menu_item_new_with_mnemonic ("Next Page");
   gtk_widget_show (viewNextPage);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewNextPage);
 
-  image538 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image538);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewNextPage), image538);
+  image582 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image582);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewNextPage), image582);
 
   viewLastPage = gtk_image_menu_item_new_with_mnemonic ("Last Page");
   gtk_widget_show (viewLastPage);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewLastPage);
 
-  image539 = gtk_image_new_from_stock ("gtk-goto-last", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image539);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewLastPage), image539);
+  image583 = gtk_image_new_from_stock ("gtk-goto-last", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image583);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewLastPage), image583);
 
   separator6 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator6);
@@ -542,17 +572,17 @@ create_winMain (void)
   gtk_widget_show (viewShowLayer);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewShowLayer);
 
-  image540 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image540);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewShowLayer), image540);
+  image584 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image584);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewShowLayer), image584);
 
   viewHideLayer = gtk_image_menu_item_new_with_mnemonic ("Hide Layer");
   gtk_widget_show (viewHideLayer);
   gtk_container_add (GTK_CONTAINER (menuView_menu), viewHideLayer);
 
-  image541 = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image541);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewHideLayer), image541);
+  image585 = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image585);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (viewHideLayer), image585);
 
   menuJournal = gtk_menu_item_new_with_mnemonic ("_Journal");
   gtk_widget_show (menuJournal);
@@ -614,43 +644,36 @@ create_winMain (void)
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorWhite));
   gtk_widget_show (papercolorWhite);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorWhite);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorWhite), TRUE);
 
   papercolorYellow = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "yellow paper");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorYellow));
   gtk_widget_show (papercolorYellow);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorYellow);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorYellow), TRUE);
 
   papercolorPink = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "pink paper");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorPink));
   gtk_widget_show (papercolorPink);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorPink);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorPink), TRUE);
 
   papercolorOrange = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "orange paper");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorOrange));
   gtk_widget_show (papercolorOrange);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorOrange);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorOrange), TRUE);
 
   papercolorBlue = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "blue paper");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorBlue));
   gtk_widget_show (papercolorBlue);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorBlue);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorBlue), TRUE);
 
   papercolorGreen = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "green paper");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorGreen));
   gtk_widget_show (papercolorGreen);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorGreen);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorGreen), TRUE);
 
   papercolorOther = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "other...");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorOther));
   gtk_widget_show (papercolorOther);
   gtk_container_add (GTK_CONTAINER (journalPaperColor_menu), papercolorOther);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (papercolorOther), TRUE);
 
   papercolorNA = gtk_radio_menu_item_new_with_mnemonic (papercolorWhite_group, "NA");
   papercolorWhite_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (papercolorNA));
@@ -668,47 +691,48 @@ create_winMain (void)
   paperstylePlain_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (paperstylePlain));
   gtk_widget_show (paperstylePlain);
   gtk_container_add (GTK_CONTAINER (journalPaperStyle_menu), paperstylePlain);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (paperstylePlain), TRUE);
 
   paperstyleLined = gtk_radio_menu_item_new_with_mnemonic (paperstylePlain_group, "lined");
   paperstylePlain_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (paperstyleLined));
   gtk_widget_show (paperstyleLined);
   gtk_container_add (GTK_CONTAINER (journalPaperStyle_menu), paperstyleLined);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (paperstyleLined), TRUE);
 
   paperstyleRuled = gtk_radio_menu_item_new_with_mnemonic (paperstylePlain_group, "ruled");
   paperstylePlain_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (paperstyleRuled));
   gtk_widget_show (paperstyleRuled);
   gtk_container_add (GTK_CONTAINER (journalPaperStyle_menu), paperstyleRuled);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (paperstyleRuled), TRUE);
 
   paperstyleGraph = gtk_radio_menu_item_new_with_mnemonic (paperstylePlain_group, "graph");
   paperstylePlain_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (paperstyleGraph));
   gtk_widget_show (paperstyleGraph);
   gtk_container_add (GTK_CONTAINER (journalPaperStyle_menu), paperstyleGraph);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (paperstyleGraph), TRUE);
 
   paperstyleNA = gtk_radio_menu_item_new_with_mnemonic (paperstylePlain_group, "NA");
   paperstylePlain_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (paperstyleNA));
   gtk_container_add (GTK_CONTAINER (journalPaperStyle_menu), paperstyleNA);
   gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (paperstyleNA), TRUE);
 
+  journalApplyAllPages = gtk_check_menu_item_new_with_mnemonic ("Apply To All Pages");
+  gtk_widget_show (journalApplyAllPages);
+  gtk_container_add (GTK_CONTAINER (menuJournal_menu), journalApplyAllPages);
+
+  separator23 = gtk_separator_menu_item_new ();
+  gtk_widget_show (separator23);
+  gtk_container_add (GTK_CONTAINER (menuJournal_menu), separator23);
+  gtk_widget_set_sensitive (separator23, FALSE);
+
   journalLoadBackground = gtk_image_menu_item_new_with_mnemonic ("Load Background");
   gtk_widget_show (journalLoadBackground);
   gtk_container_add (GTK_CONTAINER (menuJournal_menu), journalLoadBackground);
 
-  image542 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image542);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (journalLoadBackground), image542);
+  image586 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image586);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (journalLoadBackground), image586);
 
   journalScreenshot = gtk_menu_item_new_with_mnemonic ("Background Screenshot");
   gtk_widget_show (journalScreenshot);
   gtk_container_add (GTK_CONTAINER (menuJournal_menu), journalScreenshot);
 
-  journalApplyAllPages = gtk_menu_item_new_with_mnemonic ("Apply To All Pages");
-  gtk_widget_show (journalApplyAllPages);
-  gtk_container_add (GTK_CONTAINER (menuJournal_menu), journalApplyAllPages);
-
   separator19 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator19);
   gtk_container_add (GTK_CONTAINER (menuJournal_menu), separator19);
@@ -733,25 +757,21 @@ create_winMain (void)
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsPen));
   gtk_widget_show (toolsPen);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsPen);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolsPen), TRUE);
 
   toolsEraser = gtk_radio_menu_item_new_with_mnemonic (toolsPen_group, "_Eraser");
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsEraser));
   gtk_widget_show (toolsEraser);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsEraser);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolsEraser), TRUE);
 
   toolsHighlighter = gtk_radio_menu_item_new_with_mnemonic (toolsPen_group, "_Highlighter");
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsHighlighter));
   gtk_widget_show (toolsHighlighter);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsHighlighter);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolsHighlighter), TRUE);
 
   toolsText = gtk_radio_menu_item_new_with_mnemonic (toolsPen_group, "_Text");
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsText));
   gtk_widget_show (toolsText);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsText);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolsText), TRUE);
 
   separator9 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator9);
@@ -762,13 +782,11 @@ create_winMain (void)
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsSelectRegion));
   gtk_widget_show (toolsSelectRegion);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsSelectRegion);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolsSelectRegion), TRUE);
 
   toolsSelectRectangle = gtk_radio_menu_item_new_with_mnemonic (toolsPen_group, "Select Rectangle");
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsSelectRectangle));
   gtk_widget_show (toolsSelectRectangle);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsSelectRectangle);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (toolsSelectRectangle), TRUE);
 
   toolsVerticalSpace = gtk_radio_menu_item_new_with_mnemonic (toolsPen_group, "Vertical Space");
   toolsPen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (toolsVerticalSpace));
@@ -785,9 +803,9 @@ create_winMain (void)
   gtk_widget_show (toolsColor);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsColor);
 
-  image543 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image543);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (toolsColor), image543);
+  image587 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image587);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (toolsColor), image587);
 
   toolsColor_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (toolsColor), toolsColor_menu);
@@ -796,31 +814,26 @@ create_winMain (void)
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorBlack));
   gtk_widget_show (colorBlack);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorBlack);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorBlack), TRUE);
 
   colorBlue = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "blue");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorBlue));
   gtk_widget_show (colorBlue);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorBlue);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorBlue), TRUE);
 
   colorRed = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "red");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorRed));
   gtk_widget_show (colorRed);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorRed);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorRed), TRUE);
 
   colorGreen = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "green");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorGreen));
   gtk_widget_show (colorGreen);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorGreen);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorGreen), TRUE);
 
   colorGray = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "gray");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorGray));
   gtk_widget_show (colorGray);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorGray);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorGray), TRUE);
 
   separator17 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator17);
@@ -831,43 +844,36 @@ create_winMain (void)
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorLightBlue));
   gtk_widget_show (colorLightBlue);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorLightBlue);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorLightBlue), TRUE);
 
   colorLightGreen = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "light green");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorLightGreen));
   gtk_widget_show (colorLightGreen);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorLightGreen);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorLightGreen), TRUE);
 
   colorMagenta = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "magenta");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorMagenta));
   gtk_widget_show (colorMagenta);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorMagenta);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorMagenta), TRUE);
 
   colorOrange = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "orange");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorOrange));
   gtk_widget_show (colorOrange);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorOrange);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorOrange), TRUE);
 
   colorYellow = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "yellow");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorYellow));
   gtk_widget_show (colorYellow);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorYellow);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorYellow), TRUE);
 
   colorWhite = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "white");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorWhite));
   gtk_widget_show (colorWhite);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorWhite);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorWhite), TRUE);
 
   colorOther = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "other...");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorOther));
   gtk_widget_show (colorOther);
   gtk_container_add (GTK_CONTAINER (toolsColor_menu), colorOther);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (colorOther), TRUE);
 
   colorNA = gtk_radio_menu_item_new_with_mnemonic (colorBlack_group, "NA");
   colorBlack_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (colorNA));
@@ -885,25 +891,21 @@ create_winMain (void)
   penthicknessVeryFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (penthicknessVeryFine));
   gtk_widget_show (penthicknessVeryFine);
   gtk_container_add (GTK_CONTAINER (toolsPenOptions_menu), penthicknessVeryFine);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (penthicknessVeryFine), TRUE);
 
   penthicknessFine = gtk_radio_menu_item_new_with_mnemonic (penthicknessVeryFine_group, "fine");
   penthicknessVeryFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (penthicknessFine));
   gtk_widget_show (penthicknessFine);
   gtk_container_add (GTK_CONTAINER (toolsPenOptions_menu), penthicknessFine);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (penthicknessFine), TRUE);
 
   penthicknessMedium = gtk_radio_menu_item_new_with_mnemonic (penthicknessVeryFine_group, "medium");
   penthicknessVeryFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (penthicknessMedium));
   gtk_widget_show (penthicknessMedium);
   gtk_container_add (GTK_CONTAINER (toolsPenOptions_menu), penthicknessMedium);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (penthicknessMedium), TRUE);
 
   penthicknessThick = gtk_radio_menu_item_new_with_mnemonic (penthicknessVeryFine_group, "thick");
   penthicknessVeryFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (penthicknessThick));
   gtk_widget_show (penthicknessThick);
   gtk_container_add (GTK_CONTAINER (toolsPenOptions_menu), penthicknessThick);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (penthicknessThick), TRUE);
 
   penthicknessVeryThick = gtk_radio_menu_item_new_with_mnemonic (penthicknessVeryFine_group, "very thick");
   penthicknessVeryFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (penthicknessVeryThick));
@@ -922,13 +924,11 @@ create_winMain (void)
   eraserFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (eraserFine));
   gtk_widget_show (eraserFine);
   gtk_container_add (GTK_CONTAINER (toolsEraserOptions_menu), eraserFine);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (eraserFine), TRUE);
 
   eraserMedium = gtk_radio_menu_item_new_with_mnemonic (eraserFine_group, "medium");
   eraserFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (eraserMedium));
   gtk_widget_show (eraserMedium);
   gtk_container_add (GTK_CONTAINER (toolsEraserOptions_menu), eraserMedium);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (eraserMedium), TRUE);
 
   eraserThick = gtk_radio_menu_item_new_with_mnemonic (eraserFine_group, "thick");
   eraserFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (eraserThick));
@@ -945,13 +945,11 @@ create_winMain (void)
   eraserStandard_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (eraserStandard));
   gtk_widget_show (eraserStandard);
   gtk_container_add (GTK_CONTAINER (toolsEraserOptions_menu), eraserStandard);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (eraserStandard), TRUE);
 
   eraserWhiteout = gtk_radio_menu_item_new_with_mnemonic (eraserStandard_group, "whiteout");
   eraserStandard_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (eraserWhiteout));
   gtk_widget_show (eraserWhiteout);
   gtk_container_add (GTK_CONTAINER (toolsEraserOptions_menu), eraserWhiteout);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (eraserWhiteout), TRUE);
 
   eraserDeleteStrokes = gtk_radio_menu_item_new_with_mnemonic (eraserStandard_group, "delete strokes");
   eraserStandard_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (eraserDeleteStrokes));
@@ -970,13 +968,11 @@ create_winMain (void)
   highlighterFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (highlighterFine));
   gtk_widget_show (highlighterFine);
   gtk_container_add (GTK_CONTAINER (toolsHighlighterOptions_menu), highlighterFine);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (highlighterFine), TRUE);
 
   highlighterMedium = gtk_radio_menu_item_new_with_mnemonic (highlighterFine_group, "medium");
   highlighterFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (highlighterMedium));
   gtk_widget_show (highlighterMedium);
   gtk_container_add (GTK_CONTAINER (toolsHighlighterOptions_menu), highlighterMedium);
-  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (highlighterMedium), TRUE);
 
   highlighterThick = gtk_radio_menu_item_new_with_mnemonic (highlighterFine_group, "thick");
   highlighterFine_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (highlighterThick));
@@ -988,9 +984,9 @@ create_winMain (void)
   gtk_widget_show (toolsTextFont);
   gtk_container_add (GTK_CONTAINER (menuTools_menu), toolsTextFont);
 
-  image544 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image544);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (toolsTextFont), image544);
+  image588 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image588);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (toolsTextFont), image588);
 
   separator10 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator10);
@@ -1037,9 +1033,133 @@ create_winMain (void)
   gtk_widget_show (optionsUseXInput);
   gtk_container_add (GTK_CONTAINER (menuOptions_menu), optionsUseXInput);
 
-  optionsEmulateEraser = gtk_check_menu_item_new_with_mnemonic ("Emulate Eraser");
-  gtk_widget_show (optionsEmulateEraser);
-  gtk_container_add (GTK_CONTAINER (menuOptions_menu), optionsEmulateEraser);
+  optionsButtonMappings = gtk_check_menu_item_new_with_mnemonic ("Eraser Tip");
+  gtk_widget_show (optionsButtonMappings);
+  gtk_container_add (GTK_CONTAINER (menuOptions_menu), optionsButtonMappings);
+
+  button2_mapping = gtk_menu_item_new_with_mnemonic ("Button 2 Mapping");
+  gtk_widget_show (button2_mapping);
+  gtk_container_add (GTK_CONTAINER (menuOptions_menu), button2_mapping);
+
+  button2_mapping_menu = gtk_menu_new ();
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (button2_mapping), button2_mapping_menu);
+
+  button2Pen = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Pen");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2Pen));
+  gtk_widget_show (button2Pen);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2Pen);
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (button2Pen), TRUE);
+
+  button2Eraser = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Eraser");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2Eraser));
+  gtk_widget_show (button2Eraser);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2Eraser);
+
+  button2Highlighter = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Highlighter");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2Highlighter));
+  gtk_widget_show (button2Highlighter);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2Highlighter);
+
+  button2Text = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Text");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2Text));
+  gtk_widget_show (button2Text);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2Text);
+
+  button2SelectRegion = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Select Region");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2SelectRegion));
+  gtk_widget_show (button2SelectRegion);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2SelectRegion);
+
+  button2SelectRectangle = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Select Rectangle");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2SelectRectangle));
+  gtk_widget_show (button2SelectRectangle);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2SelectRectangle);
+
+  button2VerticalSpace = gtk_radio_menu_item_new_with_mnemonic (button2Pen_group, "Vertical Space");
+  button2Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2VerticalSpace));
+  gtk_widget_show (button2VerticalSpace);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2VerticalSpace);
+
+  separator24 = gtk_separator_menu_item_new ();
+  gtk_widget_show (separator24);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), separator24);
+  gtk_widget_set_sensitive (separator24, FALSE);
+
+  button2LinkBrush = gtk_radio_menu_item_new_with_mnemonic (button2LinkBrush_group, "Link to Primary Brush");
+  button2LinkBrush_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2LinkBrush));
+  gtk_widget_show (button2LinkBrush);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2LinkBrush);
+
+  button2CopyBrush = gtk_radio_menu_item_new_with_mnemonic (button2LinkBrush_group, "Copy of Current Brush");
+  button2LinkBrush_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2CopyBrush));
+  gtk_widget_show (button2CopyBrush);
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2CopyBrush);
+
+  button2NABrush = gtk_radio_menu_item_new_with_mnemonic (button2LinkBrush_group, "NA");
+  button2LinkBrush_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button2NABrush));
+  gtk_container_add (GTK_CONTAINER (button2_mapping_menu), button2NABrush);
+
+  button3_mapping = gtk_menu_item_new_with_mnemonic ("Button 3 Mapping");
+  gtk_widget_show (button3_mapping);
+  gtk_container_add (GTK_CONTAINER (menuOptions_menu), button3_mapping);
+
+  button3_mapping_menu = gtk_menu_new ();
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (button3_mapping), button3_mapping_menu);
+
+  button3Pen = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Pen");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3Pen));
+  gtk_widget_show (button3Pen);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3Pen);
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (button3Pen), TRUE);
+
+  button3Eraser = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Eraser");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3Eraser));
+  gtk_widget_show (button3Eraser);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3Eraser);
+
+  button3Highlighter = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Highlighter");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3Highlighter));
+  gtk_widget_show (button3Highlighter);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3Highlighter);
+
+  button3Text = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Text");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3Text));
+  gtk_widget_show (button3Text);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3Text);
+
+  button3SelectRegion = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Select Region");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3SelectRegion));
+  gtk_widget_show (button3SelectRegion);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3SelectRegion);
+
+  button3SelectRectangle = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Select Rectangle");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3SelectRectangle));
+  gtk_widget_show (button3SelectRectangle);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3SelectRectangle);
+
+  button3VerticalSpace = gtk_radio_menu_item_new_with_mnemonic (button3Pen_group, "Vertical Space");
+  button3Pen_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3VerticalSpace));
+  gtk_widget_show (button3VerticalSpace);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3VerticalSpace);
+
+  separator25 = gtk_separator_menu_item_new ();
+  gtk_widget_show (separator25);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), separator25);
+  gtk_widget_set_sensitive (separator25, FALSE);
+
+  button3LinkBrush = gtk_radio_menu_item_new_with_mnemonic (button3LinkBrush_group, "Link to Primary Brush");
+  button3LinkBrush_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3LinkBrush));
+  gtk_widget_show (button3LinkBrush);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3LinkBrush);
+
+  button3CopyBrush = gtk_radio_menu_item_new_with_mnemonic (button3LinkBrush_group, "Copy of Current Brush");
+  button3LinkBrush_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3CopyBrush));
+  gtk_widget_show (button3CopyBrush);
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3CopyBrush);
+
+  button3NABrush = gtk_radio_menu_item_new_with_mnemonic (button3LinkBrush_group, "NA");
+  button3LinkBrush_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (button3NABrush));
+  gtk_container_add (GTK_CONTAINER (button3_mapping_menu), button3NABrush);
 
   separator18 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator18);
@@ -1727,15 +1847,15 @@ create_winMain (void)
   g_signal_connect ((gpointer) paperstyleGraph, "toggled",
                     G_CALLBACK (on_paperstyleGraph_activate),
                     NULL);
+  g_signal_connect ((gpointer) journalApplyAllPages, "activate",
+                    G_CALLBACK (on_journalApplyAllPages_activate),
+                    NULL);
   g_signal_connect ((gpointer) journalLoadBackground, "activate",
                     G_CALLBACK (on_journalLoadBackground_activate),
                     NULL);
   g_signal_connect ((gpointer) journalScreenshot, "activate",
                     G_CALLBACK (on_journalScreenshot_activate),
                     NULL);
-  g_signal_connect ((gpointer) journalApplyAllPages, "activate",
-                    G_CALLBACK (on_journalApplyAllPages_activate),
-                    NULL);
   g_signal_connect ((gpointer) journalDefaultBackground, "activate",
                     G_CALLBACK (on_journalDefaultBackground_activate),
                     NULL);
@@ -1865,8 +1985,62 @@ create_winMain (void)
   g_signal_connect ((gpointer) optionsUseXInput, "toggled",
                     G_CALLBACK (on_optionsUseXInput_activate),
                     NULL);
-  g_signal_connect ((gpointer) optionsEmulateEraser, "activate",
-                    G_CALLBACK (on_optionsEmulateEraser_activate),
+  g_signal_connect ((gpointer) optionsButtonMappings, "activate",
+                    G_CALLBACK (on_optionsButtonMappings_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2Pen, "activate",
+                    G_CALLBACK (on_button2Pen_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2Eraser, "activate",
+                    G_CALLBACK (on_button2Eraser_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2Highlighter, "activate",
+                    G_CALLBACK (on_button2Highlighter_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2Text, "activate",
+                    G_CALLBACK (on_button2Text_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2SelectRegion, "activate",
+                    G_CALLBACK (on_button2SelectRegion_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2SelectRectangle, "activate",
+                    G_CALLBACK (on_button2SelectRectangle_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2VerticalSpace, "activate",
+                    G_CALLBACK (on_button2VerticalSpace_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2LinkBrush, "activate",
+                    G_CALLBACK (on_button2LinkBrush_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button2CopyBrush, "activate",
+                    G_CALLBACK (on_button2CopyBrush_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3Pen, "activate",
+                    G_CALLBACK (on_button3Pen_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3Eraser, "activate",
+                    G_CALLBACK (on_button3Eraser_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3Highlighter, "activate",
+                    G_CALLBACK (on_button3Highlighter_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3Text, "activate",
+                    G_CALLBACK (on_button3Text_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3SelectRegion, "activate",
+                    G_CALLBACK (on_button3SelectRegion_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3SelectRectangle, "activate",
+                    G_CALLBACK (on_button3SelectRectangle_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3VerticalSpace, "activate",
+                    G_CALLBACK (on_button3VerticalSpace_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3LinkBrush, "activate",
+                    G_CALLBACK (on_button3LinkBrush_activate),
+                    NULL);
+  g_signal_connect ((gpointer) button3CopyBrush, "activate",
+                    G_CALLBACK (on_button3CopyBrush_activate),
                     NULL);
   g_signal_connect ((gpointer) optionsAntialiasBG, "activate",
                     G_CALLBACK (on_optionsAntialiasBG_activate),
@@ -2015,7 +2189,7 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, menuFile_menu, "menuFile_menu");
   GLADE_HOOKUP_OBJECT (winMain, fileNew, "fileNew");
   GLADE_HOOKUP_OBJECT (winMain, fileNewBackground, "fileNewBackground");
-  GLADE_HOOKUP_OBJECT (winMain, image533, "image533");
+  GLADE_HOOKUP_OBJECT (winMain, image577, "image577");
   GLADE_HOOKUP_OBJECT (winMain, fileOpen, "fileOpen");
   GLADE_HOOKUP_OBJECT (winMain, fileSave, "fileSave");
   GLADE_HOOKUP_OBJECT (winMain, fileSaveAs, "fileSaveAs");
@@ -2032,7 +2206,7 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, mru7, "mru7");
   GLADE_HOOKUP_OBJECT (winMain, separator22, "separator22");
   GLADE_HOOKUP_OBJECT (winMain, filePrintOptions, "filePrintOptions");
-  GLADE_HOOKUP_OBJECT (winMain, image534, "image534");
+  GLADE_HOOKUP_OBJECT (winMain, image578, "image578");
   GLADE_HOOKUP_OBJECT (winMain, filePrint, "filePrint");
   GLADE_HOOKUP_OBJECT (winMain, filePrintPDF, "filePrintPDF");
   GLADE_HOOKUP_OBJECT (winMain, separator2, "separator2");
@@ -2057,21 +2231,21 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, viewZoomOut, "viewZoomOut");
   GLADE_HOOKUP_OBJECT (winMain, viewNormalSize, "viewNormalSize");
   GLADE_HOOKUP_OBJECT (winMain, viewPageWidth, "viewPageWidth");
-  GLADE_HOOKUP_OBJECT (winMain, image535, "image535");
+  GLADE_HOOKUP_OBJECT (winMain, image579, "image579");
   GLADE_HOOKUP_OBJECT (winMain, separator5, "separator5");
   GLADE_HOOKUP_OBJECT (winMain, viewFirstPage, "viewFirstPage");
-  GLADE_HOOKUP_OBJECT (winMain, image536, "image536");
+  GLADE_HOOKUP_OBJECT (winMain, image580, "image580");
   GLADE_HOOKUP_OBJECT (winMain, viewPreviousPage, "viewPreviousPage");
-  GLADE_HOOKUP_OBJECT (winMain, image537, "image537");
+  GLADE_HOOKUP_OBJECT (winMain, image581, "image581");
   GLADE_HOOKUP_OBJECT (winMain, viewNextPage, "viewNextPage");
-  GLADE_HOOKUP_OBJECT (winMain, image538, "image538");
+  GLADE_HOOKUP_OBJECT (winMain, image582, "image582");
   GLADE_HOOKUP_OBJECT (winMain, viewLastPage, "viewLastPage");
-  GLADE_HOOKUP_OBJECT (winMain, image539, "image539");
+  GLADE_HOOKUP_OBJECT (winMain, image583, "image583");
   GLADE_HOOKUP_OBJECT (winMain, separator6, "separator6");
   GLADE_HOOKUP_OBJECT (winMain, viewShowLayer, "viewShowLayer");
-  GLADE_HOOKUP_OBJECT (winMain, image540, "image540");
+  GLADE_HOOKUP_OBJECT (winMain, image584, "image584");
   GLADE_HOOKUP_OBJECT (winMain, viewHideLayer, "viewHideLayer");
-  GLADE_HOOKUP_OBJECT (winMain, image541, "image541");
+  GLADE_HOOKUP_OBJECT (winMain, image585, "image585");
   GLADE_HOOKUP_OBJECT (winMain, menuJournal, "menuJournal");
   GLADE_HOOKUP_OBJECT (winMain, menuJournal_menu, "menuJournal_menu");
   GLADE_HOOKUP_OBJECT (winMain, journalNewPageBefore, "journalNewPageBefore");
@@ -2101,10 +2275,11 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, paperstyleRuled, "paperstyleRuled");
   GLADE_HOOKUP_OBJECT (winMain, paperstyleGraph, "paperstyleGraph");
   GLADE_HOOKUP_OBJECT (winMain, paperstyleNA, "paperstyleNA");
+  GLADE_HOOKUP_OBJECT (winMain, journalApplyAllPages, "journalApplyAllPages");
+  GLADE_HOOKUP_OBJECT (winMain, separator23, "separator23");
   GLADE_HOOKUP_OBJECT (winMain, journalLoadBackground, "journalLoadBackground");
-  GLADE_HOOKUP_OBJECT (winMain, image542, "image542");
+  GLADE_HOOKUP_OBJECT (winMain, image586, "image586");
   GLADE_HOOKUP_OBJECT (winMain, journalScreenshot, "journalScreenshot");
-  GLADE_HOOKUP_OBJECT (winMain, journalApplyAllPages, "journalApplyAllPages");
   GLADE_HOOKUP_OBJECT (winMain, separator19, "separator19");
   GLADE_HOOKUP_OBJECT (winMain, journalDefaultBackground, "journalDefaultBackground");
   GLADE_HOOKUP_OBJECT (winMain, journalSetAsDefault, "journalSetAsDefault");
@@ -2120,7 +2295,7 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, toolsVerticalSpace, "toolsVerticalSpace");
   GLADE_HOOKUP_OBJECT (winMain, separator16, "separator16");
   GLADE_HOOKUP_OBJECT (winMain, toolsColor, "toolsColor");
-  GLADE_HOOKUP_OBJECT (winMain, image543, "image543");
+  GLADE_HOOKUP_OBJECT (winMain, image587, "image587");
   GLADE_HOOKUP_OBJECT (winMain, toolsColor_menu, "toolsColor_menu");
   GLADE_HOOKUP_OBJECT (winMain, colorBlack, "colorBlack");
   GLADE_HOOKUP_OBJECT (winMain, colorBlue, "colorBlue");
@@ -2158,7 +2333,7 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, highlighterMedium, "highlighterMedium");
   GLADE_HOOKUP_OBJECT (winMain, highlighterThick, "highlighterThick");
   GLADE_HOOKUP_OBJECT (winMain, toolsTextFont, "toolsTextFont");
-  GLADE_HOOKUP_OBJECT (winMain, image544, "image544");
+  GLADE_HOOKUP_OBJECT (winMain, image588, "image588");
   GLADE_HOOKUP_OBJECT (winMain, separator10, "separator10");
   GLADE_HOOKUP_OBJECT (winMain, toolsDefaultPen, "toolsDefaultPen");
   GLADE_HOOKUP_OBJECT (winMain, toolsDefaultEraser, "toolsDefaultEraser");
@@ -2170,7 +2345,33 @@ create_winMain (void)
   GLADE_HOOKUP_OBJECT (winMain, menuOptions, "menuOptions");
   GLADE_HOOKUP_OBJECT (winMain, menuOptions_menu, "menuOptions_menu");
   GLADE_HOOKUP_OBJECT (winMain, optionsUseXInput, "optionsUseXInput");
-  GLADE_HOOKUP_OBJECT (winMain, optionsEmulateEraser, "optionsEmulateEraser");
+  GLADE_HOOKUP_OBJECT (winMain, optionsButtonMappings, "optionsButtonMappings");
+  GLADE_HOOKUP_OBJECT (winMain, button2_mapping, "button2_mapping");
+  GLADE_HOOKUP_OBJECT (winMain, button2_mapping_menu, "button2_mapping_menu");
+  GLADE_HOOKUP_OBJECT (winMain, button2Pen, "button2Pen");
+  GLADE_HOOKUP_OBJECT (winMain, button2Eraser, "button2Eraser");
+  GLADE_HOOKUP_OBJECT (winMain, button2Highlighter, "button2Highlighter");
+  GLADE_HOOKUP_OBJECT (winMain, button2Text, "button2Text");
+  GLADE_HOOKUP_OBJECT (winMain, button2SelectRegion, "button2SelectRegion");
+  GLADE_HOOKUP_OBJECT (winMain, button2SelectRectangle, "button2SelectRectangle");
+  GLADE_HOOKUP_OBJECT (winMain, button2VerticalSpace, "button2VerticalSpace");
+  GLADE_HOOKUP_OBJECT (winMain, separator24, "separator24");
+  GLADE_HOOKUP_OBJECT (winMain, button2LinkBrush, "button2LinkBrush");
+  GLADE_HOOKUP_OBJECT (winMain, button2CopyBrush, "button2CopyBrush");
+  GLADE_HOOKUP_OBJECT (winMain, button2NABrush, "button2NABrush");
+  GLADE_HOOKUP_OBJECT (winMain, button3_mapping, "button3_mapping");
+  GLADE_HOOKUP_OBJECT (winMain, button3_mapping_menu, "button3_mapping_menu");
+  GLADE_HOOKUP_OBJECT (winMain, button3Pen, "button3Pen");
+  GLADE_HOOKUP_OBJECT (winMain, button3Eraser, "button3Eraser");
+  GLADE_HOOKUP_OBJECT (winMain, button3Highlighter, "button3Highlighter");
+  GLADE_HOOKUP_OBJECT (winMain, button3Text, "button3Text");
+  GLADE_HOOKUP_OBJECT (winMain, button3SelectRegion, "button3SelectRegion");
+  GLADE_HOOKUP_OBJECT (winMain, button3SelectRectangle, "button3SelectRectangle");
+  GLADE_HOOKUP_OBJECT (winMain, button3VerticalSpace, "button3VerticalSpace");
+  GLADE_HOOKUP_OBJECT (winMain, separator25, "separator25");
+  GLADE_HOOKUP_OBJECT (winMain, button3LinkBrush, "button3LinkBrush");
+  GLADE_HOOKUP_OBJECT (winMain, button3CopyBrush, "button3CopyBrush");
+  GLADE_HOOKUP_OBJECT (winMain, button3NABrush, "button3NABrush");
   GLADE_HOOKUP_OBJECT (winMain, separator18, "separator18");
   GLADE_HOOKUP_OBJECT (winMain, optionsAntialiasBG, "optionsAntialiasBG");
   GLADE_HOOKUP_OBJECT (winMain, optionsProgressiveBG, "optionsProgressiveBG");
index ed6be0392b5ca5f331b5aa8204ff1d61359b8cd0..b85c284d58d14a9443e45331dd7f689d07051c0f 100644 (file)
@@ -3,6 +3,7 @@
 #endif
 
 #include <math.h>
+#include <string.h>
 #include <gtk/gtk.h>
 #include <libgnomecanvas/libgnomecanvas.h>
 
@@ -150,8 +151,8 @@ void clear_redo_stack(void)
       redo->page->group = NULL;
       delete_page(redo->page);
     }
-    else if (redo->type == ITEM_MOVESEL) {
-      g_list_free(redo->itemlist);
+    else if (redo->type == ITEM_MOVESEL || redo->type == ITEM_REPAINTSEL) {
+      g_list_free(redo->itemlist); g_list_free(redo->auxlist);
     }
     else if (redo->type == ITEM_PASTE) {
       for (list = redo->itemlist; list!=NULL; list=list->next) {
@@ -199,7 +200,10 @@ void clear_undo_stack(void)
       }
       g_free(undo->bg);
     }
-    else if (undo->type == ITEM_MOVESEL || undo->type == ITEM_PASTE) {
+    else if (undo->type == ITEM_MOVESEL || undo->type == ITEM_REPAINTSEL) {
+      g_list_free(undo->itemlist); g_list_free(undo->auxlist);
+    }
+    else if (undo->type == ITEM_PASTE) {
       g_list_free(undo->itemlist);
     }
     else if (undo->type == ITEM_DELETE_LAYER) {
@@ -586,7 +590,7 @@ void lower_canvas_item_to(GnomeCanvasGroup *g, GnomeCanvasItem *item, GnomeCanva
 
 void update_thickness_buttons(void)
 {
-  if (ui.toolno >= NUM_STROKE_TOOLS) {
+  if (ui.selection!=NULL || ui.toolno[ui.cur_mapping] >= NUM_STROKE_TOOLS) {
     gtk_toggle_tool_button_set_active(
       GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonThicknessOther")), TRUE);
   } else 
@@ -611,7 +615,8 @@ void update_thickness_buttons(void)
 
 void update_color_buttons(void)
 {
-  if (ui.toolno != TOOL_PEN && ui.toolno != TOOL_HIGHLIGHTER) {
+  if (ui.selection!=NULL || (ui.toolno[ui.cur_mapping] != TOOL_PEN 
+                          && ui.toolno[ui.cur_mapping] != TOOL_HIGHLIGHTER)) {
     gtk_toggle_tool_button_set_active(
       GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonColorOther")), TRUE);
   } else
@@ -668,7 +673,7 @@ void update_color_buttons(void)
 
 void update_tool_buttons(void)
 {
-  switch(ui.toolno) {
+  switch(ui.toolno[ui.cur_mapping]) {
     case TOOL_PEN:
       gtk_toggle_tool_button_set_active(
         GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonPen")), TRUE);
@@ -700,14 +705,14 @@ void update_tool_buttons(void)
   }
     
   gtk_toggle_tool_button_set_active(
-    GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonRuler")), ui.ruler);
+    GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonRuler")), ui.ruler[ui.cur_mapping]);
   update_thickness_buttons();
   update_color_buttons();
 }
 
 void update_tool_menu(void)
 {
-  switch(ui.toolno) {
+  switch(ui.toolno[0]) {
     case TOOL_PEN:
       gtk_check_menu_item_set_active(
         GTK_CHECK_MENU_ITEM(GET_COMPONENT("toolsPen")), TRUE);
@@ -739,20 +744,21 @@ void update_tool_menu(void)
   }
 
   gtk_check_menu_item_set_active(
-    GTK_CHECK_MENU_ITEM(GET_COMPONENT("toolsRuler")), ui.ruler);
+    GTK_CHECK_MENU_ITEM(GET_COMPONENT("toolsRuler")), ui.ruler[0]);
 }
 
 void update_ruler_indicator(void)
 {
   gtk_toggle_tool_button_set_active(
-    GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonRuler")), ui.ruler);
+    GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonRuler")), ui.ruler[ui.cur_mapping]);
   gtk_check_menu_item_set_active(
-    GTK_CHECK_MENU_ITEM(GET_COMPONENT("toolsRuler")), ui.ruler);
+    GTK_CHECK_MENU_ITEM(GET_COMPONENT("toolsRuler")), ui.ruler[0]);
 }
 
 void update_color_menu(void)
 {
-  if (ui.toolno != TOOL_PEN && ui.toolno != TOOL_HIGHLIGHTER) {
+  if (ui.selection!=NULL || (ui.toolno[ui.cur_mapping] != TOOL_PEN 
+                          && ui.toolno[ui.cur_mapping] != TOOL_HIGHLIGHTER)) {
     gtk_check_menu_item_set_active(
       GTK_CHECK_MENU_ITEM(GET_COMPONENT("colorNA")), TRUE);
   } else
@@ -809,7 +815,7 @@ void update_color_menu(void)
 
 void update_pen_props_menu(void)
 {
-  switch(ui.brushes[TOOL_PEN].thickness_no) {
+  switch(ui.brushes[0][TOOL_PEN].thickness_no) {
     case THICKNESS_VERYFINE:
       gtk_check_menu_item_set_active(
         GTK_CHECK_MENU_ITEM(GET_COMPONENT("penthicknessVeryFine")), TRUE);
@@ -835,7 +841,7 @@ void update_pen_props_menu(void)
 
 void update_eraser_props_menu(void)
 {
-  switch (ui.brushes[TOOL_ERASER].thickness_no) {
+  switch (ui.brushes[0][TOOL_ERASER].thickness_no) {
     case THICKNESS_FINE:
       gtk_check_menu_item_set_active(
         GTK_CHECK_MENU_ITEM(GET_COMPONENT("eraserFine")), TRUE);
@@ -852,18 +858,18 @@ void update_eraser_props_menu(void)
   
   gtk_check_menu_item_set_active(
     GTK_CHECK_MENU_ITEM(GET_COMPONENT("eraserStandard")),
-    ui.brushes[TOOL_ERASER].tool_options == TOOLOPT_ERASER_STANDARD);
+    ui.brushes[0][TOOL_ERASER].tool_options == TOOLOPT_ERASER_STANDARD);
   gtk_check_menu_item_set_active(
     GTK_CHECK_MENU_ITEM(GET_COMPONENT("eraserWhiteout")),
-    ui.brushes[TOOL_ERASER].tool_options == TOOLOPT_ERASER_WHITEOUT);
+    ui.brushes[0][TOOL_ERASER].tool_options == TOOLOPT_ERASER_WHITEOUT);
   gtk_check_menu_item_set_active(
     GTK_CHECK_MENU_ITEM(GET_COMPONENT("eraserDeleteStrokes")),
-    ui.brushes[TOOL_ERASER].tool_options == TOOLOPT_ERASER_STROKES);
+    ui.brushes[0][TOOL_ERASER].tool_options == TOOLOPT_ERASER_STROKES);
 }
 
 void update_highlighter_props_menu(void)
 {
-  switch (ui.brushes[TOOL_HIGHLIGHTER].thickness_no) {
+  switch (ui.brushes[0][TOOL_HIGHLIGHTER].thickness_no) {
     case THICKNESS_FINE:
       gtk_check_menu_item_set_active(
         GTK_CHECK_MENU_ITEM(GET_COMPONENT("highlighterFine")), TRUE);
@@ -879,6 +885,106 @@ void update_highlighter_props_menu(void)
   }
 }
 
+void update_mappings_menu_linkings(void)
+{
+  switch (ui.linked_brush[1]) {
+    case BRUSH_LINKED:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2LinkBrush")), TRUE);
+      break;
+    case BRUSH_COPIED:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2CopyBrush")), TRUE);
+      break;
+    case BRUSH_STATIC:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2NABrush")), TRUE);
+      break;
+  }
+  switch (ui.linked_brush[2]) {
+    case BRUSH_LINKED:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3LinkBrush")), TRUE);
+      break;
+    case BRUSH_COPIED:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3CopyBrush")), TRUE);
+      break;
+    case BRUSH_STATIC:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3NABrush")), TRUE);
+      break;
+  }
+}
+
+void update_mappings_menu(void)
+{
+  gtk_check_menu_item_set_active(
+    GTK_CHECK_MENU_ITEM(GET_COMPONENT("optionsButtonMappings")), ui.use_erasertip);
+
+  switch(ui.toolno[1]) {
+    case TOOL_PEN:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2Pen")), TRUE);
+      break;
+    case TOOL_ERASER:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2Eraser")), TRUE);
+      break;
+    case TOOL_HIGHLIGHTER:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2Highlighter")), TRUE);
+      break;
+    case TOOL_TEXT:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2Text")), TRUE);
+      break;
+    case TOOL_SELECTREGION:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2SelectRegion")), TRUE);
+      break;
+    case TOOL_SELECTRECT:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2SelectRectangle")), TRUE);
+      break;
+    case TOOL_VERTSPACE:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button2VerticalSpace")), TRUE);
+      break;
+  }
+  switch(ui.toolno[2]) {
+    case TOOL_PEN:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3Pen")), TRUE);
+      break;
+    case TOOL_ERASER:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3Eraser")), TRUE);
+      break;
+    case TOOL_HIGHLIGHTER:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3Highlighter")), TRUE);
+      break;
+    case TOOL_TEXT:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3Text")), TRUE);
+      break;
+    case TOOL_SELECTREGION:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3SelectRegion")), TRUE);
+      break;
+    case TOOL_SELECTRECT:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3SelectRectangle")), TRUE);
+      break;
+    case TOOL_VERTSPACE:
+      gtk_check_menu_item_set_active(
+        GTK_CHECK_MENU_ITEM(GET_COMPONENT("button3VerticalSpace")), TRUE);
+      break;
+  }
+  update_mappings_menu_linkings();
+}
+
 void do_switch_page(int pg, gboolean rescroll, gboolean refresh_all)
 {
   int i;
@@ -990,7 +1096,7 @@ void update_page_stuff(void)
     gtk_check_menu_item_set_active(
        GTK_CHECK_MENU_ITEM(GET_COMPONENT("viewOnePage")), TRUE);
 
-  if (ui.cur_page->bg->type == BG_SOLID) {
+  if (ui.cur_page->bg->type == BG_SOLID && !ui.bg_apply_all_pages) {
     switch (ui.cur_page->bg->color_no) {
       case COLOR_WHITE:
         gtk_check_menu_item_set_active(
@@ -1049,11 +1155,9 @@ void update_page_stuff(void)
   // enable/disable the page/layer menu items and toolbar buttons
 
   gtk_widget_set_sensitive(GET_COMPONENT("journalPaperColor"), 
-     ui.cur_page->bg->type == BG_SOLID);
+     ui.cur_page->bg->type == BG_SOLID || ui.bg_apply_all_pages);
   gtk_widget_set_sensitive(GET_COMPONENT("journalSetAsDefault"),
      ui.cur_page->bg->type == BG_SOLID);
-  gtk_widget_set_sensitive(GET_COMPONENT("journalApplyAllPages"),
-     ui.cur_page->bg->type == BG_SOLID);
   
   gtk_widget_set_sensitive(GET_COMPONENT("viewFirstPage"), ui.pageno!=0);
   gtk_widget_set_sensitive(GET_COMPONENT("viewPreviousPage"), ui.pageno!=0);
@@ -1079,6 +1183,7 @@ void update_toolbar_and_menu(void)
   update_pen_props_menu();
   update_eraser_props_menu();
   update_highlighter_props_menu();
+  update_mappings_menu();
 
   gtk_toggle_tool_button_set_active(
     GTK_TOGGLE_TOOL_BUTTON(GET_COMPONENT("buttonFullscreen")), ui.fullscreen);
@@ -1120,13 +1225,33 @@ void update_copy_paste_enabled(void)
   gtk_widget_set_sensitive(GET_COMPONENT("buttonCopy"), ui.selection!=NULL);
 }
 
+void update_mapping_linkings(int toolno)
+{
+  int i;
+  
+  for (i = 1; i<=NUM_BUTTONS; i++) {
+    if (ui.linked_brush[i] == BRUSH_LINKED) {
+      if (toolno >= 0 && toolno < NUM_STROKE_TOOLS)
+        g_memmove(&(ui.brushes[i][toolno]), &(ui.brushes[0][toolno]), sizeof(struct Brush));
+      ui.ruler[i] = ui.ruler[0];
+      if (ui.toolno[i]!=TOOL_PEN && ui.toolno[i]!=TOOL_HIGHLIGHTER)
+        ui.ruler[i] = FALSE;
+    }
+    if (ui.linked_brush[i] == BRUSH_COPIED && toolno == ui.toolno[i]) {
+      ui.linked_brush[i] = BRUSH_STATIC;
+      if (i==1 || i==2) update_mappings_menu_linkings();
+    }
+  }
+}
+
 void set_cur_color(int color)
 {
   ui.cur_brush->color_no = color;
-  if (ui.toolno == TOOL_HIGHLIGHTER)
+  if (ui.toolno[0] == TOOL_HIGHLIGHTER)
     ui.cur_brush->color_rgba = predef_colors_rgba[color] & HILITER_ALPHA_MASK;
   else
     ui.cur_brush->color_rgba = predef_colors_rgba[color];
+  update_mapping_linkings(ui.toolno[0]);
 }
 
 void process_color_activate(GtkMenuItem *menuitem, int color)
@@ -1139,21 +1264,23 @@ void process_color_activate(GtkMenuItem *menuitem, int color)
       return;
   }
 
-  if (ui.toolno != TOOL_PEN && ui.toolno != TOOL_HIGHLIGHTER
-        && ui.toolno != TOOL_TEXT && ui.selection == NULL) {
-    ui.toolno = TOOL_PEN;
-    ui.cur_brush = ui.brushes+TOOL_PEN;
+  if (ui.cur_mapping != 0) return; // not user-generated
+
+  if (ui.selection != NULL) {
+    recolor_selection(color);
+    update_color_buttons();
+    update_color_menu();
+  }
+  
+  if (ui.toolno[0] != TOOL_PEN && ui.toolno[0] != TOOL_HIGHLIGHTER) {
+    if (ui.selection != NULL) return;
+    ui.toolno[0] = TOOL_PEN;
+    ui.cur_brush = &(ui.brushes[0][TOOL_PEN]);
     update_tool_buttons();
     update_tool_menu();
   }
   
-  if (ui.toolno == TOOL_PEN || ui.toolno == TOOL_HIGHLIGHTER)
-    set_cur_color(color);
-
-  if ((ui.toolno == TOOL_SELECTREGION || ui.toolno == TOOL_SELECTRECT) &&
-       ui.selection != NULL)
-    recolor_selection(color);
-
+  set_cur_color(color);
   update_color_buttons();
   update_color_menu();
   update_cursor();
@@ -1169,16 +1296,21 @@ void process_thickness_activate(GtkMenuItem *menuitem, int tool, int val)
       return;
   }
 
+  if (ui.cur_mapping != 0) return; // not user-generated
+
+  if (ui.selection != NULL && GTK_OBJECT_TYPE(menuitem) != GTK_TYPE_RADIO_MENU_ITEM) {
+    rethicken_selection(val);
+    update_thickness_buttons();
+  }
+
   if (tool >= NUM_STROKE_TOOLS) {
-    if ((tool == TOOL_SELECTREGION || tool == TOOL_SELECTRECT) && ui.selection != NULL)
-      rethicken_selection(val);
     update_thickness_buttons(); // undo illegal button selection
     return;
   }
-  
-  if (ui.brushes[tool].thickness_no == val) return; // avoid loops
-  ui.brushes[tool].thickness_no = val;
-  ui.brushes[tool].thickness = predef_thickness[tool][val];
+
+  ui.brushes[0][tool].thickness_no = val;
+  ui.brushes[0][tool].thickness = predef_thickness[tool][val];
+  update_mapping_linkings(tool);
   
   update_thickness_buttons();
   if (tool == TOOL_PEN) update_pen_props_menu();
@@ -1189,55 +1321,83 @@ void process_thickness_activate(GtkMenuItem *menuitem, int tool, int val)
 
 void process_papercolor_activate(GtkMenuItem *menuitem, int color)
 {
+  struct Page *pg;
+  GList *pglist;
+  gboolean hasdone;
+
   if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem)))
     return;
 
-  if (ui.cur_page->bg->type != BG_SOLID) {
+  if ((ui.cur_page->bg->type != BG_SOLID) || ui.bg_apply_all_pages)
     gtk_check_menu_item_set_active(
       GTK_CHECK_MENU_ITEM(GET_COMPONENT("papercolorNA")), TRUE);
-    return;
-  }
 
-  if (ui.cur_page->bg->color_no == color) return;
-  
-  reset_selection();
-  prepare_new_undo();
-  undo->type = ITEM_NEW_BG_ONE;
-  undo->page = ui.cur_page;
-  undo->bg = (struct Background *)g_memdup(ui.cur_page->bg, sizeof(struct Background));
-  undo->bg->canvas_item = NULL;
-
-  ui.cur_page->bg->color_no = color;
-  ui.cur_page->bg->color_rgba = predef_bgcolors_rgba[color];
-  update_canvas_bg(ui.cur_page);
+  pg = ui.cur_page;
+  hasdone = FALSE;
+  for (pglist = journal.pages; pglist!=NULL; pglist = pglist->next) {
+    if (ui.bg_apply_all_pages) pg = (struct Page *)pglist->data;
+    if (pg->bg->type == BG_SOLID && pg->bg->color_no != color) {
+      prepare_new_undo();
+      if (hasdone) undo->multiop |= MULTIOP_CONT_UNDO;
+      undo->multiop |= MULTIOP_CONT_REDO;
+      hasdone = TRUE;
+      undo->type = ITEM_NEW_BG_ONE;
+      undo->page = pg;
+      undo->bg = (struct Background *)g_memdup(pg->bg, sizeof(struct Background));
+      undo->bg->canvas_item = NULL;
+
+      pg->bg->color_no = color;
+      pg->bg->color_rgba = predef_bgcolors_rgba[color];
+      update_canvas_bg(pg);
+    }
+    if (!ui.bg_apply_all_pages) break;
+  }
+  if (hasdone) undo->multiop -= MULTIOP_CONT_REDO;
 }
 
 void process_paperstyle_activate(GtkMenuItem *menuitem, int style)
 {
+  struct Page *pg;
+  GList *pglist;
+  gboolean hasdone, must_upd;
+
   if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem)))
     return;
 
-  if (ui.cur_page->bg->type == BG_SOLID && ui.cur_page->bg->ruling == style)
-    return;
+  if (ui.bg_apply_all_pages)
+    gtk_check_menu_item_set_active(
+      GTK_CHECK_MENU_ITEM(GET_COMPONENT("paperstyleNA")), TRUE);
 
-  reset_selection();
-  prepare_new_undo();
-  undo->type = ITEM_NEW_BG_ONE;
-  undo->page = ui.cur_page;
-  undo->bg = (struct Background *)g_memdup(ui.cur_page->bg, sizeof(struct Background));
-  undo->bg->canvas_item = NULL;
-
-  if (ui.cur_page->bg->type != BG_SOLID) {
-    ui.cur_page->bg->type = BG_SOLID;
-    ui.cur_page->bg->color_no = COLOR_WHITE;
-    ui.cur_page->bg->color_rgba = predef_bgcolors_rgba[COLOR_WHITE];
-    ui.cur_page->bg->filename = NULL;
-    ui.cur_page->bg->pixbuf = NULL;
-    update_page_stuff();
+  pg = ui.cur_page;
+  hasdone = FALSE;
+  must_upd = FALSE;
+  for (pglist = journal.pages; pglist!=NULL; pglist = pglist->next) {
+    if (ui.bg_apply_all_pages) pg = (struct Page *)pglist->data;
+    if (pg->bg->type != BG_SOLID || pg->bg->ruling != style) {
+      prepare_new_undo();
+      undo->type = ITEM_NEW_BG_ONE;
+      if (hasdone) undo->multiop |= MULTIOP_CONT_UNDO;
+      undo->multiop |= MULTIOP_CONT_REDO;
+      hasdone = TRUE;
+      undo->page = pg;
+      undo->bg = (struct Background *)g_memdup(pg->bg, sizeof(struct Background));
+      undo->bg->canvas_item = NULL;
+
+      if (pg->bg->type != BG_SOLID) {
+        pg->bg->type = BG_SOLID;
+        pg->bg->color_no = COLOR_WHITE;
+        pg->bg->color_rgba = predef_bgcolors_rgba[COLOR_WHITE];
+        pg->bg->filename = NULL;
+        pg->bg->pixbuf = NULL;
+        must_upd = TRUE;
+      }
+      pg->bg->ruling = style;
+      update_canvas_bg(pg);
+    }
+    if (!ui.bg_apply_all_pages) break;
   }
-
-  ui.cur_page->bg->ruling = style;
-  update_canvas_bg(ui.cur_page);
+  if (hasdone) undo->multiop -= MULTIOP_CONT_REDO;
+  if (must_upd) update_page_stuff();
 }
 
 gboolean ok_to_close(void)
@@ -1279,11 +1439,17 @@ void reset_selection(void)
   g_free(ui.selection);
   ui.selection = NULL;
   update_copy_paste_enabled();
+  update_color_menu();
+  update_thickness_buttons();
+  update_color_buttons();
 }
 
-void move_journal_items_by(GList *itemlist, double dx, double dy)
+void move_journal_items_by(GList *itemlist, double dx, double dy,
+                              struct Layer *l1, struct Layer *l2, GList *depths)
 {
   struct Item *item;
+  GnomeCanvasItem *refitem;
+  GList *link;
   int i;
   double *pt;
   
@@ -1297,6 +1463,63 @@ void move_journal_items_by(GList *itemlist, double dx, double dy)
       item->bbox.top += dy;
       item->bbox.bottom += dy;
     }
+    if (l1 != l2) {
+      // find out where to insert
+      if (depths != NULL) {
+        if (depths->data == NULL) link = l2->items;
+        else {
+          link = g_list_find(l2->items, depths->data);
+          if (link != NULL) link = link->next;
+        }
+      } else link = NULL;
+      l2->items = g_list_insert_before(l2->items, link, item);
+      l2->nitems++;
+      l1->items = g_list_remove(l1->items, item);
+      l1->nitems--;
+    }
+    if (depths != NULL) { // also raise/lower the canvas items
+      if (item->canvas_item!=NULL) {
+        if (depths->data == NULL) link = NULL;
+        else link = g_list_find(l2->items, depths->data);
+        if (link != NULL) refitem = ((struct Item *)(link->data))->canvas_item;
+        else refitem = NULL;
+        lower_canvas_item_to(l2->group, item->canvas_item, refitem);
+      }
+      depths = depths->next;
+    }
     itemlist = itemlist->next;
   }
 }
+
+// Switch between button mappings
+
+/* NOTE ABOUT BUTTON MAPPINGS: ui.cur_mapping is 0 except while a canvas
+   click event is being processed ... */
+
+void switch_mapping(int m)
+{
+  if (ui.cur_mapping == m) return;
+
+  ui.cur_mapping = m;
+  if (ui.toolno[m] < NUM_STROKE_TOOLS) 
+    ui.cur_brush = &(ui.brushes[m][ui.toolno[m]]);
+  update_tool_buttons();
+  update_color_menu();
+  update_cursor();
+}
+
+void process_mapping_activate(GtkMenuItem *menuitem, int m, int tool)
+{
+  if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
+  if (ui.cur_mapping!=0) return;
+  if (ui.toolno[m] == tool) return;
+  ui.toolno[m] = tool;
+  ui.ruler[m] = FALSE;
+  if (ui.linked_brush[m] == BRUSH_LINKED 
+       && (tool==TOOL_PEN || tool==TOOL_HIGHLIGHTER))
+    ui.ruler[m] = ui.ruler[0];
+  if (ui.linked_brush[m] == BRUSH_COPIED) {
+    ui.linked_brush[m] = BRUSH_STATIC;
+    update_mappings_menu_linkings();
+  }
+}
index 7fd40cbe6e1a0f4a667a2aa80a11bb2b4f527027..a4bd9ce81da278090cb6b3dcfa6d653449dcb6c7 100644 (file)
@@ -41,12 +41,15 @@ void update_color_menu(void);
 void update_pen_props_menu(void);
 void update_eraser_props_menu(void);
 void update_highlighter_props_menu(void);
+void update_mappings_menu_linkings(void);
+void update_mappings_menu(void);
 void update_page_stuff(void);
 void update_toolbar_and_menu(void);
 void update_file_name(char *filename);
 void update_undo_redo_enabled(void);
 void update_copy_paste_enabled(void);
 
+void update_mapping_linkings(int toolno);
 void do_switch_page(int pg, gboolean rescroll, gboolean refresh_all);
 void set_cur_color(int color);
 void process_color_activate(GtkMenuItem *menuitem, int color);
@@ -60,7 +63,13 @@ gboolean page_ops_forbidden(void);
 // selection / clipboard stuff
 
 void reset_selection(void);
-void move_journal_items_by(GList *itemlist, double dx, double dy);
+void move_journal_items_by(GList *itemlist, double dx, double dy,
+                           struct Layer *l1, struct Layer *l2, GList *depths);
+
+// switch between mappings
+
+void switch_mapping(int m);
+void process_mapping_activate(GtkMenuItem *menuitem, int m, int tool);
 
 // defines for paper rulings
 
index 2aed31798ce01055354443bf16e91c58bd22136b..5d19c1b9a03718ca858804b0602611791454c5b8 100644 (file)
@@ -61,7 +61,13 @@ void update_cursor(void)
     gdk_cursor_unref(ui.cursor);
     ui.cursor = NULL;
   }
-  if (ui.toolno == TOOL_PEN) {
+  if (ui.cur_item_type == ITEM_MOVESEL) {
+    if (ui.toolno[ui.cur_mapping] == TOOL_VERTSPACE) 
+      ui.cursor = gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW);
+    else 
+      ui.cursor = gdk_cursor_new(GDK_FLEUR);
+  }
+  else if (ui.toolno[ui.cur_mapping] == TOOL_PEN) {
     fg.red = (ui.cur_brush->color_rgba >> 16) & 0xff00;
     fg.green = (ui.cur_brush->color_rgba >> 8) & 0xff00;
     fg.blue = (ui.cur_brush->color_rgba >> 0) & 0xff00;
@@ -69,14 +75,14 @@ void update_cursor(void)
     ui.cursor = gdk_cursor_new_from_pixmap(source, source, &fg, &bg, 7, 7);
     gdk_bitmap_unref(source);
   }
-  else if (ui.toolno == TOOL_ERASER) {
+  else if (ui.toolno[ui.cur_mapping] == TOOL_ERASER) {
     source = gdk_bitmap_create_from_data(NULL, cursor_eraser_bits, 16, 16);
     mask = gdk_bitmap_create_from_data(NULL, cursor_eraser_mask, 16, 16);
     ui.cursor = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 7, 7);
     gdk_bitmap_unref(source);
     gdk_bitmap_unref(mask);
   }
-  else if (ui.toolno == TOOL_HIGHLIGHTER) {
+  else if (ui.toolno[ui.cur_mapping] == TOOL_HIGHLIGHTER) {
     source = gdk_bitmap_create_from_data(NULL, cursor_eraser_bits, 16, 16);
     mask = gdk_bitmap_create_from_data(NULL, cursor_eraser_mask, 16, 16);
     bg.red = (ui.cur_brush->color_rgba >> 16) & 0xff00;
@@ -86,12 +92,6 @@ void update_cursor(void)
     gdk_bitmap_unref(source);
     gdk_bitmap_unref(mask);
   }
-  else if (ui.cur_item_type == ITEM_MOVESEL) {
-    if (ui.toolno == TOOL_VERTSPACE) 
-      ui.cursor = gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW);
-    else 
-      ui.cursor = gdk_cursor_new(GDK_FLEUR);
-  }
   else if (ui.cur_item_type == ITEM_SELECTRECT) {
     ui.cursor = gdk_cursor_new(GDK_TCROSS);
   }
@@ -141,7 +141,7 @@ void create_new_stroke(GdkEvent *event)
   ui.cur_path.num_points = 1;
   get_pointer_coords(event, ui.cur_path.coords);
   
-  if (ui.ruler) 
+  if (ui.ruler[ui.cur_mapping]
     ui.cur_item->canvas_item = gnome_canvas_item_new(ui.cur_layer->group,
       gnome_canvas_line_get_type(),
       "cap-style", GDK_CAP_ROUND, "join-style", GDK_JOIN_ROUND,
@@ -157,7 +157,7 @@ void continue_stroke(GdkEvent *event)
   GnomeCanvasPoints seg;
   double *pt;
 
-  if (ui.ruler) {
+  if (ui.ruler[ui.cur_mapping]) {
     pt = ui.cur_path.coords;
   } else {
     realloc_cur_path(ui.cur_path.num_points+1);
@@ -166,7 +166,7 @@ void continue_stroke(GdkEvent *event)
   
   get_pointer_coords(event, pt+2);
   
-  if (ui.ruler)
+  if (ui.ruler[ui.cur_mapping])
     ui.cur_path.num_points = 2;
   else {
     if (hypot(pt[0]-pt[2], pt[1]-pt[3]) < PIXEL_MOTION_THRESHOLD/ui.zoom)
@@ -182,7 +182,7 @@ void continue_stroke(GdkEvent *event)
      upon creation the line just copies the contents of the GnomeCanvasPoints
      into an internal structure */
 
-  if (ui.ruler)
+  if (ui.ruler[ui.cur_mapping])
     gnome_canvas_item_set(ui.cur_item->canvas_item, "points", &seg, NULL);
   else
     gnome_canvas_item_new((GnomeCanvasGroup *)ui.cur_item->canvas_item,
@@ -483,6 +483,10 @@ gboolean start_movesel(GdkEvent *event)
     ui.cur_item_type = ITEM_MOVESEL;
     ui.selection->anchor_x = ui.selection->last_x = pt[0];
     ui.selection->anchor_y = ui.selection->last_y = pt[1];
+    ui.selection->orig_pageno = ui.pageno;
+    ui.selection->move_pageno = ui.pageno;
+    ui.selection->move_layer = ui.selection->layer;
+    ui.selection->move_pagedelta = 0.;
     gnome_canvas_item_set(ui.selection->canvas_item, "dash", NULL, NULL);
     update_cursor();
     return TRUE;
@@ -497,22 +501,29 @@ void start_vertspace(GdkEvent *event)
   struct Item *item;
 
   reset_selection();
-  ui.cur_item_type = ITEM_MOVESEL;
+  ui.cur_item_type = ITEM_MOVESEL_VERT;
   ui.selection = g_new(struct Selection, 1);
-  ui.selection->type = ITEM_MOVESEL;
+  ui.selection->type = ITEM_MOVESEL_VERT;
   ui.selection->items = NULL;
   ui.selection->layer = ui.cur_layer;
 
   get_pointer_coords(event, pt);
+  ui.selection->bbox.top = ui.selection->bbox.bottom = pt[1];
   for (itemlist = ui.cur_layer->items; itemlist!=NULL; itemlist = itemlist->next) {
     item = (struct Item *)itemlist->data;
     if (item->bbox.top >= pt[1]) {
       ui.selection->items = g_list_append(ui.selection->items, item); 
+      if (item->bbox.bottom > ui.selection->bbox.bottom)
+        ui.selection->bbox.bottom = item->bbox.bottom;
     }
   }
 
   ui.selection->anchor_x = ui.selection->last_x = 0;
   ui.selection->anchor_y = ui.selection->last_y = pt[1];
+  ui.selection->orig_pageno = ui.pageno;
+  ui.selection->move_pageno = ui.pageno;
+  ui.selection->move_layer = ui.selection->layer;
+  ui.selection->move_pagedelta = 0.;
   ui.selection->canvas_item = gnome_canvas_item_new(ui.cur_layer->group,
       gnome_canvas_rect_get_type(), "width-pixels", 1, 
       "outline-color-rgba", 0x000000ff,
@@ -523,21 +534,69 @@ void start_vertspace(GdkEvent *event)
 
 void continue_movesel(GdkEvent *event)
 {
-  double pt[2], dx, dy;
+  double pt[2], dx, dy, upmargin;
   GList *list;
   struct Item *item;
+  int tmppageno;
+  struct Page *tmppage;
   
   get_pointer_coords(event, pt);
-  if (ui.toolno == TOOL_VERTSPACE) pt[0] = 0;
+  if (ui.cur_item_type == ITEM_MOVESEL_VERT) pt[0] = 0;
+  pt[1] += ui.selection->move_pagedelta;
+
+  // check for page jumps
+  if (ui.cur_item_type == ITEM_MOVESEL_VERT)
+    upmargin = ui.selection->bbox.bottom - ui.selection->bbox.top;
+  else upmargin = VIEW_CONTINUOUS_SKIP;
+  tmppageno = ui.selection->move_pageno;
+  tmppage = g_list_nth_data(journal.pages, tmppageno);
+  while (ui.view_continuous && (pt[1] < - upmargin)) {
+    if (tmppageno == 0) break;
+    tmppageno--;
+    tmppage = g_list_nth_data(journal.pages, tmppageno);
+    pt[1] += tmppage->height + VIEW_CONTINUOUS_SKIP;
+    ui.selection->move_pagedelta += tmppage->height + VIEW_CONTINUOUS_SKIP;
+  }
+  while (ui.view_continuous && (pt[1] > tmppage->height+VIEW_CONTINUOUS_SKIP)) {
+    if (tmppageno == journal.npages-1) break;
+    pt[1] -= tmppage->height + VIEW_CONTINUOUS_SKIP;
+    ui.selection->move_pagedelta -= tmppage->height + VIEW_CONTINUOUS_SKIP;
+    tmppageno++;
+    tmppage = g_list_nth_data(journal.pages, tmppageno);
+  }
+  
+  if (tmppageno != ui.selection->move_pageno) {
+    // move to a new page !
+    ui.selection->move_pageno = tmppageno;
+    if (tmppageno == ui.selection->orig_pageno)
+      ui.selection->move_layer = ui.selection->layer;
+    else
+      ui.selection->move_layer = (struct Layer *)(g_list_last(
+        ((struct Page *)g_list_nth_data(journal.pages, tmppageno))->layers)->data);
+    gnome_canvas_item_reparent(ui.selection->canvas_item, ui.selection->move_layer->group);
+    for (list = ui.selection->items; list!=NULL; list = list->next) {
+      item = (struct Item *)list->data;
+      if (item->canvas_item!=NULL)
+        gnome_canvas_item_reparent(item->canvas_item, ui.selection->move_layer->group);
+    }
+    // avoid a refresh bug
+    gnome_canvas_item_move(GNOME_CANVAS_ITEM(ui.selection->move_layer->group), 0., 0.);
+    if (ui.cur_item_type == ITEM_MOVESEL_VERT)
+      gnome_canvas_item_set(ui.selection->canvas_item,
+        "x2", tmppage->width+100, 
+        "y1", ui.selection->anchor_y+ui.selection->move_pagedelta, NULL);
+  }
+  
+  // now, process things normally
+
   dx = pt[0] - ui.selection->last_x;
   dy = pt[1] - ui.selection->last_y;
-  
   if (hypot(dx,dy) < 1) return; // don't move subpixel
   ui.selection->last_x = pt[0];
   ui.selection->last_y = pt[1];
-  
+
   // move the canvas items
-  if (ui.toolno == TOOL_VERTSPACE)
+  if (ui.cur_item_type == ITEM_MOVESEL_VERT)
     gnome_canvas_item_set(ui.selection->canvas_item, "y2", pt[1], NULL);
   else 
     gnome_canvas_item_move(ui.selection->canvas_item, dx, dy);
@@ -547,26 +606,38 @@ void continue_movesel(GdkEvent *event)
     if (item->canvas_item != NULL)
       gnome_canvas_item_move(item->canvas_item, dx, dy);
   }
-  
-  /* consider: if view_continuous, move items to a different page if
-     y value gets out of range (same algo as in button_down event
-     processing); then need to reparent the canvas items, delete the
-     Items from the old Layer, insert them on the new Layer, ...
-     and make an undo-event, probably cut-and-paste style... */
 }
 
 void finalize_movesel(void)
 {
+  GList *list, *link;
+  struct Item *item;
+  
   if (ui.selection->items != NULL) {
     prepare_new_undo();
     undo->type = ITEM_MOVESEL;
     undo->itemlist = g_list_copy(ui.selection->items);
     undo->val_x = ui.selection->last_x - ui.selection->anchor_x;
     undo->val_y = ui.selection->last_y - ui.selection->anchor_y;
-    move_journal_items_by(undo->itemlist, undo->val_x, undo->val_y);
+    undo->layer = ui.selection->layer;
+    undo->layer2 = ui.selection->move_layer;
+    undo->auxlist = NULL;
+    // build auxlist = pointers to Item's just before ours (for depths)
+    for (list = ui.selection->items; list!=NULL; list = list->next) {
+      link = g_list_find(ui.selection->layer->items, list->data);
+      if (link!=NULL) link = link->prev;
+      undo->auxlist = g_list_append(undo->auxlist, ((link!=NULL) ? link->data : NULL));
+    }
+    ui.selection->layer = ui.selection->move_layer;
+    move_journal_items_by(undo->itemlist, undo->val_x, undo->val_y,
+                          undo->layer, undo->layer2, 
+                          (undo->layer == undo->layer2)?undo->auxlist:NULL);
   }
 
-  if (ui.toolno == TOOL_VERTSPACE)
+  if (ui.selection->move_pageno!=ui.selection->orig_pageno) 
+    do_switch_page(ui.selection->move_pageno, FALSE, FALSE);
+    
+  if (ui.cur_item_type == ITEM_MOVESEL_VERT)
     reset_selection();
   else {
     ui.selection->bbox.left += undo->val_x;
@@ -697,12 +768,6 @@ void clipboard_paste(void)
   if (sel_data == NULL) return; // paste failed
   
   reset_selection();
-  ui.toolno = TOOL_SELECTRECT;
-  ui.ruler = FALSE;
-  update_tool_buttons();
-  update_tool_menu();
-  update_color_menu();
-  update_cursor();
   
   ui.selection = g_new(struct Selection, 1);
   p = sel_data->data + sizeof(int);
index 7c20c73c182df5ae6a8e71204e3835ed38a1a67a..236ff33578c30a9c015ff350e8e89ee9aaadf4d6 100644 (file)
@@ -98,6 +98,7 @@ extern guint predef_bgcolors_rgba[COLOR_MAX];
 #define TOOL_SELECTRECT   5
 #define TOOL_VERTSPACE    6
 #define NUM_STROKE_TOOLS  3
+#define NUM_BUTTONS       3
 
 #define TOOLOPT_ERASER_STANDARD     0
 #define TOOLOPT_ERASER_WHITEOUT     1
@@ -140,6 +141,7 @@ typedef struct Item {
 #define ITEM_NEW_PAGE 13
 #define ITEM_DELETE_PAGE 14
 #define ITEM_REPAINTSEL 15
+#define ITEM_MOVESEL_VERT 16
 
 typedef struct Layer {
   GList *items; // the items on the layer, from bottom to top
@@ -163,33 +165,37 @@ typedef struct Journal {
 } Journal;
 
 typedef struct Selection {
-  int type;
+  int type;  // ITEM_SELECTRECT, ITEM_MOVESEL_VERT
   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
   GnomeCanvasItem *canvas_item; // if the selection box is on screen 
   GList *items; // the selected items (a list of struct Item)
+  int move_pageno, orig_pageno; // if selection moves to a different page
+  struct Layer *move_layer;
+  float move_pagedelta;
 } Selection;
 
 typedef struct UIData {
   int pageno, layerno; // the current page and layer
   struct Page *cur_page;
   struct Layer *cur_layer;
-  int toolno;  // the number of the currently selected tool
   gboolean saved; // is file saved ?
   struct Brush *cur_brush;  // the brush in use (one of brushes[...])
-  struct Brush brushes[NUM_STROKE_TOOLS]; // the current pen, eraser, hiliter
+  int toolno[NUM_BUTTONS+1];  // the number of the currently selected tool
+  struct Brush brushes[NUM_BUTTONS+1][NUM_STROKE_TOOLS]; // the current pen, eraser, hiliter
   struct Brush default_brushes[NUM_STROKE_TOOLS]; // the default ones
-  gboolean ruler; // whether we're in ruler mode
+  gboolean ruler[NUM_BUTTONS+1]; // whether each button is in ruler mode
+  int linked_brush[NUM_BUTTONS+1]; // whether brushes are linked across buttons
+  int cur_mapping; // the current button number for mappings
+  gboolean use_erasertip;
+  int which_mouse_button; // the mouse button drawing the current path
   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
   int cur_item_type;
   GnomeCanvasPoints cur_path; // the path being drawn
   int cur_path_storage_alloc;
-  int which_mouse_button; // the mouse button drawing the current path
-  int saved_toolno;  // while using an eraser device
-  gboolean saved_ruler;
   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 ?
@@ -199,14 +205,18 @@ typedef struct UIData {
   gboolean in_update_page_stuff; // semaphore to avoid scrollbar retroaction
   struct Selection *selection;
   GdkCursor *cursor;
-  gboolean emulate_eraser;
   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 *mru[MRU_SIZE]; // MRU data
   GtkWidget *mrumenu[MRU_SIZE];
+  gboolean bg_apply_all_pages;
 } UIData;
 
+#define BRUSH_LINKED 0
+#define BRUSH_COPIED 1
+#define BRUSH_STATIC 2
+
 typedef struct UndoErasureData {
   struct Item *item; // the item that got erased
   int npos; // its position in its layer
@@ -217,12 +227,12 @@ 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
-  struct Layer *layer2; // for ITEM_DELETE_LAYER with val=-1
+  struct Layer *layer; // for ITEM_STROKE, ITEM_ERASURE, ITEM_PASTE, ITEM_NEW_LAYER, ITEM_DELETE_LAYER, ITEM_MOVESEL
+  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
   GList *itemlist;  // for ITEM_MOVESEL, ITEM_PASTE, ITEM_REPAINTSEL
-  GList *auxlist;   // for ITEM_REPAINTSEL
+  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
index d0afe62dea5036c0a1417779e66dee2035519bba..c73ca4d4ae72bdd7404ae43d02eac49a3748ae90 100644 (file)
@@ -55,7 +55,7 @@
                      <signal name="activate" handler="on_fileNewBackground_activate" last_modification_time="Wed, 30 Nov 2005 18:39:59 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image533">
+                       <widget class="GtkImage" id="image577">
                          <property name="visible">True</property>
                          <property name="stock">gtk-open</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_filePrintOptions_activate" last_modification_time="Wed, 30 Nov 2005 18:44:18 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image534">
+                       <widget class="GtkImage" id="image578">
                          <property name="visible">True</property>
                          <property name="stock">gtk-preferences</property>
                          <property name="icon_size">1</property>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Continuous</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <signal name="toggled" handler="on_viewContinuous_activate" last_modification_time="Wed, 30 Nov 2005 19:31:48 GMT"/>
                    </widget>
                  </child>
                      <signal name="activate" handler="on_viewPageWidth_activate" last_modification_time="Wed, 30 Nov 2005 19:31:48 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image535">
+                       <widget class="GtkImage" id="image579">
                          <property name="visible">True</property>
                          <property name="stock">gtk-zoom-fit</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_viewFirstPage_activate" last_modification_time="Wed, 30 Nov 2005 19:33:03 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image536">
+                       <widget class="GtkImage" id="image580">
                          <property name="visible">True</property>
                          <property name="stock">gtk-goto-first</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_viewPreviousPage_activate" last_modification_time="Wed, 30 Nov 2005 19:35:41 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image537">
+                       <widget class="GtkImage" id="image581">
                          <property name="visible">True</property>
                          <property name="stock">gtk-go-back</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_viewNextPage_activate" last_modification_time="Wed, 30 Nov 2005 19:35:41 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image538">
+                       <widget class="GtkImage" id="image582">
                          <property name="visible">True</property>
                          <property name="stock">gtk-go-forward</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_viewLastPage_activate" last_modification_time="Wed, 30 Nov 2005 19:35:41 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image539">
+                       <widget class="GtkImage" id="image583">
                          <property name="visible">True</property>
                          <property name="stock">gtk-goto-last</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_viewShowLayer_activate" last_modification_time="Wed, 30 Nov 2005 19:40:23 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image540">
+                       <widget class="GtkImage" id="image584">
                          <property name="visible">True</property>
                          <property name="stock">gtk-add</property>
                          <property name="icon_size">1</property>
                      <signal name="activate" handler="on_viewHideLayer_activate" last_modification_time="Wed, 30 Nov 2005 19:40:23 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image541">
+                       <widget class="GtkImage" id="image585">
                          <property name="visible">True</property>
                          <property name="stock">gtk-remove</property>
                          <property name="icon_size">1</property>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">white paper</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_papercolorWhite_activate" last_modification_time="Wed, 30 Nov 2005 19:58:26 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">yellow paper</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">papercolorWhite</property>
                              <signal name="toggled" handler="on_papercolorYellow_activate" last_modification_time="Wed, 30 Nov 2005 19:58:26 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">pink paper</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">papercolorWhite</property>
                              <signal name="toggled" handler="on_papercolorPink_activate" last_modification_time="Wed, 30 Nov 2005 19:58:26 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">orange paper</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">papercolorWhite</property>
                              <signal name="toggled" handler="on_papercolorOrange_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">blue paper</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">papercolorWhite</property>
                              <signal name="toggled" handler="on_papercolorBlue_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">green paper</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">papercolorWhite</property>
                              <signal name="toggled" handler="on_papercolorGreen_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">other...</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">papercolorWhite</property>
                              <signal name="toggled" handler="on_papercolorOther_activate" last_modification_time="Thu, 01 Dec 2005 22:00:06 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">plain</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_paperstylePlain_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">lined</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">paperstylePlain</property>
                              <signal name="toggled" handler="on_paperstyleLined_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">ruled</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">paperstylePlain</property>
                              <signal name="toggled" handler="on_paperstyleRuled_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">graph</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">paperstylePlain</property>
                              <signal name="toggled" handler="on_paperstyleGraph_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
                            </widget>
                    </widget>
                  </child>
 
+                 <child>
+                   <widget class="GtkCheckMenuItem" id="journalApplyAllPages">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Apply To All Pages</property>
+                     <property name="use_underline">True</property>
+                     <property name="active">False</property>
+                     <signal name="activate" handler="on_journalApplyAllPages_activate" last_modification_time="Wed, 30 Nov 2005 19:58:26 GMT"/>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkSeparatorMenuItem" id="separator23">
+                     <property name="visible">True</property>
+                   </widget>
+                 </child>
+
                  <child>
                    <widget class="GtkImageMenuItem" id="journalLoadBackground">
                      <property name="visible">True</property>
                      <signal name="activate" handler="on_journalLoadBackground_activate" last_modification_time="Wed, 30 Nov 2005 20:06:31 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image542">
+                       <widget class="GtkImage" id="image586">
                          <property name="visible">True</property>
                          <property name="stock">gtk-open</property>
                          <property name="icon_size">1</property>
                    </widget>
                  </child>
 
-                 <child>
-                   <widget class="GtkMenuItem" id="journalApplyAllPages">
-                     <property name="visible">True</property>
-                     <property name="label" translatable="yes">Apply To All Pages</property>
-                     <property name="use_underline">True</property>
-                     <signal name="activate" handler="on_journalApplyAllPages_activate" last_modification_time="Wed, 30 Nov 2005 19:58:26 GMT"/>
-                   </widget>
-                 </child>
-
                  <child>
                    <widget class="GtkSeparatorMenuItem" id="separator19">
                      <property name="visible">True</property>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Pen</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <signal name="toggled" handler="on_toolsPen_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                    </widget>
                  </child>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Eraser</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <property name="group">toolsPen</property>
                      <signal name="toggled" handler="on_toolsEraser_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Highlighter</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <property name="group">toolsPen</property>
                      <signal name="toggled" handler="on_toolsHighlighter_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Text</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <property name="group">toolsPen</property>
                      <signal name="toggled" handler="on_toolsText_activate" last_modification_time="Thu, 01 Dec 2005 20:54:08 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Select Region</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <property name="group">toolsPen</property>
                      <signal name="toggled" handler="on_toolsSelectRegion_activate" last_modification_time="Thu, 01 Dec 2005 20:54:08 GMT"/>
                    </widget>
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Select Rectangle</property>
                      <property name="use_underline">True</property>
-                     <property name="active">True</property>
+                     <property name="active">False</property>
                      <property name="group">toolsPen</property>
                      <signal name="toggled" handler="on_toolsSelectRectangle_activate" last_modification_time="Thu, 01 Dec 2005 20:54:08 GMT"/>
                    </widget>
                      <property name="use_underline">True</property>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image543">
+                       <widget class="GtkImage" id="image587">
                          <property name="visible">True</property>
                          <property name="stock">gtk-select-color</property>
                          <property name="icon_size">1</property>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">black</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_colorBlack_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">blue</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorBlue_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">red</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorRed_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">green</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorGreen_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">gray</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorGray_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">light blue</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorLightBlue_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">light green</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorLightGreen_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">magenta</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorMagenta_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">orange</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorOrange_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">yellow</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorYellow_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">white</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorWhite_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">other...</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">colorBlack</property>
                              <signal name="toggled" handler="on_colorOther_activate" last_modification_time="Thu, 01 Dec 2005 21:56:57 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">very fine</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_penthicknessVeryFine_activate" last_modification_time="Thu, 01 Dec 2005 19:29:18 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">fine</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">penthicknessVeryFine</property>
                              <signal name="toggled" handler="on_penthicknessFine_activate" last_modification_time="Thu, 01 Dec 2005 19:29:18 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">medium</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">penthicknessVeryFine</property>
                              <signal name="toggled" handler="on_penthicknessMedium_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">thick</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">penthicknessVeryFine</property>
                              <signal name="toggled" handler="on_penthicknessThick_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">fine</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_eraserFine_activate" last_modification_time="Thu, 01 Dec 2005 19:29:18 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">medium</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">eraserFine</property>
                              <signal name="toggled" handler="on_eraserMedium_activate" last_modification_time="Thu, 01 Dec 2005 19:29:18 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">standard</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_eraserStandard_activate" last_modification_time="Thu, 01 Dec 2005 19:29:18 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">whiteout</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">eraserStandard</property>
                              <signal name="toggled" handler="on_eraserWhiteout_activate" last_modification_time="Thu, 01 Dec 2005 19:29:18 GMT"/>
                            </widget>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">fine</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <signal name="toggled" handler="on_highlighterFine_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                            </widget>
                          </child>
                              <property name="visible">True</property>
                              <property name="label" translatable="yes">medium</property>
                              <property name="use_underline">True</property>
-                             <property name="active">True</property>
+                             <property name="active">False</property>
                              <property name="group">highlighterFine</property>
                              <signal name="toggled" handler="on_highlighterMedium_activate" last_modification_time="Thu, 01 Dec 2005 05:36:05 GMT"/>
                            </widget>
                      <signal name="activate" handler="on_toolsTextFont_activate" last_modification_time="Thu, 01 Dec 2005 20:54:08 GMT"/>
 
                      <child internal-child="image">
-                       <widget class="GtkImage" id="image544">
+                       <widget class="GtkImage" id="image588">
                          <property name="visible">True</property>
                          <property name="stock">gtk-select-font</property>
                          <property name="icon_size">1</property>
                  </child>
 
                  <child>
-                   <widget class="GtkCheckMenuItem" id="optionsEmulateEraser">
+                   <widget class="GtkCheckMenuItem" id="optionsButtonMappings">
                      <property name="visible">True</property>
-                     <property name="label" translatable="yes">Emulate Eraser</property>
+                     <property name="label" translatable="yes">Eraser Tip</property>
                      <property name="use_underline">True</property>
                      <property name="active">False</property>
-                     <signal name="activate" handler="on_optionsEmulateEraser_activate" last_modification_time="Thu, 26 Jan 2006 03:45:32 GMT"/>
+                     <signal name="activate" handler="on_optionsButtonMappings_activate" last_modification_time="Thu, 26 Jan 2006 03:45:32 GMT"/>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkMenuItem" id="button2_mapping">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Button 2 Mapping</property>
+                     <property name="use_underline">True</property>
+
+                     <child>
+                       <widget class="GtkMenu" id="button2_mapping_menu">
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2Pen">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Pen</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">True</property>
+                             <signal name="activate" handler="on_button2Pen_activate" last_modification_time="Sun, 04 Jun 2006 14:18:50 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2Eraser">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Eraser</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2Pen</property>
+                             <signal name="activate" handler="on_button2Eraser_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2Highlighter">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Highlighter</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2Pen</property>
+                             <signal name="activate" handler="on_button2Highlighter_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2Text">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Text</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2Pen</property>
+                             <signal name="activate" handler="on_button2Text_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2SelectRegion">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Select Region</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2Pen</property>
+                             <signal name="activate" handler="on_button2SelectRegion_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2SelectRectangle">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Select Rectangle</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2Pen</property>
+                             <signal name="activate" handler="on_button2SelectRectangle_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2VerticalSpace">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Vertical Space</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2Pen</property>
+                             <signal name="activate" handler="on_button2VerticalSpace_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkSeparatorMenuItem" id="separator24">
+                             <property name="visible">True</property>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2LinkBrush">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Link to Primary Brush</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <signal name="activate" handler="on_button2LinkBrush_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2CopyBrush">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Copy of Current Brush</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2LinkBrush</property>
+                             <signal name="activate" handler="on_button2CopyBrush_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button2NABrush">
+                             <property name="label" translatable="yes">NA</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button2LinkBrush</property>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+
+                 <child>
+                   <widget class="GtkMenuItem" id="button3_mapping">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Button 3 Mapping</property>
+                     <property name="use_underline">True</property>
+
+                     <child>
+                       <widget class="GtkMenu" id="button3_mapping_menu">
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3Pen">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Pen</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">True</property>
+                             <signal name="activate" handler="on_button3Pen_activate" last_modification_time="Sun, 04 Jun 2006 14:18:50 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3Eraser">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Eraser</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3Pen</property>
+                             <signal name="activate" handler="on_button3Eraser_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3Highlighter">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Highlighter</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3Pen</property>
+                             <signal name="activate" handler="on_button3Highlighter_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3Text">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Text</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3Pen</property>
+                             <signal name="activate" handler="on_button3Text_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3SelectRegion">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Select Region</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3Pen</property>
+                             <signal name="activate" handler="on_button3SelectRegion_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3SelectRectangle">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Select Rectangle</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3Pen</property>
+                             <signal name="activate" handler="on_button3SelectRectangle_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3VerticalSpace">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Vertical Space</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3Pen</property>
+                             <signal name="activate" handler="on_button3VerticalSpace_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkSeparatorMenuItem" id="separator25">
+                             <property name="visible">True</property>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3LinkBrush">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Link to Primary Brush</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <signal name="activate" handler="on_button3LinkBrush_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3CopyBrush">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Copy of Current Brush</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3LinkBrush</property>
+                             <signal name="activate" handler="on_button3CopyBrush_activate" last_modification_time="Sun, 04 Jun 2006 14:33:10 GMT"/>
+                           </widget>
+                         </child>
+
+                         <child>
+                           <widget class="GtkRadioMenuItem" id="button3NABrush">
+                             <property name="label" translatable="yes">NA</property>
+                             <property name="use_underline">True</property>
+                             <property name="active">False</property>
+                             <property name="group">button3LinkBrush</property>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
                    </widget>
                  </child>