Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 29212) +++ trunk/src/board.c (revision 29213) @@ -266,18 +266,6 @@ pcb->hidlib.size_x = Width; pcb->hidlib.size_y = Height; - /* crosshair range is different if pastebuffer-mode - * is enabled - */ - if (pcbhl_conf.editor.mode == PCB_MODE_PASTE_BUFFER) - pcb_crosshair_set_range(PCB_PASTEBUFFER->X - PCB_PASTEBUFFER->BoundingBox.X1, - PCB_PASTEBUFFER->Y - PCB_PASTEBUFFER->BoundingBox.Y1, - MAX(0, - Width - (PCB_PASTEBUFFER->BoundingBox.X2 - - PCB_PASTEBUFFER->X)), MAX(0, Height - (PCB_PASTEBUFFER->BoundingBox.Y2 - PCB_PASTEBUFFER->Y))); - else - pcb_crosshair_set_range(0, 0, Width, Height); - if (pcb == PCB) pcb_board_changed(0); } Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 29212) +++ trunk/src/buffer.c (revision 29213) @@ -466,7 +466,6 @@ pcb_notify_crosshair_change(pcb_false); pcb_buffer_rotate(PCB_PASTEBUFFER, ang); - pcb_crosshair_range_to_buffer(); pcb_notify_crosshair_change(pcb_true); return 0; } @@ -582,7 +581,6 @@ pcb_notify_crosshair_change(pcb_false); pcb_buffer_scale(PCB_PASTEBUFFER, x, y, th, recurse); - pcb_crosshair_range_to_buffer(); pcb_notify_crosshair_change(pcb_true); return 0; } @@ -725,7 +723,6 @@ for (i = 0; i < PCB_MAX_BUFFER; i++) pcb_buffer_flip_side(pcb, &pcb_buffers[i]); - pcb_crosshair_range_to_buffer(); } void *pcb_move_obj_to_buffer(pcb_board_t *pcb, pcb_data_t *Destination, pcb_data_t *Src, int Type, void *Ptr1, void *Ptr2, void *Ptr3) @@ -898,12 +895,8 @@ void pcb_buffer_set_number(int Number) { - if (Number >= 0 && Number < PCB_MAX_BUFFER) { + if (Number >= 0 && Number < PCB_MAX_BUFFER) conf_set_design("editor/buffer_number", "%d", Number); - - /* do an update on the crosshair range */ - pcb_crosshair_range_to_buffer(); - } } /* loads footprint data from file/library into buffer (as subcircuit) @@ -1035,7 +1028,6 @@ if (numtmp < 0) numtmp = 4-numtmp; pcb_buffer_rotate90(PCB_PASTEBUFFER, (unsigned int)numtmp); - pcb_crosshair_range_to_buffer(); } break; @@ -1142,7 +1134,6 @@ pcb_set_buffer_bbox(PCB_PASTEBUFFER); PCB_PASTEBUFFER->X = pcb_round(((double)PCB_PASTEBUFFER->BoundingBox.X1 + (double)PCB_PASTEBUFFER->BoundingBox.X2) / 2.0); PCB_PASTEBUFFER->Y = pcb_round(((double)PCB_PASTEBUFFER->BoundingBox.Y1 + (double)PCB_PASTEBUFFER->BoundingBox.Y2) / 2.0); - pcb_crosshair_range_to_buffer(); break; case F_GetSource: Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 29212) +++ trunk/src/crosshair.c (revision 29213) @@ -879,8 +879,8 @@ struct snap_data snap_data; int ans; - pcb_crosshair.X = PCB_CLAMP(X, pcb_crosshair.MinX, pcb_crosshair.MaxX); - pcb_crosshair.Y = PCB_CLAMP(Y, pcb_crosshair.MinY, pcb_crosshair.MaxY); + 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); if (PCB->RatDraw) { nearest_grid_x = -PCB_MIL_TO_COORD(6); @@ -1045,17 +1045,6 @@ return pcb_false; } -void pcb_crosshair_set_range(pcb_coord_t MinX, pcb_coord_t MinY, pcb_coord_t MaxX, pcb_coord_t MaxY) -{ - pcb_crosshair.MinX = MAX(0, MinX); - pcb_crosshair.MinY = MAX(0, MinY); - pcb_crosshair.MaxX = MIN(PCB->hidlib.size_x, MaxX); - pcb_crosshair.MaxY = MIN(PCB->hidlib.size_y, MaxY); - - /* force update of position */ - pcb_crosshair_move_relative(0, 0); -} - /* --------------------------------------------------------------------------- * centers the displayed PCB around the specified point (X,Y) */ @@ -1082,11 +1071,6 @@ pcb_hid_set_line_cap(pcb_crosshair.GC, pcb_cap_round); pcb_hid_set_line_width(pcb_crosshair.GC, 1); - /* set default limits */ - pcb_crosshair.MinX = pcb_crosshair.MinY = 0; - pcb_crosshair.MaxX = PCB->hidlib.size_x; - pcb_crosshair.MaxY = PCB->hidlib.size_y; - /* Initialize the onpoint data. */ memset(&pcb_crosshair.onpoint_objs, 0, sizeof(vtop_t)); memset(&pcb_crosshair.old_onpoint_objs, 0, sizeof(vtop_t)); @@ -1106,21 +1090,6 @@ pcb_hid_destroy_gc(pcb_crosshair.GC); } -void pcb_crosshair_range_to_buffer(void) -{ - if (pcbhl_conf.editor.mode == PCB_MODE_PASTE_BUFFER) { - if (pcb_set_buffer_bbox(PCB_PASTEBUFFER) == 0) { - pcb_crosshair_set_range(PCB_PASTEBUFFER->X - PCB_PASTEBUFFER->bbox_naked.X1, - PCB_PASTEBUFFER->Y - PCB_PASTEBUFFER->bbox_naked.Y1, - PCB->hidlib.size_x - - (PCB_PASTEBUFFER->bbox_naked.X2 - PCB_PASTEBUFFER->X), - PCB->hidlib.size_y - (PCB_PASTEBUFFER->bbox_naked.Y2 - PCB_PASTEBUFFER->Y)); - } - else /* failed to calculate the bounding box of the buffer, it's probably a single-object move, allow the whole page */ - pcb_crosshair_set_range(0, 0, PCB->hidlib.size_x, PCB->hidlib.size_y); - } -} - void pcb_crosshair_set_local_ref(pcb_coord_t X, pcb_coord_t Y, pcb_bool Showing) { static pcb_mark_t old; Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 29212) +++ trunk/src/crosshair.h (revision 29213) @@ -64,7 +64,6 @@ pcb_hid_gc_t AttachGC; /* and for displaying buffer contents */ pcb_coord_t ptr_x, ptr_y; /* last seen raw mouse pointer x;y coords */ pcb_coord_t X, Y; /* (snapped) crosshair position */ - pcb_coord_t MinX, MinY, MaxX, MaxY; /* lowest and highest coordinates */ pcb_attached_line_t AttachedLine; /* data of new lines... */ pcb_attached_box_t AttachedBox; pcb_poly_t AttachedPolygon; @@ -96,14 +95,11 @@ void pcb_notify_mark_change(pcb_bool changes_complete); void pcb_crosshair_move_relative(pcb_coord_t, pcb_coord_t); pcb_bool pcb_crosshair_move_absolute(pcb_coord_t, pcb_coord_t); -void pcb_crosshair_set_range(pcb_coord_t, pcb_coord_t, pcb_coord_t, pcb_coord_t); void pcb_crosshair_init(void); void pcb_crosshair_uninit(void); void pcb_crosshair_grid_fit(pcb_coord_t, pcb_coord_t); void pcb_center_display(pcb_coord_t X, pcb_coord_t Y); -/* sets the crosshair range to the current buffer extents */ -void pcb_crosshair_range_to_buffer(void); void pcb_crosshair_set_local_ref(pcb_coord_t X, pcb_coord_t Y, pcb_bool Showing); /*** utility for plugins ***/ Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 29212) +++ trunk/src/file_act.c (revision 29213) @@ -171,7 +171,6 @@ PCB->hidlib.name = name; pcb_layervis_reset_stack(&PCB->hidlib); - pcb_crosshair_set_range(0, 0, PCB->hidlib.size_x, PCB->hidlib.size_y); pcb_center_display(PCB->hidlib.size_x / 2, PCB->hidlib.size_y / 2); pcb_board_changed(0); pcb_hid_redraw(PCB); Index: trunk/src/tool.c =================================================================== --- trunk/src/tool.c (revision 29212) +++ trunk/src/tool.c (revision 29213) @@ -326,7 +326,6 @@ void pcb_tool_attach_for_copy(pcb_hidlib_t *hl, pcb_coord_t PlaceX, pcb_coord_t PlaceY, pcb_bool do_rubberband) { - pcb_box_t box; pcb_coord_t mx = 0, my = 0; pcb_event(hl, PCB_EVENT_RUBBER_RESET, NULL); @@ -346,13 +345,6 @@ pcb_crosshair_set_local_ref(PlaceX - mx, PlaceY - my, pcb_true); pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; - /* get boundingbox of object and set cursor range */ - pcb_obj_get_bbox_naked(pcb_crosshair.AttachedObject.Type, pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3, &box); - pcb_crosshair_set_range(pcb_crosshair.AttachedObject.X - box.X1, - pcb_crosshair.AttachedObject.Y - box.Y1, - hl->size_x - (box.X2 - pcb_crosshair.AttachedObject.X), - hl->size_y - (box.Y2 - pcb_crosshair.AttachedObject.Y)); - /* get all attached objects if necessary */ if (do_rubberband && conf_core.editor.rubber_band_mode) pcb_event(hl, PCB_EVENT_RUBBER_LOOKUP_LINES, "ippp", pcb_crosshair.AttachedObject.Type, pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3); Index: trunk/src/tool_buffer.c =================================================================== --- trunk/src/tool_buffer.c (revision 29212) +++ trunk/src/tool_buffer.c (revision 29213) @@ -47,12 +47,10 @@ void pcb_tool_buffer_init(void) { - pcb_crosshair_range_to_buffer(); } void pcb_tool_buffer_uninit(void) { - pcb_crosshair_set_range(0, 0, PCB->hidlib.size_x, PCB->hidlib.size_y); } static void pcb_tool_buffer_notify_mode_(pcb_hidlib_t *hl, pcb_bool keep_ids) Index: trunk/src/tool_move.c =================================================================== --- trunk/src/tool_move.c (revision 29212) +++ trunk/src/tool_move.c (revision 29213) @@ -95,7 +95,6 @@ /* reset identifiers */ pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; - pcb_crosshair_set_range(0, 0, hl->size_x, hl->size_y); pcb_crosshair.extobj_edit = NULL; break; }