pcb 4.1.1
An interactive printed circuit board layout editor.

crosshair.h File Reference

Prototypes for crosshair routines. More...

#include "global.h"
Include dependency graph for crosshair.h:
This graph shows which files directly or indirectly include this file:

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.

Detailed Description

Prototypes for crosshair routines.


Copyright.


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 Documentation

#define STATE_SECOND   1
#define STATE_THIRD   2

Function Documentation

void DestroyCrosshair ( void  )

Exits crosshair routines, release GCs.

Definition at line 1350 of file crosshair.c.

References CrosshairType::AttachedPolygon, Crosshair, and FreePolygonMemory().

Here is the call graph for this function:

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().

Here is the call graph for this function:

Coord GridFit ( Coord  x,
Coord  grid_spacing,
Coord  grid_offset 
)

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().

Here is the call graph for this function:

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().

bool MoveCrosshairAbsolute ( Coord  X,
Coord  Y 
)

Move crosshair absolute.

Returns:
true if the crosshair was moved from its existing position.

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void SetCrosshairRange ( Coord  ,
Coord  ,
Coord  ,
Coord   
)

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().

Here is the call graph for this function: