pcb 4.1.1
An interactive printed circuit board layout editor.
|
Prototypes for crosshair routines. More...
#include "global.h"
Go to the source code of this file.
Defines | |
#define | STATE_FIRST 0 |
#define | STATE_SECOND 1 |
#define | STATE_THIRD 2 |
Functions | |
Coord | GridFit (Coord x, Coord grid_spacing, Coord grid_offset) |
Returns the nearest grid-point to the given Coord. | |
void | notify_crosshair_change (bool changes_complete) |
Notify the GUI that data relating to the crosshair is being changed. | |
void | notify_mark_change (bool changes_complete) |
Notify the GUI that data relating to the mark is being changed. | |
void | HideCrosshair (void) |
Convenience for plugins using the old {Hide,Restore}Crosshair API. | |
void | RestoreCrosshair (void) |
void | DrawAttached (hidGC gc) |
Draws additional stuff that follows the crosshair. | |
void | DrawMark (hidGC gc) |
Draw the marker position. | |
bool | MoveCrosshairAbsolute (Coord, Coord) |
Move crosshair absolute. | |
void | SetCrosshairRange (Coord, Coord, Coord, Coord) |
Sets the valid range for the crosshair cursor. | |
void | InitCrosshair (void) |
Initializes crosshair stuff. | |
void | DestroyCrosshair (void) |
Exits crosshair routines, release GCs. | |
void | FitCrosshairIntoGrid (Coord, Coord) |
Recalculates the passed coordinates to fit the current grid setting. | |
void | crosshair_update_range (void) |
Update the valid range for the crosshair cursor. |
Prototypes for crosshair routines.
PCB, interactive printed circuit board design
Copyright (C) 1994,1995,1996 Thomas Nau
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Contact addresses for paper mail and Email: Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany Thomas.Nau@rz.uni-ulm.de
Definition in file crosshair.h.
#define STATE_FIRST 0 |
initial state.
Definition at line 41 of file crosshair.h.
Referenced by ActionDisplay(), ActionMode(), ActionRedo(), ActionSelect(), ActionUndo(), ActionUnselect(), AdjustAttachedLine(), AdjustInsertPoint(), AdjustTwoLine(), CopyAttachedPolygonToLayer(), DrawAttached(), FitCrosshairIntoGrid(), GoToPreviousPoint(), NotifyBlock(), NotifyLine(), NotifyMode(), ReleaseMode(), run_get_location_loop(), and SetMode().
#define STATE_SECOND 1 |
Definition at line 42 of file crosshair.h.
Referenced by ActionRedo(), ActionUndo(), AdjustAttachedBox(), AttachForCopy(), DrawAttached(), NotifyBlock(), NotifyLine(), NotifyMode(), and SetMode().
#define STATE_THIRD 2 |
Definition at line 43 of file crosshair.h.
Referenced by ActionSelect(), ActionUndo(), ActionUnselect(), DrawAttached(), NotifyBlock(), NotifyLine(), and NotifyMode().
void crosshair_update_range | ( | void | ) |
Update the valid range for the crosshair cursor.
Definition at line 1273 of file crosshair.c.
References CrosshairType::AttachedObject, box, Crosshair, GetObjectBoundingBox(), MAX, PCBType::MaxHeight, PCBType::MaxWidth, MIN, SettingType::Mode, PASTEBUFFER, PASTEBUFFER_MODE, PCB, AttachedObjectType::Ptr1, AttachedObjectType::Ptr2, AttachedObjectType::Ptr3, SetBufferBoundingBox(), SetCrosshairRange(), Settings, AttachedObjectType::Type, AttachedObjectType::X, BoxType::X1, BoxType::X2, AttachedObjectType::Y, BoxType::Y1, and BoxType::Y2.
Referenced by ActionPasteBuffer(), AttachForCopy(), FreeRotateBuffer(), MirrorBuffer(), PCBChanged(), RotateBuffer(), SetBufferNumber(), SetMode(), sizes_set(), SwapBuffer(), and SwapBuffers().
void DestroyCrosshair | ( | void | ) |
Exits crosshair routines, release GCs.
Definition at line 1350 of file crosshair.c.
References CrosshairType::AttachedPolygon, Crosshair, and FreePolygonMemory().
void DrawAttached | ( | hidGC | gc | ) |
Draws additional stuff that follows the crosshair.
Definition at line 594 of file crosshair.c.
References ARC_MODE, CrosshairType::AttachedBox, CrosshairType::AttachedLine, CrosshairType::AttachedPolygon, PCBType::Bloat, pin_st::Clearance, PCBType::Clipping, COPY_MODE, SettingType::CrossColor, Crosshair, SettingType::CrosshairColor, AttachedLineType::draw, hid_draw_st::draw_arc, hid_draw_st::draw_line, hid_draw_st::draw_rect, pin_st::DrillingHole, hid_st::graphics, gui, INSERTPOINT_MODE, SettingType::Keepaway, LINE_MODE, SettingType::LineThickness, pin_st::Mask, SettingType::Mode, MOVE_MODE, NoFlags, PASTEBUFFER, PASTEBUFFER_MODE, PCB, AttachedBoxType::Point1, AttachedLineType::Point1, AttachedBoxType::Point2, AttachedLineType::Point2, polygon_st::PointN, POLYGON_MODE, POLYGONHOLE_MODE, PCBType::RatDraw, Round_Cap, hid_draw_st::set_color, hid_draw_st::set_draw_xor, hid_draw_st::set_line_cap, hid_draw_st::set_line_width, Settings, AttachedBoxType::State, AttachedLineType::State, STATE_FIRST, STATE_SECOND, STATE_THIRD, TEST_FLAG, pin_st::Thickness, hid_draw_st::thindraw_pcb_pv, Trace_Cap, VIA_MODE, SettingType::ViaDrillingHole, SettingType::ViaThickness, PointType::X, CrosshairType::X, pin_st::X, XORDrawAttachedArc(), XORDrawAttachedLine(), XORDrawBuffer(), XORDrawInsertPointObject(), XORDrawMoveOrCopyObject(), XORPolygon(), PointType::Y, CrosshairType::Y, and pin_st::Y.
Referenced by ghid_drawing_area_expose_cb(), ghid_notify_crosshair_change(), idle_proc(), lesstif_flush_debug_draw(), lesstif_notify_crosshair_change(), and redraw_region().
void DrawMark | ( | hidGC | gc | ) |
Draw the marker position.
Definition at line 730 of file crosshair.c.
References SettingType::CrosshairColor, hid_draw_st::draw_line, hid_st::graphics, gui, MARK_SIZE, Marked, hid_draw_st::set_color, hid_draw_st::set_draw_xor, hid_draw_st::set_line_cap, hid_draw_st::set_line_width, Settings, MarkType::status, Trace_Cap, MarkType::X, and MarkType::Y.
Referenced by ghid_drawing_area_expose_cb(), ghid_notify_mark_change(), idle_proc(), lesstif_flush_debug_draw(), lesstif_notify_mark_change(), and redraw_region().
Recalculates the passed coordinates to fit the current grid setting.
Definition at line 997 of file crosshair.c.
References ARC_MODE, ARROW_MODE, CrosshairType::AttachedLine, CrosshairType::AttachedObject, bottom_group, BOTTOM_SIDE, check_snap_object(), check_snap_offgrid_line(), snap_data::crosshair, Crosshair, crosshair_sq_dist(), CURRENT, PCBType::Data, END_LOOP, EnforceLineDRC(), GetLayerGroupNumberBySide(), PCBType::Grid, GridFit(), PCBType::GridOffsetX, PCBType::GridOffsetY, GROUP_LOOP, gui, hid_action(), hid_actionl(), HID_SC_DO_NOTHING, layer, LINE_MODE, Marked, ElementType::MarkX, ElementType::MarkY, CrosshairType::MaxX, CrosshairType::MaxY, MIL_TO_COORD, CrosshairType::MinX, CrosshairType::MinY, SettingType::Mode, MOVE_MODE, snap_data::nearest_is_grid, snap_data::nearest_sq_dist, PCB, pin, AttachedObjectType::Ptr1, ptr1, ptr2, ptr3, PCBType::RatDraw, SearchObjectByLocation(), hid_st::set_crosshair, Settings, AttachedLineType::State, STATE_FIRST, MarkType::status, TEST_FLAG, top_group, TOP_SIDE, AttachedObjectType::Type, PointType::X, pin_st::X, snap_data::x, MarkType::X, CrosshairType::X, PointType::Y, pin_st::Y, snap_data::y, MarkType::Y, and CrosshairType::Y.
Referenced by ActionUndo(), MoveCrosshairAbsolute(), SetCrosshairRange(), and SetLineSize().
Returns the nearest grid-point to the given Coord.
Definition at line 755 of file crosshair.c.
References x.
Referenced by ActionSelect(), AttachForCopy(), Center(), FitCrosshairIntoGrid(), ghid_draw_grid(), hidgl_draw_grid(), and lesstif_draw_grid().
void HideCrosshair | ( | void | ) |
Convenience for plugins using the old {Hide,Restore}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 what all GUIs may do in response to the notifications. Keeping these APIs is aimed at easing transition to the newer API, they will emit a harmless warning at the time of their first use.
Definition at line 823 of file crosshair.c.
References _, Message(), notify_crosshair_change(), and notify_mark_change().
void InitCrosshair | ( | void | ) |
Initializes crosshair stuff.
Clears the struct, allocates to graphical contexts.
Definition at line 1332 of file crosshair.c.
References Basic_Crosshair_Shape, Crosshair, Marked, PCBType::MaxHeight, PCBType::MaxWidth, CrosshairType::MaxX, CrosshairType::MaxY, CrosshairType::MinX, CrosshairType::MinY, PCB, CrosshairType::shape, and MarkType::status.
Referenced by main().
Move crosshair absolute.
Definition at line 1242 of file crosshair.c.
References Crosshair, FitCrosshairIntoGrid(), notify_crosshair_change(), CrosshairType::X, and CrosshairType::Y.
Referenced by ActionDisplay(), CenterDisplay(), EventMoveCrosshair(), ghid_note_event_location(), and netnode_browse().
void notify_crosshair_change | ( | bool | changes_complete | ) |
Notify the GUI that data relating to the crosshair is being changed.
The argument passed is false to notify "changes are about to happen", and true to notify "changes have finished".
Each call with a 'false' parameter must be matched with a following one with a 'true' parameter. Unmatched 'true' calls are currently not permitted, but might be allowed in the future.
GUIs should not complain if they receive extra calls with 'true' as parameter. They should initiate a redraw of the crosshair attached objects - which may (if necessary) mean repainting the whole screen if the GUI hasn't tracked the location of existing attached drawing.
Definition at line 781 of file crosshair.c.
References gui, and hid_st::notify_crosshair_change.
Referenced by ActionDisplay(), ActionFreeRotateBuffer(), ActionLoadFrom(), ActionMode(), ActionNew(), ActionPasteBuffer(), ActionPolygon(), ActionRedo(), ActionSelect(), ActionSetSame(), ActionUndo(), ActionUnselect(), AddSelectedToBuffer(), CenterDisplay(), click_cb(), EventMoveCrosshair(), ghid_note_event_location(), HideCrosshair(), mod_changed(), MoveCrosshairAbsolute(), NotifyBlock(), RestoreCrosshair(), run_get_location_loop(), SetMode(), ShowCrosshair(), and work_area_input().
void notify_mark_change | ( | bool | changes_complete | ) |
Notify the GUI that data relating to the mark is being changed.
The argument passed is false to notify "changes are about to happen", and true to notify "changes have finished".
Each call with a 'false' parameter must be matched with a following one with a 'true' parameter. Unmatched 'true' calls are currently not permitted, but might be allowed in the future.
GUIs should not complain if they receive extra calls with 'true' as parameter. They should initiate a redraw of the mark - which may (if necessary) mean repainting the whole screen if the GUI hasn't tracked the mark's location.
Definition at line 803 of file crosshair.c.
References gui, and hid_st::notify_mark_change.
Referenced by ActionMarkCrosshair(), HideCrosshair(), RestoreCrosshair(), SetLocalRef(), and ShowCrosshair().
void RestoreCrosshair | ( | void | ) |
Definition at line 838 of file crosshair.c.
References _, Message(), notify_crosshair_change(), and notify_mark_change().
Sets the valid range for the crosshair cursor.
Definition at line 1315 of file crosshair.c.
References Crosshair, FitCrosshairIntoGrid(), MAX, PCBType::MaxHeight, PCBType::MaxWidth, CrosshairType::MaxX, CrosshairType::MaxY, MIN, CrosshairType::MinX, CrosshairType::MinY, PCB, CrosshairType::X, and CrosshairType::Y.
Referenced by crosshair_update_range().