#include "xo-misc.h"
#include "xo-file.h"
#include "xo-paint.h"
+#include "xo-selection.h"
#include "xo-print.h"
#include "xo-shapes.h"
on_toolsSelectRegion_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
-
+ if (GTK_OBJECT_TYPE(menuitem) == GTK_TYPE_RADIO_MENU_ITEM) {
+ if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem)))
+ return;
+ } else {
+ if (!gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON (menuitem)))
+ return;
+ }
+
+ if (ui.cur_mapping != 0 && !ui.button_switch_mapping) return; // not user-generated
+ if (ui.toolno[ui.cur_mapping] == TOOL_SELECTREGION) return;
+
+ ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
+ end_text();
+ ui.toolno[ui.cur_mapping] = TOOL_SELECTREGION;
+ update_mapping_linkings(-1);
+ update_tool_buttons();
+ update_tool_menu();
+ update_color_menu();
+ update_cursor();
}
ui.cur_path.num_points == 1) {
// Xorg 7.3+ sent core event before XInput event: fix initial point
ui.is_corestroke = FALSE;
+ ui.stroke_device = event->device;
get_pointer_coords((GdkEvent *)event, ui.cur_path.coords);
}
if (ui.cur_item_type != ITEM_NONE) return FALSE; // we're already doing something
do_eraser((GdkEvent *)event, ui.cur_brush->thickness/2,
ui.cur_brush->tool_options == TOOLOPT_ERASER_STROKES);
}
+ else if (ui.toolno[mapping] == TOOL_SELECTREGION) {
+ start_selectregion((GdkEvent *)event);
+ }
else if (ui.toolno[mapping] == TOOL_SELECTRECT) {
start_selectrect((GdkEvent *)event);
}
is_core = (event->device == gdk_device_get_core_pointer());
if (!ui.use_xinput && !is_core) return FALSE;
if (ui.use_xinput && is_core && !ui.is_corestroke) return FALSE;
+ if (ui.ignore_other_devices && ui.stroke_device!=event->device) return FALSE;
if (!is_core) fix_xinput_coords((GdkEvent *)event);
if (event->button != ui.which_mouse_button &&
else if (ui.cur_item_type == ITEM_ERASURE) {
finalize_erasure();
}
+ else if (ui.cur_item_type == ITEM_SELECTREGION) {
+ finalize_selectregion();
+ }
else if (ui.cur_item_type == ITEM_SELECTRECT) {
finalize_selectrect();
}
}
if (ui.use_xinput && is_core && !ui.is_corestroke) return FALSE;
- if (!is_core) ui.is_corestroke = FALSE;
+ if (!is_core && ui.is_corestroke) {
+ ui.is_corestroke = FALSE;
+ ui.stroke_device = event->device;
+ }
+ if (ui.ignore_other_devices && ui.stroke_device!=event->device) return FALSE;
#ifdef INPUT_DEBUG
printf("DEBUG: MotionNotify (%s) (x,y)=(%.2f,%.2f), modifier %x\n",
- is_core?"core":"xinput", event->x, event->y, event->state);
+ event->device->name, event->x, event->y, event->state);
#endif
looks_wrong = !(event->state & (1<<(7+ui.which_mouse_button)));
else if (ui.cur_item_type == ITEM_ERASURE) {
finalize_erasure();
}
+ else if (ui.cur_item_type == ITEM_SELECTREGION) {
+ finalize_selectregion();
+ }
else if (ui.cur_item_type == ITEM_SELECTRECT) {
finalize_selectrect();
}
do_eraser((GdkEvent *)event, ui.cur_brush->thickness/2,
ui.cur_brush->tool_options == TOOLOPT_ERASER_STROKES);
}
+ else if (ui.cur_item_type == ITEM_SELECTREGION) {
+ continue_selectregion((GdkEvent *)event);
+ }
else if (ui.cur_item_type == ITEM_SELECTRECT) {
get_pointer_coords((GdkEvent *)event, pt);
ui.selection->bbox.right = pt[0];