Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 29393) +++ trunk/src/crosshair.c (revision 29394) @@ -860,8 +860,8 @@ struct snap_data snap_data; int ans; - pcb_crosshair.X = PCB_CLAMP(X, -PCB->hidlib.size_x/2, PCB->hidlib.size_x*3/2); - pcb_crosshair.Y = PCB_CLAMP(Y, -PCB->hidlib.size_y/2, PCB->hidlib.size_y*3/2); + PCB->hidlib.ch_x = pcb_crosshair.X = PCB_CLAMP(X, -PCB->hidlib.size_x/2, PCB->hidlib.size_x*3/2); + PCB->hidlib.ch_y = pcb_crosshair.Y = PCB_CLAMP(Y, -PCB->hidlib.size_y/2, PCB->hidlib.size_y*3/2); if (PCB->RatDraw) { nearest_grid_x = -PCB_MIL_TO_COORD(6); @@ -961,8 +961,8 @@ check_snap_object(&snap_data, pnt->X, pnt->Y, pcb_true, NULL); } - pcb_crosshair.X = snap_data.x; - pcb_crosshair.Y = snap_data.y; + PCB->hidlib.ch_x = pcb_crosshair.X = snap_data.x; + PCB->hidlib.ch_x = pcb_crosshair.Y = snap_data.y; if (conf_core.editor.highlight_on_point) onpoint_work(&pcb_crosshair, pcb_crosshair.X, pcb_crosshair.Y); @@ -1009,14 +1009,14 @@ /* back up to old position to notify the GUI * (which might want to erase the old crosshair) */ z = pcb_crosshair.X; - pcb_crosshair.X = x; + PCB->hidlib.ch_x = pcb_crosshair.X = x; x = z; z = pcb_crosshair.Y; - pcb_crosshair.Y = y; + PCB->hidlib.ch_y = pcb_crosshair.Y = y; pcb_hid_notify_crosshair_change(&PCB->hidlib, pcb_false); /* Our caller notifies when it has done */ /* now move forward again */ - pcb_crosshair.X = x; - pcb_crosshair.Y = z; + PCB->hidlib.ch_x = pcb_crosshair.X = x; + PCB->hidlib.ch_y = pcb_crosshair.Y = z; return pcb_true; } return pcb_false; Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 29393) +++ trunk/src/crosshair.h (revision 29394) @@ -86,11 +86,8 @@ } pcb_crosshair_t; typedef struct { - pcb_coord_t X, Y; pcb_cardinal_t Buffer; /* buffer number */ - pcb_bool Click; /* true if clicked somewhere with the arrow tool */ pcb_bool Moving; /* true if clicked on an object of PCB_SELECT_TYPES */ - int Hit; /* type of a hit object of PCB_MOVE_TYPES; 0 if there was no PCB_MOVE_TYPES object under the crosshair */ void *ptr1, *ptr2, *ptr3; } pcb_crosshair_note_t; Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 29393) +++ trunk/src/gui_act.c (revision 29394) @@ -390,13 +390,14 @@ /* DOC: tool.html */ static fgw_error_t pcb_act_Tool(fgw_arg_t *res, int argc, fgw_arg_t *argv) { + pcb_hidlib_t *hidlib = PCB_ACT_HIDLIB; const char *cmd; PCB_ACT_IRES(0); PCB_ACT_CONVARG(1, FGW_STR, Tool, cmd = argv[1].val.str); /* it is okay to use crosshair directly here, the mode command is called from a click when it needs coords */ - pcb_crosshair_note.X = pcb_crosshair.X; - pcb_crosshair_note.Y = pcb_crosshair.Y; + hidlib->tool_x = hidlib->ch_x; + hidlib->tool_y = hidlib->ch_y; pcb_hid_notify_crosshair_change(PCB_ACT_HIDLIB, pcb_false); switch(pcb_funchash_get(cmd, NULL)) { case F_Cancel: @@ -408,7 +409,7 @@ const pcb_tool_t *t = pcb_tool_get(pcbhl_conf.editor.mode); if ((t == NULL) || (t->escape == NULL)) { pcb_tool_select_by_name(PCB_ACT_HIDLIB, "arrow"); - pcb_crosshair_note.Hit = pcb_crosshair_note.Click = 0; /* if the mouse button is still pressed, don't start selecting a box */ + hidlib->tool_hit = hidlib->tool_click = 0; /* if the mouse button is still pressed, don't start selecting a box */ } else t->escape(PCB_ACT_HIDLIB); @@ -436,7 +437,7 @@ break; case F_Stroke: if (conf_core.editor.enable_stroke) { - pcb_event(PCB_ACT_HIDLIB, PCB_EVENT_STROKE_START, "cc", pcb_crosshair.X, pcb_crosshair.Y); + pcb_event(PCB_ACT_HIDLIB, PCB_EVENT_STROKE_START, "cc", hidlib->tool_x, hidlib->tool_y); break; } @@ -466,6 +467,7 @@ #define close_enough(a, b) ((((a)-(b)) > 0) ? ((a)-(b) < (PCB_SLOP * pcb_pixel_slop)) : ((a)-(b) > -(PCB_SLOP * pcb_pixel_slop))) static fgw_error_t pcb_act_CycleDrag(fgw_arg_t *res, int argc, fgw_arg_t *argv) { + pcb_hidlib_t *hidlib = PCB_ACT_HIDLIB; void *ptr1, *ptr2, *ptr3; int over = 0; @@ -483,7 +485,7 @@ if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_OBJ_LINE) != PCB_OBJ_VOID) { /* line has two endpoints, check which one is close to the original x;y */ pcb_line_t *l = ptr2; - if (close_enough(pcb_crosshair_note.X, l->Point1.X) && close_enough(pcb_crosshair_note.Y, l->Point1.Y)) { + if (close_enough(hidlib->tool_x, l->Point1.X) && close_enough(hidlib->tool_y, l->Point1.Y)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -490,7 +492,7 @@ pcb_crosshair.AttachedObject.Ptr3 = &l->Point1; goto switched; } - if (close_enough(pcb_crosshair_note.X, l->Point2.X) && close_enough(pcb_crosshair_note.Y, l->Point2.Y)) { + if (close_enough(hidlib->tool_x, l->Point2.X) && close_enough(hidlib->tool_y, l->Point2.Y)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -501,7 +503,7 @@ else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_OBJ_ARC_POINT) != PCB_OBJ_VOID) { pcb_coord_t ex, ey; pcb_arc_get_end((pcb_arc_t *)ptr2, 0, &ex, &ey); - if (close_enough(pcb_crosshair_note.X, ex) && close_enough(pcb_crosshair_note.Y, ey)) { + if (close_enough(hidlib->tool_x, ex) && close_enough(hidlib->tool_y, ey)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -509,7 +511,7 @@ goto switched; } pcb_arc_get_end((pcb_arc_t *)ptr2, 1, &ex, &ey); - if (close_enough(pcb_crosshair_note.X, ex) && close_enough(pcb_crosshair_note.Y, ey)) { + if (close_enough(hidlib->tool_x, ex) && close_enough(hidlib->tool_y, ey)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; Index: trunk/src/librnd/core/hidlib.h =================================================================== --- trunk/src/librnd/core/hidlib.h (revision 29393) +++ trunk/src/librnd/core/hidlib.h (revision 29394) @@ -36,6 +36,12 @@ char *name; /* name of the design */ char *filename; /* name of the file (from load) */ + /* tool state */ + 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 */ + + /* 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/obj_line_drcenf.c =================================================================== --- trunk/src/obj_line_drcenf.c (revision 29393) +++ trunk/src/obj_line_drcenf.c (revision 29394) @@ -505,8 +505,8 @@ pcb_conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 1); } } - pcb_crosshair.X = rs.X; - pcb_crosshair.Y = rs.Y; + pcb->hidlib.ch_x = pcb_crosshair.X = rs.X; + pcb->hidlib.ch_y = pcb_crosshair.Y = rs.Y; } else { if (conf_core.editor.line_refraction !=0) { Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 29393) +++ trunk/src/plug_io.c (revision 29394) @@ -542,8 +542,8 @@ pcb_board_new_postproc(PCB, 0); if (how == 0) { /* update cursor location */ - pcb_crosshair.X = PCB->hidlib.size_x/2; - pcb_crosshair.Y = PCB->hidlib.size_y/2; + PCB->hidlib.ch_x = pcb_crosshair.X = PCB->hidlib.size_x/2; + PCB->hidlib.ch_y = pcb_crosshair.Y = PCB->hidlib.size_y/2; /* update cursor confinement and output area (scrollbars) */ pcb_board_resize(PCB->hidlib.size_x, PCB->hidlib.size_y, 0); Index: trunk/src/remove_act.c =================================================================== --- trunk/src/remove_act.c (revision 29393) +++ trunk/src/remove_act.c (revision 29394) @@ -72,7 +72,8 @@ pcb_remove_object(obj->type, obj->parent.any, obj, obj); } else { /* interactive remove */ - pcb_hid_get_coords("Click on object to delete", &pcb_crosshair_note.X, &pcb_crosshair_note.Y, 0); + pcb_hidlib_t *hidlib = PCB_ACT_HIDLIB; + pcb_hid_get_coords("Click on object to delete", &hidlib->tool_x, &hidlib->tool_y, 0); pcb_tool_save(PCB_ACT_HIDLIB); pcb_tool_select_by_name(PCB_ACT_HIDLIB, "remove"); pcb_press_mode(PCB_ACT_HIDLIB); Index: trunk/src_plugins/serpentine/serpentine.c =================================================================== --- trunk/src_plugins/serpentine/serpentine.c (revision 29393) +++ trunk/src_plugins/serpentine/serpentine.c (revision 29394) @@ -304,13 +304,13 @@ switch (pcb_crosshair.AttachedObject.State) { case PCB_CH_STATE_FIRST: - pcb_crosshair.AttachedObject.Type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_LINE, + pcb_crosshair.AttachedObject.Type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_LINE, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); /* TODO: check if an object is on the current layer */ if (pcb_crosshair.AttachedObject.Type == PCB_OBJ_LINE) { pcb_line_t * p_line = (pcb_line_t *)pcb_crosshair.AttachedObject.Ptr2; - double t = point_on_line( pcb_crosshair_note.X,pcb_crosshair_note.Y, + double t = point_on_line( hl->tool_x,hl->tool_y, p_line->Point1.X,p_line->Point1.Y, p_line->Point2.X,p_line->Point2.Y, &pcb_crosshair.AttachedObject.X, Index: trunk/src_plugins/sketch_route/sketch_route.c =================================================================== --- trunk/src_plugins/sketch_route/sketch_route.c (revision 29393) +++ trunk/src_plugins/sketch_route/sketch_route.c (revision 29394) @@ -1025,7 +1025,7 @@ switch (pcb_crosshair.AttachedObject.State) { case PCB_CH_STATE_FIRST: - type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_CLASS_TERM, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_CLASS_TERM, &ptr1, &ptr2, &ptr3); /* TODO: check if an object is on the current layer */ if (type != PCB_OBJ_VOID) { term_obj = ptr2; @@ -1042,7 +1042,7 @@ break; case PCB_CH_STATE_SECOND: - type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_CLASS_TERM, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_CLASS_TERM, &ptr1, &ptr2, &ptr3); /* TODO: check if an object is on the current layer */ if (type != PCB_OBJ_VOID) { term_obj = ptr2; Index: trunk/src_plugins/tool_std/tool_arc.c =================================================================== --- trunk/src_plugins/tool_std/tool_arc.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_arc.c (revision 29394) @@ -80,8 +80,8 @@ switch (pcb_crosshair.AttachedBox.State) { case PCB_CH_STATE_FIRST: - pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair_note.X; - pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair_note.Y; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = hl->tool_x; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = hl->tool_y; pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; break; @@ -92,8 +92,8 @@ pcb_coord_t wx, wy; pcb_angle_t sa, dir; - wx = pcb_crosshair_note.X - pcb_crosshair.AttachedBox.Point1.X; - wy = pcb_crosshair_note.Y - pcb_crosshair.AttachedBox.Point1.Y; + wx = hl->tool_x - pcb_crosshair.AttachedBox.Point1.X; + wy = hl->tool_y - pcb_crosshair.AttachedBox.Point1.Y; if (PCB_XOR(pcb_crosshair.AttachedBox.otherway, coord_abs(wy) > coord_abs(wx))) { pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.AttachedBox.Point1.X + coord_abs(wy) * PCB_SGNZ(wx); sa = (wx >= 0) ? 0 : 180; Index: trunk/src_plugins/tool_std/tool_arrow.c =================================================================== --- trunk/src_plugins/tool_std/tool_arrow.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_arrow.c (revision 29394) @@ -67,15 +67,15 @@ pcb_hidlib_t *hl = hv.ptr; pcb_board_t *pcb = hv.ptr; - if (pcb_crosshair_note.Click) { + if (hl->tool_click) { pcb_hid_notify_crosshair_change(&PCB->hidlib, pcb_false); - pcb_crosshair_note.Click = pcb_false; + hl->tool_click = pcb_false; if (pcb_crosshair_note.Moving && !pcb_gui->shift_is_pressed(pcb_gui)) { pcb_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); - pcb_buffer_add_selected(pcb, PCB_PASTEBUFFER, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_true, pcb_true); + pcb_buffer_add_selected(pcb, PCB_PASTEBUFFER, hl->tool_x, hl->tool_y, pcb_true, pcb_true); pcb_undo_save_serial(); pcb_remove_selected(pcb_false); pcb_tool_save(hl); @@ -82,7 +82,7 @@ pcb_tool_is_saved = pcb_true; pcb_tool_select_by_name(hl, "buffer"); } - else if (pcb_crosshair_note.Hit && !pcb_gui->shift_is_pressed(pcb_gui)) { + else if (hl->tool_hit && !pcb_gui->shift_is_pressed(pcb_gui)) { pcb_box_t box; pcb_grabbed.status = pcb_true; @@ -92,26 +92,26 @@ pcb_crosshair.AttachedObject.Ptr1 = pcb_crosshair_note.ptr1; pcb_crosshair.AttachedObject.Ptr2 = pcb_crosshair_note.ptr2; pcb_crosshair.AttachedObject.Ptr3 = pcb_crosshair_note.ptr3; - pcb_crosshair.AttachedObject.Type = pcb_crosshair_note.Hit; + pcb_crosshair.AttachedObject.Type = hl->tool_hit; if (pcb_crosshair.drags != NULL) { free(pcb_crosshair.drags); pcb_crosshair.drags = NULL; } - pcb_crosshair.dragx = pcb_crosshair_note.X; - pcb_crosshair.dragy = pcb_crosshair_note.Y; - box.X1 = pcb_crosshair_note.X + PCB_SLOP * pcb_pixel_slop; - box.X2 = pcb_crosshair_note.X - PCB_SLOP * pcb_pixel_slop; - box.Y1 = pcb_crosshair_note.Y + PCB_SLOP * pcb_pixel_slop; - box.Y2 = pcb_crosshair_note.Y - PCB_SLOP * pcb_pixel_slop; + pcb_crosshair.dragx = hl->tool_x; + pcb_crosshair.dragy = hl->tool_y; + box.X1 = hl->tool_x + PCB_SLOP * pcb_pixel_slop; + box.X2 = hl->tool_x - PCB_SLOP * pcb_pixel_slop; + box.Y1 = hl->tool_y + PCB_SLOP * pcb_pixel_slop; + box.Y2 = hl->tool_y - PCB_SLOP * pcb_pixel_slop; pcb_crosshair.drags = pcb_list_block(pcb, &box, &pcb_crosshair.drags_len); pcb_crosshair.drags_current = 0; - pcb_tool_attach_for_copy(hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_true); + pcb_tool_attach_for_copy(hl, hl->tool_x, hl->tool_y, pcb_true); } else { pcb_box_t box; - pcb_crosshair_note.Hit = 0; + hl->tool_hit = 0; pcb_crosshair_note.Moving = pcb_false; pcb_undo_save_serial(); box.X1 = -PCB_MAX_COORD; @@ -122,8 +122,8 @@ if (!pcb_gui->shift_is_pressed(pcb_gui) && pcb_select_block(pcb, &box, pcb_false, pcb_false, pcb_false)) pcb_board_set_changed_flag(pcb_true); pcb_tool_notify_block(); - pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair_note.X; - pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair_note.Y; + pcb_crosshair.AttachedBox.Point1.X = hl->tool_x; + pcb_crosshair.AttachedBox.Point1.Y = hl->tool_y; } pcb_hid_notify_crosshair_change(&PCB->hidlib, pcb_true); } @@ -141,7 +141,7 @@ int test; pcb_hidval_t hv; - pcb_crosshair_note.Click = pcb_true; + hl->tool_click = pcb_true; /* do something after click time */ hv.ptr = hl; pcb_gui->add_timer(pcb_gui, click_timer_cb, conf_core.editor.click_time, hv); @@ -148,31 +148,31 @@ /* see if we clicked on something already selected * (pcb_crosshair_note.Moving) or clicked on a MOVE_TYPE - * (pcb_crosshair_note.Hit) + * (hl->tool_hit) */ for (test = (PCB_SELECT_TYPES | PCB_MOVE_TYPES | PCB_OBJ_FLOATER | PCB_LOOSE_SUBC(PCB)) & ~PCB_OBJ_RAT; test; test &= ~otype) { /* grab object/point (e.g. line endpoint) for edit */ - otype = type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, test, &ptr1, &ptr2, &ptr3); + otype = type = pcb_search_screen(hl->tool_x, hl->tool_y, test, &ptr1, &ptr2, &ptr3); if (otype == PCB_OBJ_ARC_POINT) { /* ignore arc endpoints if arc radius is 0 (so arc center is grabbed) */ pcb_arc_t *arc = (pcb_arc_t *)ptr2; if ((arc->Width == 0) && (arc->Height == 0)) continue; } - if (!pcb_crosshair_note.Hit && (type & PCB_MOVE_TYPES) && !PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_any_obj_t *) ptr2)) { - pcb_crosshair_note.Hit = type; + if (!hl->tool_hit && (type & PCB_MOVE_TYPES) && !PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_any_obj_t *) ptr2)) { + hl->tool_hit = type; pcb_crosshair_note.ptr1 = ptr1; pcb_crosshair_note.ptr2 = ptr2; pcb_crosshair_note.ptr3 = ptr3; - pcb_crosshair.AttachedObject.tx = pcb_crosshair_note.X; - pcb_crosshair.AttachedObject.ty = pcb_crosshair_note.Y; + pcb_crosshair.AttachedObject.tx = hl->tool_x; + pcb_crosshair.AttachedObject.ty = hl->tool_y; } if (!pcb_crosshair_note.Moving && (type & (PCB_SELECT_TYPES | PCB_LOOSE_SUBC(PCB))) && PCB_FLAG_TEST(PCB_FLAG_SELECTED, (pcb_any_obj_t *) ptr2)) { pcb_crosshair_note.Moving = pcb_true; /* remember where the user clicked to start this op */ - pcb_crosshair.AttachedObject.tx = pcb_crosshair.AttachedObject.X = pcb_crosshair_note.X; - pcb_crosshair.AttachedObject.ty = pcb_crosshair.AttachedObject.Y = pcb_crosshair_note.Y; + pcb_crosshair.AttachedObject.tx = pcb_crosshair.AttachedObject.X = hl->tool_x; + pcb_crosshair.AttachedObject.ty = pcb_crosshair.AttachedObject.Y = hl->tool_y; } - if ((pcb_crosshair_note.Hit && pcb_crosshair_note.Moving) || type == PCB_OBJ_VOID) + if ((hl->tool_hit && pcb_crosshair_note.Moving) || type == PCB_OBJ_VOID) return; } } @@ -182,7 +182,7 @@ pcb_box_t box; pcb_board_t *pcb = (pcb_board_t *)hl; - if (pcb_crosshair_note.Click) { + if (hl->tool_click) { pcb_box_t box; box.X1 = -PCB_MAX_COORD; @@ -190,7 +190,7 @@ box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; - pcb_crosshair_note.Click = pcb_false; /* inhibit timer action */ + hl->tool_click = pcb_false; /* inhibit timer action */ pcb_undo_save_serial(); /* unselect first if shift key not down */ if (!pcb_gui->shift_is_pressed(pcb_gui)) { @@ -198,7 +198,7 @@ pcb_board_set_changed_flag(pcb_true); if (pcb_crosshair_note.Moving) { pcb_crosshair_note.Moving = 0; - pcb_crosshair_note.Hit = 0; + hl->tool_hit = 0; return; } } @@ -209,7 +209,7 @@ pcb_board_set_changed_flag(pcb_true); else pcb_undo_inc_serial(); /* We didn't select anything new, so, the deselection should get its own SN. */ - pcb_crosshair_note.Hit = 0; + hl->tool_hit = 0; pcb_crosshair_note.Moving = 0; } else if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_SECOND) { Index: trunk/src_plugins/tool_std/tool_buffer.c =================================================================== --- trunk/src_plugins/tool_std/tool_buffer.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_buffer.c (revision 29394) @@ -83,7 +83,7 @@ pcb_buffer_clear(pcb, PCB_PASTEBUFFER); pcb_buffer_set_number(pcb_crosshair_note.Buffer); pcb_crosshair_note.Moving = pcb_false; - pcb_crosshair_note.Hit = 0; + hl->tool_hit = 0; } } Index: trunk/src_plugins/tool_std/tool_copy.c =================================================================== --- trunk/src_plugins/tool_std/tool_copy.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_copy.c (revision 29394) @@ -60,10 +60,10 @@ int types = PCB_COPY_TYPES; pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, types, + pcb_search_screen(hl->tool_x, hl->tool_y, types, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); if (pcb_crosshair.AttachedObject.Type != PCB_OBJ_VOID) { - pcb_tool_attach_for_copy(hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_false); + pcb_tool_attach_for_copy(hl, hl->tool_x, hl->tool_y, pcb_false); } break; } @@ -93,9 +93,9 @@ void pcb_tool_copy_release_mode(pcb_hidlib_t *hl) { - if (pcb_crosshair_note.Hit) { + if (hl->tool_hit) { pcb_tool_copy_notify_mode(hl); - pcb_crosshair_note.Hit = 0; + hl->tool_hit = 0; } } Index: trunk/src_plugins/tool_std/tool_insert.c =================================================================== --- trunk/src_plugins/tool_std/tool_insert.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_insert.c (revision 29394) @@ -66,7 +66,7 @@ /* first notify, lookup object */ case PCB_CH_STATE_FIRST: pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_INSERT_TYPES, + pcb_search_screen(hl->tool_x, hl->tool_y, PCB_INSERT_TYPES, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); if (pcb_crosshair.AttachedObject.Type != PCB_OBJ_VOID) { @@ -81,7 +81,7 @@ /* get starting point of nearest segment */ if (pcb_crosshair.AttachedObject.Type == PCB_OBJ_POLY) { fake.poly = (pcb_poly_t *) pcb_crosshair.AttachedObject.Ptr2; - polyIndex = pcb_poly_get_lowest_distance_point(fake.poly, pcb_crosshair_note.X, pcb_crosshair_note.Y); + polyIndex = pcb_poly_get_lowest_distance_point(fake.poly, hl->tool_x, hl->tool_y); fake.line.Point1 = fake.poly->Points[polyIndex]; fake.line.Point2 = fake.poly->Points[pcb_poly_contour_prev_point(fake.poly, polyIndex)]; pcb_crosshair.AttachedObject.Ptr2 = &fake.line; Index: trunk/src_plugins/tool_std/tool_line.c =================================================================== --- trunk/src_plugins/tool_std/tool_line.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_line.c (revision 29394) @@ -241,12 +241,12 @@ pcb_crosshair.AttachedLine.Point2.X && pcb_crosshair.AttachedLine.Point1.Y == pcb_crosshair.AttachedLine.Point2.Y - && (pcb_crosshair.AttachedLine.Point2.X != pcb_crosshair_note.X || pcb_crosshair.AttachedLine.Point2.Y != pcb_crosshair_note.Y)) { + && (pcb_crosshair.AttachedLine.Point2.X != hl->tool_x || pcb_crosshair.AttachedLine.Point2.Y != hl->tool_y)) { /* We will only need to paint the second line segment. Since we only check for vias on the first segment, swap them so the non-empty segment is the first segment. */ - pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair_note.X; - pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair_note.Y; + pcb_crosshair.AttachedLine.Point2.X = hl->tool_x; + pcb_crosshair.AttachedLine.Point2.Y = hl->tool_y; } if (conf_core.editor.auto_drc @@ -302,12 +302,12 @@ last_layer = PCB_CURRLAYER(pcb); pcb_subc_as_board_update(PCB); } - if (conf_core.editor.line_refraction && (pcb_crosshair_note.X != pcb_crosshair.AttachedLine.Point2.X || pcb_crosshair_note.Y != pcb_crosshair.AttachedLine.Point2.Y) + if (conf_core.editor.line_refraction && (hl->tool_x != pcb_crosshair.AttachedLine.Point2.X || hl->tool_y != pcb_crosshair.AttachedLine.Point2.Y) && (line = pcb_line_new_merge(pcb_loose_subc_layer(pcb, PCB_CURRLAYER(pcb), pcb_true), pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y, - pcb_crosshair_note.X, pcb_crosshair_note.Y, + hl->tool_x, hl->tool_y, conf_core.design.line_thickness, 2 * conf_core.design.clearance, pcb_flag_make((conf_core.editor.auto_drc ? PCB_FLAG_FOUND : 0) | @@ -318,10 +318,10 @@ pcb_undo_inc_serial(); pcb_line_invalidate_draw(PCB_CURRLAYER(pcb), line); /* move to new start point */ - pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair_note.X; - pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair_note.Y; - pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair_note.X; - pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair_note.Y; + pcb_crosshair.AttachedLine.Point1.X = hl->tool_x; + pcb_crosshair.AttachedLine.Point1.Y = hl->tool_y; + pcb_crosshair.AttachedLine.Point2.X = hl->tool_x; + pcb_crosshair.AttachedLine.Point2.Y = hl->tool_y; if (conf_core.editor.swap_start_direction) { @@ -331,8 +331,8 @@ } 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_marked.X = pcb_crosshair_note.X; - pcb_marked.Y = pcb_crosshair_note.Y; + pcb_marked.X = hl->tool_x; + pcb_marked.Y = hl->tool_y; } pcb_draw(); } Index: trunk/src_plugins/tool_std/tool_lock.c =================================================================== --- trunk/src_plugins/tool_std/tool_lock.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_lock.c (revision 29394) @@ -52,7 +52,7 @@ void *ptr1, *ptr2, *ptr3; int type; - type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_CLASS_LOCK, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_CLASS_LOCK, &ptr1, &ptr2, &ptr3); if (type == PCB_OBJ_SUBC) { pcb_subc_t *subc = (pcb_subc_t *)ptr2; Index: trunk/src_plugins/tool_std/tool_move.c =================================================================== --- trunk/src_plugins/tool_std/tool_move.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_move.c (revision 29394) @@ -62,7 +62,7 @@ int types = PCB_MOVE_TYPES; pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, types, + pcb_search_screen(hl->tool_x, hl->tool_y, types, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); if (pcb_crosshair.AttachedObject.Type != PCB_OBJ_VOID) { pcb_any_obj_t *obj = (pcb_any_obj_t *)pcb_crosshair.AttachedObject.Ptr2; @@ -72,7 +72,7 @@ pcb_crosshair.extobj_edit = NULL; } else - pcb_tool_attach_for_copy(hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_true); + pcb_tool_attach_for_copy(hl, hl->tool_x, hl->tool_y, pcb_true); } break; } @@ -102,9 +102,9 @@ void pcb_tool_move_release_mode(pcb_hidlib_t *hl) { - if (pcb_crosshair_note.Hit) { + if (hl->tool_hit) { pcb_tool_move_notify_mode(hl); - pcb_crosshair_note.Hit = 0; + hl->tool_hit = 0; } } Index: trunk/src_plugins/tool_std/tool_poly.c =================================================================== --- trunk/src_plugins/tool_std/tool_poly.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_poly.c (revision 29394) @@ -92,8 +92,8 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - pcb_grabbed.X = pcb_crosshair_note.X; - pcb_grabbed.Y = pcb_crosshair_note.Y; + pcb_grabbed.X = hl->tool_x; + pcb_grabbed.Y = hl->tool_y; pcb_grabbed.status = pcb_true; } } Index: trunk/src_plugins/tool_std/tool_polyhole.c =================================================================== --- trunk/src_plugins/tool_std/tool_polyhole.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_polyhole.c (revision 29394) @@ -61,7 +61,7 @@ case PCB_CH_STATE_FIRST: pcb_crosshair.AttachedPolygon_pts = 0; pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_POLY, + pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_POLY, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); if (pcb_crosshair.AttachedObject.Type == PCB_OBJ_VOID) { @@ -94,8 +94,8 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - pcb_grabbed.X = pcb_crosshair_note.X; - pcb_grabbed.Y = pcb_crosshair_note.Y; + pcb_grabbed.X = hl->tool_x; + pcb_grabbed.Y = hl->tool_y; pcb_grabbed.status = pcb_true; } Index: trunk/src_plugins/tool_std/tool_remove.c =================================================================== --- trunk/src_plugins/tool_std/tool_remove.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_remove.c (revision 29394) @@ -53,7 +53,7 @@ pcb_any_obj_t *obj; int type; - if ((type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_REMOVE_TYPES | PCB_LOOSE_SUBC(PCB) | PCB_OBJ_FLOATER, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) { + if ((type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_REMOVE_TYPES | PCB_LOOSE_SUBC(PCB) | PCB_OBJ_FLOATER, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) { obj = (pcb_any_obj_t *)ptr2; if (PCB_FLAG_TEST(PCB_FLAG_LOCK, obj)) { pcb_message(PCB_MSG_WARNING, "Sorry, %s object is locked\n", pcb_obj_type_name(obj->type)); Index: trunk/src_plugins/tool_std/tool_rotate.c =================================================================== --- trunk/src_plugins/tool_std/tool_rotate.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_rotate.c (revision 29394) @@ -44,7 +44,7 @@ void pcb_tool_rotate_notify_mode(pcb_hidlib_t *hl) { - pcb_screen_obj_rotate90((pcb_board_t *)hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, + pcb_screen_obj_rotate90((pcb_board_t *)hl, hl->tool_x, hl->tool_y, pcb_gui->shift_is_pressed(pcb_gui) ? (conf_core.editor.show_solder_side ? 1 : 3) : (conf_core.editor.show_solder_side ? 3 : 1)); pcb_subc_as_board_update(PCB); } Index: trunk/src_plugins/tool_std/tool_text.c =================================================================== --- trunk/src_plugins/tool_std/tool_text.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_text.c (revision 29394) @@ -57,8 +57,8 @@ if (pcb_layer_flags(pcb, PCB_CURRLID(pcb)) & PCB_LYT_BOTTOM) flag |= PCB_FLAG_ONSOLDER; - if ((text = pcb_text_new(pcb_loose_subc_layer(pcb, PCB_CURRLAYER(pcb), pcb_true), pcb_font(pcb, conf_core.design.text_font_id, 1), pcb_crosshair_note.X, - pcb_crosshair_note.Y, 0, conf_core.design.text_scale, conf_core.design.text_thickness, string, pcb_flag_make(flag))) != NULL) { + if ((text = pcb_text_new(pcb_loose_subc_layer(pcb, PCB_CURRLAYER(pcb), pcb_true), pcb_font(pcb, conf_core.design.text_font_id, 1), hl->tool_x, + hl->tool_y, 0, conf_core.design.text_scale, conf_core.design.text_thickness, string, pcb_flag_make(flag))) != NULL) { pcb_undo_add_obj_to_create(PCB_OBJ_TEXT, PCB_CURRLAYER(pcb), text, text); pcb_undo_inc_serial(); pcb_text_invalidate_draw(PCB_CURRLAYER(pcb), text); Index: trunk/src_plugins/tool_std/tool_thermal.c =================================================================== --- trunk/src_plugins/tool_std/tool_thermal.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_thermal.c (revision 29394) @@ -95,7 +95,7 @@ void *ptr1, *ptr2, *ptr3; int type; - if (((type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_CLASS_PIN, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) + if (((type = pcb_search_screen(hl->tool_x, hl->tool_y, PCB_OBJ_CLASS_PIN, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) && !PCB_FLAG_TEST(PCB_FLAG_HOLE, (pcb_any_obj_t *) ptr3)) { if (type == PCB_OBJ_PSTK) pcb_tool_thermal_on_pstk((pcb_pstk_t *)ptr2, PCB_CURRLID(pcb)); Index: trunk/src_plugins/tool_std/tool_via.c =================================================================== --- trunk/src_plugins/tool_std/tool_via.c (revision 29393) +++ trunk/src_plugins/tool_std/tool_via.c (revision 29394) @@ -67,7 +67,7 @@ TODO("pstk #21: do not work in comp mode, use a pstk proto - scconfig also has TODO #21, fix it there too") { - pcb_pstk_t *ps = pcb_pstk_new_compat_via(pcb->Data, -1, pcb_crosshair_note.X, pcb_crosshair_note.Y, + pcb_pstk_t *ps = pcb_pstk_new_compat_via(pcb->Data, -1, hl->tool_x, hl->tool_y, conf_core.design.via_drilling_hole, conf_core.design.via_thickness, conf_core.design.clearance, 0, PCB_PSTK_COMPAT_ROUND, pcb_true); if (ps == NULL)