]> git.donarmstrong.com Git - xournal.git/blobdiff - src/xo-paint.c
Add a hand tool (+ other misc updates)
[xournal.git] / src / xo-paint.c
index 5d19c1b9a03718ca858804b0602611791454c5b8..f52f1240173e4c6143cd05481781dfd71e5b94b6 100644 (file)
@@ -61,12 +61,10 @@ void update_cursor(void)
     gdk_cursor_unref(ui.cursor);
     ui.cursor = NULL;
   }
-  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);
-  }
+  if (ui.cur_item_type == ITEM_MOVESEL_VERT)
+    ui.cursor = gdk_cursor_new(GDK_SB_V_DOUBLE_ARROW);
+  else if (ui.cur_item_type == ITEM_MOVESEL)
+    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;
@@ -95,6 +93,9 @@ void update_cursor(void)
   else if (ui.cur_item_type == ITEM_SELECTRECT) {
     ui.cursor = gdk_cursor_new(GDK_TCROSS);
   }
+  else if (ui.toolno[ui.cur_mapping] == TOOL_HAND) {
+    ui.cursor = gdk_cursor_new(GDK_HAND1);
+  }
   
   gdk_window_set_cursor(GTK_WIDGET(canvas)->window, ui.cursor);
 }
@@ -897,3 +898,15 @@ void rethicken_selection(int val)
          "width-units", item->brush.thickness, NULL);
   }
 }
+
+void do_hand(GdkEvent *event)
+{
+  double pt[2], val;
+  int cx, cy;
+  
+  get_pointer_coords(event, pt);
+  gnome_canvas_get_scroll_offsets(canvas, &cx, &cy);
+  cx -= (pt[0]-ui.hand_refpt[0])*ui.zoom;
+  cy -= (pt[1]-ui.hand_refpt[1])*ui.zoom;
+  gnome_canvas_scroll_to(canvas, cx, cy);
+}