X-Git-Url: https://git.donarmstrong.com/?p=xournal.git;a=blobdiff_plain;f=src%2Fxo-callbacks.c;fp=src%2Fxo-callbacks.c;h=50672f6b14737a2edbf462266894798a12ffbd1d;hp=8c6f098a1cdc88566305da6b6181386ad3960a0d;hb=9f09269d8918dfa930543f4a15de4e7276719e5e;hpb=c33ae4cb8af712159f96db55e8229589258c45fe diff --git a/src/xo-callbacks.c b/src/xo-callbacks.c index 8c6f098..50672f6 100644 --- a/src/xo-callbacks.c +++ b/src/xo-callbacks.c @@ -33,6 +33,7 @@ #include "xo-misc.h" #include "xo-file.h" #include "xo-paint.h" +#include "xo-selection.h" #include "xo-print.h" #include "xo-shapes.h" @@ -1807,7 +1808,25 @@ void 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(); } @@ -2520,6 +2539,9 @@ on_canvas_button_press_event (GtkWidget *widget, 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); } @@ -2564,6 +2586,9 @@ on_canvas_button_release_event (GtkWidget *widget, 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(); } @@ -2756,6 +2781,9 @@ on_canvas_motion_notify_event (GtkWidget *widget, 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(); } @@ -2779,6 +2807,9 @@ on_canvas_motion_notify_event (GtkWidget *widget, 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];