Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 29398) +++ trunk/src/crosshair.c (revision 29399) @@ -502,7 +502,7 @@ { pcb_coord_t ms = conf_core.appearance.mark_size, ms2 = ms / 2; - if ((pcb_marked.status) || (pcb_grabbed.status)) { + if ((pcb_marked.status) || (hidlib->tool_grabbed.status)) { if (!inhibit_drawing_mode) { pcb_render->set_drawing_mode(pcb_gui, PCB_HID_COMP_RESET, 1, NULL); pcb_render->set_drawing_mode(pcb_gui, PCB_HID_COMP_POSITIVE, 1, NULL); @@ -515,12 +515,12 @@ pcb_render->draw_line(pcb_crosshair.GC, pcb_marked.X + ms, pcb_marked.Y - ms, pcb_marked.X - ms, pcb_marked.Y + ms); } - if (pcb_grabbed.status) { - pcb_render->draw_line(pcb_crosshair.GC, pcb_grabbed.X - ms, pcb_grabbed.Y - ms2, pcb_grabbed.X + ms, pcb_grabbed.Y + ms2); - pcb_render->draw_line(pcb_crosshair.GC, pcb_grabbed.X + ms2, pcb_grabbed.Y - ms, pcb_grabbed.X - ms2, pcb_grabbed.Y + ms); + if (hidlib->tool_grabbed.status) { + pcb_render->draw_line(pcb_crosshair.GC, hidlib->tool_grabbed.X - ms, hidlib->tool_grabbed.Y - ms2, hidlib->tool_grabbed.X + ms, hidlib->tool_grabbed.Y + ms2); + pcb_render->draw_line(pcb_crosshair.GC, hidlib->tool_grabbed.X + ms2, hidlib->tool_grabbed.Y - ms, hidlib->tool_grabbed.X - ms2, hidlib->tool_grabbed.Y + ms); } - if ((pcb_marked.status) || (pcb_grabbed.status)) + if ((pcb_marked.status) || (hidlib->tool_grabbed.status)) if (!inhibit_drawing_mode) pcb_render->set_drawing_mode(pcb_gui, PCB_HID_COMP_FLUSH, 1, NULL); } @@ -854,6 +854,7 @@ */ void pcb_crosshair_grid_fit(pcb_coord_t X, pcb_coord_t Y) { + pcb_hidlib_t *hidlib = &PCB->hidlib; pcb_coord_t nearest_grid_x, nearest_grid_y; void *ptr1, *ptr2, *ptr3; struct snap_data snap_data; @@ -871,12 +872,12 @@ nearest_grid_y = pcb_grid_fit(pcb_crosshair.Y, PCB->hidlib.grid, PCB->hidlib.grid_oy); if (pcb_marked.status && conf_core.editor.orthogonal_moves) { - pcb_coord_t dx = pcb_crosshair.X - pcb_grabbed.X; - pcb_coord_t dy = pcb_crosshair.Y - pcb_grabbed.Y; + pcb_coord_t dx = pcb_crosshair.X - hidlib->tool_grabbed.X; + pcb_coord_t dy = pcb_crosshair.Y - hidlib->tool_grabbed.Y; if (PCB_ABS(dx) > PCB_ABS(dy)) - nearest_grid_y = pcb_grabbed.Y; + nearest_grid_y = hidlib->tool_grabbed.Y; else - nearest_grid_x = pcb_grabbed.X; + nearest_grid_x = hidlib->tool_grabbed.X; } } Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 29398) +++ trunk/src/crosshair.h (revision 29399) @@ -33,7 +33,7 @@ #include "config.h" #include "vtonpoint.h" #include -#include +#include #include "obj_line.h" #include "obj_poly.h" #include "route.h" @@ -96,7 +96,6 @@ extern pcb_crosshair_t pcb_crosshair; extern pcb_mark_t pcb_marked; /* the point the user explicitly marked, or in some operations where the operation originally started */ -extern pcb_mark_t pcb_grabbed; /* point where a drag&drop operation started */ void pcb_notify_mark_change(pcb_bool changes_complete); void pcb_crosshair_move_relative(pcb_coord_t, pcb_coord_t); Index: trunk/src/librnd/core/hidlib.h =================================================================== --- trunk/src/librnd/core/hidlib.h (revision 29398) +++ trunk/src/librnd/core/hidlib.h (revision 29399) @@ -29,6 +29,12 @@ #include "global_typedefs.h" +typedef struct pcb_mark_s { + pcb_bool status; + pcb_coord_t X, Y; + unsigned user_placed:1; /* if 1, the user has explicitly placed the mark - do not move it */ +} pcb_mark_t; + struct pcb_hidlib_s { pcb_coord_t grid; /* grid resolution */ pcb_coord_t grid_ox, grid_oy; /* grid offset */ @@ -40,8 +46,8 @@ pcb_coord_t ch_x, ch_y, tool_x, tool_y; /* ch is crosshair */ unsigned int tool_hit; /* optional: type of a hit object of PCB_MOVE_TYPES; 0 if there was no PCB_MOVE_TYPES object under the crosshair */ unsigned int tool_click:1; /* optional: true if clicked somewhere with the arrow tool */ + pcb_mark_t tool_grabbed; /* point where a drag&drop operation started */ - /* internal */ int *batch_ask_ovr; /* if not NULL, override local ask-overwrite state - useful when manu operations that need to write files are ran in batch, e.g. in a cam job */ Index: trunk/src/librnd/core/tool.c =================================================================== --- trunk/src/librnd/core/tool.c (revision 29398) +++ trunk/src/librnd/core/tool.c (revision 29399) @@ -260,13 +260,12 @@ wrap_retv(redo_act, return pcb_true, (hl)); } -pcb_mark_t pcb_grabbed; /* TEMPORARY */ static void do_release(pcb_hidlib_t *hidlib) { if (pcbhl_conf.temp.click_cmd_entry_active && (pcb_cli_mouse(hidlib, 0) == 0)) return; - pcb_grabbed.status = pcb_false; + hidlib->tool_grabbed.status = pcb_false; pcb_tool_release(hidlib); @@ -281,8 +280,8 @@ if (pcbhl_conf.temp.click_cmd_entry_active && (pcb_cli_mouse(hidlib, 1) == 0)) return; - pcb_grabbed.X = hidlib->tool_x; - pcb_grabbed.Y = hidlib->tool_y; + hidlib->tool_grabbed.X = hidlib->tool_x; + hidlib->tool_grabbed.Y = hidlib->tool_y; pcb_tool_press(hidlib); pcb_event(hidlib, PCB_EVENT_TOOL_PRESS, NULL); Index: trunk/src/librnd/core/tool.h =================================================================== --- trunk/src/librnd/core/tool.h (revision 29398) +++ trunk/src/librnd/core/tool.h (revision 29399) @@ -71,12 +71,6 @@ unsigned long user_flags; } pcb_tool_t; -typedef struct pcb_mark_s { - pcb_bool status; - pcb_coord_t X, Y; - unsigned user_placed:1; /* if 1, the user has explicitly placed the mark - do not move it */ -} pcb_mark_t; - extern vtp0_t pcb_tools; extern pcb_toolid_t pcb_tool_prev_id; extern pcb_toolid_t pcb_tool_next_id; Index: trunk/src_plugins/tool_std/tool_arrow.c =================================================================== --- trunk/src_plugins/tool_std/tool_arrow.c (revision 29398) +++ trunk/src_plugins/tool_std/tool_arrow.c (revision 29399) @@ -71,7 +71,7 @@ pcb_hid_notify_crosshair_change(&PCB->hidlib, pcb_false); hl->tool_click = pcb_false; if (pcb_crosshair_note.Moving && !pcb_gui->shift_is_pressed(pcb_gui)) { - pcb_grabbed.status = pcb_true; + hl->tool_grabbed.status = pcb_true; pcb_crosshair_note.Buffer = conf_core.editor.buffer_number; pcb_buffer_set_number(PCB_MAX_BUFFER - 1); pcb_buffer_clear(pcb, PCB_PASTEBUFFER); @@ -85,7 +85,7 @@ else if (hl->tool_hit && !pcb_gui->shift_is_pressed(pcb_gui)) { pcb_box_t box; - pcb_grabbed.status = pcb_true; + hl->tool_grabbed.status = pcb_true; pcb_tool_save(hl); pcb_tool_is_saved = pcb_true; pcb_tool_select_by_name(hl, pcb_gui->control_is_pressed(pcb_gui)? "copy" : "move"); Index: trunk/src_plugins/tool_std/tool_line.c =================================================================== --- trunk/src_plugins/tool_std/tool_line.c (revision 29398) +++ trunk/src_plugins/tool_std/tool_line.c (revision 29399) @@ -218,9 +218,9 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works as expected and we can draw a perpendicular line from here */ - pcb_grabbed.X = pcb_crosshair.Route.end_point.X; - pcb_grabbed.Y = pcb_crosshair.Route.end_point.Y; - pcb_grabbed.status = pcb_true; + hl->tool_grabbed.X = pcb_crosshair.Route.end_point.X; + hl->tool_grabbed.Y = pcb_crosshair.Route.end_point.Y; + hl->tool_grabbed.status = pcb_true; } if (ps) Index: trunk/src_plugins/tool_std/tool_poly.c =================================================================== --- trunk/src_plugins/tool_std/tool_poly.c (revision 29398) +++ trunk/src_plugins/tool_std/tool_poly.c (revision 29399) @@ -92,9 +92,9 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - pcb_grabbed.X = hl->tool_x; - pcb_grabbed.Y = hl->tool_y; - pcb_grabbed.status = pcb_true; + hl->tool_grabbed.X = hl->tool_x; + hl->tool_grabbed.Y = hl->tool_y; + hl->tool_grabbed.status = pcb_true; } } Index: trunk/src_plugins/tool_std/tool_polyhole.c =================================================================== --- trunk/src_plugins/tool_std/tool_polyhole.c (revision 29398) +++ trunk/src_plugins/tool_std/tool_polyhole.c (revision 29399) @@ -94,9 +94,9 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - pcb_grabbed.X = hl->tool_x; - pcb_grabbed.Y = hl->tool_y; - pcb_grabbed.status = pcb_true; + hl->tool_grabbed.X = hl->tool_x; + hl->tool_grabbed.Y = hl->tool_y; + hl->tool_grabbed.status = pcb_true; } /* check if this is the last point of a polygon */