Index: trunk/doc-rnd/hacking/renames =================================================================== --- trunk/doc-rnd/hacking/renames (revision 5034) +++ trunk/doc-rnd/hacking/renames (revision 5035) @@ -955,3 +955,5 @@ Union_Jack_Crosshair_Shape -> pcb_ch_shape_union_jack Dozen_Crosshair_Shape -> pcb_ch_shape_dozen Crosshair_Shapes_Number -> pcb_ch_shape_NUM +Crosshair -> pcb_crosshair +Marked -> pcb_marked Index: trunk/src/action_helper.c =================================================================== --- trunk/src/action_helper.c (revision 5034) +++ trunk/src/action_helper.c (revision 5035) @@ -108,41 +108,41 @@ pcb_box_t *box; pcb_coord_t mx = 0, my = 0; - Crosshair.AttachedObject.RubberbandN = 0; + pcb_crosshair.AttachedObject.RubberbandN = 0; if (!conf_core.editor.snap_pin) { /* dither the grab point so that the mark, center, etc * will end up on a grid coordinate */ - GetGridLockCoordinates(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3, &mx, &my); + GetGridLockCoordinates(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, + pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3, &mx, &my); mx = pcb_grid_fit(mx, PCB->Grid, PCB->GridOffsetX) - mx; my = pcb_grid_fit(my, PCB->Grid, PCB->GridOffsetY) - my; } - Crosshair.AttachedObject.X = PlaceX - mx; - Crosshair.AttachedObject.Y = PlaceY - my; - if (!Marked.status || conf_core.editor.local_ref) + pcb_crosshair.AttachedObject.X = PlaceX - mx; + pcb_crosshair.AttachedObject.Y = PlaceY - my; + if (!pcb_marked.status || conf_core.editor.local_ref) pcb_crosshair_set_local_ref(PlaceX - mx, PlaceY - my, pcb_true); - Crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; /* get boundingbox of object and set cursor range */ - box = GetObjectBoundingBox(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); - pcb_crosshair_set_range(Crosshair.AttachedObject.X - box->X1, - Crosshair.AttachedObject.Y - box->Y1, - PCB->MaxWidth - (box->X2 - Crosshair.AttachedObject.X), - PCB->MaxHeight - (box->Y2 - Crosshair.AttachedObject.Y)); + box = GetObjectBoundingBox(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3); + pcb_crosshair_set_range(pcb_crosshair.AttachedObject.X - box->X1, + pcb_crosshair.AttachedObject.Y - box->Y1, + PCB->MaxWidth - (box->X2 - pcb_crosshair.AttachedObject.X), + PCB->MaxHeight - (box->Y2 - pcb_crosshair.AttachedObject.Y)); /* get all attached objects if necessary */ if ((conf_core.editor.mode != PCB_MODE_COPY) && conf_core.editor.rubber_band_mode) - pcb_rubber_band_lookup_lines(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); + pcb_rubber_band_lookup_lines(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3); if (conf_core.editor.mode != PCB_MODE_COPY && - (Crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT || - Crosshair.AttachedObject.Type == PCB_TYPE_VIA || - Crosshair.AttachedObject.Type == PCB_TYPE_LINE || Crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT)) - pcb_rubber_band_lookup_rat_lines(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); + (pcb_crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT || + pcb_crosshair.AttachedObject.Type == PCB_TYPE_VIA || + pcb_crosshair.AttachedObject.Type == PCB_TYPE_LINE || pcb_crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT)) + pcb_rubber_band_lookup_rat_lines(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3); } @@ -316,23 +316,23 @@ pcb_crosshair_save_mode(); saved_mode = pcb_true; pcb_crosshair_set_mode(gui->control_is_pressed()? PCB_MODE_COPY : PCB_MODE_MOVE); - Crosshair.AttachedObject.Ptr1 = Note.ptr1; - Crosshair.AttachedObject.Ptr2 = Note.ptr2; - Crosshair.AttachedObject.Ptr3 = Note.ptr3; - Crosshair.AttachedObject.Type = Note.Hit; + pcb_crosshair.AttachedObject.Ptr1 = Note.ptr1; + pcb_crosshair.AttachedObject.Ptr2 = Note.ptr2; + pcb_crosshair.AttachedObject.Ptr3 = Note.ptr3; + pcb_crosshair.AttachedObject.Type = Note.Hit; - if (Crosshair.drags != NULL) { - free(Crosshair.drags); - Crosshair.drags = NULL; + if (pcb_crosshair.drags != NULL) { + free(pcb_crosshair.drags); + pcb_crosshair.drags = NULL; } - Crosshair.dragx = Note.X; - Crosshair.dragy = Note.Y; + pcb_crosshair.dragx = Note.X; + pcb_crosshair.dragy = Note.Y; box.X1 = Note.X + SLOP * pixel_slop; box.X2 = Note.X - SLOP * pixel_slop; box.Y1 = Note.Y + SLOP * pixel_slop; box.Y2 = Note.Y - SLOP * pixel_slop; - Crosshair.drags = pcb_list_block(&box, &Crosshair.drags_len); - Crosshair.drags_current = 0; + pcb_crosshair.drags = pcb_list_block(&box, &pcb_crosshair.drags_len); + pcb_crosshair.drags_current = 0; AttachForCopy(Note.X, Note.Y); } else { @@ -349,8 +349,8 @@ if (!gui->shift_is_pressed() && pcb_select_block(&box, pcb_false)) pcb_board_set_changed_flag(pcb_true); pcb_notify_block(); - Crosshair.AttachedBox.Point1.X = Note.X; - Crosshair.AttachedBox.Point1.Y = Note.Y; + pcb_crosshair.AttachedBox.Point1.X = Note.X; + pcb_crosshair.AttachedBox.Point1.Y = Note.Y; } pcb_notify_crosshair_change(pcb_true); } @@ -403,10 +403,10 @@ Note.Hit = 0; } else if (conf_core.editor.mode == PCB_MODE_ARROW) { - box.X1 = Crosshair.AttachedBox.Point1.X; - box.Y1 = Crosshair.AttachedBox.Point1.Y; - box.X2 = Crosshair.AttachedBox.Point2.X; - box.Y2 = Crosshair.AttachedBox.Point2.Y; + box.X1 = pcb_crosshair.AttachedBox.Point1.X; + box.Y1 = pcb_crosshair.AttachedBox.Point1.Y; + box.X2 = pcb_crosshair.AttachedBox.Point2.X; + box.Y2 = pcb_crosshair.AttachedBox.Point2.Y; pcb_undo_restore_serial(); if (pcb_select_block(&box, pcb_true)) @@ -413,7 +413,7 @@ pcb_board_set_changed_flag(pcb_true); else if (Bumped) pcb_undo_inc_serial(); - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; } if (saved_mode) pcb_crosshair_restore_mode(); @@ -427,15 +427,15 @@ static void AdjustAttachedBox(void) { if (conf_core.editor.mode == PCB_MODE_ARC) { - Crosshair.AttachedBox.otherway = gui->shift_is_pressed(); + pcb_crosshair.AttachedBox.otherway = gui->shift_is_pressed(); return; } - switch (Crosshair.AttachedBox.State) { + switch (pcb_crosshair.AttachedBox.State) { case PCB_CH_STATE_SECOND: /* one corner is selected */ { /* update coordinates */ - Crosshair.AttachedBox.Point2.X = Crosshair.X; - Crosshair.AttachedBox.Point2.Y = Crosshair.Y; + pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.X; + pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.Y; break; } } @@ -448,9 +448,9 @@ /* update at least an attached block (selection) */ case PCB_MODE_NO: case PCB_MODE_ARROW: - if (Crosshair.AttachedBox.State) { - Crosshair.AttachedBox.Point2.X = Crosshair.X; - Crosshair.AttachedBox.Point2.Y = Crosshair.Y; + if (pcb_crosshair.AttachedBox.State) { + pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.X; + pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.Y; } break; @@ -488,43 +488,43 @@ int type = PCB_TYPE_NONE; void *ptr1, *ptr2, *ptr3; - if (!Marked.status || conf_core.editor.local_ref) - pcb_crosshair_set_local_ref(Crosshair.X, Crosshair.Y, pcb_true); - switch (Crosshair.AttachedLine.State) { + if (!pcb_marked.status || conf_core.editor.local_ref) + pcb_crosshair_set_local_ref(pcb_crosshair.X, pcb_crosshair.Y, pcb_true); + switch (pcb_crosshair.AttachedLine.State) { case PCB_CH_STATE_FIRST: /* first point */ - if (PCB->RatDraw && pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr1, &ptr1) == PCB_TYPE_NONE) { + if (PCB->RatDraw && pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr1, &ptr1) == PCB_TYPE_NONE) { gui->beep(); break; } if (conf_core.editor.auto_drc && conf_core.editor.mode == PCB_MODE_LINE) { - type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3); - pcb_lookup_conn(Crosshair.X, Crosshair.Y, pcb_true, 1, PCB_FLAG_FOUND); + type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_PIN | PCB_TYPE_PAD | PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3); + pcb_lookup_conn(pcb_crosshair.X, pcb_crosshair.Y, pcb_true, 1, PCB_FLAG_FOUND); } if (type == PCB_TYPE_PIN || type == PCB_TYPE_VIA) { - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = ((pcb_pin_t *) ptr2)->X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = ((pcb_pin_t *) ptr2)->Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = ((pcb_pin_t *) ptr2)->X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = ((pcb_pin_t *) ptr2)->Y; } else if (type == PCB_TYPE_PAD) { pcb_pad_t *pad = (pcb_pad_t *) ptr2; - double d1 = pcb_distance(Crosshair.X, Crosshair.Y, pad->Point1.X, pad->Point1.Y); - double d2 = pcb_distance(Crosshair.X, Crosshair.Y, pad->Point2.X, pad->Point2.Y); - double dm = pcb_distance(Crosshair.X, Crosshair.Y, (pad->Point1.X + pad->Point2.X) / 2, (pad->Point1.Y + pad->Point2.Y)/2); + double d1 = pcb_distance(pcb_crosshair.X, pcb_crosshair.Y, pad->Point1.X, pad->Point1.Y); + double d2 = pcb_distance(pcb_crosshair.X, pcb_crosshair.Y, pad->Point2.X, pad->Point2.Y); + double dm = pcb_distance(pcb_crosshair.X, pcb_crosshair.Y, (pad->Point1.X + pad->Point2.X) / 2, (pad->Point1.Y + pad->Point2.Y)/2); if ((dm <= d1) && (dm <= d2)) { /* prefer to snap to the middle of a pin if that's the closest */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.Y; } else if (d2 < d1) { /* else select the closest endpoint */ - Crosshair.AttachedLine.Point1 = Crosshair.AttachedLine.Point2 = pad->Point2; + pcb_crosshair.AttachedLine.Point1 = pcb_crosshair.AttachedLine.Point2 = pad->Point2; } else { - Crosshair.AttachedLine.Point1 = Crosshair.AttachedLine.Point2 = pad->Point1; + pcb_crosshair.AttachedLine.Point1 = pcb_crosshair.AttachedLine.Point2 = pad->Point1; } } else { - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.Y; } - Crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; break; case PCB_CH_STATE_SECOND: @@ -531,7 +531,7 @@ /* fall through to third state too */ lastLayer = CURRENT; default: /* all following points */ - Crosshair.AttachedLine.State = PCB_CH_STATE_THIRD; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_THIRD; break; } } @@ -539,15 +539,15 @@ void pcb_notify_block(void) { pcb_notify_crosshair_change(pcb_false); - switch (Crosshair.AttachedBox.State) { + switch (pcb_crosshair.AttachedBox.State) { case PCB_CH_STATE_FIRST: /* setup first point */ - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Crosshair.X; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Crosshair.Y; - Crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.X; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.Y; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; break; case PCB_CH_STATE_SECOND: /* setup second point */ - Crosshair.AttachedBox.State = PCB_CH_STATE_THIRD; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_THIRD; break; } pcb_notify_crosshair_change(pcb_true); @@ -613,11 +613,11 @@ case PCB_MODE_ARC: { - switch (Crosshair.AttachedBox.State) { + switch (pcb_crosshair.AttachedBox.State) { case PCB_CH_STATE_FIRST: - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Note.X; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Note.Y; - Crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = Note.X; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = Note.Y; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; break; case PCB_CH_STATE_SECOND: @@ -627,10 +627,10 @@ pcb_coord_t wx, wy; pcb_angle_t sa, dir; - wx = Note.X - Crosshair.AttachedBox.Point1.X; - wy = Note.Y - Crosshair.AttachedBox.Point1.Y; - if (PCB_XOR(Crosshair.AttachedBox.otherway, coord_abs(wy) > coord_abs(wx))) { - Crosshair.AttachedBox.Point2.X = Crosshair.AttachedBox.Point1.X + coord_abs(wy) * PCB_SGNZ(wx); + wx = Note.X - pcb_crosshair.AttachedBox.Point1.X; + wy = 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; #ifdef ARC45 if (abs(wy) / 2 >= abs(wx)) @@ -640,7 +640,7 @@ dir = (PCB_SGNZ(wx) == PCB_SGNZ(wy)) ? 90 : -90; } else { - Crosshair.AttachedBox.Point2.Y = Crosshair.AttachedBox.Point1.Y + coord_abs(wx) * PCB_SGNZ(wy); + pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.AttachedBox.Point1.Y + coord_abs(wx) * PCB_SGNZ(wy); sa = (wy >= 0) ? -90 : 90; #ifdef ARC45 if (abs(wx) / 2 >= abs(wy)) @@ -651,8 +651,8 @@ wy = wx; } if (coord_abs(wy) > 0 && (arc = pcb_arc_new(CURRENT, - Crosshair.AttachedBox.Point2.X, - Crosshair.AttachedBox.Point2.Y, + pcb_crosshair.AttachedBox.Point2.X, + pcb_crosshair.AttachedBox.Point2.Y, coord_abs(wy), coord_abs(wy), sa, @@ -663,14 +663,14 @@ pcb_box_t *bx; bx = pcb_arc_get_ends(arc); - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = bx->X2; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = bx->Y2; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = bx->X2; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = bx->Y2; pcb_undo_add_obj_to_create(PCB_TYPE_ARC, CURRENT, arc, arc); pcb_undo_inc_serial(); addedLines++; DrawArc(CURRENT, arc); pcb_draw(); - Crosshair.AttachedBox.State = PCB_CH_STATE_THIRD; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_THIRD; } break; } @@ -740,7 +740,7 @@ case PCB_MODE_LINE: /* do update of position */ pcb_notify_line(); - if (Crosshair.AttachedLine.State != PCB_CH_STATE_THIRD) + if (pcb_crosshair.AttachedLine.State != PCB_CH_STATE_THIRD) break; /* Remove anchor if clicking on start point; @@ -749,7 +749,7 @@ * Instead use a very small delta, or change * the file after saving. */ - if (Crosshair.X == Crosshair.AttachedLine.Point1.X && Crosshair.Y == Crosshair.AttachedLine.Point1.Y) { + if (pcb_crosshair.X == pcb_crosshair.AttachedLine.Point1.X && pcb_crosshair.Y == pcb_crosshair.AttachedLine.Point1.Y) { pcb_crosshair_set_mode(PCB_MODE_LINE); break; } @@ -761,8 +761,8 @@ pcb_undo_add_obj_to_create(PCB_TYPE_RATLINE, line, line, line); pcb_undo_inc_serial(); DrawRat(line); - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y; pcb_draw(); } break; @@ -774,16 +774,16 @@ int maybe_found_flag; if (conf_core.editor.line_refraction - && Crosshair.AttachedLine.Point1.X == - Crosshair.AttachedLine.Point2.X - && Crosshair.AttachedLine.Point1.Y == - Crosshair.AttachedLine.Point2.Y - && (Crosshair.AttachedLine.Point2.X != Note.X || Crosshair.AttachedLine.Point2.Y != Note.Y)) { + && pcb_crosshair.AttachedLine.Point1.X == + pcb_crosshair.AttachedLine.Point2.X + && pcb_crosshair.AttachedLine.Point1.Y == + pcb_crosshair.AttachedLine.Point2.Y + && (pcb_crosshair.AttachedLine.Point2.X != Note.X || pcb_crosshair.AttachedLine.Point2.Y != 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. */ - Crosshair.AttachedLine.Point2.X = Note.X; - Crosshair.AttachedLine.Point2.Y = Note.Y; + pcb_crosshair.AttachedLine.Point2.X = Note.X; + pcb_crosshair.AttachedLine.Point2.Y = Note.Y; } if (conf_core.editor.auto_drc @@ -792,14 +792,14 @@ else maybe_found_flag = 0; - if ((Crosshair.AttachedLine.Point1.X != - Crosshair.AttachedLine.Point2.X || Crosshair.AttachedLine.Point1.Y != Crosshair.AttachedLine.Point2.Y) + if ((pcb_crosshair.AttachedLine.Point1.X != + pcb_crosshair.AttachedLine.Point2.X || pcb_crosshair.AttachedLine.Point1.Y != pcb_crosshair.AttachedLine.Point2.Y) && (line = pcb_line_new_merge(CURRENT, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, + pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, + pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, conf_core.design.line_thickness, 2 * conf_core.design.clearance, pcb_flag_make(maybe_found_flag | @@ -815,14 +815,14 @@ if (PCB->ViaOn && GetLayerGroupNumberByPointer(CURRENT) != GetLayerGroupNumberByPointer(lastLayer) && pcb_search_obj_by_location(PCB_TYPEMASK_PIN, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, + pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, conf_core.design.via_thickness / 2) == PCB_TYPE_NONE && (via = pcb_via_new(PCB->Data, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, + pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, conf_core.design.via_thickness, 2 * conf_core.design.clearance, 0, conf_core.design.via_drilling_hole, NULL, pcb_no_flags())) != NULL) { pcb_undo_add_obj_to_create(PCB_TYPE_VIA, via, via, via); @@ -829,16 +829,16 @@ DrawVia(via); } /* copy the coordinates */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y; pcb_undo_inc_serial(); lastLayer = CURRENT; } - if (conf_core.editor.line_refraction && (Note.X != Crosshair.AttachedLine.Point2.X || Note.Y != Crosshair.AttachedLine.Point2.Y) + if (conf_core.editor.line_refraction && (Note.X != pcb_crosshair.AttachedLine.Point2.X || Note.Y != pcb_crosshair.AttachedLine.Point2.Y) && (line = pcb_line_new_merge(CURRENT, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, + pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, Note.X, Note.Y, conf_core.design.line_thickness, 2 * conf_core.design.clearance, @@ -849,10 +849,10 @@ pcb_undo_inc_serial(); DrawLine(CURRENT, line); /* move to new start point */ - Crosshair.AttachedLine.Point1.X = Note.X; - Crosshair.AttachedLine.Point1.Y = Note.Y; - Crosshair.AttachedLine.Point2.X = Note.X; - Crosshair.AttachedLine.Point2.Y = Note.Y; + pcb_crosshair.AttachedLine.Point1.X = Note.X; + pcb_crosshair.AttachedLine.Point1.Y = Note.Y; + pcb_crosshair.AttachedLine.Point2.X = Note.X; + pcb_crosshair.AttachedLine.Point2.Y = Note.Y; if (conf_core.editor.swap_start_direction) { @@ -861,8 +861,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 */ - Marked.X = Note.X; - Marked.Y = Note.Y; + pcb_marked.X = Note.X; + pcb_marked.Y = Note.Y; } pcb_draw(); } @@ -875,9 +875,9 @@ /* create rectangle if both corners are determined * and width, height are != 0 */ - if (Crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && - Crosshair.AttachedBox.Point1.X != Crosshair.AttachedBox.Point2.X && - Crosshair.AttachedBox.Point1.Y != Crosshair.AttachedBox.Point2.Y) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && + pcb_crosshair.AttachedBox.Point1.X != pcb_crosshair.AttachedBox.Point2.X && + pcb_crosshair.AttachedBox.Point1.Y != pcb_crosshair.AttachedBox.Point2.Y) { pcb_polygon_t *polygon; int flags = PCB_FLAG_CLEARPOLY; @@ -884,10 +884,10 @@ if (conf_core.editor.full_poly) flags |= PCB_FLAG_FULLPOLY; if ((polygon = pcb_poly_new_from_rectangle(CURRENT, - Crosshair.AttachedBox.Point1.X, - Crosshair.AttachedBox.Point1.Y, - Crosshair.AttachedBox.Point2.X, - Crosshair.AttachedBox.Point2.Y, pcb_flag_make(flags))) != NULL) { + pcb_crosshair.AttachedBox.Point1.X, + pcb_crosshair.AttachedBox.Point1.Y, + pcb_crosshair.AttachedBox.Point2.X, + pcb_crosshair.AttachedBox.Point2.Y, pcb_flag_make(flags))) != NULL) { pcb_undo_add_obj_to_create(PCB_TYPE_POLYGON, CURRENT, polygon, polygon); pcb_undo_inc_serial(); DrawPolygon(CURRENT, polygon); @@ -895,7 +895,7 @@ } /* reset state to 'first corner' */ - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; } break; @@ -925,14 +925,14 @@ case PCB_MODE_POLYGON: { - pcb_point_t *points = Crosshair.AttachedPolygon.Points; - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN; + pcb_point_t *points = pcb_crosshair.AttachedPolygon.Points; + pcb_cardinal_t n = pcb_crosshair.AttachedPolygon.PointN; /* do update of position; use the 'PCB_MODE_LINE' mechanism */ pcb_notify_line(); /* check if this is the last point of a polygon */ - if (n >= 3 && points[0].X == Crosshair.AttachedLine.Point2.X && points[0].Y == Crosshair.AttachedLine.Point2.Y) { + if (n >= 3 && points[0].X == pcb_crosshair.AttachedLine.Point2.X && points[0].Y == pcb_crosshair.AttachedLine.Point2.Y) { pcb_hid_actionl("Polygon", "Close", NULL); pcb_polygon_close_poly(); break; @@ -939,7 +939,7 @@ } /* Someone clicking twice on the same point ('doubleclick'): close polygon */ - if (n >= 3 && points[n - 1].X == Crosshair.AttachedLine.Point2.X && points[n - 1].Y == Crosshair.AttachedLine.Point2.Y) { + if (n >= 3 && points[n - 1].X == pcb_crosshair.AttachedLine.Point2.X && points[n - 1].Y == pcb_crosshair.AttachedLine.Point2.Y) { pcb_hid_actionl("Polygon", "Close", NULL); break; } @@ -947,18 +947,18 @@ /* create new point if it's the first one or if it's * different to the last one */ - if (!n || points[n - 1].X != Crosshair.AttachedLine.Point2.X || points[n - 1].Y != Crosshair.AttachedLine.Point2.Y) { - pcb_poly_point_new(&Crosshair.AttachedPolygon, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); + if (!n || points[n - 1].X != pcb_crosshair.AttachedLine.Point2.X || points[n - 1].Y != pcb_crosshair.AttachedLine.Point2.Y) { + pcb_poly_point_new(&pcb_crosshair.AttachedPolygon, pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y); /* copy the coordinates */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y; } if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - Marked.X = Note.X; - Marked.Y = Note.Y; + pcb_marked.X = Note.X; + pcb_marked.Y = Note.Y; } break; @@ -966,33 +966,33 @@ case PCB_MODE_POLYGON_HOLE: { - switch (Crosshair.AttachedObject.State) { + switch (pcb_crosshair.AttachedObject.State) { /* first notify, lookup object */ case PCB_CH_STATE_FIRST: - Crosshair.AttachedObject.Type = + pcb_crosshair.AttachedObject.Type = pcb_search_screen(Note.X, Note.Y, PCB_TYPE_POLYGON, - &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); + &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); - if (Crosshair.AttachedObject.Type == PCB_TYPE_NONE) { + if (pcb_crosshair.AttachedObject.Type == PCB_TYPE_NONE) { pcb_message(PCB_MSG_DEFAULT, "The first point of a polygon hole must be on a polygon.\n"); break; /* don't start doing anything if clicket out of polys */ } if (PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_polygon_t *) - Crosshair.AttachedObject.Ptr2)) { + pcb_crosshair.AttachedObject.Ptr2)) { pcb_message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_NONE; break; } else - Crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; /* fall thru: first click is also the first point of the poly hole */ /* second notify, insert new point into object */ case PCB_CH_STATE_SECOND: { - pcb_point_t *points = Crosshair.AttachedPolygon.Points; - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN; + pcb_point_t *points = pcb_crosshair.AttachedPolygon.Points; + pcb_cardinal_t n = pcb_crosshair.AttachedPolygon.PointN; pcb_polyarea_t *original, *new_hole, *result; pcb_flag_t Flags; @@ -1001,16 +1001,16 @@ if (conf_core.editor.orthogonal_moves) { /* set the mark to the new starting point so ortho works */ - Marked.X = Note.X; - Marked.Y = Note.Y; + pcb_marked.X = Note.X; + pcb_marked.Y = Note.Y; } /* check if this is the last point of a polygon */ - if (n >= 3 && points[0].X == Crosshair.AttachedLine.Point2.X && points[0].Y == Crosshair.AttachedLine.Point2.Y) { + if (n >= 3 && points[0].X == pcb_crosshair.AttachedLine.Point2.X && points[0].Y == pcb_crosshair.AttachedLine.Point2.Y) { /* Create pcb_polyarea_ts from the original polygon * and the new hole polygon */ - original = pcb_poly_from_poly((pcb_polygon_t *) Crosshair.AttachedObject.Ptr2); - new_hole = pcb_poly_from_poly(&Crosshair.AttachedPolygon); + original = pcb_poly_from_poly((pcb_polygon_t *) pcb_crosshair.AttachedObject.Ptr2); + new_hole = pcb_poly_from_poly(&pcb_crosshair.AttachedPolygon); /* Subtract the hole from the original polygon shape */ pcb_polyarea_boolean_free(original, new_hole, &result, PBO_SUB); @@ -1019,18 +1019,18 @@ * and place them on the page. Delete the original polygon. */ pcb_undo_save_serial(); - Flags = ((pcb_polygon_t *) Crosshair.AttachedObject.Ptr2)->Flags; - pcb_poly_to_polygons_on_layer(PCB->Data, (pcb_layer_t *) Crosshair.AttachedObject.Ptr1, result, Flags); + Flags = ((pcb_polygon_t *) pcb_crosshair.AttachedObject.Ptr2)->Flags; + pcb_poly_to_polygons_on_layer(PCB->Data, (pcb_layer_t *) pcb_crosshair.AttachedObject.Ptr1, result, Flags); pcb_remove_object(PCB_TYPE_POLYGON, - Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3); + pcb_crosshair.AttachedObject.Ptr1, pcb_crosshair.AttachedObject.Ptr2, pcb_crosshair.AttachedObject.Ptr3); pcb_undo_restore_serial(); pcb_undo_inc_serial(); pcb_draw(); /* reset state of attached line */ - memset(&Crosshair.AttachedPolygon, 0, sizeof(pcb_polygon_t)); - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + memset(&pcb_crosshair.AttachedPolygon, 0, sizeof(pcb_polygon_t)); + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; addedLines = 0; break; @@ -1039,13 +1039,13 @@ /* create new point if it's the first one or if it's * different to the last one */ - if (!n || points[n - 1].X != Crosshair.AttachedLine.Point2.X || points[n - 1].Y != Crosshair.AttachedLine.Point2.Y) { - pcb_poly_point_new(&Crosshair.AttachedPolygon, - Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); + if (!n || points[n - 1].X != pcb_crosshair.AttachedLine.Point2.X || points[n - 1].Y != pcb_crosshair.AttachedLine.Point2.Y) { + pcb_poly_point_new(&pcb_crosshair.AttachedPolygon, + pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y); /* copy the coordinates */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y; } break; } @@ -1110,10 +1110,10 @@ pcb_rubberband_t *ptr; int i; - Crosshair.AttachedObject.RubberbandN = 0; + pcb_crosshair.AttachedObject.RubberbandN = 0; pcb_rubber_band_lookup_rat_lines(type, ptr1, ptr2, ptr3); - ptr = Crosshair.AttachedObject.Rubberband; - for (i = 0; i < Crosshair.AttachedObject.RubberbandN; i++) { + ptr = pcb_crosshair.AttachedObject.Rubberband; + for (i = 0; i < pcb_crosshair.AttachedObject.RubberbandN; i++) { if (PCB->RatOn) EraseRat((pcb_rat_t *) ptr->Line); if (PCB_FLAG_TEST(PCB_FLAG_RUBBEREND, ptr->Line)) @@ -1137,20 +1137,20 @@ /* both are almost the same */ case PCB_MODE_COPY: case PCB_MODE_MOVE: - switch (Crosshair.AttachedObject.State) { + switch (pcb_crosshair.AttachedObject.State) { /* first notify, lookup object */ case PCB_CH_STATE_FIRST: { int types = (conf_core.editor.mode == PCB_MODE_COPY) ? PCB_COPY_TYPES : PCB_MOVE_TYPES; - Crosshair.AttachedObject.Type = + pcb_crosshair.AttachedObject.Type = pcb_search_screen(Note.X, Note.Y, types, - &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); - if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { + &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); + if (pcb_crosshair.AttachedObject.Type != PCB_TYPE_NONE) { if (conf_core.editor.mode == PCB_MODE_MOVE && PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_pin_t *) - Crosshair.AttachedObject.Ptr2)) { + pcb_crosshair.AttachedObject.Ptr2)) { pcb_message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_NONE; } else AttachForCopy(Note.X, Note.Y); @@ -1161,23 +1161,23 @@ /* second notify, move or copy object */ case PCB_CH_STATE_SECOND: if (conf_core.editor.mode == PCB_MODE_COPY) - pcb_copy_obj(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, - Crosshair.AttachedObject.Ptr3, Note.X - Crosshair.AttachedObject.X, Note.Y - Crosshair.AttachedObject.Y); + pcb_copy_obj(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, + pcb_crosshair.AttachedObject.Ptr2, + pcb_crosshair.AttachedObject.Ptr3, Note.X - pcb_crosshair.AttachedObject.X, Note.Y - pcb_crosshair.AttachedObject.Y); else { - pcb_move_obj_and_rubberband(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, - Crosshair.AttachedObject.Ptr3, - Note.X - Crosshair.AttachedObject.X, Note.Y - Crosshair.AttachedObject.Y); + pcb_move_obj_and_rubberband(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, + pcb_crosshair.AttachedObject.Ptr2, + pcb_crosshair.AttachedObject.Ptr3, + Note.X - pcb_crosshair.AttachedObject.X, Note.Y - pcb_crosshair.AttachedObject.Y); pcb_crosshair_set_local_ref(0, 0, pcb_false); } pcb_board_set_changed_flag(pcb_true); /* reset identifiers */ - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - Crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_NONE; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; break; } break; @@ -1184,31 +1184,31 @@ /* insert a point into a polygon/line/... */ case PCB_MODE_INSERT_POINT: - switch (Crosshair.AttachedObject.State) { + switch (pcb_crosshair.AttachedObject.State) { /* first notify, lookup object */ case PCB_CH_STATE_FIRST: - Crosshair.AttachedObject.Type = + pcb_crosshair.AttachedObject.Type = pcb_search_screen(Note.X, Note.Y, PCB_INSERT_TYPES, - &Crosshair.AttachedObject.Ptr1, &Crosshair.AttachedObject.Ptr2, &Crosshair.AttachedObject.Ptr3); + &pcb_crosshair.AttachedObject.Ptr1, &pcb_crosshair.AttachedObject.Ptr2, &pcb_crosshair.AttachedObject.Ptr3); - if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { + if (pcb_crosshair.AttachedObject.Type != PCB_TYPE_NONE) { if (PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_polygon_t *) - Crosshair.AttachedObject.Ptr2)) { + pcb_crosshair.AttachedObject.Ptr2)) { pcb_message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_NONE; break; } else { /* get starting point of nearest segment */ - if (Crosshair.AttachedObject.Type == PCB_TYPE_POLYGON) { - fake.poly = (pcb_polygon_t *) Crosshair.AttachedObject.Ptr2; + if (pcb_crosshair.AttachedObject.Type == PCB_TYPE_POLYGON) { + fake.poly = (pcb_polygon_t *) pcb_crosshair.AttachedObject.Ptr2; polyIndex = pcb_poly_get_lowest_distance_point(fake.poly, Note.X, Note.Y); fake.line.Point1 = fake.poly->Points[polyIndex]; fake.line.Point2 = fake.poly->Points[pcb_poly_contour_prev_point(fake.poly, polyIndex)]; - Crosshair.AttachedObject.Ptr2 = &fake.line; + pcb_crosshair.AttachedObject.Ptr2 = &fake.line; } - Crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; InsertedPoint = *pcb_adjust_insert_point(); } } @@ -1216,19 +1216,19 @@ /* second notify, insert new point into object */ case PCB_CH_STATE_SECOND: - if (Crosshair.AttachedObject.Type == PCB_TYPE_POLYGON) + if (pcb_crosshair.AttachedObject.Type == PCB_TYPE_POLYGON) pcb_insert_point_in_object(PCB_TYPE_POLYGON, - Crosshair.AttachedObject.Ptr1, fake.poly, + pcb_crosshair.AttachedObject.Ptr1, fake.poly, &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); else - pcb_insert_point_in_object(Crosshair.AttachedObject.Type, - Crosshair.AttachedObject.Ptr1, - Crosshair.AttachedObject.Ptr2, &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); + pcb_insert_point_in_object(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, + pcb_crosshair.AttachedObject.Ptr2, &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); pcb_board_set_changed_flag(pcb_true); /* reset identifiers */ - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - Crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_NONE; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; break; } break; Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 5034) +++ trunk/src/board.c (revision 5035) @@ -259,8 +259,8 @@ { if (Grid >= 1 && Grid <= MAX_GRID) { if (align) { - PCB->GridOffsetX = Crosshair.X % Grid; - PCB->GridOffsetY = Crosshair.Y % Grid; + PCB->GridOffsetX = pcb_crosshair.X % Grid; + PCB->GridOffsetY = pcb_crosshair.Y % Grid; } PCB->Grid = Grid; conf_set_design("editor/grid", "%$mS", Grid); @@ -275,7 +275,7 @@ if (Size >= MIN_LINESIZE && Size <= MAX_LINESIZE) { conf_set_design("design/line_thickness", "%$mS", Size); if (conf_core.editor.auto_drc) - pcb_crosshair_grid_fit(Crosshair.X, Crosshair.Y); + pcb_crosshair_grid_fit(pcb_crosshair.X, pcb_crosshair.Y); } } Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 5034) +++ trunk/src/buffer.c (revision 5035) @@ -130,8 +130,8 @@ Buffer->Y = Y; } else { - Buffer->X = Crosshair.X; - Buffer->Y = Crosshair.Y; + Buffer->X = pcb_crosshair.X; + Buffer->Y = pcb_crosshair.Y; } pcb_notify_crosshair_change(pcb_true); } Index: trunk/src/change_act.c =================================================================== --- trunk/src/change_act.c (revision 5034) +++ trunk/src/change_act.c (revision 5035) @@ -195,7 +195,7 @@ int type; void *ptr1, *ptr2, *ptr3; - if ((type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) + if ((type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) if (PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_pin_t *) ptr2)) pcb_message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); if (set_object(type, ptr1, ptr2, ptr3)) @@ -394,7 +394,7 @@ int funcid = pcb_funchash_get(function, NULL); if (funcid == F_Object) - type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); if (strcmp(argv[1], "style") == 0) { if (pcb_get_style_size(funcid, &value, type, 0) != 0) @@ -671,10 +671,10 @@ int i; pcb_undo_restore_serial(); - Crosshair.AttachedObject.RubberbandN = 0; + pcb_crosshair.AttachedObject.RubberbandN = 0; pcb_rubber_band_lookup_rat_lines(type, ptr1, ptr2, ptr3); - ptr = Crosshair.AttachedObject.Rubberband; - for (i = 0; i < Crosshair.AttachedObject.RubberbandN; i++, ptr++) { + ptr = pcb_crosshair.AttachedObject.Rubberband; + for (i = 0; i < pcb_crosshair.AttachedObject.RubberbandN; i++, ptr++) { if (PCB->RatOn) EraseRat((pcb_rat_t *) ptr->Line); pcb_undo_move_obj_to_remove(PCB_TYPE_RATLINE, ptr->Line, ptr->Line, ptr->Line); @@ -1110,7 +1110,7 @@ void *ptr1, *ptr2, *ptr3; gui->get_coords(_("Select an Object"), &x, &y); - if ((type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) + if ((type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_CHANGEOCTAGON_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) if (pcb_clr_obj_octagon(type, ptr1, ptr2, ptr3)) pcb_board_set_changed_flag(pcb_true); break; @@ -1186,7 +1186,7 @@ if (absolute) switch (pcb_funchash_get(function, NULL)) { case F_Object: - if ((type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_CHANGETHERMAL_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { + if ((type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_CHANGETHERMAL_TYPES, &ptr1, &ptr2, &ptr3)) != PCB_TYPE_NONE) { pcb_chg_obj_thermal(type, ptr1, ptr2, ptr3, kind); pcb_undo_inc_serial(); pcb_draw(); @@ -1395,7 +1395,7 @@ int funcid = pcb_funchash_get(function, NULL); if (funcid == F_Object) - type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); { /* convert angle from string */ char *end; @@ -1467,7 +1467,7 @@ int funcid = pcb_funchash_get(function, NULL); if (funcid == F_Object) - type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_CHANGESIZE_TYPES, &ptr1, &ptr2, &ptr3); value = pcb_get_value(delta, units, &absolute, NULL); Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 5034) +++ trunk/src/crosshair.c (revision 5035) @@ -51,8 +51,8 @@ int x, y; } point; -pcb_crosshair_t Crosshair; /* information about cursor settings */ -pcb_mark_t Marked; /* a cross-hair mark */ +pcb_crosshair_t pcb_crosshair; /* information about cursor settings */ +pcb_mark_t pcb_marked; /* a cross-hair mark */ /* --------------------------------------------------------------------------- @@ -73,7 +73,7 @@ moved_pv.X += x; moved_pv.Y += y; - gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &moved_pv, pcb_true, pcb_false); + gui->thindraw_pcb_pv(pcb_crosshair.GC, pcb_crosshair.GC, &moved_pv, pcb_true, pcb_false); } static void draw_dashed_line(pcb_hid_gc_t GC, pcb_coord_t x1, pcb_coord_t y1, pcb_coord_t x2, pcb_coord_t y2) @@ -86,13 +86,13 @@ if (len_squared < 1000000) { /* line too short, just draw it - TODO: magic value; with a proper geo lib this would be gone anyway */ - gui->draw_line(Crosshair.GC, x1, y1, x2, y2); + gui->draw_line(pcb_crosshair.GC, x1, y1, x2, y2); return; } /* first seg is drawn from x1, y1 with no rounding error due to n-1 == 0 */ for(n = 1; n < segs; n+=2) - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, x1 + (dx * (double)(n-1) / (double)segs), y1 + (dy * (double)(n-1) / (double)segs), x1 + (dx * (double)n / (double)segs), y1 + (dy * (double)n / (double)segs)); @@ -99,7 +99,7 @@ /* make sure the last segment is drawn properly to x2 and y2, don't leave room for rounding errors */ - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, x2 - (dx / (double)segs), y2 - (dy / (double)segs), x2, y2); } @@ -118,7 +118,7 @@ continue; if (dash_last) { - draw_dashed_line(Crosshair.GC, + draw_dashed_line(pcb_crosshair.GC, polygon->Points[i].X + dx, polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy); break; /* skip normal line draw below */ @@ -126,7 +126,7 @@ } /* normal contour line */ - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, polygon->Points[i].X + dx, polygon->Points[i].Y + dy, polygon->Points[next].X + dx, polygon->Points[next].Y + dy); } @@ -143,14 +143,14 @@ pcb_angle_t sa, dir; pcb_coord_t wid = thick / 2; - wx = Crosshair.X - Crosshair.AttachedBox.Point1.X; - wy = Crosshair.Y - Crosshair.AttachedBox.Point1.Y; + wx = pcb_crosshair.X - pcb_crosshair.AttachedBox.Point1.X; + wy = pcb_crosshair.Y - pcb_crosshair.AttachedBox.Point1.Y; if (wx == 0 && wy == 0) return; - arc.X = Crosshair.AttachedBox.Point1.X; - arc.Y = Crosshair.AttachedBox.Point1.Y; - if (PCB_XOR(Crosshair.AttachedBox.otherway, coord_abs(wy) > coord_abs(wx))) { - arc.X = Crosshair.AttachedBox.Point1.X + coord_abs(wy) * PCB_SGNZ(wx); + arc.X = pcb_crosshair.AttachedBox.Point1.X; + arc.Y = pcb_crosshair.AttachedBox.Point1.Y; + if (PCB_XOR(pcb_crosshair.AttachedBox.otherway, coord_abs(wy) > coord_abs(wx))) { + arc.X = pcb_crosshair.AttachedBox.Point1.X + coord_abs(wy) * PCB_SGNZ(wx); sa = (wx >= 0) ? 0 : 180; #ifdef ARC45 if (coord_abs(wy) >= 2 * coord_abs(wx)) @@ -160,7 +160,7 @@ dir = (PCB_SGNZ(wx) == PCB_SGNZ(wy)) ? 90 : -90; } else { - arc.Y = Crosshair.AttachedBox.Point1.Y + coord_abs(wx) * PCB_SGNZ(wy); + arc.Y = pcb_crosshair.AttachedBox.Point1.Y + coord_abs(wx) * PCB_SGNZ(wy); sa = (wy >= 0) ? -90 : 90; #ifdef ARC45 if (coord_abs(wx) >= 2 * coord_abs(wy)) @@ -176,11 +176,11 @@ arc.Width = arc.Height = wy; bx = pcb_arc_get_ends(&arc); /* sa = sa - 180; */ - gui->draw_arc(Crosshair.GC, arc.X, arc.Y, wy + wid, wy + wid, sa, dir); + gui->draw_arc(pcb_crosshair.GC, arc.X, arc.Y, wy + wid, wy + wid, sa, dir); if (wid > pixel_slop) { - gui->draw_arc(Crosshair.GC, arc.X, arc.Y, wy - wid, wy - wid, sa, dir); - gui->draw_arc(Crosshair.GC, bx->X1, bx->Y1, wid, wid, sa, -180 * SGN(dir)); - gui->draw_arc(Crosshair.GC, bx->X2, bx->Y2, wid, wid, sa + dir, 180 * SGN(dir)); + gui->draw_arc(pcb_crosshair.GC, arc.X, arc.Y, wy - wid, wy - wid, sa, dir); + gui->draw_arc(pcb_crosshair.GC, bx->X1, bx->Y1, wid, wid, sa, -180 * SGN(dir)); + gui->draw_arc(pcb_crosshair.GC, bx->X2, bx->Y2, wid, wid, sa + dir, 180 * SGN(dir)); } } @@ -200,12 +200,12 @@ h = 0.0; ox = dy * h + 0.5 * SGN(dy); oy = -(dx * h + 0.5 * SGN(dx)); - gui->draw_line(Crosshair.GC, x1 + ox, y1 + oy, x2 + ox, y2 + oy); + gui->draw_line(pcb_crosshair.GC, x1 + ox, y1 + oy, x2 + ox, y2 + oy); if (coord_abs(ox) >= pixel_slop || coord_abs(oy) >= pixel_slop) { pcb_angle_t angle = atan2(dx, dy) * 57.295779; - gui->draw_line(Crosshair.GC, x1 - ox, y1 - oy, x2 - ox, y2 - oy); - gui->draw_arc(Crosshair.GC, x1, y1, thick / 2, thick / 2, angle - 180, 180); - gui->draw_arc(Crosshair.GC, x2, y2, thick / 2, thick / 2, angle, 180); + gui->draw_line(pcb_crosshair.GC, x1 - ox, y1 - oy, x2 - ox, y2 - oy); + gui->draw_arc(pcb_crosshair.GC, x1, y1, thick / 2, thick / 2, angle - 180, 180); + gui->draw_arc(pcb_crosshair.GC, x2, y2, thick / 2, thick / 2, angle, 180); } } @@ -216,16 +216,16 @@ { /* if no silkscreen, draw the bounding box */ if (arclist_length(&Element->Arc) == 0 && linelist_length(&Element->Line) == 0) { - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y1, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y2); - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y2, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y2); - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y2, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y1); - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, DX + Element->BoundingBox.X2, DY + Element->BoundingBox.Y1, DX + Element->BoundingBox.X1, DY + Element->BoundingBox.Y1); } @@ -232,7 +232,7 @@ else { PCB_ELEMENT_PCB_LINE_LOOP(Element); { - gui->draw_line(Crosshair.GC, DX + line->Point1.X, DY + line->Point1.Y, DX + line->Point2.X, DY + line->Point2.Y); + gui->draw_line(pcb_crosshair.GC, DX + line->Point1.X, DY + line->Point1.Y, DX + line->Point2.X, DY + line->Point2.Y); } END_LOOP; @@ -239,7 +239,7 @@ /* arc coordinates and angles have to be converted to X11 notation */ PCB_ARC_LOOP(Element); { - gui->draw_arc(Crosshair.GC, DX + arc->X, DY + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); + gui->draw_arc(pcb_crosshair.GC, DX + arc->X, DY + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); } END_LOOP; } @@ -261,18 +261,18 @@ moved_pad.Point2.X += DX; moved_pad.Point2.Y += DY; - gui->thindraw_pcb_pad(Crosshair.GC, &moved_pad, pcb_false, pcb_false); + gui->thindraw_pcb_pad(pcb_crosshair.GC, &moved_pad, pcb_false, pcb_false); } } END_LOOP; /* mark */ - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, Element->MarkX + DX - EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY - EMARK_SIZE); - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, Element->MarkX + DX + EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY - EMARK_SIZE); - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, Element->MarkX + DX - EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY + EMARK_SIZE); - gui->draw_line(Crosshair.GC, + gui->draw_line(pcb_crosshair.GC, Element->MarkX + DX + EMARK_SIZE, Element->MarkY + DY, Element->MarkX + DX, Element->MarkY + DY + EMARK_SIZE); } @@ -285,8 +285,8 @@ pcb_coord_t x, y; /* set offset */ - x = Crosshair.X - Buffer->X; - y = Crosshair.Y - Buffer->Y; + x = pcb_crosshair.X - Buffer->X; + y = pcb_crosshair.Y - Buffer->Y; /* draw all visible layers */ for (i = 0; i < max_copper_layer + 2; i++) @@ -300,18 +300,18 @@ y +line->Point1.Y, x +line->Point2.X, y +line->Point2.Y, line->Thickness); */ - gui->draw_line(Crosshair.GC, x + line->Point1.X, y + line->Point1.Y, x + line->Point2.X, y + line->Point2.Y); + gui->draw_line(pcb_crosshair.GC, x + line->Point1.X, y + line->Point1.Y, x + line->Point2.X, y + line->Point2.Y); } END_LOOP; PCB_ARC_LOOP(layer); { - gui->draw_arc(Crosshair.GC, x + arc->X, y + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); + gui->draw_arc(pcb_crosshair.GC, x + arc->X, y + arc->Y, arc->Width, arc->Height, arc->StartAngle, arc->Delta); } END_LOOP; PCB_TEXT_LOOP(layer); { pcb_box_t *box = &text->BoundingBox; - gui->draw_rect(Crosshair.GC, x + box->X1, y + box->Y1, x + box->X2, y + box->Y2); + gui->draw_rect(pcb_crosshair.GC, x + box->X1, y + box->Y1, x + box->X2, y + box->Y2); } END_LOOP; /* the tmp polygon has n+1 points because the first @@ -347,12 +347,12 @@ */ static void XORDrawInsertPointObject(void) { - pcb_line_t *line = (pcb_line_t *) Crosshair.AttachedObject.Ptr2; - pcb_point_t *point = (pcb_point_t *) Crosshair.AttachedObject.Ptr3; + pcb_line_t *line = (pcb_line_t *) pcb_crosshair.AttachedObject.Ptr2; + pcb_point_t *point = (pcb_point_t *) pcb_crosshair.AttachedObject.Ptr3; - if (Crosshair.AttachedObject.Type != PCB_TYPE_NONE) { - gui->draw_line(Crosshair.GC, point->X, point->Y, line->Point1.X, line->Point1.Y); - gui->draw_line(Crosshair.GC, point->X, point->Y, line->Point2.X, line->Point2.Y); + if (pcb_crosshair.AttachedObject.Type != PCB_TYPE_NONE) { + gui->draw_line(pcb_crosshair.GC, point->X, point->Y, line->Point1.X, line->Point1.Y); + gui->draw_line(pcb_crosshair.GC, point->X, point->Y, line->Point2.X, line->Point2.Y); } } @@ -363,12 +363,12 @@ { pcb_rubberband_t *ptr; pcb_cardinal_t i; - pcb_coord_t dx = Crosshair.X - Crosshair.AttachedObject.X, dy = Crosshair.Y - Crosshair.AttachedObject.Y; + pcb_coord_t dx = pcb_crosshair.X - pcb_crosshair.AttachedObject.X, dy = pcb_crosshair.Y - pcb_crosshair.AttachedObject.Y; - switch (Crosshair.AttachedObject.Type) { + switch (pcb_crosshair.AttachedObject.Type) { case PCB_TYPE_VIA: { - pcb_pin_t *via = (pcb_pin_t *) Crosshair.AttachedObject.Ptr1; + pcb_pin_t *via = (pcb_pin_t *) pcb_crosshair.AttachedObject.Ptr1; thindraw_moved_pv(via, dx, dy); break; } @@ -375,7 +375,7 @@ case PCB_TYPE_LINE: { - pcb_line_t *line = (pcb_line_t *) Crosshair.AttachedObject.Ptr2; + pcb_line_t *line = (pcb_line_t *) pcb_crosshair.AttachedObject.Ptr2; XORDrawAttachedLine(line->Point1.X + dx, line->Point1.Y + dy, line->Point2.X + dx, line->Point2.Y + dy, line->Thickness); break; @@ -383,15 +383,15 @@ case PCB_TYPE_ARC: { - pcb_arc_t *Arc = (pcb_arc_t *) Crosshair.AttachedObject.Ptr2; + pcb_arc_t *Arc = (pcb_arc_t *) pcb_crosshair.AttachedObject.Ptr2; - gui->draw_arc(Crosshair.GC, Arc->X + dx, Arc->Y + dy, Arc->Width, Arc->Height, Arc->StartAngle, Arc->Delta); + gui->draw_arc(pcb_crosshair.GC, Arc->X + dx, Arc->Y + dy, Arc->Width, Arc->Height, Arc->StartAngle, Arc->Delta); break; } case PCB_TYPE_POLYGON: { - pcb_polygon_t *polygon = (pcb_polygon_t *) Crosshair.AttachedObject.Ptr2; + pcb_polygon_t *polygon = (pcb_polygon_t *) pcb_crosshair.AttachedObject.Ptr2; /* the tmp polygon has n+1 points because the first * and the last one are set to the same coordinates @@ -405,8 +405,8 @@ pcb_line_t *line; pcb_point_t *point; - line = (pcb_line_t *) Crosshair.AttachedObject.Ptr2; - point = (pcb_point_t *) Crosshair.AttachedObject.Ptr3; + line = (pcb_line_t *) pcb_crosshair.AttachedObject.Ptr2; + point = (pcb_point_t *) pcb_crosshair.AttachedObject.Ptr3; if (point == &line->Point1) XORDrawAttachedLine(point->X + dx, point->Y + dy, line->Point2.X, line->Point2.Y, line->Thickness); else @@ -420,8 +420,8 @@ pcb_point_t *point; pcb_cardinal_t point_idx, prev, next; - polygon = (pcb_polygon_t *) Crosshair.AttachedObject.Ptr2; - point = (pcb_point_t *) Crosshair.AttachedObject.Ptr3; + polygon = (pcb_polygon_t *) pcb_crosshair.AttachedObject.Ptr2; + point = (pcb_point_t *) pcb_crosshair.AttachedObject.Ptr3; point_idx = pcb_poly_point_idx(polygon, point); /* get previous and following point */ @@ -429,8 +429,8 @@ next = pcb_poly_contour_next_point(polygon, point_idx); /* draw the two segments */ - gui->draw_line(Crosshair.GC, polygon->Points[prev].X, polygon->Points[prev].Y, point->X + dx, point->Y + dy); - gui->draw_line(Crosshair.GC, point->X + dx, point->Y + dy, polygon->Points[next].X, polygon->Points[next].Y); + gui->draw_line(pcb_crosshair.GC, polygon->Points[prev].X, polygon->Points[prev].Y, point->X + dx, point->Y + dy); + gui->draw_line(pcb_crosshair.GC, point->X + dx, point->Y + dy, polygon->Points[next].X, polygon->Points[next].Y); break; } @@ -437,16 +437,16 @@ case PCB_TYPE_ELEMENT_NAME: { /* locate the element "mark" and draw an association line from crosshair to it */ - pcb_element_t *element = (pcb_element_t *) Crosshair.AttachedObject.Ptr1; + pcb_element_t *element = (pcb_element_t *) pcb_crosshair.AttachedObject.Ptr1; - gui->draw_line(Crosshair.GC, element->MarkX, element->MarkY, Crosshair.X, Crosshair.Y); + gui->draw_line(pcb_crosshair.GC, element->MarkX, element->MarkY, pcb_crosshair.X, pcb_crosshair.Y); /* fall through to move the text as a box outline */ } case PCB_TYPE_TEXT: { - pcb_text_t *text = (pcb_text_t *) Crosshair.AttachedObject.Ptr2; + pcb_text_t *text = (pcb_text_t *) pcb_crosshair.AttachedObject.Ptr2; pcb_box_t *box = &text->BoundingBox; - gui->draw_rect(Crosshair.GC, box->X1 + dx, box->Y1 + dy, box->X2 + dx, box->Y2 + dy); + gui->draw_rect(pcb_crosshair.GC, box->X1 + dx, box->Y1 + dy, box->X2 + dx, box->Y2 + dy); break; } @@ -454,13 +454,13 @@ case PCB_TYPE_PAD: case PCB_TYPE_PIN: case PCB_TYPE_ELEMENT: - XORDrawElement((pcb_element_t *) Crosshair.AttachedObject.Ptr2, dx, dy); + XORDrawElement((pcb_element_t *) pcb_crosshair.AttachedObject.Ptr2, dx, dy); break; } /* draw the attached rubberband lines too */ - i = Crosshair.AttachedObject.RubberbandN; - ptr = Crosshair.AttachedObject.Rubberband; + i = pcb_crosshair.AttachedObject.RubberbandN; + ptr = pcb_crosshair.AttachedObject.Rubberband; while (i) { pcb_point_t *point1, *point2; @@ -498,8 +498,8 @@ { /* Make a dummy via structure to draw from */ pcb_pin_t via; - via.X = Crosshair.X; - via.Y = Crosshair.Y; + via.X = pcb_crosshair.X; + via.Y = pcb_crosshair.Y; via.Thickness = conf_core.design.via_thickness; via.Clearance = 2 * conf_core.design.clearance; via.DrillingHole = conf_core.design.via_drilling_hole; @@ -506,14 +506,14 @@ via.Mask = 0; via.Flags = pcb_no_flags(); - gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &via, pcb_true, pcb_false); + gui->thindraw_pcb_pv(pcb_crosshair.GC, pcb_crosshair.GC, &via, pcb_true, pcb_false); if (conf_core.editor.show_drc) { /* XXX: Naughty cheat - use the mask to draw DRC clearance! */ via.Mask = conf_core.design.via_thickness + PCB->Bloat * 2; - gui->set_color(Crosshair.GC, conf_core.appearance.color.cross); - gui->thindraw_pcb_pv(Crosshair.GC, Crosshair.GC, &via, pcb_false, pcb_true); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.cross); + gui->thindraw_pcb_pv(pcb_crosshair.GC, pcb_crosshair.GC, &via, pcb_false, pcb_true); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.crosshair); } break; } @@ -522,24 +522,24 @@ case PCB_MODE_POLYGON: case PCB_MODE_POLYGON_HOLE: /* draw only if starting point is set */ - if (Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) - gui->draw_line(Crosshair.GC, - Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y); + if (pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) + gui->draw_line(pcb_crosshair.GC, + pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y); /* draw attached polygon only if in PCB_MODE_POLYGON or PCB_MODE_POLYGON_HOLE */ - if (Crosshair.AttachedPolygon.PointN > 1) { - XORPolygon(&Crosshair.AttachedPolygon, 0, 0, 1); + if (pcb_crosshair.AttachedPolygon.PointN > 1) { + XORPolygon(&pcb_crosshair.AttachedPolygon, 0, 0, 1); } break; case PCB_MODE_ARC: - if (Crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) { + if (pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) { XORDrawAttachedArc(conf_core.design.line_thickness); if (conf_core.editor.show_drc) { - gui->set_color(Crosshair.GC, conf_core.appearance.color.cross); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.cross); XORDrawAttachedArc(conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.crosshair); } } @@ -547,27 +547,27 @@ case PCB_MODE_LINE: /* draw only if starting point exists and the line has length */ - if (Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST && Crosshair.AttachedLine.draw) { - XORDrawAttachedLine(Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness); + if (pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST && pcb_crosshair.AttachedLine.draw) { + XORDrawAttachedLine(pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, + pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness); /* draw two lines ? */ if (conf_core.editor.line_refraction) - XORDrawAttachedLine(Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, - Crosshair.X, Crosshair.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness); + XORDrawAttachedLine(pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, + pcb_crosshair.X, pcb_crosshair.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness); if (conf_core.editor.show_drc) { - gui->set_color(Crosshair.GC, conf_core.appearance.color.cross); - XORDrawAttachedLine(Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.cross); + XORDrawAttachedLine(pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, + pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); if (conf_core.editor.line_refraction) - XORDrawAttachedLine(Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, - Crosshair.X, Crosshair.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); + XORDrawAttachedLine(pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, + pcb_crosshair.X, pcb_crosshair.Y, PCB->RatDraw ? 10 : conf_core.design.line_thickness + 2 * (PCB->Bloat + 1)); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.crosshair); } } break; @@ -587,14 +587,14 @@ } /* an attached box does not depend on a special mode */ - if (Crosshair.AttachedBox.State == PCB_CH_STATE_SECOND || Crosshair.AttachedBox.State == PCB_CH_STATE_THIRD) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_SECOND || pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD) { pcb_coord_t x1, y1, x2, y2; - x1 = Crosshair.AttachedBox.Point1.X; - y1 = Crosshair.AttachedBox.Point1.Y; - x2 = Crosshair.AttachedBox.Point2.X; - y2 = Crosshair.AttachedBox.Point2.Y; - gui->draw_rect(Crosshair.GC, x1, y1, x2, y2); + x1 = pcb_crosshair.AttachedBox.Point1.X; + y1 = pcb_crosshair.AttachedBox.Point1.Y; + x2 = pcb_crosshair.AttachedBox.Point2.X; + y2 = pcb_crosshair.AttachedBox.Point2.Y; + gui->draw_rect(pcb_crosshair.GC, x1, y1, x2, y2); } } @@ -607,11 +607,11 @@ pcb_coord_t ms = conf_core.appearance.mark_size; /* Mark is not drawn when it is not set */ - if (!Marked.status) + if (!pcb_marked.status) return; - gui->draw_line(Crosshair.GC, Marked.X - ms, Marked.Y - ms, Marked.X + ms, Marked.Y + ms); - gui->draw_line(Crosshair.GC, Marked.X + ms, Marked.Y - ms, Marked.X - ms, Marked.Y + ms); + gui->draw_line(pcb_crosshair.GC, pcb_marked.X - ms, pcb_marked.Y - ms, pcb_marked.X + ms, pcb_marked.Y + ms); + gui->draw_line(pcb_crosshair.GC, pcb_marked.X + ms, pcb_marked.Y - ms, pcb_marked.X - ms, pcb_marked.Y + ms); } /* --------------------------------------------------------------------------- @@ -670,7 +670,7 @@ /* --------------------------------------------------------------------------- - * Convenience for plugins using the old {Hide,Restore}Crosshair API. + * Convenience for plugins using the old {Hide,Restore}pcb_crosshair API. * This links up to notify the GUI of the expected changes using the new APIs. * * Use of this old API is deprecated, as the names don't necessarily reflect @@ -926,7 +926,7 @@ /* Pick the nearest grid-point in the x or y direction * to align with, then adjust until we hit the line */ - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_LINE, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_LINE, &ptr1, &ptr2, &ptr3); if (ans == PCB_TYPE_NONE) return; @@ -939,8 +939,8 @@ */ if ((conf_core.editor.mode != PCB_MODE_LINE || CURRENT != ptr1) && (conf_core.editor.mode != PCB_MODE_MOVE || - Crosshair.AttachedObject.Ptr1 != ptr1 || - Crosshair.AttachedObject.Type != PCB_TYPE_LINE_POINT || Crosshair.AttachedObject.Ptr2 == line)) + pcb_crosshair.AttachedObject.Ptr1 != ptr1 || + pcb_crosshair.AttachedObject.Type != PCB_TYPE_LINE_POINT || pcb_crosshair.AttachedObject.Ptr2 == line)) return; dx = line->Point2.X - line->Point1.X; @@ -1000,8 +1000,8 @@ struct snap_data snap_data; int ans; - Crosshair.X = PCB_CLAMP(X, Crosshair.MinX, Crosshair.MaxX); - Crosshair.Y = PCB_CLAMP(Y, Crosshair.MinY, Crosshair.MaxY); + pcb_crosshair.X = PCB_CLAMP(X, pcb_crosshair.MinX, pcb_crosshair.MaxX); + pcb_crosshair.Y = PCB_CLAMP(Y, pcb_crosshair.MinY, pcb_crosshair.MaxY); if (PCB->RatDraw) { nearest_grid_x = -PCB_MIL_TO_COORD(6); @@ -1008,22 +1008,22 @@ nearest_grid_y = -PCB_MIL_TO_COORD(6); } else { - nearest_grid_x = pcb_grid_fit(Crosshair.X, PCB->Grid, PCB->GridOffsetX); - nearest_grid_y = pcb_grid_fit(Crosshair.Y, PCB->Grid, PCB->GridOffsetY); + nearest_grid_x = pcb_grid_fit(pcb_crosshair.X, PCB->Grid, PCB->GridOffsetX); + nearest_grid_y = pcb_grid_fit(pcb_crosshair.Y, PCB->Grid, PCB->GridOffsetY); - if (Marked.status && conf_core.editor.orthogonal_moves) { - pcb_coord_t dx = Crosshair.X - Marked.X; - pcb_coord_t dy = Crosshair.Y - Marked.Y; + if (pcb_marked.status && conf_core.editor.orthogonal_moves) { + pcb_coord_t dx = pcb_crosshair.X - pcb_marked.X; + pcb_coord_t dy = pcb_crosshair.Y - pcb_marked.Y; if (PCB_ABS(dx) > PCB_ABS(dy)) - nearest_grid_y = Marked.Y; + nearest_grid_y = pcb_marked.Y; else - nearest_grid_x = Marked.X; + nearest_grid_x = pcb_marked.X; } } - snap_data.crosshair = &Crosshair; - snap_data.nearest_sq_dist = crosshair_sq_dist(&Crosshair, nearest_grid_x, nearest_grid_y); + snap_data.crosshair = &pcb_crosshair; + snap_data.nearest_sq_dist = crosshair_sq_dist(&pcb_crosshair, nearest_grid_x, nearest_grid_y); snap_data.nearest_is_grid = pcb_true; snap_data.x = nearest_grid_x; snap_data.y = nearest_grid_y; @@ -1030,7 +1030,7 @@ ans = PCB_TYPE_NONE; if (!PCB->RatDraw) - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3); if (ans & PCB_TYPE_ELEMENT) { pcb_element_t *el = (pcb_element_t *) ptr1; @@ -1039,15 +1039,15 @@ ans = PCB_TYPE_NONE; if (PCB->RatDraw || conf_core.editor.snap_pin) - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_PAD, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_PAD, &ptr1, &ptr2, &ptr3); /* Avoid self-snapping when moving */ if (ans != PCB_TYPE_NONE && - conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT && ptr1 == Crosshair.AttachedObject.Ptr1) + conf_core.editor.mode == PCB_MODE_MOVE && pcb_crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT && ptr1 == pcb_crosshair.AttachedObject.Ptr1) ans = PCB_TYPE_NONE; if (ans != PCB_TYPE_NONE && - (conf_core.editor.mode == PCB_MODE_LINE || (conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT))) { + (conf_core.editor.mode == PCB_MODE_LINE || (conf_core.editor.mode == PCB_MODE_MOVE && pcb_crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT))) { pcb_pad_t *pad = (pcb_pad_t *) ptr2; pcb_layer_t *desired_layer; pcb_cardinal_t desired_group; @@ -1055,8 +1055,8 @@ int found_our_layer = pcb_false; desired_layer = CURRENT; - if (conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT) { - desired_layer = (pcb_layer_t *) Crosshair.AttachedObject.Ptr1; + if (conf_core.editor.mode == PCB_MODE_MOVE && pcb_crosshair.AttachedObject.Type == PCB_TYPE_LINE_POINT) { + desired_layer = (pcb_layer_t *) pcb_crosshair.AttachedObject.Ptr1; } /* find layer groups of the component side and solder side */ @@ -1084,11 +1084,11 @@ ans = PCB_TYPE_NONE; if (PCB->RatDraw || conf_core.editor.snap_pin) - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3); /* Avoid self-snapping when moving */ if (ans != PCB_TYPE_NONE && - conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT && ptr1 == Crosshair.AttachedObject.Ptr1) + conf_core.editor.mode == PCB_MODE_MOVE && pcb_crosshair.AttachedObject.Type == PCB_TYPE_ELEMENT && ptr1 == pcb_crosshair.AttachedObject.Ptr1) ans = PCB_TYPE_NONE; if (ans != PCB_TYPE_NONE) { @@ -1098,10 +1098,10 @@ ans = PCB_TYPE_NONE; if (conf_core.editor.snap_pin) - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_VIA, &ptr1, &ptr2, &ptr3); /* Avoid snapping vias to any other vias */ - if (conf_core.editor.mode == PCB_MODE_MOVE && Crosshair.AttachedObject.Type == PCB_TYPE_VIA && (ans & PCB_TYPEMASK_PIN)) + if (conf_core.editor.mode == PCB_MODE_MOVE && pcb_crosshair.AttachedObject.Type == PCB_TYPE_VIA && (ans & PCB_TYPEMASK_PIN)) ans = PCB_TYPE_NONE; if (ans != PCB_TYPE_NONE) { @@ -1111,7 +1111,7 @@ ans = PCB_TYPE_NONE; if (conf_core.editor.snap_pin) - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_LINE_POINT, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_LINE_POINT, &ptr1, &ptr2, &ptr3); if (ans != PCB_TYPE_NONE) { pcb_point_t *pnt = (pcb_point_t *) ptr3; @@ -1126,7 +1126,7 @@ ans = PCB_TYPE_NONE; if (conf_core.editor.snap_pin) - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_POLYGON_POINT, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_POLYGON_POINT, &ptr1, &ptr2, &ptr3); if (ans != PCB_TYPE_NONE) { pcb_point_t *pnt = (pcb_point_t *) ptr3; @@ -1134,15 +1134,15 @@ } if (snap_data.x >= 0 && snap_data.y >= 0) { - Crosshair.X = snap_data.x; - Crosshair.Y = snap_data.y; + pcb_crosshair.X = snap_data.x; + pcb_crosshair.Y = snap_data.y; } if (conf_core.editor.highlight_on_point) - onpoint_work(&Crosshair, Crosshair.X, Crosshair.Y); + onpoint_work(&pcb_crosshair, pcb_crosshair.X, pcb_crosshair.Y); if (conf_core.editor.mode == PCB_MODE_ARROW) { - ans = pcb_search_grid_slop(Crosshair.X, Crosshair.Y, PCB_TYPE_LINE_POINT, &ptr1, &ptr2, &ptr3); + ans = pcb_search_grid_slop(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_LINE_POINT, &ptr1, &ptr2, &ptr3); if (ans == PCB_TYPE_NONE) pcb_hid_action("PointCursor"); else if (!PCB_FLAG_TEST(PCB_FLAG_SELECTED, (pcb_line_t *) ptr2)) @@ -1149,10 +1149,10 @@ pcb_hid_actionl("PointCursor", "True", NULL); } - if (conf_core.editor.mode == PCB_MODE_LINE && Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST && conf_core.editor.auto_drc) + if (conf_core.editor.mode == PCB_MODE_LINE && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST && conf_core.editor.auto_drc) EnforceLineDRC(); - gui->set_crosshair(Crosshair.X, Crosshair.Y, HID_SC_DO_NOTHING); + gui->set_crosshair(pcb_crosshair.X, pcb_crosshair.Y, HID_SC_DO_NOTHING); } /* --------------------------------------------------------------------------- @@ -1160,7 +1160,7 @@ */ void pcb_crosshair_move_relative(pcb_coord_t DeltaX, pcb_coord_t DeltaY) { - pcb_crosshair_grid_fit(Crosshair.X + DeltaX, Crosshair.Y + DeltaY); + pcb_crosshair_grid_fit(pcb_crosshair.X + DeltaX, pcb_crosshair.Y + DeltaY); } /* --------------------------------------------------------------------------- @@ -1170,21 +1170,21 @@ pcb_bool pcb_crosshair_move_absolute(pcb_coord_t X, pcb_coord_t Y) { pcb_coord_t x, y, z; - x = Crosshair.X; - y = Crosshair.Y; + x = pcb_crosshair.X; + y = pcb_crosshair.Y; pcb_crosshair_grid_fit(X, Y); - if (Crosshair.X != x || Crosshair.Y != y) { + if (pcb_crosshair.X != x || pcb_crosshair.Y != y) { /* back up to old position to notify the GUI * (which might want to erase the old crosshair) */ - z = Crosshair.X; - Crosshair.X = x; + z = pcb_crosshair.X; + pcb_crosshair.X = x; x = z; - z = Crosshair.Y; - Crosshair.Y = y; + z = pcb_crosshair.Y; + pcb_crosshair.Y = y; pcb_notify_crosshair_change(pcb_false); /* Our caller notifies when it has done */ /* now move forward again */ - Crosshair.X = x; - Crosshair.Y = z; + pcb_crosshair.X = x; + pcb_crosshair.Y = z; return (pcb_true); } return (pcb_false); @@ -1195,10 +1195,10 @@ */ void pcb_crosshair_set_range(pcb_coord_t MinX, pcb_coord_t MinY, pcb_coord_t MaxX, pcb_coord_t MaxY) { - Crosshair.MinX = MAX(0, MinX); - Crosshair.MinY = MAX(0, MinY); - Crosshair.MaxX = MIN(PCB->MaxWidth, MaxX); - Crosshair.MaxY = MIN(PCB->MaxHeight, MaxY); + pcb_crosshair.MinX = MAX(0, MinX); + pcb_crosshair.MinY = MAX(0, MinY); + pcb_crosshair.MaxX = MIN(PCB->MaxWidth, MaxX); + pcb_crosshair.MaxY = MIN(PCB->MaxHeight, MaxY); /* force update of position */ pcb_crosshair_move_relative(0, 0); @@ -1213,7 +1213,7 @@ PCB->Grid = 1; if (pcb_crosshair_move_absolute(X, Y)) pcb_notify_crosshair_change(pcb_true); - gui->set_crosshair(Crosshair.X, Crosshair.Y, HID_SC_WARP_POINTER); + gui->set_crosshair(pcb_crosshair.X, pcb_crosshair.Y, HID_SC_WARP_POINTER); PCB->Grid = save_grid; } @@ -1223,27 +1223,27 @@ */ void pcb_crosshair_init(void) { - Crosshair.GC = gui->make_gc(); + pcb_crosshair.GC = gui->make_gc(); - gui->set_color(Crosshair.GC, conf_core.appearance.color.crosshair); - gui->set_draw_xor(Crosshair.GC, 1); - gui->set_line_cap(Crosshair.GC, Trace_Cap); - gui->set_line_width(Crosshair.GC, 1); + gui->set_color(pcb_crosshair.GC, conf_core.appearance.color.crosshair); + gui->set_draw_xor(pcb_crosshair.GC, 1); + gui->set_line_cap(pcb_crosshair.GC, Trace_Cap); + gui->set_line_width(pcb_crosshair.GC, 1); /* set initial shape */ - Crosshair.shape = pcb_ch_shape_basic; + pcb_crosshair.shape = pcb_ch_shape_basic; /* set default limits */ - Crosshair.MinX = Crosshair.MinY = 0; - Crosshair.MaxX = PCB->MaxWidth; - Crosshair.MaxY = PCB->MaxHeight; + pcb_crosshair.MinX = pcb_crosshair.MinY = 0; + pcb_crosshair.MaxX = PCB->MaxWidth; + pcb_crosshair.MaxY = PCB->MaxHeight; /* Initialize the onpoint data. */ - memset(&Crosshair.onpoint_objs, 0, sizeof(vtop_t)); - memset(&Crosshair.old_onpoint_objs, 0, sizeof(vtop_t)); + memset(&pcb_crosshair.onpoint_objs, 0, sizeof(vtop_t)); + memset(&pcb_crosshair.old_onpoint_objs, 0, sizeof(vtop_t)); /* clear the mark */ - Marked.status = pcb_false; + pcb_marked.status = pcb_false; } /* --------------------------------------------------------------------------- @@ -1251,8 +1251,8 @@ */ void pcb_crosshair_uninit(void) { - pcb_poly_free_fields(&Crosshair.AttachedPolygon); - gui->destroy_gc(Crosshair.GC); + pcb_poly_free_fields(&pcb_crosshair.AttachedPolygon); + gui->destroy_gc(pcb_crosshair.GC); } /************************* mode *************************************/ @@ -1303,9 +1303,9 @@ recursing = pcb_true; pcb_notify_crosshair_change(pcb_false); addedLines = 0; - Crosshair.AttachedObject.Type = PCB_TYPE_NONE; - Crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedPolygon.PointN = 0; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_NONE; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedPolygon.PointN = 0; if (PCB->RatDraw) { if (Mode == PCB_MODE_ARC || Mode == PCB_MODE_RECTANGLE || Mode == PCB_MODE_VIA || Mode == PCB_MODE_POLYGON || @@ -1314,18 +1314,18 @@ Mode = PCB_MODE_NO; } } - if (conf_core.editor.mode == PCB_MODE_LINE && Mode == PCB_MODE_ARC && Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Crosshair.AttachedLine.Point1.X; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Crosshair.AttachedLine.Point1.Y; + if (conf_core.editor.mode == PCB_MODE_LINE && Mode == PCB_MODE_ARC && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.AttachedLine.Point1.X; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.AttachedLine.Point1.Y; pcb_adjust_attached_objects(); } - else if (conf_core.editor.mode == PCB_MODE_ARC && Mode == PCB_MODE_LINE && Crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) { - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.AttachedBox.Point1.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.AttachedBox.Point1.Y; + else if (conf_core.editor.mode == PCB_MODE_ARC && Mode == PCB_MODE_LINE && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) { + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.AttachedBox.Point1.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.AttachedBox.Point1.Y; sprintf(sMode, "%d", Mode); conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); pcb_adjust_attached_objects(); @@ -1333,8 +1333,8 @@ else { if (conf_core.editor.mode == PCB_MODE_ARC || conf_core.editor.mode == PCB_MODE_LINE) pcb_crosshair_set_local_ref(0, 0, pcb_false); - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; if (Mode == PCB_MODE_LINE && conf_core.editor.auto_drc) { if (pcb_reset_conns(pcb_true)) { pcb_undo_inc_serial(); @@ -1369,10 +1369,10 @@ if (Showing) { pcb_notify_mark_change(pcb_false); if (count == 0) - old = Marked; - Marked.X = X; - Marked.Y = Y; - Marked.status = pcb_true; + old = pcb_marked; + pcb_marked.X = X; + pcb_marked.Y = Y; + pcb_marked.status = pcb_true; count++; pcb_notify_mark_change(pcb_true); } @@ -1379,7 +1379,7 @@ else if (count > 0) { pcb_notify_mark_change(pcb_false); count = 0; - Marked = old; + pcb_marked = old; pcb_notify_mark_change(pcb_true); } } Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 5034) +++ trunk/src/crosshair.h (revision 5035) @@ -96,8 +96,8 @@ #define PCB_CH_STATE_SECOND 1 #define PCB_CH_STATE_THIRD 2 -extern pcb_crosshair_t Crosshair; -extern pcb_mark_t Marked; +extern pcb_crosshair_t pcb_crosshair; +extern pcb_mark_t pcb_marked; pcb_coord_t pcb_grid_fit(pcb_coord_t x, pcb_coord_t grid_spacing, pcb_coord_t grid_offset); Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 5034) +++ trunk/src/file_act.c (revision 5035) @@ -304,7 +304,7 @@ FILE *fp; pcb_bool result; - if ((pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) { + if ((pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) { element = (pcb_element_t *) ptrtmp; if ((fp = pcb_check_and_open_file(name, pcb_true, pcb_false, &result, NULL)) != NULL) { pcb_lookup_element_conns(element, fp); Index: trunk/src/flag.h =================================================================== --- trunk/src/flag.h (revision 5034) +++ trunk/src/flag.h (revision 5035) @@ -130,7 +130,7 @@ @item 0x00800 New lines/arc clear polygons. @item 0x01000 -Crosshair snaps to pins and pads. +pcb_crosshair snaps to pins and pads. @item 0x02000 Show the solder mask layer. @item 0x04000 Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 5034) +++ trunk/src/gui_act.c (revision 5035) @@ -86,7 +86,7 @@ then orthogonal. If AllDirections is set, this action disables it. @item CycleCrosshair -Changes crosshair drawing. Crosshair may accept form of 4-ray, +Changes crosshair drawing. pcb_crosshair may accept form of 4-ray, 8-ray and 12-ray cross. @item ToggleRubberBandMode @@ -293,9 +293,9 @@ case F_CycleCrosshair: pcb_notify_crosshair_change(pcb_false); - Crosshair.shape = CrosshairShapeIncrement(Crosshair.shape); - if (pcb_ch_shape_NUM == Crosshair.shape) - Crosshair.shape = pcb_ch_shape_basic; + pcb_crosshair.shape = CrosshairShapeIncrement(pcb_crosshair.shape); + if (pcb_ch_shape_NUM == pcb_crosshair.shape) + pcb_crosshair.shape = pcb_ch_shape_basic; pcb_notify_crosshair_change(pcb_true); break; @@ -382,8 +382,8 @@ pcb_undo_inc_serial(); pcb_draw(); } - if (Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) - pcb_lookup_conn(Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, pcb_true, 1, PCB_FLAG_FOUND); + if (pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) + pcb_lookup_conn(pcb_crosshair.AttachedLine.Point1.X, pcb_crosshair.AttachedLine.Point1.Y, pcb_true, 1, PCB_FLAG_FOUND); } pcb_notify_crosshair_change(pcb_true); break; @@ -421,7 +421,7 @@ pcb_coord_t oldGrid = PCB->Grid; PCB->Grid = 1; - if (pcb_crosshair_move_absolute(Crosshair.X, Crosshair.Y)) + if (pcb_crosshair_move_absolute(pcb_crosshair.X, pcb_crosshair.Y)) pcb_notify_crosshair_change(pcb_true); /* first notify was in MoveCrosshairAbs */ pcb_board_set_grid(oldGrid, pcb_true); } @@ -612,8 +612,8 @@ const char *function = PCB_ACTION_ARG(0); if (function) { - Note.X = Crosshair.X; - Note.Y = Crosshair.Y; + Note.X = pcb_crosshair.X; + Note.Y = pcb_crosshair.Y; pcb_notify_crosshair_change(pcb_false); switch (pcb_funchash_get(function, NULL)) { case F_Arc: @@ -666,7 +666,7 @@ break; case PCB_MODE_LINE: - if (Crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_ARROW); else { pcb_crosshair_set_mode(PCB_MODE_NO); @@ -675,7 +675,7 @@ break; case PCB_MODE_RECTANGLE: - if (Crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_ARROW); else { pcb_crosshair_set_mode(PCB_MODE_NO); @@ -684,7 +684,7 @@ break; case PCB_MODE_POLYGON: - if (Crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_ARROW); else { pcb_crosshair_set_mode(PCB_MODE_NO); @@ -693,7 +693,7 @@ break; case PCB_MODE_POLYGON_HOLE: - if (Crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_ARROW); else { pcb_crosshair_set_mode(PCB_MODE_NO); @@ -702,7 +702,7 @@ break; case PCB_MODE_ARC: - if (Crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_ARROW); else { pcb_crosshair_set_mode(PCB_MODE_NO); @@ -754,14 +754,14 @@ /* Handle middle mouse button restarts of drawing mode. If not in | a drawing mode, middle mouse button will select objects. */ - if (conf_core.editor.mode == PCB_MODE_LINE && Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { + if (conf_core.editor.mode == PCB_MODE_LINE && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { pcb_crosshair_set_mode(PCB_MODE_LINE); } - else if (conf_core.editor.mode == PCB_MODE_ARC && Crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) + else if (conf_core.editor.mode == PCB_MODE_ARC && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_ARC); - else if (conf_core.editor.mode == PCB_MODE_RECTANGLE && Crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) + else if (conf_core.editor.mode == PCB_MODE_RECTANGLE && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_RECTANGLE); - else if (conf_core.editor.mode == PCB_MODE_POLYGON && Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) + else if (conf_core.editor.mode == PCB_MODE_POLYGON && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) pcb_crosshair_set_mode(PCB_MODE_POLYGON); else { pcb_crosshair_save_mode(); @@ -806,53 +806,53 @@ void *ptr1, *ptr2, *ptr3; int over = 0; - if (Crosshair.drags == NULL) + if (pcb_crosshair.drags == NULL) return 0; do { - Crosshair.drags_current++; - if (Crosshair.drags_current >= Crosshair.drags_len) { - Crosshair.drags_current = 0; + pcb_crosshair.drags_current++; + if (pcb_crosshair.drags_current >= pcb_crosshair.drags_len) { + pcb_crosshair.drags_current = 0; over++; } - if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_LINE) != PCB_TYPE_NONE) { + if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_TYPE_LINE) != PCB_TYPE_NONE) { /* line has two endpoints, check which one is close to the original x;y */ pcb_line_t *l = ptr2; if (close_enough(Note.X, l->Point1.X) && close_enough(Note.Y, l->Point1.Y)) { - Crosshair.AttachedObject.Type = PCB_TYPE_LINE_POINT; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = &l->Point1; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_LINE_POINT; + pcb_crosshair.AttachedObject.Ptr1 = ptr1; + pcb_crosshair.AttachedObject.Ptr2 = ptr2; + pcb_crosshair.AttachedObject.Ptr3 = &l->Point1; return 0; } if (close_enough(Note.X, l->Point2.X) && close_enough(Note.Y, l->Point2.Y)) { - Crosshair.AttachedObject.Type = PCB_TYPE_LINE_POINT; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = &l->Point2; + pcb_crosshair.AttachedObject.Type = PCB_TYPE_LINE_POINT; + pcb_crosshair.AttachedObject.Ptr1 = ptr1; + pcb_crosshair.AttachedObject.Ptr2 = ptr2; + pcb_crosshair.AttachedObject.Ptr3 = &l->Point2; return 0; } } - else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_VIA) != PCB_TYPE_NONE) { - Crosshair.AttachedObject.Type = PCB_TYPE_VIA; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = ptr3; + else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_TYPE_VIA) != PCB_TYPE_NONE) { + pcb_crosshair.AttachedObject.Type = PCB_TYPE_VIA; + pcb_crosshair.AttachedObject.Ptr1 = ptr1; + pcb_crosshair.AttachedObject.Ptr2 = ptr2; + pcb_crosshair.AttachedObject.Ptr3 = ptr3; return 0; } - else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_PAD) != PCB_TYPE_NONE) { - Crosshair.AttachedObject.Type = PCB_TYPE_ELEMENT; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr1; - Crosshair.AttachedObject.Ptr3 = ptr1; + else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_TYPE_PAD) != PCB_TYPE_NONE) { + pcb_crosshair.AttachedObject.Type = PCB_TYPE_ELEMENT; + pcb_crosshair.AttachedObject.Ptr1 = ptr1; + pcb_crosshair.AttachedObject.Ptr2 = ptr1; + pcb_crosshair.AttachedObject.Ptr3 = ptr1; return 0; } - else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, Crosshair.drags[Crosshair.drags_current], PCB_TYPE_ARC) != PCB_TYPE_NONE) { - Crosshair.AttachedObject.Type = PCB_TYPE_ARC; - Crosshair.AttachedObject.Ptr1 = ptr1; - Crosshair.AttachedObject.Ptr2 = ptr2; - Crosshair.AttachedObject.Ptr3 = ptr3; + else if (pcb_search_obj_by_id(PCB->Data, &ptr1, &ptr2, &ptr3, pcb_crosshair.drags[pcb_crosshair.drags_current], PCB_TYPE_ARC) != PCB_TYPE_NONE) { + pcb_crosshair.AttachedObject.Type = PCB_TYPE_ARC; + pcb_crosshair.AttachedObject.Ptr1 = ptr1; + pcb_crosshair.AttachedObject.Ptr2 = ptr2; + pcb_crosshair.AttachedObject.Ptr3 = ptr3; return 0; } @@ -957,7 +957,7 @@ static const char markcrosshair_syntax[] = "MarkCrosshair()\n" "MarkCrosshair(Center)"; -static const char markcrosshair_help[] = "Set/Reset the Crosshair mark."; +static const char markcrosshair_help[] = "Set/Reset the pcb_crosshair mark."; /* %start-doc actions MarkCrosshair @@ -977,25 +977,25 @@ { const char *function = PCB_ACTION_ARG(0); if (!function || !*function) { - if (Marked.status) { + if (pcb_marked.status) { pcb_notify_mark_change(pcb_false); - Marked.status = pcb_false; + pcb_marked.status = pcb_false; pcb_notify_mark_change(pcb_true); } else { pcb_notify_mark_change(pcb_false); - Marked.status = pcb_false; - Marked.status = pcb_true; - Marked.X = Crosshair.X; - Marked.Y = Crosshair.Y; + pcb_marked.status = pcb_false; + pcb_marked.status = pcb_true; + pcb_marked.X = pcb_crosshair.X; + pcb_marked.Y = pcb_crosshair.Y; pcb_notify_mark_change(pcb_true); } } else if (pcb_funchash_get(function, NULL) == F_Center) { pcb_notify_mark_change(pcb_false); - Marked.status = pcb_true; - Marked.X = Crosshair.X; - Marked.Y = Crosshair.Y; + pcb_marked.status = pcb_true; + pcb_marked.X = pcb_crosshair.X; + pcb_marked.Y = pcb_crosshair.Y; pcb_notify_mark_change(pcb_true); } return 0; Index: trunk/src/insert.c =================================================================== --- trunk/src/insert.c (revision 5034) +++ trunk/src/insert.c (revision 5035) @@ -88,16 +88,16 @@ static pcb_point_t InsertedPoint; double m; pcb_coord_t x, y, m1, m2; - pcb_line_t *line = (pcb_line_t *) Crosshair.AttachedObject.Ptr2; + pcb_line_t *line = (pcb_line_t *) pcb_crosshair.AttachedObject.Ptr2; - if (Crosshair.AttachedObject.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedObject.State == PCB_CH_STATE_FIRST) return NULL; - Crosshair.AttachedObject.Ptr3 = &InsertedPoint; + pcb_crosshair.AttachedObject.Ptr3 = &InsertedPoint; if (gui->shift_is_pressed()) { pcb_attached_line_t myline; /* only force 45 degree for nearest point */ - if (pcb_distance(Crosshair.X, Crosshair.Y, line->Point1.X, line->Point1.Y) < - pcb_distance(Crosshair.X, Crosshair.Y, line->Point2.X, line->Point2.Y)) + if (pcb_distance(pcb_crosshair.X, pcb_crosshair.Y, line->Point1.X, line->Point1.Y) < + pcb_distance(pcb_crosshair.X, pcb_crosshair.Y, line->Point2.X, line->Point2.Y)) myline.Point1 = myline.Point2 = line->Point1; else myline.Point1 = myline.Point2 = line->Point2; @@ -107,14 +107,14 @@ return &InsertedPoint; } if (conf_core.editor.all_direction_lines) { - InsertedPoint.X = Crosshair.X; - InsertedPoint.Y = Crosshair.Y; + InsertedPoint.X = pcb_crosshair.X; + InsertedPoint.Y = pcb_crosshair.Y; return &InsertedPoint; } - if (Crosshair.X == line->Point1.X) + if (pcb_crosshair.X == line->Point1.X) m1 = 2; /* 2 signals infinite slope */ else { - m = (double) (Crosshair.X - line->Point1.X) / (Crosshair.Y - line->Point1.Y); + m = (double) (pcb_crosshair.X - line->Point1.X) / (pcb_crosshair.Y - line->Point1.Y); m1 = 0; if (m > PCB_TAN_30_DEGREE) m1 = (m > PCB_TAN_60_DEGREE) ? 2 : 1; @@ -121,10 +121,10 @@ else if (m < -PCB_TAN_30_DEGREE) m1 = (m < -PCB_TAN_60_DEGREE) ? 2 : -1; } - if (Crosshair.X == line->Point2.X) + if (pcb_crosshair.X == line->Point2.X) m2 = 2; /* 2 signals infinite slope */ else { - m = (double) (Crosshair.X - line->Point1.X) / (Crosshair.Y - line->Point1.Y); + m = (double) (pcb_crosshair.X - line->Point1.X) / (pcb_crosshair.Y - line->Point1.Y); m2 = 0; if (m > PCB_TAN_30_DEGREE) m2 = (m > PCB_TAN_60_DEGREE) ? 2 : 1; Index: trunk/src/move.c =================================================================== --- trunk/src/move.c (revision 5034) +++ trunk/src/move.c (revision 5035) @@ -100,7 +100,7 @@ int n; /* first clear any marks that we made in the line flags */ - for(n = 0, ptr = Crosshair.AttachedObject.Rubberband; n < Crosshair.AttachedObject.RubberbandN; n++, ptr++) + for(n = 0, ptr = pcb_crosshair.AttachedObject.Rubberband; n < pcb_crosshair.AttachedObject.RubberbandN; n++, ptr++) PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); return (NULL); @@ -107,13 +107,13 @@ } /* move all the lines... and reset the counter */ - ptr = Crosshair.AttachedObject.Rubberband; - while (Crosshair.AttachedObject.RubberbandN) { + ptr = pcb_crosshair.AttachedObject.Rubberband; + while (pcb_crosshair.AttachedObject.RubberbandN) { /* first clear any marks that we made in the line flags */ PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); pcb_undo_add_obj_to_move(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, DX, DY); MoveLinePoint(&ctx, ptr->Layer, ptr->Line, ptr->MovedPoint); - Crosshair.AttachedObject.RubberbandN--; + pcb_crosshair.AttachedObject.RubberbandN--; ptr++; } Index: trunk/src/obj_line_drcenf.c =================================================================== --- trunk/src/obj_line_drcenf.c (revision 5034) +++ trunk/src/obj_line_drcenf.c (revision 5035) @@ -44,7 +44,7 @@ */ void AdjustAttachedLine(void) { - pcb_attached_line_t *line = &Crosshair.AttachedLine; + pcb_attached_line_t *line = &pcb_crosshair.AttachedLine; /* I need at least one point */ if (line->State == PCB_CH_STATE_FIRST) @@ -58,8 +58,8 @@ line->draw = pcb_true; /* no 45 degree lines required */ if (PCB->RatDraw || conf_core.editor.all_direction_lines) { - line->Point2.X = Crosshair.X; - line->Point2.Y = Crosshair.Y; + line->Point2.X = pcb_crosshair.X; + line->Point2.Y = pcb_crosshair.Y; return; } FortyFiveLine(line); @@ -83,8 +83,8 @@ double m; /* first calculate direction of line */ - dx = Crosshair.X - Line->Point1.X; - dy = Crosshair.Y - Line->Point1.Y; + dx = pcb_crosshair.X - Line->Point1.X; + dy = pcb_crosshair.Y - Line->Point1.Y; if (!dx) { if (!dy) @@ -113,12 +113,12 @@ case 0: case 4: Line->Point2.X = Line->Point1.X; - Line->Point2.Y = Crosshair.Y; + Line->Point2.Y = pcb_crosshair.Y; break; case 2: case 6: - Line->Point2.X = Crosshair.X; + Line->Point2.X = pcb_crosshair.X; Line->Point2.Y = Line->Point1.Y; break; @@ -150,9 +150,9 @@ void AdjustTwoLine(pcb_bool way) { pcb_coord_t dx, dy; - pcb_attached_line_t *line = &Crosshair.AttachedLine; + pcb_attached_line_t *line = &pcb_crosshair.AttachedLine; - if (Crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) + if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) return; /* don't draw outline when ctrl key is pressed */ if (gui->control_is_pressed()) { @@ -162,32 +162,32 @@ else line->draw = pcb_true; if (conf_core.editor.all_direction_lines) { - line->Point2.X = Crosshair.X; - line->Point2.Y = Crosshair.Y; + line->Point2.X = pcb_crosshair.X; + line->Point2.Y = pcb_crosshair.Y; return; } /* swap the modes if shift is held down */ if (gui->shift_is_pressed()) way = !way; - dx = Crosshair.X - line->Point1.X; - dy = Crosshair.Y - line->Point1.Y; + dx = pcb_crosshair.X - line->Point1.X; + dy = pcb_crosshair.Y - line->Point1.Y; if (!way) { if (coord_abs(dx) > coord_abs(dy)) { - line->Point2.X = Crosshair.X - SGN(dx) * coord_abs(dy); + line->Point2.X = pcb_crosshair.X - SGN(dx) * coord_abs(dy); line->Point2.Y = line->Point1.Y; } else { line->Point2.X = line->Point1.X; - line->Point2.Y = Crosshair.Y - SGN(dy) * coord_abs(dx); + line->Point2.Y = pcb_crosshair.Y - SGN(dy) * coord_abs(dx); } } else { if (coord_abs(dx) > coord_abs(dy)) { line->Point2.X = line->Point1.X + SGN(dx) * coord_abs(dy); - line->Point2.Y = Crosshair.Y; + line->Point2.Y = pcb_crosshair.Y; } else { - line->Point2.X = Crosshair.X; + line->Point2.X = pcb_crosshair.X; line->Point2.Y = line->Point1.Y + SGN(dy) * coord_abs(dx);; } } @@ -266,8 +266,8 @@ line1.Thickness = conf_core.design.line_thickness + 2 * (PCB->Bloat + 1); line2.Thickness = line1.Thickness; line1.Clearance = line2.Clearance = 0; - line1.Point1.X = Crosshair.AttachedLine.Point1.X; - line1.Point1.Y = Crosshair.AttachedLine.Point1.Y; + line1.Point1.X = pcb_crosshair.AttachedLine.Point1.X; + line1.Point1.Y = pcb_crosshair.AttachedLine.Point1.Y; dy = end->Y - line1.Point1.Y; dx = end->X - line1.Point1.X; if (coord_abs(dx) > coord_abs(dy)) { @@ -418,8 +418,8 @@ static pcb_point_t last_good; /* internal state of last good endpoint - we cna do thsi cheat, because... */ /* ... we hardwire the assumption on how a line is drawn: it starts out as a 0 long segment, which is valid: */ - if ((Crosshair.AttachedLine.Point1.X == Crosshair.X) && (Crosshair.AttachedLine.Point1.Y == Crosshair.Y)) { - line.Point1 = line.Point2 = Crosshair.AttachedLine.Point1; + if ((pcb_crosshair.AttachedLine.Point1.X == pcb_crosshair.X) && (pcb_crosshair.AttachedLine.Point1.Y == pcb_crosshair.Y)) { + line.Point1 = line.Point2 = pcb_crosshair.AttachedLine.Point1; goto auto_good; } @@ -426,8 +426,8 @@ memset(&line, 0, sizeof(line)); /* check where the line wants to end */ - aline.Point1.X = Crosshair.AttachedLine.Point1.X; - aline.Point1.Y = Crosshair.AttachedLine.Point1.Y; + aline.Point1.X = pcb_crosshair.AttachedLine.Point1.X; + aline.Point1.Y = pcb_crosshair.AttachedLine.Point1.Y; FortyFiveLine(&aline); line.Point1 = aline.Point1; line.Point2 = aline.Point2; @@ -481,8 +481,8 @@ if (gui->mod1_is_pressed() || gui->control_is_pressed() || PCB->RatDraw || layer_idx >= max_copper_layer) return; - rs.X = r45.X = Crosshair.X; - rs.Y = r45.Y = Crosshair.Y; + rs.X = r45.X = pcb_crosshair.X; + rs.Y = r45.Y = pcb_crosshair.Y; if (conf_core.editor.line_refraction != 0) { /* first try starting straight */ @@ -494,7 +494,7 @@ drc_line(&rs); r45 = rs; #define sqr(a) ((a) * (a)) - r1 = r2 = sqrt(sqr(rs.X - Crosshair.AttachedLine.Point1.X) + sqr(rs.Y - Crosshair.AttachedLine.Point1.Y)); + r1 = r2 = sqrt(sqr(rs.X - pcb_crosshair.AttachedLine.Point1.X) + sqr(rs.Y - pcb_crosshair.AttachedLine.Point1.Y)); #undef sqr } /* shift forces the line lookahead path to refract the alternate way */ @@ -511,8 +511,8 @@ conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 1); } } - Crosshair.X = rs.X; - Crosshair.Y = rs.Y; + pcb_crosshair.X = rs.X; + pcb_crosshair.Y = rs.Y; } else { if (conf_core.editor.line_refraction !=0) { @@ -525,7 +525,7 @@ conf_setf(CFR_DESIGN, "editor/line_refraction", -1, "%d", 2); } } - Crosshair.X = r45.X; - Crosshair.Y = r45.Y; + pcb_crosshair.X = r45.X; + pcb_crosshair.Y = r45.Y; } } Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 5034) +++ trunk/src/object_act.c (revision 5035) @@ -329,7 +329,7 @@ case F_Object: if ((pcb_search_screen(x, y, PCB_TYPE_ELEMENT, &ptrtmp, &ptrtmp, &ptrtmp)) != PCB_TYPE_NONE) { element = (pcb_element_t *) ptrtmp; - pcb_element_change_side(element, 2 * Crosshair.Y - PCB->MaxHeight); + pcb_element_change_side(element, 2 * pcb_crosshair.Y - PCB->MaxHeight); pcb_undo_inc_serial(); pcb_draw(); } @@ -386,7 +386,7 @@ nx -= x; if (absolute2) ny -= y; - Crosshair.AttachedObject.RubberbandN = 0; + pcb_crosshair.AttachedObject.RubberbandN = 0; if (conf_core.editor.rubber_band_mode) pcb_rubber_band_lookup_lines(type, ptr1, ptr2, ptr3); if (type == PCB_TYPE_ELEMENT) @@ -789,7 +789,7 @@ { void *ptr1, *ptr2, *ptr3; - if (pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3) != PCB_TYPE_NONE) { + if (pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_TYPE_ELEMENT, &ptr1, &ptr2, &ptr3) != PCB_TYPE_NONE) { Note.Buffer = conf_core.editor.buffer_number; pcb_buffer_set_number(MAX_BUFFER - 1); pcb_buffer_clear(PCB_PASTEBUFFER); Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 5034) +++ trunk/src/plug_io.c (revision 5035) @@ -322,8 +322,8 @@ if (how == 0) { /* update cursor location */ - Crosshair.X = PCB_CLAMP(PCB->CursorX, 0, PCB->MaxWidth); - Crosshair.Y = PCB_CLAMP(PCB->CursorY, 0, PCB->MaxHeight); + pcb_crosshair.X = PCB_CLAMP(PCB->CursorX, 0, PCB->MaxWidth); + pcb_crosshair.Y = PCB_CLAMP(PCB->CursorY, 0, PCB->MaxHeight); /* update cursor confinement and output area (scrollbars) */ pcb_board_resize(PCB->MaxWidth, PCB->MaxHeight); Index: trunk/src/polygon.c =================================================================== --- trunk/src/polygon.c (revision 5034) +++ trunk/src/polygon.c (revision 5035) @@ -1271,7 +1271,7 @@ */ void pcb_polygon_go_to_prev_point(void) { - switch (Crosshair.AttachedPolygon.PointN) { + switch (pcb_crosshair.AttachedPolygon.PointN) { /* do nothing if mode has just been entered */ case 0: break; @@ -1278,8 +1278,8 @@ /* reset number of points and 'PCB_MODE_LINE' state */ case 1: - Crosshair.AttachedPolygon.PointN = 0; - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedPolygon.PointN = 0; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; addedLines = 0; break; @@ -1286,12 +1286,12 @@ /* back-up one point */ default: { - pcb_point_t *points = Crosshair.AttachedPolygon.Points; - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN - 2; + pcb_point_t *points = pcb_crosshair.AttachedPolygon.Points; + pcb_cardinal_t n = pcb_crosshair.AttachedPolygon.PointN - 2; - Crosshair.AttachedPolygon.PointN--; - Crosshair.AttachedLine.Point1.X = points[n].X; - Crosshair.AttachedLine.Point1.Y = points[n].Y; + pcb_crosshair.AttachedPolygon.PointN--; + pcb_crosshair.AttachedLine.Point1.X = points[n].X; + pcb_crosshair.AttachedLine.Point1.Y = points[n].Y; break; } } @@ -1302,7 +1302,7 @@ */ void pcb_polygon_close_poly(void) { - pcb_cardinal_t n = Crosshair.AttachedPolygon.PointN; + pcb_cardinal_t n = pcb_crosshair.AttachedPolygon.PointN; /* check number of points */ if (n >= 3) { @@ -1312,8 +1312,8 @@ if (!conf_core.editor.all_direction_lines) { pcb_coord_t dx, dy; - dx = coord_abs(Crosshair.AttachedPolygon.Points[n - 1].X - Crosshair.AttachedPolygon.Points[0].X); - dy = coord_abs(Crosshair.AttachedPolygon.Points[n - 1].Y - Crosshair.AttachedPolygon.Points[0].Y); + dx = coord_abs(pcb_crosshair.AttachedPolygon.Points[n - 1].X - pcb_crosshair.AttachedPolygon.Points[0].X); + dy = coord_abs(pcb_crosshair.AttachedPolygon.Points[n - 1].Y - pcb_crosshair.AttachedPolygon.Points[0].Y); if (!(dx == 0 || dy == 0 || dx == dy)) { pcb_message(PCB_MSG_ERROR, _("Cannot close polygon because 45 degree lines are requested.\n")); return; @@ -1337,12 +1337,12 @@ /* move data to layer and clear attached struct */ polygon = pcb_poly_new(CURRENT, pcb_no_flags()); saveID = polygon->ID; - *polygon = Crosshair.AttachedPolygon; + *polygon = pcb_crosshair.AttachedPolygon; polygon->ID = saveID; PCB_FLAG_SET(PCB_FLAG_CLEARPOLY, polygon); if (conf_core.editor.full_poly) PCB_FLAG_SET(PCB_FLAG_FULLPOLY, polygon); - memset(&Crosshair.AttachedPolygon, 0, sizeof(pcb_polygon_t)); + memset(&pcb_crosshair.AttachedPolygon, 0, sizeof(pcb_polygon_t)); pcb_poly_bbox(polygon); if (!CURRENT->polygon_tree) CURRENT->polygon_tree = pcb_r_create_tree(NULL, 0, 0); @@ -1352,7 +1352,7 @@ pcb_board_set_changed_flag(pcb_true); /* reset state of attached line */ - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; addedLines = 0; /* add to undo list */ Index: trunk/src/rats.c =================================================================== --- trunk/src/rats.c (revision 5034) +++ trunk/src/rats.c (revision 5035) @@ -818,12 +818,12 @@ pcb_lib_menu_t *menu; pcb_lib_entry_t *entry; - if (Crosshair.AttachedLine.Point1.X == Crosshair.AttachedLine.Point2.X - && Crosshair.AttachedLine.Point1.Y == Crosshair.AttachedLine.Point2.Y) + if (pcb_crosshair.AttachedLine.Point1.X == pcb_crosshair.AttachedLine.Point2.X + && pcb_crosshair.AttachedLine.Point1.Y == pcb_crosshair.AttachedLine.Point2.Y) return (NULL); found = pcb_search_obj_by_location(PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 5); + pcb_crosshair.AttachedLine.Point1.X, pcb_crosshair.AttachedLine.Point1.Y, 5); if (found == PCB_TYPE_NONE) { pcb_message(PCB_MSG_DEFAULT, _("No pad/pin under rat line\n")); return (NULL); @@ -838,7 +838,7 @@ GetLayerGroupNumberByNumber(solder_silk_layer) : GetLayerGroupNumberByNumber(component_silk_layer)); strcpy(name1, pcb_connection_name(found, ptr1, ptr2)); found = pcb_search_obj_by_location(PCB_TYPE_PAD | PCB_TYPE_PIN, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y, 5); + pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y, 5); if (found == PCB_TYPE_NONE) { pcb_message(PCB_MSG_DEFAULT, _("No pad/pin under rat line\n")); return (NULL); @@ -897,10 +897,10 @@ ratIt: pcb_netlist_changed(0); - return (pcb_rat_new(PCB->Data, Crosshair.AttachedLine.Point1.X, - Crosshair.AttachedLine.Point1.Y, - Crosshair.AttachedLine.Point2.X, - Crosshair.AttachedLine.Point2.Y, group1, group2, conf_core.appearance.rat_thickness, pcb_no_flags())); + return (pcb_rat_new(PCB->Data, pcb_crosshair.AttachedLine.Point1.X, + pcb_crosshair.AttachedLine.Point1.Y, + pcb_crosshair.AttachedLine.Point2.X, + pcb_crosshair.AttachedLine.Point2.Y, group1, group2, conf_core.appearance.rat_thickness, pcb_no_flags())); } Index: trunk/src/remove_act.c =================================================================== --- trunk/src/remove_act.c (revision 5034) +++ trunk/src/remove_act.c (revision 5035) @@ -47,8 +47,8 @@ const char *function = PCB_ACTION_ARG(0); int id = pcb_funchash_get(function, NULL); - Note.X = Crosshair.X; - Note.Y = Crosshair.Y; + Note.X = pcb_crosshair.X; + Note.Y = pcb_crosshair.Y; if (id == -1) { /* no arg */ if (pcb_remove_selected() == pcb_false) Index: trunk/src/rotate.c =================================================================== --- trunk/src/rotate.c (revision 5034) +++ trunk/src/rotate.c (revision 5035) @@ -92,8 +92,8 @@ ctx.rotate.center_y = Y; /* move all the rubberband lines... and reset the counter */ - ptr = Crosshair.AttachedObject.Rubberband; - while (Crosshair.AttachedObject.RubberbandN) { + ptr = pcb_crosshair.AttachedObject.Rubberband; + while (pcb_crosshair.AttachedObject.RubberbandN) { changed = pcb_true; PCB_FLAG_CLEAR(PCB_FLAG_RUBBEREND, ptr->Line); pcb_undo_add_obj_to_rotate(PCB_TYPE_LINE_POINT, ptr->Layer, ptr->Line, ptr->MovedPoint, ctx.rotate.center_x, ctx.rotate.center_y, Steps); @@ -115,7 +115,7 @@ pcb_r_insert_entry(PCB->Data->rat_tree, (pcb_box_t *) ptr->Line, 0); DrawRat((pcb_rat_t *) ptr->Line); } - Crosshair.AttachedObject.RubberbandN--; + pcb_crosshair.AttachedObject.RubberbandN--; ptr++; } pcb_undo_add_obj_to_rotate(Type, Ptr1, Ptr2, Ptr3, ctx.rotate.center_x, ctx.rotate.center_y, ctx.rotate.number); @@ -137,7 +137,7 @@ pcb_message(PCB_MSG_DEFAULT, _("Sorry, the object is locked\n")); return; } - Crosshair.AttachedObject.RubberbandN = 0; + pcb_crosshair.AttachedObject.RubberbandN = 0; if (conf_core.editor.rubber_band_mode) pcb_rubber_band_lookup_lines(type, ptr1, ptr2, ptr3); if (type == PCB_TYPE_ELEMENT) Index: trunk/src/rubberband.c =================================================================== --- trunk/src/rubberband.c (revision 5034) +++ trunk/src/rubberband.c (revision 5035) @@ -388,7 +388,7 @@ /* --------------------------------------------------------------------------- * lookup all lines that are connected to an object and save the - * data to 'Crosshair.AttachedObject.Rubberband' + * data to 'pcb_crosshair.AttachedObject.Rubberband' * lookup is only done for visible layers */ void pcb_rubber_band_lookup_lines(int Type, void *Ptr1, void *Ptr2, void *Ptr3) @@ -493,20 +493,20 @@ */ pcb_rubberband_t *pcb_rubber_band_alloc(void) { - pcb_rubberband_t *ptr = Crosshair.AttachedObject.Rubberband; + pcb_rubberband_t *ptr = pcb_crosshair.AttachedObject.Rubberband; /* realloc new memory if necessary and clear it */ - if (Crosshair.AttachedObject.RubberbandN >= Crosshair.AttachedObject.RubberbandMax) { - Crosshair.AttachedObject.RubberbandMax += STEP_RUBBERBAND; - ptr = (pcb_rubberband_t *) realloc(ptr, Crosshair.AttachedObject.RubberbandMax * sizeof(pcb_rubberband_t)); - Crosshair.AttachedObject.Rubberband = ptr; - memset(ptr + Crosshair.AttachedObject.RubberbandN, 0, STEP_RUBBERBAND * sizeof(pcb_rubberband_t)); + if (pcb_crosshair.AttachedObject.RubberbandN >= pcb_crosshair.AttachedObject.RubberbandMax) { + pcb_crosshair.AttachedObject.RubberbandMax += STEP_RUBBERBAND; + ptr = (pcb_rubberband_t *) realloc(ptr, pcb_crosshair.AttachedObject.RubberbandMax * sizeof(pcb_rubberband_t)); + pcb_crosshair.AttachedObject.Rubberband = ptr; + memset(ptr + pcb_crosshair.AttachedObject.RubberbandN, 0, STEP_RUBBERBAND * sizeof(pcb_rubberband_t)); } - return (ptr + Crosshair.AttachedObject.RubberbandN++); + return (ptr + pcb_crosshair.AttachedObject.RubberbandN++); } /* --------------------------------------------------------------------------- - * adds a new line to the rubberband list of 'Crosshair.AttachedObject' + * adds a new line to the rubberband list of 'pcb_crosshair.AttachedObject' * if Layer == 0 it is a rat line */ pcb_rubberband_t *pcb_rubber_band_create(pcb_layer_t *Layer, pcb_line_t *Line, pcb_point_t *MovedPoint) Index: trunk/src/select.c =================================================================== --- trunk/src/select.c (revision 5034) +++ trunk/src/select.c (revision 5035) @@ -115,7 +115,7 @@ pcb_bool changed = pcb_true; - type = pcb_search_screen(Crosshair.X, Crosshair.Y, PCB_SELECT_TYPES, &ptr1, &ptr2, &ptr3); + type = pcb_search_screen(pcb_crosshair.X, pcb_crosshair.Y, PCB_SELECT_TYPES, &ptr1, &ptr2, &ptr3); if (type == PCB_TYPE_NONE || PCB_FLAG_TEST(PCB_FLAG_LOCK, (pcb_pin_t *) ptr2)) return (pcb_false); switch (type) { Index: trunk/src/select_act.c =================================================================== --- trunk/src/select_act.c (revision 5034) +++ trunk/src/select_act.c (revision 5035) @@ -178,15 +178,15 @@ { pcb_box_t box; - box.X1 = MIN(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y1 = MIN(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); - box.X2 = MAX(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y2 = MAX(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); + box.X1 = MIN(pcb_crosshair.AttachedBox.Point1.X, pcb_crosshair.AttachedBox.Point2.X); + box.Y1 = MIN(pcb_crosshair.AttachedBox.Point1.Y, pcb_crosshair.AttachedBox.Point2.Y); + box.X2 = MAX(pcb_crosshair.AttachedBox.Point1.X, pcb_crosshair.AttachedBox.Point2.X); + box.Y2 = MAX(pcb_crosshair.AttachedBox.Point1.Y, pcb_crosshair.AttachedBox.Point2.Y); pcb_notify_crosshair_change(pcb_false); pcb_notify_block(); - if (Crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(&box, pcb_true)) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(&box, pcb_true)) { pcb_board_set_changed_flag(pcb_true); - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; } pcb_notify_crosshair_change(pcb_true); break; @@ -330,15 +330,15 @@ { pcb_box_t box; - box.X1 = MIN(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y1 = MIN(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); - box.X2 = MAX(Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X); - box.Y2 = MAX(Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y); + box.X1 = MIN(pcb_crosshair.AttachedBox.Point1.X, pcb_crosshair.AttachedBox.Point2.X); + box.Y1 = MIN(pcb_crosshair.AttachedBox.Point1.Y, pcb_crosshair.AttachedBox.Point2.Y); + box.X2 = MAX(pcb_crosshair.AttachedBox.Point1.X, pcb_crosshair.AttachedBox.Point2.X); + box.Y2 = MAX(pcb_crosshair.AttachedBox.Point1.Y, pcb_crosshair.AttachedBox.Point2.Y); pcb_notify_crosshair_change(pcb_false); pcb_notify_block(); - if (Crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(&box, pcb_false)) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD && pcb_select_block(&box, pcb_false)) { pcb_board_set_changed_flag(pcb_true); - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; } pcb_notify_crosshair_change(pcb_true); break; Index: trunk/src/undo_act.c =================================================================== --- trunk/src/undo_act.c (revision 5034) +++ trunk/src/undo_act.c (revision 5035) @@ -128,14 +128,14 @@ const char *function = PCB_ACTION_ARG(0); if (!function || !*function) { /* don't allow undo in the middle of an operation */ - if (conf_core.editor.mode != PCB_MODE_POLYGON_HOLE && Crosshair.AttachedObject.State != PCB_CH_STATE_FIRST) + if (conf_core.editor.mode != PCB_MODE_POLYGON_HOLE && pcb_crosshair.AttachedObject.State != PCB_CH_STATE_FIRST) return 1; - if (Crosshair.AttachedBox.State != PCB_CH_STATE_FIRST && conf_core.editor.mode != PCB_MODE_ARC) + if (pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST && conf_core.editor.mode != PCB_MODE_ARC) return 1; /* undo the last operation */ pcb_notify_crosshair_change(pcb_false); - if ((conf_core.editor.mode == PCB_MODE_POLYGON || conf_core.editor.mode == PCB_MODE_POLYGON_HOLE) && Crosshair.AttachedPolygon.PointN) { + if ((conf_core.editor.mode == PCB_MODE_POLYGON || conf_core.editor.mode == PCB_MODE_POLYGON_HOLE) && pcb_crosshair.AttachedPolygon.PointN) { pcb_polygon_go_to_prev_point(); pcb_notify_crosshair_change(pcb_true); return 0; @@ -142,44 +142,44 @@ } /* move anchor point if undoing during line creation */ if (conf_core.editor.mode == PCB_MODE_LINE) { - if (Crosshair.AttachedLine.State == PCB_CH_STATE_SECOND) { + if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_SECOND) { if (conf_core.editor.auto_drc) pcb_undo(pcb_true); /* undo the connection find */ - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; pcb_crosshair_set_local_ref(0, 0, pcb_false); pcb_notify_crosshair_change(pcb_true); return 0; } - if (Crosshair.AttachedLine.State == PCB_CH_STATE_THIRD) { + if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_THIRD) { int type; void *ptr1, *ptr3, *ptrtmp; pcb_line_t *ptr2; /* this search is guaranteed to succeed */ pcb_search_obj_by_location(PCB_TYPE_LINE | PCB_TYPE_RATLINE, &ptr1, - &ptrtmp, &ptr3, Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 0); + &ptrtmp, &ptr3, pcb_crosshair.AttachedLine.Point1.X, pcb_crosshair.AttachedLine.Point1.Y, 0); ptr2 = (pcb_line_t *) ptrtmp; /* save both ends of line */ - Crosshair.AttachedLine.Point2.X = ptr2->Point1.X; - Crosshair.AttachedLine.Point2.Y = ptr2->Point1.Y; + pcb_crosshair.AttachedLine.Point2.X = ptr2->Point1.X; + pcb_crosshair.AttachedLine.Point2.Y = ptr2->Point1.Y; if ((type = pcb_undo(pcb_true))) pcb_board_set_changed_flag(pcb_true); /* check that the undo was of the right type */ if ((type & PCB_UNDO_CREATE) == 0) { /* wrong undo type, restore anchor points */ - Crosshair.AttachedLine.Point2.X = Crosshair.AttachedLine.Point1.X; - Crosshair.AttachedLine.Point2.Y = Crosshair.AttachedLine.Point1.Y; + pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.AttachedLine.Point1.X; + pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.AttachedLine.Point1.Y; pcb_notify_crosshair_change(pcb_true); return 0; } /* move to new anchor */ - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y; /* check if an intermediate point was removed */ if (type & PCB_UNDO_REMOVE) { /* this search should find the restored line */ pcb_search_obj_by_location(PCB_TYPE_LINE | PCB_TYPE_RATLINE, &ptr1, - &ptrtmp, &ptr3, Crosshair.AttachedLine.Point2.X, Crosshair.AttachedLine.Point2.Y, 0); + &ptrtmp, &ptr3, pcb_crosshair.AttachedLine.Point2.X, pcb_crosshair.AttachedLine.Point2.Y, 0); ptr2 = (pcb_line_t *) ptrtmp; if (conf_core.editor.auto_drc) { /* undo loses PCB_FLAG_FOUND */ @@ -186,19 +186,19 @@ PCB_FLAG_SET(PCB_FLAG_FOUND, ptr2); DrawLine(CURRENT, ptr2); } - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = ptr2->Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = ptr2->Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = ptr2->Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = ptr2->Point2.Y; } - pcb_crosshair_grid_fit(Crosshair.X, Crosshair.Y); + pcb_crosshair_grid_fit(pcb_crosshair.X, pcb_crosshair.Y); pcb_adjust_attached_objects(); if (--addedLines == 0) { - Crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; lastLayer = CURRENT; } else { /* this search is guaranteed to succeed too */ pcb_search_obj_by_location(PCB_TYPE_LINE | PCB_TYPE_RATLINE, &ptr1, - &ptrtmp, &ptr3, Crosshair.AttachedLine.Point1.X, Crosshair.AttachedLine.Point1.Y, 0); + &ptrtmp, &ptr3, pcb_crosshair.AttachedLine.Point1.X, pcb_crosshair.AttachedLine.Point1.Y, 0); ptr2 = (pcb_line_t *) ptrtmp; lastLayer = (pcb_layer_t *) ptr1; } @@ -207,23 +207,23 @@ } } if (conf_core.editor.mode == PCB_MODE_ARC) { - if (Crosshair.AttachedBox.State == PCB_CH_STATE_SECOND) { - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_SECOND) { + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; pcb_notify_crosshair_change(pcb_true); return 0; } - if (Crosshair.AttachedBox.State == PCB_CH_STATE_THIRD) { + if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_THIRD) { void *ptr1, *ptr2, *ptr3; pcb_box_t *bx; /* guaranteed to succeed */ pcb_search_obj_by_location(PCB_TYPE_ARC, &ptr1, &ptr2, &ptr3, - Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point1.Y, 0); + pcb_crosshair.AttachedBox.Point1.X, pcb_crosshair.AttachedBox.Point1.Y, 0); bx = pcb_arc_get_ends((pcb_arc_t *) ptr2); - Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = bx->X1; - Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = bx->Y1; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = bx->X1; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = bx->Y1; pcb_adjust_attached_objects(); if (--addedLines == 0) - Crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; } } /* undo the last destructive operation */ @@ -266,15 +266,15 @@ int ActionRedo(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) { if (((conf_core.editor.mode == PCB_MODE_POLYGON || - conf_core.editor.mode == PCB_MODE_POLYGON_HOLE) && Crosshair.AttachedPolygon.PointN) || Crosshair.AttachedLine.State == PCB_CH_STATE_SECOND) + conf_core.editor.mode == PCB_MODE_POLYGON_HOLE) && pcb_crosshair.AttachedPolygon.PointN) || pcb_crosshair.AttachedLine.State == PCB_CH_STATE_SECOND) return 1; pcb_notify_crosshair_change(pcb_false); if (pcb_redo(pcb_true)) { pcb_board_set_changed_flag(pcb_true); - if (conf_core.editor.mode == PCB_MODE_LINE && Crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { + if (conf_core.editor.mode == PCB_MODE_LINE && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { pcb_line_t *line = linelist_last(&CURRENT->Line); - Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = line->Point2.X; - Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = line->Point2.Y; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = line->Point2.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = line->Point2.Y; addedLines++; } } Index: trunk/src_plugins/distalign/distalign.c =================================================================== --- trunk/src_plugins/distalign/distalign.c (revision 5034) +++ trunk/src_plugins/distalign/distalign.c (revision 5035) @@ -47,7 +47,7 @@ * of their top edges and let them wander off the grid to exactly the * average of their tops. * - * :Align(X,Marks,Crosshair) + * :Align(X,Marks,pcb_crosshair) * * None of the objects are where you want them, so you move the * crosshair to a likely spot and cause them all to move their X @@ -69,7 +69,7 @@ * Objects are spread out evenly from the first (uppermost) to last * using their marks as the reference point. * - * :Distribute(X,Lefts,Crosshair,Last) + * :Distribute(X,Lefts,pcb_crosshair,Last) * * You move your crosshair to the left edge of the target area, which * will be the leftmost edge of the leftmost object. The objects are @@ -82,7 +82,7 @@ * their centers being spread out evenly, you want the space (or "gaps") * to be even. * - * You get tricky and bind `Align(X,Marks,Crosshair)' to a key. + * You get tricky and bind `Align(X,Marks,pcb_crosshair)' to a key. * Now you can select an object and hit your key and the object will * warp to the same X coordinate as your cursor. * @@ -117,10 +117,10 @@ #define ARG(n) (argc > (n) ? argv[n] : 0) static const char align_syntax[] = - "Align(X/Y, [Lefts/Rights/Tops/Bottoms/Centers/Marks, [First/Last/Crosshair/Average[, Gridless]]])"; + "Align(X/Y, [Lefts/Rights/Tops/Bottoms/Centers/Marks, [First/Last/pcb_crosshair/Average[, Gridless]]])"; static const char distribute_syntax[] = - "Distribute(Y, [Lefts/Rights/Tops/Bottoms/Centers/Marks/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]])"; + "Distribute(Y, [Lefts/Rights/Tops/Bottoms/Centers/Marks/Gaps, [First/Last/pcb_crosshair, First/Last/pcb_crosshair[, Gridless]]])"; enum { K_X, @@ -155,7 +155,7 @@ /*[K_First] */ "First", /*[K_Last] */ "Last", /*[K_Average] */ "Average", - /*[K_Crosshair] */ "Crosshair", + /*[K_Crosshair] */ "pcb_crosshair", /*[K_Gridless] */ "Gridless", }; @@ -325,8 +325,8 @@ } /*! - * Align(X, [Lefts/Rights/Centers/Marks, [First/Last/Crosshair/Average[, Gridless]]])\n - * Align(Y, [Tops/Bottoms/Centers/Marks, [First/Last/Crosshair/Average[, Gridless]]]) + * Align(X, [Lefts/Rights/Centers/Marks, [First/Last/pcb_crosshair/Average[, Gridless]]])\n + * Align(Y, [Tops/Bottoms/Centers/Marks, [First/Last/pcb_crosshair/Average[, Gridless]]]) * * X or Y - Select which axis will move, other is untouched. \n * Lefts, Rights, \n @@ -333,9 +333,9 @@ * Tops, Bottoms, \n * Centers, Marks - Pick alignment point within each element. \n * First, Last, \n - * Crosshair, \n + * pcb_crosshair, \n * Average - Alignment reference, First=Topmost/Leftmost, \n - * Last=Bottommost/Rightmost, Average or Crosshair point \n + * Last=Bottommost/Rightmost, Average or pcb_crosshair point \n * Gridless - Do not force results to align to prevailing grid. \n * * Defaults are Marks, First. @@ -408,7 +408,7 @@ PCB_AFAIL(align); } /* find the final alignment coordinate using the above options */ - q = reference_coord(K_align, Crosshair.X, Crosshair.Y, dir, point, reference); + q = reference_coord(K_align, pcb_crosshair.X, pcb_crosshair.Y, dir, point, reference); /* move all selected elements to the new coordinate */ PCB_ELEMENT_LOOP(PCB->Data); { @@ -446,14 +446,14 @@ } /*! - * Distribute(X, [Lefts/Rights/Centers/Marks/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]]) \n - * Distribute(Y, [Tops/Bottoms/Centers/Marks/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]]) \n + * Distribute(X, [Lefts/Rights/Centers/Marks/Gaps, [First/Last/pcb_crosshair, First/Last/pcb_crosshair[, Gridless]]]) \n + * Distribute(Y, [Tops/Bottoms/Centers/Marks/Gaps, [First/Last/pcb_crosshair, First/Last/pcb_crosshair[, Gridless]]]) \n * \n * As with align, plus: \n * \n * Gaps - Make gaps even rather than spreading points evenly. \n * First, Last, \n - * Crosshair - Two arguments specifying both ends of the distribution, + * pcb_crosshair - Two arguments specifying both ends of the distribution, * they can't both be the same. \n * \n * Defaults are Marks, First, Last \n Index: trunk/src_plugins/distaligntext/distaligntext.c =================================================================== --- trunk/src_plugins/distaligntext/distaligntext.c (revision 5034) +++ trunk/src_plugins/distaligntext/distaligntext.c (revision 5035) @@ -41,10 +41,10 @@ #define ARG(n) (argc > (n) ? argv[n] : 0) static const char aligntext_syntax[] = - "AlignText(X/Y, [Lefts/Rights/Tops/Bottoms/Centers, [First/Last/Crosshair/Average[, Gridless]]])"; + "AlignText(X/Y, [Lefts/Rights/Tops/Bottoms/Centers, [First/Last/pcb_crosshair/Average[, Gridless]]])"; static const char distributetext_syntax[] = - "DistributeText(Y, [Lefts/Rights/Tops/Bottoms/Centers/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]])"; + "DistributeText(Y, [Lefts/Rights/Tops/Bottoms/Centers/Gaps, [First/Last/pcb_crosshair, First/Last/pcb_crosshair[, Gridless]]])"; enum { K_X, @@ -77,7 +77,7 @@ /* [K_First] */ "First", /* [K_Last] */ "Last", /* [K_Average] */ "Average", - /* [K_Crosshair] */ "Crosshair", + /* [K_Crosshair] */ "pcb_crosshair", /* [K_Gridless] */ "Gridless", }; @@ -265,8 +265,8 @@ /*! - * AlignText(X, [Lefts/Rights/Centers, [First/Last/Crosshair/Average[, Gridless]]])\n - * AlignText(Y, [Tops/Bottoms/Centers, [First/Last/Crosshair/Average[, Gridless]]]) + * AlignText(X, [Lefts/Rights/Centers, [First/Last/pcb_crosshair/Average[, Gridless]]])\n + * AlignText(Y, [Tops/Bottoms/Centers, [First/Last/pcb_crosshair/Average[, Gridless]]]) * * X or Y - Select which axis will move, other is untouched. \n * Lefts, Rights, \n @@ -274,9 +274,9 @@ * Centers - Pick alignment point within each element. \n * NB: text objects have no Mark. \n * First, Last, \n - * Crosshair, \n + * pcb_crosshair, \n * Average - Alignment reference, First=Topmost/Leftmost, \n - * Last=Bottommost/Rightmost, Average or Crosshair point \n + * Last=Bottommost/Rightmost, Average or pcb_crosshair point \n * Gridless - Do not force results to align to prevailing grid. \n * * Defaults are Lefts/Tops, First @@ -355,7 +355,7 @@ } pcb_undo_save_serial(); /* find the final alignment coordinate using the above options */ - q = reference_coord(K_aligntext, Crosshair.X, Crosshair.Y, dir, point, reference); + q = reference_coord(K_aligntext, pcb_crosshair.X, pcb_crosshair.Y, dir, point, reference); /* move all selected elements to the new coordinate */ /* selected text part of an element */ PCB_ELEMENT_LOOP(PCB->Data); @@ -424,14 +424,14 @@ } /*! - * DistributeText(X, [Lefts/Rights/Centers/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]]) \n - * DistributeText(Y, [Tops/Bottoms/Centers/Gaps, [First/Last/Crosshair, First/Last/Crosshair[, Gridless]]]) \n + * DistributeText(X, [Lefts/Rights/Centers/Gaps, [First/Last/pcb_crosshair, First/Last/pcb_crosshair[, Gridless]]]) \n + * DistributeText(Y, [Tops/Bottoms/Centers/Gaps, [First/Last/pcb_crosshair, First/Last/pcb_crosshair[, Gridless]]]) \n * \n * As with align, plus: \n * \n * Gaps - Make gaps even rather than spreading points evenly. \n * First, Last, \n - * Crosshair - Two arguments specifying both ends of the distribution, + * pcb_crosshair - Two arguments specifying both ends of the distribution, * they can't both be the same. \n * \n * Defaults are Lefts/Tops, First, Last \n Index: trunk/src_plugins/hid_gtk/gtkhid-gdk.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-gdk.c (revision 5034) +++ trunk/src_plugins/hid_gtk/gtkhid-gdk.c (revision 5035) @@ -1023,7 +1023,7 @@ draw_slanted_cross(xor_gc, x, y); if (prev == pcb_ch_shape_dozen) draw_dozen_cross(xor_gc, x, y); - prev = Crosshair.shape; + prev = pcb_crosshair.shape; } static void show_crosshair(gboolean paint_new_location) Index: trunk/src_plugins/hid_gtk/gtkhid-gl.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-gl.c (revision 5034) +++ trunk/src_plugins/hid_gtk/gtkhid-gl.c (revision 5035) @@ -666,7 +666,7 @@ draw_slanted_cross(x, y, z); if (prev == pcb_ch_shape_dozen) draw_dozen_cross(x, y, z); - prev = Crosshair.shape; + prev = pcb_crosshair.shape; } void ghid_show_crosshair(gboolean paint_new_location) Index: trunk/src_plugins/hid_gtk/gtkhid-main.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 5034) +++ trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 5035) @@ -1601,8 +1601,8 @@ if (!conf_core.editor.view.flip_y) dy = -dy; - pcb_event_move_crosshair(Crosshair.X + dx, Crosshair.Y + dy); - gui->set_crosshair(Crosshair.X, Crosshair.Y, pan_warp); + pcb_event_move_crosshair(pcb_crosshair.X + dx, pcb_crosshair.Y + dy); + gui->set_crosshair(pcb_crosshair.X, pcb_crosshair.Y, pan_warp); return 0; } Index: trunk/src_plugins/hid_gtk/gui-misc.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-misc.c (revision 5034) +++ trunk/src_plugins/hid_gtk/gui-misc.c (revision 5035) @@ -199,10 +199,10 @@ { GdkCursorType shape; - if (Crosshair.Y <= Crosshair.AttachedBox.Point1.Y) - shape = (Crosshair.X >= Crosshair.AttachedBox.Point1.X) ? GDK_UR_ANGLE : GDK_UL_ANGLE; + if (pcb_crosshair.Y <= pcb_crosshair.AttachedBox.Point1.Y) + shape = (pcb_crosshair.X >= pcb_crosshair.AttachedBox.Point1.X) ? GDK_UR_ANGLE : GDK_UL_ANGLE; else - shape = (Crosshair.X >= Crosshair.AttachedBox.Point1.X) ? GDK_LR_ANGLE : GDK_LL_ANGLE; + shape = (pcb_crosshair.X >= pcb_crosshair.AttachedBox.Point1.X) ? GDK_LR_ANGLE : GDK_LL_ANGLE; if (gport->X_cursor_shape != shape) gport_set_cursor(shape); } @@ -275,13 +275,13 @@ getting_loc = 1; ghid_status_line_set_text(message); - oldObjState = Crosshair.AttachedObject.State; - oldLineState = Crosshair.AttachedLine.State; - oldBoxState = Crosshair.AttachedBox.State; + oldObjState = pcb_crosshair.AttachedObject.State; + oldLineState = pcb_crosshair.AttachedLine.State; + oldBoxState = pcb_crosshair.AttachedBox.State; pcb_notify_crosshair_change(pcb_false); - Crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; - Crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; ghid_hand_cursor(); pcb_notify_crosshair_change(pcb_true); @@ -310,9 +310,9 @@ ghid_interface_set_sensitive(TRUE); pcb_notify_crosshair_change(pcb_false); - Crosshair.AttachedObject.State = oldObjState; - Crosshair.AttachedLine.State = oldLineState; - Crosshair.AttachedBox.State = oldBoxState; + pcb_crosshair.AttachedObject.State = oldObjState; + pcb_crosshair.AttachedLine.State = oldLineState; + pcb_crosshair.AttachedBox.State = oldBoxState; pcb_notify_crosshair_change(pcb_true); ghid_restore_cursor(); @@ -395,10 +395,10 @@ if (conf_hid_gtk.plugins.hid_gtk.compact_vertical) sep = '\n'; - if (Marked.status) { - pcb_coord_t dx = Crosshair.X - Marked.X; - pcb_coord_t dy = Crosshair.Y - Marked.Y; - pcb_coord_t r = pcb_distance(Crosshair.X, Crosshair.Y, Marked.X, Marked.Y); + if (pcb_marked.status) { + pcb_coord_t dx = pcb_crosshair.X - pcb_marked.X; + pcb_coord_t dy = pcb_crosshair.Y - pcb_marked.Y; + pcb_coord_t r = pcb_distance(pcb_crosshair.X, pcb_crosshair.Y, pcb_marked.X, pcb_marked.Y); double a = atan2(dy, dx) * PCB_RAD_TO_DEG; @@ -413,7 +413,7 @@ } - text = pcb_strdup_printf("%m+%-mS%c%-mS", conf_core.editor.grid_unit->allow, Crosshair.X, sep, Crosshair.Y); + text = pcb_strdup_printf("%m+%-mS%c%-mS", conf_core.editor.grid_unit->allow, pcb_crosshair.X, sep, pcb_crosshair.Y); ghid_cursor_position_label_set_text(text); free(text); } Index: trunk/src_plugins/hid_lesstif/main.c =================================================================== --- trunk/src_plugins/hid_lesstif/main.c (revision 5034) +++ trunk/src_plugins/hid_lesstif/main.c (revision 5035) @@ -162,13 +162,13 @@ return; pcb_notify_crosshair_change(pcb_false); - if (Marked.status) + if (pcb_marked.status) pcb_notify_mark_change(pcb_false); crosshair_on = show; pcb_notify_crosshair_change(pcb_true); - if (Marked.status) + if (pcb_marked.status) pcb_notify_mark_change(pcb_true); } @@ -863,8 +863,8 @@ if (!conf_core.editor.view.flip_y) dy = -dy; - pcb_event_move_crosshair(Crosshair.X + dx, Crosshair.Y + dy); - gui->set_crosshair(Crosshair.X, Crosshair.Y, pan_warp); + pcb_event_move_crosshair(pcb_crosshair.X + dx, pcb_crosshair.Y + dy); + gui->set_crosshair(pcb_crosshair.X, pcb_crosshair.Y, pan_warp); return 0; } @@ -1460,9 +1460,9 @@ static void draw_crosshair(GC xor_gc, int x, int y, int view_width, int view_height) { draw_right_cross(xor_gc, x, y, view_width, view_height); - if (Crosshair.shape == pcb_ch_shape_union_jack) + if (pcb_crosshair.shape == pcb_ch_shape_union_jack) draw_slanted_cross(xor_gc, x, y, view_width, view_height); - if (Crosshair.shape == pcb_ch_shape_dozen) + if (pcb_crosshair.shape == pcb_ch_shape_dozen) draw_dozen_cross(xor_gc, x, y, view_width, view_height); } @@ -2447,7 +2447,7 @@ static pcb_mark_t saved_mark; static const pcb_unit_t *old_grid_unit = NULL; if (crosshair_x != c_x || crosshair_y != c_y - || conf_core.editor.grid_unit != old_grid_unit || memcmp(&saved_mark, &Marked, sizeof(pcb_mark_t))) { + || conf_core.editor.grid_unit != old_grid_unit || memcmp(&saved_mark, &pcb_marked, sizeof(pcb_mark_t))) { static int last_state = 0; static int this_state = 0; @@ -2455,11 +2455,11 @@ c_y = crosshair_y; this_state = cursor_pos_to_widget(crosshair_x, crosshair_y, m_crosshair, this_state); - if (Marked.status) - mark_delta_to_widget(crosshair_x - Marked.X, crosshair_y - Marked.Y, m_mark); + if (pcb_marked.status) + mark_delta_to_widget(crosshair_x - pcb_marked.X, crosshair_y - pcb_marked.Y, m_mark); - if (Marked.status != saved_mark.status) { - if (Marked.status) { + if (pcb_marked.status != saved_mark.status) { + if (pcb_marked.status) { XtManageChild(XtParent(m_mark)); XtManageChild(m_mark); stdarg_n = 0; @@ -2475,7 +2475,7 @@ } last_state = this_state + 100; } - memcpy(&saved_mark, &Marked, sizeof(pcb_mark_t)); + memcpy(&saved_mark, &pcb_marked, sizeof(pcb_mark_t)); if (old_grid_unit != conf_core.editor.grid_unit) { old_grid_unit = conf_core.editor.grid_unit; Index: trunk/src_plugins/import_sch/import_sch.c =================================================================== --- trunk/src_plugins/import_sch/import_sch.c (revision 5034) +++ trunk/src_plugins/import_sch/import_sch.c (revision 5035) @@ -220,9 +220,9 @@ return 0; } else if (strcasecmp(xs, "mark") == 0) { - if (Marked.status) { - x = Marked.X; - y = Marked.Y; + if (pcb_marked.status) { + x = pcb_marked.X; + y = pcb_marked.Y; } } else if (ys) { Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 5034) +++ trunk/src_plugins/io_pcb/file.c (revision 5035) @@ -239,7 +239,7 @@ pcb_print_quoted_string(FP, (char *) PCB_EMPTY(PCB->Name)); pcb_fprintf(FP, " %[0] %[0]]\n\n", PCB->MaxWidth, PCB->MaxHeight); pcb_fprintf(FP, "Grid[%[0] %[0] %[0] %d]\n", PCB->Grid, PCB->GridOffsetX, PCB->GridOffsetY, conf_core.editor.draw_grid); - pcb_fprintf(FP, "Cursor[%[0] %[0] %s]\n", Crosshair.X, Crosshair.Y, c_dtostr(PCB->Zoom)); + pcb_fprintf(FP, "Cursor[%[0] %[0] %s]\n", pcb_crosshair.X, pcb_crosshair.Y, c_dtostr(PCB->Zoom)); /* PolyArea should be output in square cmils, no suffix */ fprintf(FP, "PolyArea[%s]\n", c_dtostr(PCB_COORD_TO_MIL(PCB_COORD_TO_MIL(PCB->IsleArea) * 100) * 100)); pcb_fprintf(FP, "Thermal[%s]\n", c_dtostr(PCB->ThermScale)); Index: trunk/src_plugins/jostle/jostle.c =================================================================== --- trunk/src_plugins/jostle/jostle.c (revision 5034) +++ trunk/src_plugins/jostle/jostle.c (revision 5035) @@ -47,7 +47,7 @@ t = (a)[1], (a)[1] = (b)[1], (b)[1] = t; \ } -/*{if (!Marked.status && side==NORTHWEST) { pcb_draw_mark(pcb_true); Marked.status = True; Marked.X = p[0]; Marked.Y = p[1]; pcb_draw_mark(False);} }*/ +/*{if (!pcb_marked.status && side==NORTHWEST) { pcb_draw_mark(pcb_true); pcb_marked.status = True; pcb_marked.X = p[0]; pcb_marked.Y = p[1]; pcb_draw_mark(False);} }*/ enum { JNORTH, @@ -511,8 +511,8 @@ else { value = conf_core.design.via_thickness + (PCB->Bloat + 1) * 2 + 50; } - x = Crosshair.X; - y = Crosshair.Y; + x = pcb_crosshair.X; + y = pcb_crosshair.Y; fprintf(stderr, "%d, %d, %f\n", (int) x, (int) y, value); info.brush = pcb_poly_from_circle(x, y, value / 2); info.layer = CURRENT; Index: trunk/src_plugins/puller/puller.c =================================================================== --- trunk/src_plugins/puller/puller.c (revision 5034) +++ trunk/src_plugins/puller/puller.c (revision 5035) @@ -339,7 +339,7 @@ pcb_box_t spot; #if TRACE1 - pcb_printf("\nPuller find_pair at %#mD\n", Crosshair.X, Crosshair.Y); + pcb_printf("\nPuller find_pair at %#mD\n", pcb_crosshair.X, pcb_crosshair.Y); #endif x = Px; @@ -391,7 +391,7 @@ double tangent; int new_delta_angle; - if (!find_pair(Crosshair.X, Crosshair.Y)) + if (!find_pair(pcb_crosshair.X, pcb_crosshair.Y)) if (!find_pair(Ux, Uy)) return 0; @@ -1729,7 +1729,7 @@ e->deleted = 1; unlink_extras(e); #if TRACE1 - pcb_printf("Marked line %p for deletion %#mD to %#mD\n", (void *)e, l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y); + pcb_printf("pcb_marked line %p for deletion %#mD to %#mD\n", (void *)e, l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y); #endif #if 0 if (l->Point1.X < 0) { @@ -1747,7 +1747,7 @@ e->deleted = 1; unlink_extras(e); #if TRACE1 - printf("Marked arc %p for deletion %ld < %ld\n", (void *)e, a->StartAngle, a->Delta); + printf("pcb_marked arc %p for deletion %ld < %ld\n", (void *)e, a->StartAngle, a->Delta); #endif } Index: trunk/src_plugins/stroke/stroke.c =================================================================== --- trunk/src_plugins/stroke/stroke.c (revision 5034) +++ trunk/src_plugins/stroke/stroke.c (revision 5035) @@ -152,8 +152,8 @@ { fprintf(stderr, "stroke: MIID!\n"); pcb_mid_stroke = pcb_true; - StrokeBox.X1 = Crosshair.X; - StrokeBox.Y1 = Crosshair.Y; + StrokeBox.X1 = pcb_crosshair.X; + StrokeBox.Y1 = pcb_crosshair.Y; } pcb_uninit_t hid_stroke_init(void)