Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 29329) +++ trunk/src/crosshair.c (revision 29330) @@ -68,7 +68,9 @@ pcb_crosshair_t pcb_crosshair; /* information about cursor settings */ pcb_mark_t pcb_marked; pcb_mark_t pcb_grabbed; +pcb_crosshair_note_t pcb_crosshair_note; + static void thindraw_moved_ps(pcb_pstk_t *ps, pcb_coord_t x, pcb_coord_t y) { /* Make a copy of the pin structure, moved to the correct position */ Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 29329) +++ trunk/src/crosshair.h (revision 29330) @@ -84,7 +84,18 @@ int tool_arrow, tool_line, tool_move, tool_arc, tool_poly, tool_poly_hole; } 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; +extern pcb_crosshair_note_t pcb_crosshair_note; + + /*** all possible states of an attached object ***/ #define PCB_CH_STATE_FIRST 0 /* initial state */ #define PCB_CH_STATE_SECOND 1 Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 29329) +++ trunk/src/gui_act.c (revision 29330) @@ -394,8 +394,8 @@ PCB_ACT_CONVARG(1, FGW_KEYWORD, Display, ;); /* it is okay to use crosshair directly here, the mode command is called from a click when it needs coords */ - pcb_tool_note.X = pcb_crosshair.X; - pcb_tool_note.Y = pcb_crosshair.Y; + pcb_crosshair_note.X = pcb_crosshair.X; + pcb_crosshair_note.Y = pcb_crosshair.Y; pcb_notify_crosshair_change(pcb_false); switch(fgw_keyword(&argv[1])) { case F_Arc: @@ -432,7 +432,7 @@ 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_tool_note.Hit = pcb_tool_note.Click = 0; /* if the mouse button is still pressed, don't start selecting a box */ + pcb_crosshair_note.Hit = pcb_crosshair_note.Click = 0; /* if the mouse button is still pressed, don't start selecting a box */ } else t->escape(PCB_ACT_HIDLIB); @@ -525,7 +525,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_tool_note.X, l->Point1.X) && close_enough(pcb_tool_note.Y, l->Point1.Y)) { + if (close_enough(pcb_crosshair_note.X, l->Point1.X) && close_enough(pcb_crosshair_note.Y, l->Point1.Y)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -532,7 +532,7 @@ pcb_crosshair.AttachedObject.Ptr3 = &l->Point1; goto switched; } - if (close_enough(pcb_tool_note.X, l->Point2.X) && close_enough(pcb_tool_note.Y, l->Point2.Y)) { + if (close_enough(pcb_crosshair_note.X, l->Point2.X) && close_enough(pcb_crosshair_note.Y, l->Point2.Y)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_LINE_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -543,7 +543,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_tool_note.X, ex) && close_enough(pcb_tool_note.Y, ey)) { + if (close_enough(pcb_crosshair_note.X, ex) && close_enough(pcb_crosshair_note.Y, ey)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; @@ -551,7 +551,7 @@ goto switched; } pcb_arc_get_end((pcb_arc_t *)ptr2, 1, &ex, &ey); - if (close_enough(pcb_tool_note.X, ex) && close_enough(pcb_tool_note.Y, ey)) { + if (close_enough(pcb_crosshair_note.X, ex) && close_enough(pcb_crosshair_note.Y, ey)) { pcb_crosshair.AttachedObject.Type = PCB_OBJ_ARC_POINT; pcb_crosshair.AttachedObject.Ptr1 = ptr1; pcb_crosshair.AttachedObject.Ptr2 = ptr2; Index: trunk/src/remove_act.c =================================================================== --- trunk/src/remove_act.c (revision 29329) +++ trunk/src/remove_act.c (revision 29330) @@ -72,7 +72,7 @@ pcb_remove_object(obj->type, obj->parent.any, obj, obj); } else { /* interactive remove */ - pcb_hid_get_coords("Click on object to delete", &pcb_tool_note.X, &pcb_tool_note.Y, 0); + pcb_hid_get_coords("Click on object to delete", &pcb_crosshair_note.X, &pcb_crosshair_note.Y, 0); pcb_tool_save(PCB_ACT_HIDLIB); pcb_tool_select_by_name(PCB_ACT_HIDLIB, "remove"); pcb_notify_mode(PCB_ACT_HIDLIB); Index: trunk/src/select_act.c =================================================================== --- trunk/src/select_act.c (revision 29329) +++ trunk/src/select_act.c (revision 29330) @@ -148,7 +148,7 @@ case F_ConvertSubc: { pcb_coord_t x, y; - pcb_tool_note.Buffer = conf_core.editor.buffer_number; + pcb_crosshair_note.Buffer = conf_core.editor.buffer_number; pcb_buffer_set_number(PCB_MAX_BUFFER - 1); pcb_buffer_clear(PCB, PCB_PASTEBUFFER); pcb_hid_get_coords("Select the Subcircuit's Origin (mark) Location", &x, &y, 0); @@ -160,7 +160,7 @@ pcb_subc_convert_from_buffer(PCB_PASTEBUFFER); pcb_undo_restore_serial(); pcb_buffer_copy_to_layout(PCB, x, y, pcb_false); - pcb_buffer_set_number(pcb_tool_note.Buffer); + pcb_buffer_set_number(pcb_crosshair_note.Buffer); } break; Index: trunk/src/tool.c =================================================================== --- trunk/src/tool.c (revision 29329) +++ trunk/src/tool.c (revision 29330) @@ -288,7 +288,6 @@ /**** tool helper functions ****/ -pcb_tool_note_t pcb_tool_note; pcb_bool pcb_tool_is_saved = pcb_false; static void get_grid_lock_coordinates(int type, void *ptr1, void *ptr2, void *ptr3, pcb_coord_t * x, pcb_coord_t * y) Index: trunk/src/tool.h =================================================================== --- trunk/src/tool.h (revision 29329) +++ trunk/src/tool.h (revision 29330) @@ -112,18 +112,6 @@ /**** tool helper functions ****/ -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; - void *ptr2; - void *ptr3; -} pcb_tool_note_t; - -extern pcb_tool_note_t pcb_tool_note; extern pcb_bool pcb_tool_is_saved; extern pcb_toolid_t pcb_tool_prev_id; extern pcb_toolid_t pcb_tool_next_id; Index: trunk/src_plugins/ddraft/constraint.c =================================================================== --- trunk/src_plugins/ddraft/constraint.c (revision 29329) +++ trunk/src_plugins/ddraft/constraint.c (revision 29330) @@ -177,7 +177,7 @@ cnst_line2(&cons); else if (pcb_crosshair.AttachedObject.State == PCB_CH_STATE_SECOND) /* normal d&d move or copy */ cnst_move(&cons); - else if (pcb_tool_note.Moving) /* selected copy (buffer mode) */ + else if (pcb_crosshair_note.Moving) /* selected copy (buffer mode) */ cnst_move(&cons); } Index: trunk/src_plugins/serpentine/serpentine.c =================================================================== --- trunk/src_plugins/serpentine/serpentine.c (revision 29329) +++ trunk/src_plugins/serpentine/serpentine.c (revision 29330) @@ -304,13 +304,13 @@ switch (pcb_crosshair.AttachedObject.State) { case PCB_CH_STATE_FIRST: - pcb_crosshair.AttachedObject.Type = pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_OBJ_LINE, + pcb_crosshair.AttachedObject.Type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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_tool_note.X,pcb_tool_note.Y, + double t = point_on_line( pcb_crosshair_note.X,pcb_crosshair_note.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 29329) +++ trunk/src_plugins/sketch_route/sketch_route.c (revision 29330) @@ -1025,7 +1025,7 @@ switch (pcb_crosshair.AttachedObject.State) { case PCB_CH_STATE_FIRST: - type = pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_OBJ_CLASS_TERM, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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_tool_note.X, pcb_tool_note.Y, PCB_OBJ_CLASS_TERM, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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 29329) +++ trunk/src_plugins/tool_std/tool_arc.c (revision 29330) @@ -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_tool_note.X; - pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = pcb_tool_note.Y; + 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.State = PCB_CH_STATE_SECOND; break; @@ -92,8 +92,8 @@ pcb_coord_t wx, wy; pcb_angle_t sa, dir; - wx = pcb_tool_note.X - pcb_crosshair.AttachedBox.Point1.X; - wy = pcb_tool_note.Y - pcb_crosshair.AttachedBox.Point1.Y; + wx = pcb_crosshair_note.X - pcb_crosshair.AttachedBox.Point1.X; + wy = pcb_crosshair_note.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 29329) +++ trunk/src_plugins/tool_std/tool_arrow.c (revision 29330) @@ -66,15 +66,15 @@ pcb_hidlib_t *hl = hv.ptr; pcb_board_t *pcb = hv.ptr; - if (pcb_tool_note.Click) { + if (pcb_crosshair_note.Click) { pcb_notify_crosshair_change(pcb_false); - pcb_tool_note.Click = pcb_false; - if (pcb_tool_note.Moving && !pcb_gui->shift_is_pressed(pcb_gui)) { + pcb_crosshair_note.Click = pcb_false; + if (pcb_crosshair_note.Moving && !pcb_gui->shift_is_pressed(pcb_gui)) { pcb_grabbed.status = pcb_true; - pcb_tool_note.Buffer = conf_core.editor.buffer_number; + 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_tool_note.X, pcb_tool_note.Y, pcb_true, pcb_true); + pcb_buffer_add_selected(pcb, PCB_PASTEBUFFER, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_true, pcb_true); pcb_undo_save_serial(); pcb_remove_selected(pcb_false); pcb_tool_save(hl); @@ -81,7 +81,7 @@ pcb_tool_is_saved = pcb_true; pcb_tool_select_by_name(hl, "buffer"); } - else if (pcb_tool_note.Hit && !pcb_gui->shift_is_pressed(pcb_gui)) { + else if (pcb_crosshair_note.Hit && !pcb_gui->shift_is_pressed(pcb_gui)) { pcb_box_t box; pcb_grabbed.status = pcb_true; @@ -88,30 +88,30 @@ 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"); - pcb_crosshair.AttachedObject.Ptr1 = pcb_tool_note.ptr1; - pcb_crosshair.AttachedObject.Ptr2 = pcb_tool_note.ptr2; - pcb_crosshair.AttachedObject.Ptr3 = pcb_tool_note.ptr3; - pcb_crosshair.AttachedObject.Type = pcb_tool_note.Hit; + 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; if (pcb_crosshair.drags != NULL) { free(pcb_crosshair.drags); pcb_crosshair.drags = NULL; } - pcb_crosshair.dragx = pcb_tool_note.X; - pcb_crosshair.dragy = pcb_tool_note.Y; - box.X1 = pcb_tool_note.X + PCB_SLOP * pcb_pixel_slop; - box.X2 = pcb_tool_note.X - PCB_SLOP * pcb_pixel_slop; - box.Y1 = pcb_tool_note.Y + PCB_SLOP * pcb_pixel_slop; - box.Y2 = pcb_tool_note.Y - PCB_SLOP * pcb_pixel_slop; + 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.drags = pcb_list_block(pcb, &box, &pcb_crosshair.drags_len); pcb_crosshair.drags_current = 0; - pcb_tool_attach_for_copy(hl, pcb_tool_note.X, pcb_tool_note.Y, pcb_true); + pcb_tool_attach_for_copy(hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_true); } else { pcb_box_t box; - pcb_tool_note.Hit = 0; - pcb_tool_note.Moving = pcb_false; + pcb_crosshair_note.Hit = 0; + pcb_crosshair_note.Moving = pcb_false; pcb_undo_save_serial(); box.X1 = -PCB_MAX_COORD; box.Y1 = -PCB_MAX_COORD; @@ -121,8 +121,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_tool_note.X; - pcb_crosshair.AttachedBox.Point1.Y = pcb_tool_note.Y; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair_note.X; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair_note.Y; } pcb_notify_crosshair_change(pcb_true); } @@ -140,38 +140,38 @@ int test; pcb_hidval_t hv; - pcb_tool_note.Click = pcb_true; + pcb_crosshair_note.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); /* see if we clicked on something already selected - * (pcb_tool_note.Moving) or clicked on a MOVE_TYPE - * (pcb_tool_note.Hit) + * (pcb_crosshair_note.Moving) or clicked on a MOVE_TYPE + * (pcb_crosshair_note.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_tool_note.X, pcb_tool_note.Y, test, &ptr1, &ptr2, &ptr3); + otype = type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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_tool_note.Hit && (type & PCB_MOVE_TYPES) && !PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_any_obj_t *) ptr2)) { - pcb_tool_note.Hit = type; - pcb_tool_note.ptr1 = ptr1; - pcb_tool_note.ptr2 = ptr2; - pcb_tool_note.ptr3 = ptr3; - pcb_crosshair.AttachedObject.tx = pcb_tool_note.X; - pcb_crosshair.AttachedObject.ty = pcb_tool_note.Y; + 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; + 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; } - if (!pcb_tool_note.Moving && (type & (PCB_SELECT_TYPES | PCB_LOOSE_SUBC(PCB))) && PCB_FLAG_TEST(PCB_FLAG_SELECTED, (pcb_any_obj_t *) ptr2)) { - pcb_tool_note.Moving = pcb_true; + 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_tool_note.X; - pcb_crosshair.AttachedObject.ty = pcb_crosshair.AttachedObject.Y = pcb_tool_note.Y; + pcb_crosshair.AttachedObject.tx = pcb_crosshair.AttachedObject.X = pcb_crosshair_note.X; + pcb_crosshair.AttachedObject.ty = pcb_crosshair.AttachedObject.Y = pcb_crosshair_note.Y; } - if ((pcb_tool_note.Hit && pcb_tool_note.Moving) || type == PCB_OBJ_VOID) + if ((pcb_crosshair_note.Hit && pcb_crosshair_note.Moving) || type == PCB_OBJ_VOID) return; } } @@ -181,7 +181,7 @@ pcb_box_t box; pcb_board_t *pcb = (pcb_board_t *)hl; - if (pcb_tool_note.Click) { + if (pcb_crosshair_note.Click) { pcb_box_t box; box.X1 = -PCB_MAX_COORD; @@ -189,15 +189,15 @@ box.X2 = PCB_MAX_COORD; box.Y2 = PCB_MAX_COORD; - pcb_tool_note.Click = pcb_false; /* inhibit timer action */ + pcb_crosshair_note.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)) { if (pcb_select_block(pcb, &box, pcb_false, pcb_false, pcb_false)) pcb_board_set_changed_flag(pcb_true); - if (pcb_tool_note.Moving) { - pcb_tool_note.Moving = 0; - pcb_tool_note.Hit = 0; + if (pcb_crosshair_note.Moving) { + pcb_crosshair_note.Moving = 0; + pcb_crosshair_note.Hit = 0; return; } } @@ -208,8 +208,8 @@ 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_tool_note.Hit = 0; - pcb_tool_note.Moving = 0; + pcb_crosshair_note.Hit = 0; + pcb_crosshair_note.Moving = 0; } else if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_SECOND) { box.X1 = pcb_crosshair.AttachedBox.Point1.X; Index: trunk/src_plugins/tool_std/tool_buffer.c =================================================================== --- trunk/src_plugins/tool_std/tool_buffer.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_buffer.c (revision 29330) @@ -77,13 +77,13 @@ { pcb_board_t *pcb = (pcb_board_t *)hl; - if (pcb_tool_note.Moving) { + if (pcb_crosshair_note.Moving) { pcb_undo_restore_serial(); pcb_tool_buffer_notify_mode_(hl, pcb_true); pcb_buffer_clear(pcb, PCB_PASTEBUFFER); - pcb_buffer_set_number(pcb_tool_note.Buffer); - pcb_tool_note.Moving = pcb_false; - pcb_tool_note.Hit = 0; + pcb_buffer_set_number(pcb_crosshair_note.Buffer); + pcb_crosshair_note.Moving = pcb_false; + pcb_crosshair_note.Hit = 0; } } Index: trunk/src_plugins/tool_std/tool_copy.c =================================================================== --- trunk/src_plugins/tool_std/tool_copy.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_copy.c (revision 29330) @@ -60,10 +60,10 @@ int types = PCB_COPY_TYPES; pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, types, + pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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_tool_note.X, pcb_tool_note.Y, pcb_false); + pcb_tool_attach_for_copy(hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_false); } break; } @@ -93,9 +93,9 @@ void pcb_tool_copy_release_mode(pcb_hidlib_t *hl) { - if (pcb_tool_note.Hit) { + if (pcb_crosshair_note.Hit) { pcb_tool_copy_notify_mode(hl); - pcb_tool_note.Hit = 0; + pcb_crosshair_note.Hit = 0; } } Index: trunk/src_plugins/tool_std/tool_insert.c =================================================================== --- trunk/src_plugins/tool_std/tool_insert.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_insert.c (revision 29330) @@ -66,7 +66,7 @@ /* first notify, lookup object */ case PCB_CH_STATE_FIRST: pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_INSERT_TYPES, + pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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_tool_note.X, pcb_tool_note.Y); + polyIndex = pcb_poly_get_lowest_distance_point(fake.poly, pcb_crosshair_note.X, pcb_crosshair_note.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 29329) +++ trunk/src_plugins/tool_std/tool_line.c (revision 29330) @@ -240,12 +240,12 @@ pcb_crosshair.AttachedLine.Point2.X && pcb_crosshair.AttachedLine.Point1.Y == pcb_crosshair.AttachedLine.Point2.Y - && (pcb_crosshair.AttachedLine.Point2.X != pcb_tool_note.X || pcb_crosshair.AttachedLine.Point2.Y != pcb_tool_note.Y)) { + && (pcb_crosshair.AttachedLine.Point2.X != pcb_crosshair_note.X || pcb_crosshair.AttachedLine.Point2.Y != pcb_crosshair_note.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_tool_note.X; - pcb_crosshair.AttachedLine.Point2.Y = pcb_tool_note.Y; + pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair_note.X; + pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair_note.Y; } if (conf_core.editor.auto_drc @@ -301,12 +301,12 @@ last_layer = PCB_CURRLAYER(pcb); pcb_subc_as_board_update(PCB); } - if (conf_core.editor.line_refraction && (pcb_tool_note.X != pcb_crosshair.AttachedLine.Point2.X || pcb_tool_note.Y != pcb_crosshair.AttachedLine.Point2.Y) + if (conf_core.editor.line_refraction && (pcb_crosshair_note.X != pcb_crosshair.AttachedLine.Point2.X || pcb_crosshair_note.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_tool_note.X, pcb_tool_note.Y, + pcb_crosshair_note.X, pcb_crosshair_note.Y, conf_core.design.line_thickness, 2 * conf_core.design.clearance, pcb_flag_make((conf_core.editor.auto_drc ? PCB_FLAG_FOUND : 0) | @@ -317,10 +317,10 @@ pcb_undo_inc_serial(); pcb_line_invalidate_draw(PCB_CURRLAYER(pcb), line); /* move to new start point */ - pcb_crosshair.AttachedLine.Point1.X = pcb_tool_note.X; - pcb_crosshair.AttachedLine.Point1.Y = pcb_tool_note.Y; - pcb_crosshair.AttachedLine.Point2.X = pcb_tool_note.X; - pcb_crosshair.AttachedLine.Point2.Y = pcb_tool_note.Y; + 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; if (conf_core.editor.swap_start_direction) { @@ -330,8 +330,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_tool_note.X; - pcb_marked.Y = pcb_tool_note.Y; + pcb_marked.X = pcb_crosshair_note.X; + pcb_marked.Y = pcb_crosshair_note.Y; } pcb_draw(); } Index: trunk/src_plugins/tool_std/tool_lock.c =================================================================== --- trunk/src_plugins/tool_std/tool_lock.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_lock.c (revision 29330) @@ -51,7 +51,7 @@ void *ptr1, *ptr2, *ptr3; int type; - type = pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_OBJ_CLASS_LOCK, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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 29329) +++ trunk/src_plugins/tool_std/tool_move.c (revision 29330) @@ -62,7 +62,7 @@ int types = PCB_MOVE_TYPES; pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, types, + pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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_tool_note.X, pcb_tool_note.Y, pcb_true); + pcb_tool_attach_for_copy(hl, pcb_crosshair_note.X, pcb_crosshair_note.Y, pcb_true); } break; } @@ -102,9 +102,9 @@ void pcb_tool_move_release_mode(pcb_hidlib_t *hl) { - if (pcb_tool_note.Hit) { + if (pcb_crosshair_note.Hit) { pcb_tool_move_notify_mode(hl); - pcb_tool_note.Hit = 0; + pcb_crosshair_note.Hit = 0; } } Index: trunk/src_plugins/tool_std/tool_poly.c =================================================================== --- trunk/src_plugins/tool_std/tool_poly.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_poly.c (revision 29330) @@ -91,8 +91,8 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - pcb_grabbed.X = pcb_tool_note.X; - pcb_grabbed.Y = pcb_tool_note.Y; + pcb_grabbed.X = pcb_crosshair_note.X; + pcb_grabbed.Y = pcb_crosshair_note.Y; pcb_grabbed.status = pcb_true; } } Index: trunk/src_plugins/tool_std/tool_polyhole.c =================================================================== --- trunk/src_plugins/tool_std/tool_polyhole.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_polyhole.c (revision 29330) @@ -60,7 +60,7 @@ case PCB_CH_STATE_FIRST: pcb_crosshair.AttachedPolygon_pts = 0; pcb_crosshair.AttachedObject.Type = - pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_OBJ_POLY, + pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.Y, PCB_OBJ_POLY, &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); if (pcb_crosshair.AttachedObject.Type == PCB_OBJ_VOID) { @@ -93,8 +93,8 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - pcb_grabbed.X = pcb_tool_note.X; - pcb_grabbed.Y = pcb_tool_note.Y; + pcb_grabbed.X = pcb_crosshair_note.X; + pcb_grabbed.Y = pcb_crosshair_note.Y; pcb_grabbed.status = pcb_true; } Index: trunk/src_plugins/tool_std/tool_remove.c =================================================================== --- trunk/src_plugins/tool_std/tool_remove.c (revision 29329) +++ trunk/src_plugins/tool_std/tool_remove.c (revision 29330) @@ -42,6 +42,7 @@ #include "search.h" #include "obj_rat.h" #include "tool.h" +#include "crosshair.h" void pcb_tool_remove_notify_mode(pcb_hidlib_t *hl) @@ -51,7 +52,7 @@ pcb_any_obj_t *obj; int type; - if ((type = pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_REMOVE_TYPES | PCB_LOOSE_SUBC(PCB) | PCB_OBJ_FLOATER, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) { + 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) { 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 29329) +++ trunk/src_plugins/tool_std/tool_rotate.c (revision 29330) @@ -39,11 +39,12 @@ #include "board.h" #include "rotate.h" #include "tool.h" +#include "crosshair.h" void pcb_tool_rotate_notify_mode(pcb_hidlib_t *hl) { - pcb_screen_obj_rotate90((pcb_board_t *)hl, pcb_tool_note.X, pcb_tool_note.Y, + pcb_screen_obj_rotate90((pcb_board_t *)hl, pcb_crosshair_note.X, pcb_crosshair_note.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 29329) +++ trunk/src_plugins/tool_std/tool_text.c (revision 29330) @@ -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_tool_note.X, - pcb_tool_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), 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) { 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 29329) +++ trunk/src_plugins/tool_std/tool_thermal.c (revision 29330) @@ -95,7 +95,7 @@ void *ptr1, *ptr2, *ptr3; int type; - if (((type = pcb_search_screen(pcb_tool_note.X, pcb_tool_note.Y, PCB_OBJ_CLASS_PIN, &ptr1, &ptr2, &ptr3)) != PCB_OBJ_VOID) + if (((type = pcb_search_screen(pcb_crosshair_note.X, pcb_crosshair_note.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 29329) +++ trunk/src_plugins/tool_std/tool_via.c (revision 29330) @@ -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_tool_note.X, pcb_tool_note.Y, + pcb_pstk_t *ps = pcb_pstk_new_compat_via(pcb->Data, -1, pcb_crosshair_note.X, pcb_crosshair_note.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)