KiCad PCB EDA Suite
EXCELLON_IMAGE Class Reference

#include <class_excellon.h>

Inheritance diagram for EXCELLON_IMAGE:
GERBER_FILE_IMAGE EDA_ITEM KIGFX::VIEW_ITEM

Public Member Functions

 EXCELLON_IMAGE (int layer)
 
 ~EXCELLON_IMAGE ()
 
virtual void ResetDefaultValues () override
 
bool LoadFile (const wxString &aFullFileName)
 Read and load a drill (EXCELLON format) file. More...
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
void Clear_GERBER_FILE_IMAGE ()
 
bool LoadGerberFile (const wxString &aFullFileName)
 Read and load a gerber file. More...
 
const wxArrayString & GetMessages () const
 
int GetDcodesCount ()
 
COLOR4D GetPositiveDrawColor () const
 
GERBER_DRAW_ITEMGetItemsList ()
 Function GetItemsList. More...
 
GERBER_LAYERGetLayerParams ()
 Function GetLayerParams. More...
 
bool HasNegativeItems ()
 Function HasNegativeItems. More...
 
void ClearMessageList ()
 Function ClearMessageList Clear the message list Call it before reading a Gerber file. More...
 
void AddMessageToList (const wxString &aMessage)
 Function AddMessageToList Add a message to the message list. More...
 
void InitToolTable ()
 Function InitToolTable. More...
 
wxPoint ReadXYCoord (char *&Text)
 Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) More...
 
wxPoint ReadIJCoord (char *&Text)
 Function ReadIJCoord Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are relative, so if coordinate is absent, it's value defaults to 0. More...
 
int GCodeNumber (char *&Text)
 
int DCodeNumber (char *&Text)
 
bool Execute_G_Command (char *&text, int G_command)
 
bool Execute_DCODE_Command (char *&text, int D_command)
 
bool ReadRS274XCommand (char *aBuff, char *&text)
 Function ReadRS274XCommand reads a single RS274X command terminated with a %. More...
 
bool ExecuteRS274XCommand (int command, char *aBuff, char *&text)
 Function ExecuteRS274XCommand executes 1 command. More...
 
bool ReadApertureMacro (char *aBuff, char *&text, FILE *gerber_file)
 Function ReadApertureMacro reads in an aperture macro and saves it in m_aperture_macros. More...
 
D_CODEGetDCODEOrCreate (int aDCODE, bool aCreateIfNoExist=true)
 Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE. More...
 
D_CODEGetDCODE (int aDCODE) const
 Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE. More...
 
APERTURE_MACROFindApertureMacro (const APERTURE_MACRO &aLookup)
 Function FindApertureMacro looks up a previously read in aperture macro. More...
 
void StepAndRepeatItem (const GERBER_DRAW_ITEM &aItem)
 Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called when reading a gerber file and after creating a new gerber item that must be repeated (i.e when m_XRepeatCount or m_YRepeatCount are > 1) More...
 
void DisplayImageInfo (GERBVIEW_FRAME *aMainFrame)
 Function DisplayImageInfo has knowledge about the frame and how and where to put status information about this object into the frame's message panel. More...
 
void RemoveAttribute (X2_ATTRIBUTE &aAttribute)
 Function RemoveAttribute. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 > More...
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (time_t aNewTimeStamp)
 
time_t GetTimeStamp () const
 
EDA_ITEMNext () const
 
EDA_ITEMBack () const
 
EDA_ITEMGetParent () const
 
DHEADGetList () const
 
void SetNext (EDA_ITEM *aNext)
 
void SetBack (EDA_ITEM *aBack)
 
void SetParent (EDA_ITEM *aParent)
 
void SetList (DHEAD *aList)
 
bool IsNew () const
 
bool IsModified () const
 
bool IsMoving () const
 
bool IsDragging () const
 
bool IsWireImage () const
 
bool IsSelected () const
 
bool IsResized () const
 
bool IsHighlighted () const
 
bool IsBrightened () const
 
void SetWireImage ()
 
void SetSelected ()
 
void SetHighlighted ()
 
void SetBrightened ()
 
void ClearSelected ()
 
void ClearHighlighted ()
 
void ClearBrightened ()
 
void SetModified ()
 
int GetState (int type) const
 
void SetState (int type, int state)
 
STATUS_FLAGS GetStatus () const
 
void SetStatus (STATUS_FLAGS aStatus)
 
void SetFlags (STATUS_FLAGS aMask)
 
void ClearFlags (STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
 
STATUS_FLAGS GetFlags () const
 
void SetForceVisible (bool aEnable)
 Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible. More...
 
virtual void GetMsgPanelInfo (std::vector< MSG_PANEL_ITEM > &aList)
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
virtual bool HitTest (const wxPoint &aPosition) const
 Function HitTest tests if aPosition is contained within or on the bounding area of an item. More...
 
virtual const EDA_RECT GetBoundingBox () const
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
virtual EDA_ITEMClone () const
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
virtual wxString GetSelectMenuText () const
 Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position. More...
 
virtual BITMAP_DEF GetMenuImage () const
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
virtual bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
 Function Matches compares the item against the search criteria in aSearchData. More...
 
bool Replace (wxFindReplaceData &aSearchData, wxString &aText)
 Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL)
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
virtual bool IsReplaceable () const
 Function IsReplaceable. More...
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
virtual const BOX2I ViewBBox () const override
 Function ViewBBox() returns the bounding box of the item covering all its layers. More...
 
virtual void ViewGetLayers (int aLayers[], int &aCount) const override
 Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on. More...
 
virtual void ViewDraw (int aLayer, VIEW *aView) const
 Function ViewDraw() Draws the parts of the object belonging to layer aLayer. More...
 
virtual unsigned int ViewGetLOD (int aLayer, VIEW *aView) const
 Function ViewGetLOD() Returns the level of detail (LOD) of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

Static Public Member Functions

static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Public Attributes

DLIST< GERBER_DRAW_ITEMm_Drawings
 
bool m_InUse
 
bool m_IsVisible
 
COLOR4D m_PositiveDrawColor
 
wxString m_FileName
 
wxString m_ImageName
 
bool m_IsX2_file
 
X2_ATTRIBUTE_FILEFUNCTIONm_FileFunction
 
wxString m_MD5_value
 
wxString m_PartString
 
int m_GraphicLayer
 
bool m_ImageNegative
 
bool m_ImageJustifyXCenter
 
bool m_ImageJustifyYCenter
 
wxPoint m_ImageJustifyOffset
 
bool m_GerbMetric
 
bool m_Relative
 
bool m_NoTrailingZeros
 
wxPoint m_ImageOffset
 
wxSize m_FmtScale
 
wxSize m_FmtLen
 
int m_ImageRotation
 
double m_LocalRotation
 
wxPoint m_Offset
 
wxRealPoint m_Scale
 
bool m_SwapAxis
 
bool m_MirrorA
 
bool m_MirrorB
 
int m_Iterpolation
 
int m_Current_Tool
 
int m_Last_Pen_Command
 
int m_CommandState
 
int m_LineNum
 
wxPoint m_CurrentPos
 
wxPoint m_PreviousPos
 
wxPoint m_IJPos
 
FILE * m_Current_File
 
int m_Selected_Tool
 
bool m_Has_DCode
 
bool m_360Arc_enbl
 
bool m_PolygonFillMode
 
int m_PolygonFillModeState
 
APERTURE_MACRO_SET m_aperture_macros
 a collection of APERTURE_MACROS, sorted by name More...
 
GBR_NETLIST_METADATA m_NetAttributeDict
 
wxString m_AperFunction
 
std::map< wxString, int > m_ComponentsList
 
std::map< wxString, int > m_NetnamesList
 

Protected Member Functions

bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Protected Attributes

EDA_ITEMPnext
 next in linked list More...
 
EDA_ITEMPback
 previous in linked list More...
 
DHEADm_List
 which DLIST I am on. More...
 
EDA_ITEMm_Parent
 Linked list: Link (parent struct) More...
 
time_t m_TimeStamp
 Time stamp used for logical links. More...
 
bool m_forceVisible
 Set to true to override the visibility setting of the item. More...
 
STATUS_FLAGS m_Flags
 Flag bits for editing and other uses. More...
 

Private Types

enum  excellon_state { READ_HEADER_STATE, READ_PROGRAM_STATE }
 

Private Member Functions

bool Execute_HEADER_Command (char *&text)
 
bool Select_Tool (char *&text)
 
bool Execute_EXCELLON_G_Command (char *&text)
 
bool Execute_Drill_Command (char *&text)
 
bool readToolInformation (char *&aText)
 Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list. More...
 
int TCodeNumber (char *&aText)
 
void SelectUnits (bool aMetric)
 

Private Attributes

excellon_state m_State
 
bool m_SlotOn
 

Detailed Description

Definition at line 89 of file class_excellon.h.

Member Enumeration Documentation

Enumerator
READ_HEADER_STATE 
READ_PROGRAM_STATE 

Definition at line 92 of file class_excellon.h.

92  {
93  READ_HEADER_STATE, // When we are in this state, we are reading header
94  READ_PROGRAM_STATE // When we are in this state, we are reading drill data
95  };

Constructor & Destructor Documentation

EXCELLON_IMAGE::EXCELLON_IMAGE ( int  layer)
inline

Definition at line 100 of file class_excellon.h.

References READ_HEADER_STATE.

100  : EXCELLON_IMAGE( int layer ) :
101  GERBER_FILE_IMAGE( layer )
102  {
104  m_SlotOn = false;
105  }
Class GERBER_FILE_IMAGE holds the Image data and parameters for one gerber file and layer parameters ...
EXCELLON_IMAGE(int layer)
excellon_state m_State
EXCELLON_IMAGE::~EXCELLON_IMAGE ( )
inline

Definition at line 108 of file class_excellon.h.

108 {};

Member Function Documentation

void GERBER_FILE_IMAGE::AddMessageToList ( const wxString &  aMessage)
inlineinherited
EDA_ITEM* EDA_ITEM::Back ( ) const
inlineinherited

Definition at line 221 of file base_struct.h.

References EDA_ITEM::Pback.

Referenced by DHEAD::insert(), and DHEAD::remove().

221 { return Pback; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
void GERBER_FILE_IMAGE::Clear_GERBER_FILE_IMAGE ( )
inherited
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 247 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::disambiguationMenu().

247 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void EDA_ITEM::ClearFlags ( STATUS_FLAGS  aMask = EDA_ITEM_ALL_FLAGS)
inlineinherited

Definition at line 268 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), ClearMarkItems(), clearModuleItemFlags(), EDA_ITEM::ClearSelected(), SCH_EDIT_FRAME::ConvertPart(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), MWAVE::CreateMicrowaveInductor(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::Delete_LastCreatedCorner(), PCB_EDIT_FRAME::Delete_Segment_Edge(), LIB_PART::DeleteSelectedItems(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::End_Edge(), FOOTPRINT_EDIT_FRAME::End_Edge_Module(), PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines(), PCB_EDIT_FRAME::End_Zone(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_EAGLE_PLUGIN::loadSheet(), MarkItemsInBloc(), MirrorX(), MirrorY(), moveBitmap(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnRotateItem(), SCH_EDIT_FRAME::OnSelectUnit(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), LIB_PIN::Save(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), SCH_EDIT_FRAME::SetRepeatItem(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), and DIALOG_PAD_PROPERTIES::TransferDataFromWindow().

268 { m_Flags &= ~aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
void EDA_ITEM::ClearHighlighted ( )
inlineinherited

Definition at line 246 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

246 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
void GERBER_FILE_IMAGE::ClearMessageList ( )
inlineinherited

Function ClearMessageList Clear the message list Call it before reading a Gerber file.

Definition at line 251 of file class_gerber_file_image.h.

Referenced by LoadFile(), and GERBER_FILE_IMAGE::LoadGerberFile().

252  {
253  m_messagesList.Clear();
254  }
void EDA_ITEM::ClearSelected ( )
inlineinherited
EDA_ITEM * EDA_ITEM::Clone ( ) const
virtualinherited

Function Clone creates a duplicate of this item with linked list members set to NULL.

The default version will return NULL in release builds and likely crash the program. In debug builds, a warning message indicating the derived class has not implemented cloning. This really should be a pure virtual function. Due to the fact that there are so many objects derived from EDA_ITEM, the decision was made to return NULL until all the objects derived from EDA_ITEM implement cloning. Once that happens, this function should be made pure.

Returns
A clone of the item.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_TEXT, SCH_FIELD, SCH_SHEET_PIN, SCH_LINE, SCH_BUS_BUS_ENTRY, LIB_ARC, SCH_BUS_WIRE_ENTRY, SCH_BITMAP, TEXTE_PCB, LIB_TEXT, EDGE_MODULE, LIB_POLYLINE, LIB_RECTANGLE, LIB_CIRCLE, SCH_MARKER, PCB_TARGET, LIB_BEZIER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 125 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by PCB_EDIT_FRAME::Block_Duplicate(), CopyMarkedItems(), LIB_PART::CopySelectedItems(), BOARD::Duplicate(), DuplicateStruct(), SCH_SCREEN::ExtractWires(), LIB_PART::LIB_PART(), LIB_EDIT_FRAME::LoadOneSymbol(), new_clone(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::RepeatDrawItem(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), LIB_PART::SetConversion(), SCH_EDIT_FRAME::SetRepeatItem(), SCH_EDIT_FRAME::SetUndoItem(), LIB_PART::SetUnitCount(), and COMMIT::Stage().

126 {
127  wxCHECK_MSG( false, NULL, wxT( "Clone not implemented in derived class " ) + GetClass() +
128  wxT( ". Bad programmer!" ) );
129 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
int GERBER_FILE_IMAGE::DCodeNumber ( char *&  Text)
inherited

Definition at line 438 of file rs274d.cpp.

References IsNumber.

Referenced by GERBER_FILE_IMAGE::Execute_G_Command(), GERBER_FILE_IMAGE::LoadGerberFile(), and TCodeNumber().

439 {
440  int ii = 0;
441  char* text;
442  char line[1024];
443 
444  if( Text == NULL )
445  return 0;
446 
447  Text++;
448  text = line;
449  while( IsNumber( *Text ) )
450  *(text++) = *(Text++);
451 
452  *text = 0;
453  ii = atoi( line );
454  return ii;
455 }
#define IsNumber(x)
void GERBER_FILE_IMAGE::DisplayImageInfo ( GERBVIEW_FRAME aMainFrame)
inherited

Function DisplayImageInfo has knowledge about the frame and how and where to put status information about this object into the frame's message panel.

Display info about Image Parameters.

Parameters
aMainFrame= the GERBVIEW_FRAME to display messages

Display info about Image Parameters. These parameters are valid for the entire file, and must set only once (If more than once, only the last value is used)

Definition at line 334 of file class_gerber_file_image.cpp.

References EDA_DRAW_FRAME::AppendMsgPanel(), BROWN, EDA_DRAW_FRAME::ClearMsgPanel(), CYAN, DARKRED, g_UserUnit, INCHES, GERBER_FILE_IMAGE::m_GraphicLayer, GERBER_FILE_IMAGE::m_ImageJustifyOffset, GERBER_FILE_IMAGE::m_ImageJustifyXCenter, GERBER_FILE_IMAGE::m_ImageJustifyYCenter, GERBER_FILE_IMAGE::m_ImageName, GERBER_FILE_IMAGE::m_ImageNegative, GERBER_FILE_IMAGE::m_ImageRotation, wxPoint::x, and wxPoint::y.

Referenced by GERBVIEW_FRAME::OnLeftClick(), and GERBVIEW_FRAME::UpdateTitleAndInfo().

335 {
336  wxString msg;
337 
338  aMainFrame->ClearMsgPanel();
339 
340  // Display Image name (Image specific)
341  aMainFrame->AppendMsgPanel( _( "Image name" ), m_ImageName, CYAN );
342 
343  // Display graphic layer number used to draw this Image
344  // (not a Gerber parameter but is also image specific)
345  msg.Printf( wxT( "%d" ), m_GraphicLayer + 1 );
346  aMainFrame->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN );
347 
348  // Display Image rotation (Image specific)
349  msg.Printf( wxT( "%d" ), m_ImageRotation );
350  aMainFrame->AppendMsgPanel( _( "Img Rot." ), msg, CYAN );
351 
352  // Display Image polarity (Image specific)
353  msg = m_ImageNegative ? _("Negative") : _("Normal");
354  aMainFrame->AppendMsgPanel( _( "Polarity" ), msg, BROWN );
355 
356  // Display Image justification and offset for justification (Image specific)
357  msg = m_ImageJustifyXCenter ? _("Center") : _("Normal");
358  aMainFrame->AppendMsgPanel( _( "X Justify" ), msg, DARKRED );
359 
360  msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
361  aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED );
362 
363  if( g_UserUnit == INCHES )
364  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0,
365  Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 );
366  else
367  msg.Printf( wxT( "X=%f Y=%f" ), Iu2Millimeter( m_ImageJustifyOffset.x ),
368  Iu2Millimeter( m_ImageJustifyOffset.y ) );
369 
370  aMainFrame->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
371 }
Definition: colors.h:54
Definition: common.h:144
Definition: colors.h:59
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void AppendMsgPanel(const wxString &textUpper, const wxString &textLower, COLOR4D color, int pad=6)
Append a message to the message panel.
Definition: draw_frame.cpp:764
void ClearMsgPanel(void)
Clear all messages from the message panel.
Definition: draw_frame.cpp:775
Definition: colors.h:62
bool GERBER_FILE_IMAGE::Execute_DCODE_Command ( char *&  text,
int  D_command 
)
inherited

Definition at line 584 of file rs274d.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), DLIST< T >::Append(), SHAPE_POLY_SET::Append(), APT_CIRCLE, fillArcGBRITEM(), fillArcPOLY(), fillFlashedGBRITEM(), fillLineGBRITEM(), FIRST_DCODE, GBR_POLYGON, GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_001X, GERB_INTERPOL_LINEAR_01X, GERB_INTERPOL_LINEAR_10X, GERB_INTERPOL_LINEAR_1X, GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::GetItemsList(), DLIST< T >::GetLast(), GERBER_FILE_IMAGE::GetLayerParams(), GERBER_FILE_IMAGE::m_360Arc_enbl, GERBER_FILE_IMAGE::m_Current_Tool, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_Drawings, GERBER_DRAW_ITEM::m_End, GERBER_FILE_IMAGE::m_Exposure, GERBER_DRAW_ITEM::m_Flashed, GERBER_FILE_IMAGE::m_IJPos, D_CODE::m_InUse, GERBER_FILE_IMAGE::m_Iterpolation, GERBER_FILE_IMAGE::m_Last_Pen_Command, D_CODE::m_Num_Dcode, GERBER_DRAW_ITEM::m_Polygon, GERBER_FILE_IMAGE::m_PolygonFillMode, GERBER_FILE_IMAGE::m_PolygonFillModeState, GERBER_FILE_IMAGE::m_PreviousPos, GERBER_DRAW_ITEM::m_Shape, D_CODE::m_Shape, D_CODE::m_Size, GERBER_DRAW_ITEM::m_Start, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::OutlineCount(), GERBER_FILE_IMAGE::StepAndRepeatItem(), TOOLS_MAX_COUNT, and SHAPE_POLY_SET::Vertex().

Referenced by GERBER_FILE_IMAGE::LoadGerberFile().

585 {
586  wxSize size( 15, 15 );
587 
588  APERTURE_T aperture = APT_CIRCLE;
589  GERBER_DRAW_ITEM* gbritem;
590 
591  int dcode = 0;
592  D_CODE* tool = NULL;
593  wxString msg;
594 
595  if( D_commande >= FIRST_DCODE ) // This is a "Set tool" command
596  {
597  if( D_commande > (TOOLS_MAX_COUNT - 1) )
598  D_commande = TOOLS_MAX_COUNT - 1;
599 
600  // remember which tool is selected, nothing is done with it in this
601  // call
602  m_Current_Tool = D_commande;
603 
604  D_CODE* pt_Dcode = GetDCODE( D_commande );
605  if( pt_Dcode )
606  pt_Dcode->m_InUse = true;
607 
608  return true;
609  }
610  else // D_commande = 0..9: this is a pen command (usually D1, D2 or D3)
611  {
612  m_Last_Pen_Command = D_commande;
613  }
614 
615  if( m_PolygonFillMode ) // Enter a polygon description:
616  {
617  switch( D_commande )
618  {
619  case 1: // code D01 Draw line, exposure ON
620  if( !m_Exposure ) // Start a new polygon outline:
621  {
622  m_Exposure = true;
623  gbritem = new GERBER_DRAW_ITEM( this );
624  m_Drawings.Append( gbritem );
625  gbritem->m_Shape = GBR_POLYGON;
626  gbritem->m_Flashed = false;
627  }
628 
629  switch( m_Iterpolation )
630  {
633  gbritem = m_Drawings.GetLast();
634 
635  fillArcPOLY( gbritem, m_PreviousPos,
637  ( m_Iterpolation == GERB_INTERPOL_ARC_NEG ) ? false : true,
638  m_360Arc_enbl, GetLayerParams().m_LayerNegative );
639  break;
640 
641  default:
642  gbritem = m_Drawings.GetLast();
643 
644  gbritem->m_Start = m_PreviousPos; // m_Start is used as temporary storage
645  if( gbritem->m_Polygon.OutlineCount() == 0 )
646  {
647  gbritem->m_Polygon.NewOutline();
648  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_Start ) );
649  }
650 
651  gbritem->m_End = m_CurrentPos; // m_End is used as temporary storage
652  gbritem->m_Polygon.Append( VECTOR2I( gbritem->m_End ) );
653  break;
654  }
655 
658  break;
659 
660  case 2: // code D2: exposure OFF (i.e. "move to")
661  if( m_Exposure && GetItemsList() ) // End of polygon
662  {
663  gbritem = m_Drawings.GetLast();
664  gbritem->m_Polygon.Append( gbritem->m_Polygon.Vertex( 0 ) );
665  StepAndRepeatItem( *gbritem );
666  }
667  m_Exposure = false;
670  break;
671 
672  default:
673  return false;
674  }
675  }
676  else
677  {
678  switch( D_commande )
679  {
680  case 1: // code D01 Draw line, exposure ON
681  m_Exposure = true;
682 
683  tool = GetDCODE( m_Current_Tool );
684  if( tool )
685  {
686  size = tool->m_Size;
687  dcode = tool->m_Num_Dcode;
688  aperture = tool->m_Shape;
689  }
690 
691  switch( m_Iterpolation )
692  {
694  gbritem = new GERBER_DRAW_ITEM( this );
695  m_Drawings.Append( gbritem );
696 
697  fillLineGBRITEM( gbritem, dcode, m_PreviousPos,
698  m_CurrentPos, size, GetLayerParams().m_LayerNegative );
699  StepAndRepeatItem( *gbritem );
700  break;
701 
705  wxBell();
706  break;
707 
710  gbritem = new GERBER_DRAW_ITEM( this );
711  m_Drawings.Append( gbritem );
712 
713  fillArcGBRITEM( gbritem, dcode, m_PreviousPos,
714  m_CurrentPos, m_IJPos, size,
716  false : true, m_360Arc_enbl, GetLayerParams().m_LayerNegative );
717  StepAndRepeatItem( *gbritem );
718  break;
719 
720  default:
721  msg.Printf( wxT( "RS274D: DCODE Command: interpol error (type %X)" ),
722  m_Iterpolation );
723  AddMessageToList( msg );
724  break;
725  }
726 
728  break;
729 
730  case 2: // code D2: exposure OFF (i.e. "move to")
731  m_Exposure = false;
733  break;
734 
735  case 3: // code D3: flash aperture
736  tool = GetDCODE( m_Current_Tool );
737  if( tool )
738  {
739  size = tool->m_Size;
740  dcode = tool->m_Num_Dcode;
741  aperture = tool->m_Shape;
742  }
743 
744  gbritem = new GERBER_DRAW_ITEM( this );
745  m_Drawings.Append( gbritem );
746  fillFlashedGBRITEM( gbritem, aperture, dcode, m_CurrentPos,
747  size, GetLayerParams().m_LayerNegative );
748  StepAndRepeatItem( *gbritem );
750  break;
751 
752  default:
753  return false;
754  }
755  }
756 
757  return true;
758 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
static void fillArcPOLY(GERBER_DRAW_ITEM *aGbrItem, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &rel_center, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcPOLY creates an arc G code when found in poly outlines.
Definition: rs274d.cpp:338
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
int OutlineCount() const
Returns the number of outlines in the set
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Function fillLineGBRITEM initializes a given GBRITEM so that it can draw a linear D code...
Definition: rs274d.cpp:162
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
SHAPE_POLY_SET m_Polygon
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:170
#define FIRST_DCODE
Definition: dcode.h:71
APERTURE_T
Enum APERTURE_T is the set of all gerber aperture types allowed, according to page 16 of http://gerbv...
Definition: dcode.h:50
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
int NewOutline()
Creates a new empty polygon in the set and returns its index
bool m_Exposure
whether an aperture macro tool is flashed on or off
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const wxPoint &aPos, wxSize aSize, bool aLayerNegative)
Function fillFlashedGBRITEM initializes a given GBRITEM so that it can draw a circle which is filled ...
Definition: rs274d.cpp:107
DLIST< GERBER_DRAW_ITEM > m_Drawings
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
static void fillArcGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, const wxPoint &aRelCenter, wxSize aPenSize, bool aClockwise, bool aMultiquadrant, bool aLayerNegative)
Function fillArcGBRITEM initializes a given GBRITEM so that it can draw an arc G code.
Definition: rs274d.cpp:211
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline) ...
bool EXCELLON_IMAGE::Execute_Drill_Command ( char *&  text)
private

Definition at line 534 of file excellon_read_drill_file.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), DLIST< T >::Append(), Execute_EXCELLON_G_Command(), fillFlashedGBRITEM(), fillLineGBRITEM(), GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::m_Current_Tool, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_Drawings, D_CODE::m_Num_Dcode, GERBER_FILE_IMAGE::m_PreviousPos, D_CODE::m_Shape, D_CODE::m_Size, m_SlotOn, GERBER_FILE_IMAGE::ReadXYCoord(), and GERBER_FILE_IMAGE::StepAndRepeatItem().

Referenced by LoadFile().

535 {
536  D_CODE* tool;
537  GERBER_DRAW_ITEM * gbritem;
538 
539  while( true )
540  {
541  switch( *text )
542  {
543  case 'X':
544  ReadXYCoord( text );
545  break;
546  case 'Y':
547  ReadXYCoord( text );
548  break;
549  case 'G': // G85 is found here for oval holes
552  break;
553  case 0: // E.O.L: execute command
554  tool = GetDCODE( m_Current_Tool );
555 
556  if( !tool )
557  {
558  wxString msg;
559  msg.Printf( _( "Tool %d not defined" ), m_Current_Tool );
560  AddMessageToList( msg );
561  return false;
562  }
563 
564  gbritem = new GERBER_DRAW_ITEM( this );
565  m_Drawings.Append( gbritem );
566 
567  if( m_SlotOn ) // Oblong hole
568  {
569  fillLineGBRITEM( gbritem, tool->m_Num_Dcode,
571  tool->m_Size, false );
572  // the hole is made: reset the slot on command (G85)
573  // (it is needed for each oblong hole)
574  m_SlotOn = false;
575  }
576  else
577  {
578  fillFlashedGBRITEM( gbritem, tool->m_Shape, tool->m_Num_Dcode,
579  m_CurrentPos, tool->m_Size, false );
580  }
581 
582  StepAndRepeatItem( *gbritem );
584  return true;
585  break;
586 
587  default:
588  text++;
589  break;
590  }
591  }
592 
593  return true;
594 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
wxPoint ReadXYCoord(char *&Text)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) ...
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
void fillFlashedGBRITEM(GERBER_DRAW_ITEM *aGbrItem, APERTURE_T aAperture, int Dcode_index, const wxPoint &aPos, wxSize aSize, bool aLayerNegative)
Function fillFlashedGBRITEM initializes a given GBRITEM so that it can draw a circle which is filled ...
Definition: rs274d.cpp:107
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
DLIST< GERBER_DRAW_ITEM > m_Drawings
bool Execute_EXCELLON_G_Command(char *&text)
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
void fillLineGBRITEM(GERBER_DRAW_ITEM *aGbrItem, int Dcode_index, const wxPoint &aStart, const wxPoint &aEnd, wxSize aPenSize, bool aLayerNegative)
Function fillLineGBRITEM initializes a given GBRITEM so that it can draw a linear D code...
Definition: rs274d.cpp:162
bool EXCELLON_IMAGE::Execute_EXCELLON_G_Command ( char *&  text)
private

Definition at line 635 of file excellon_read_drill_file.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), DRILL_G_ABSOLUTE, DRILL_G_CCWMOVE, DRILL_G_CWMOVE, DRILL_G_DRILL, DRILL_G_INCREMENTAL, DRILL_G_LINEARMOVE, DRILL_G_ROUT, DRILL_G_SLOT, DRILL_G_UNKNOWN, DRILL_G_ZERO_SET, FROM_UTF8(), GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_1X, GetChars(), EXCELLON_CMD::m_Code, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_Iterpolation, EXCELLON_CMD::m_Name, GERBER_FILE_IMAGE::m_Offset, GERBER_FILE_IMAGE::m_PolygonFillMode, GERBER_FILE_IMAGE::m_Relative, m_SlotOn, and GERBER_FILE_IMAGE::ReadXYCoord().

Referenced by Execute_Drill_Command(), and LoadFile().

636 {
637  EXCELLON_CMD* cmd = NULL;
638  bool success = false;
639  int id = DRILL_G_UNKNOWN;
640 
641  // Search command in list
642  EXCELLON_CMD* candidate;
643  char * gcmd = text; // gcmd points the G command, for error messages.
644 
645  for( unsigned ii = 0; ; ii++ )
646  {
647  candidate = &excellon_G_CmdList[ii];
648  int len = candidate->m_Name.size();
649  if( len == 0 ) // End of list reached
650  break;
651  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
652  {
653  cmd = candidate;
654  text += len;
655  success = true;
656  id = cmd->m_Code;
657  break;
658  }
659  }
660 
661  switch( id )
662  {
663  case DRILL_G_ZERO_SET:
664  ReadXYCoord( text );
666  break;
667 
668  case DRILL_G_ROUT:
669  m_SlotOn = false;
670  m_PolygonFillMode = true;
671  break;
672 
673  case DRILL_G_DRILL:
674  m_SlotOn = false;
675  m_PolygonFillMode = false;
676  break;
677 
678  case DRILL_G_SLOT:
679  m_SlotOn = true;
680  break;
681 
682  case DRILL_G_LINEARMOVE:
684  break;
685 
686  case DRILL_G_CWMOVE:
688  break;
689 
690  case DRILL_G_CCWMOVE:
692  break;
693 
694  case DRILL_G_ABSOLUTE:
695  m_Relative = false; // false = absolute coord
696  break;
697 
698  case DRILL_G_INCREMENTAL:
699  m_Relative = true; // true = relative coord
700  break;
701 
702  case DRILL_G_UNKNOWN:
703  default:
704  {
705  wxString msg;
706  msg.Printf( _( "Unknown Excellon G Code: &lt;%s&gt;" ), GetChars(FROM_UTF8(gcmd)) );
707  AddMessageToList( msg );
708  while( *text )
709  text++;
710  return false;
711  }
712  }
713  return success;
714 }
static EXCELLON_CMD excellon_G_CmdList[]
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
wxPoint ReadXYCoord(char *&Text)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) ...
std::string m_Name
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
bool GERBER_FILE_IMAGE::Execute_G_Command ( char *&  text,
int  G_command 
)
inherited

Definition at line 458 of file rs274d.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), SHAPE_POLY_SET::Append(), GERBER_FILE_IMAGE::DCodeNumber(), dummy(), FIRST_DCODE, GC_CIRCLE_NEG_INTERPOL, GC_CIRCLE_POS_INTERPOL, GC_COMMENT, GC_LINEAR_INTERPOL_0P01X, GC_LINEAR_INTERPOL_0P1X, GC_LINEAR_INTERPOL_10X, GC_LINEAR_INTERPOL_1X, GC_MOVE, GC_PHOTO_MODE, GC_SELECT_TOOL, GC_SPECIFY_ABSOLUES_COORD, GC_SPECIFY_INCHES, GC_SPECIFY_MILLIMETERS, GC_SPECIFY_RELATIVEES_COORD, GC_TURN_OFF_360_INTERPOL, GC_TURN_OFF_POLY_FILL, GC_TURN_ON_360_INTERPOL, GC_TURN_ON_POLY_FILL, GERB_INTERPOL_ARC_NEG, GERB_INTERPOL_ARC_POS, GERB_INTERPOL_LINEAR_001X, GERB_INTERPOL_LINEAR_01X, GERB_INTERPOL_LINEAR_10X, GERB_INTERPOL_LINEAR_1X, GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::GetItemsList(), DLIST< T >::GetLast(), X2_ATTRIBUTE::IsFileFunction(), GERBER_FILE_IMAGE::m_360Arc_enbl, GERBER_FILE_IMAGE::m_Current_File, GERBER_FILE_IMAGE::m_Current_Tool, GERBER_FILE_IMAGE::m_Drawings, GERBER_FILE_IMAGE::m_Exposure, GERBER_FILE_IMAGE::m_FileFunction, GERBER_FILE_IMAGE::m_GerbMetric, D_CODE::m_InUse, GERBER_FILE_IMAGE::m_Iterpolation, GERBER_FILE_IMAGE::m_LineNum, GERBER_DRAW_ITEM::m_Polygon, GERBER_FILE_IMAGE::m_PolygonFillMode, GERBER_FILE_IMAGE::m_PolygonFillModeState, GERBER_FILE_IMAGE::m_Relative, X2_ATTRIBUTE::ParseAttribCmd(), GERBER_FILE_IMAGE::StepAndRepeatItem(), TOOLS_MAX_COUNT, and SHAPE_POLY_SET::Vertex().

Referenced by GERBER_FILE_IMAGE::LoadGerberFile().

459 {
460 // D( printf( "%22s: G_CODE<%d>\n", __func__, G_command ); )
461 
462  switch( G_command )
463  {
464  case GC_PHOTO_MODE: // can starts a D03 flash command: redundant, can
465  // be safely ignored
466  break;
467 
470  break;
471 
474  break;
475 
478  break;
479 
480  case GC_COMMENT:
481  // Skip comment, but only if the line does not start by "G04 #@! TF"
482  // which is a metadata
483  if( strncmp( text, " #@! TF", 7 ) == 0 )
484  {
485  text += 7;
487  dummy.ParseAttribCmd( m_Current_File, NULL, 0, text, m_LineNum );
488  if( dummy.IsFileFunction() )
489  {
490  delete m_FileFunction;
492  }
493  }
494 
495  while ( *text && (*text != '*') )
496  text++;
497  break;
498 
501  break;
502 
505  break;
506 
509  break;
510 
511  case GC_SELECT_TOOL:
512  {
513  int D_commande = DCodeNumber( text );
514  if( D_commande < FIRST_DCODE )
515  return false;
516  if( D_commande > (TOOLS_MAX_COUNT - 1) )
517  D_commande = TOOLS_MAX_COUNT - 1;
518  m_Current_Tool = D_commande;
519  D_CODE* pt_Dcode = GetDCODE( D_commande );
520  if( pt_Dcode )
521  pt_Dcode->m_InUse = true;
522  break;
523  }
524 
525  case GC_SPECIFY_INCHES:
526  m_GerbMetric = false; // false = Inches, true = metric
527  break;
528 
530  m_GerbMetric = true; // false = Inches, true = metric
531  break;
532 
533  case GC_TURN_OFF_360_INTERPOL: // disable Multi cadran arc and Arc interpol
534  m_360Arc_enbl = false;
535  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // not sure it should be done
536  break;
537 
539  m_360Arc_enbl = true;
540  break;
541 
543  m_Relative = false; // false = absolute Coord, true = relative
544  // Coord
545  break;
546 
548  m_Relative = true; // false = absolute Coord, true = relative
549  // Coord
550  break;
551 
553  m_PolygonFillMode = true;
554  m_Exposure = false;
555  break;
556 
558  if( m_Exposure && GetItemsList() ) // End of polygon
559  {
560  GERBER_DRAW_ITEM * gbritem = m_Drawings.GetLast();
561  gbritem->m_Polygon.Append( gbritem->m_Polygon.Vertex( 0 ) );
562  StepAndRepeatItem( *gbritem );
563  }
564  m_Exposure = false;
565  m_PolygonFillMode = false;
567  break;
568 
569  case GC_MOVE: // Non existent
570  default:
571  {
572  wxString msg;
573  msg.Printf( wxT( "G%0.2d command not handled" ), G_command );
574  AddMessageToList( msg );
575  return false;
576  }
577  }
578 
579 
580  return true;
581 }
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF...
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
class X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma ...
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
SHAPE_POLY_SET m_Polygon
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
T * GetLast() const
Function GetLast returns the last T* in the list without removing it, or NULL if the list is empty...
Definition: dlist.h:170
#define FIRST_DCODE
Definition: dcode.h:71
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:438
bool IsFileFunction()
return true if the attribute is .FileFunction
bool m_Exposure
whether an aperture macro tool is flashed on or off
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
DLIST< GERBER_DRAW_ITEM > m_Drawings
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText, int &aLineNum)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
void StepAndRepeatItem(const GERBER_DRAW_ITEM &aItem)
Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called wh...
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline) ...
bool EXCELLON_IMAGE::Execute_HEADER_Command ( char *&  text)
private

Definition at line 321 of file excellon_read_drill_file.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), DRILL_AUTOMATIC_SPEED, DRILL_AUTOMATIC_TOOL_CHANGE, DRILL_AXIS_VERSION, DRILL_DETECT_BROKEN, DRILL_FMT, DRILL_IMPERIALHEADER, DRILL_INCREMENTALHEADER, DRILL_M_BEGINPATTERN, DRILL_M_CANNEDTEXT, DRILL_M_END, DRILL_M_ENDHEADER, DRILL_M_ENDPATTERN, DRILL_M_ENDREWIND, DRILL_M_HEADER, DRILL_M_IMPERIAL, DRILL_M_LONGMESSAGE, DRILL_M_MESSAGE, DRILL_M_METRIC, DRILL_M_TIPCHECK, DRILL_M_UNKNOWN, DRILL_METRICHEADER, DRILL_RESET_CMD, DRILL_REWIND_STOP, DRILL_SKIP, DRILL_TOOL_CHANGE_STOP, DRILL_TOOL_INFORMATION, EXCELLON_CMD::m_Code, EXCELLON_CMD::m_Name, GERBER_FILE_IMAGE::m_NoTrailingZeros, GERBER_FILE_IMAGE::m_Relative, m_State, READ_HEADER_STATE, READ_PROGRAM_STATE, readToolInformation(), and SelectUnits().

Referenced by LoadFile().

322 {
323  EXCELLON_CMD* cmd = NULL;
324  wxString msg;
325 
326  // Search command in list
327  for( unsigned ii = 0; ; ii++ )
328  {
329  EXCELLON_CMD* candidate = &excellonHeaderCmdList[ii];
330  int len = candidate->m_Name.size();
331 
332  if( len == 0 ) // End of list reached
333  break;
334 
335  if( candidate->m_Name.compare( 0, len, text, len ) == 0 ) // found.
336  {
337  cmd = candidate;
338  text += len;
339  break;
340  }
341  }
342 
343  if( !cmd )
344  {
345  msg.Printf( wxT( "Unknown Excellon command &lt;%s&gt;" ), text );
346  AddMessageToList( msg );
347  while( *text )
348  text++;
349 
350  return false;
351  }
352 
353  // Execute command
354  // some do nothing
355  switch( cmd->m_Code )
356  {
357  case DRILL_SKIP:
358  case DRILL_M_UNKNOWN:
359  break;
360 
361  case DRILL_M_END:
362  break;
363 
364  case DRILL_M_ENDREWIND:
365  break;
366 
367  case DRILL_M_MESSAGE:
368  break;
369 
370  case DRILL_M_LONGMESSAGE:
371  break;
372 
373  case DRILL_M_HEADER:
375  break;
376 
377  case DRILL_M_ENDHEADER:
379  break;
380 
381  case DRILL_REWIND_STOP: // End of header. No action in a viewer
383  break;
384 
385  case DRILL_M_METRIC:
386  SelectUnits( true );
387  break;
388 
389  case DRILL_METRICHEADER: // command like METRIC,TZ or METRIC,LZ
390  SelectUnits( true );
391  if( *text != ',' )
392  {
393  AddMessageToList( _( "METRIC command has no parameter" ) );
394  break;
395  }
396  text++; // skip separator
397  if( *text == 'T' )
398  m_NoTrailingZeros = false;
399  else
400  m_NoTrailingZeros = true;
401  break;
402 
403  case DRILL_M_IMPERIAL:
404  SelectUnits( false );
405  break;
406 
407  case DRILL_IMPERIALHEADER: // command like INCH,TZ or INCH,LZ
408  SelectUnits( false );
409  if( *text != ',' )
410  {
411  AddMessageToList( _( "INCH command has no parameter" ) );
412  break;
413  }
414  text++; // skip separator
415  if( *text == 'T' )
416  m_NoTrailingZeros = false;
417  else
418  m_NoTrailingZeros = true;
419  break;
420 
422  break;
423 
424  case DRILL_M_ENDPATTERN:
425  break;
426 
427  case DRILL_M_CANNEDTEXT:
428  break;
429 
430  case DRILL_M_TIPCHECK:
431  break;
432 
433  case DRILL_DETECT_BROKEN:
434  break;
435 
437  if( *text != ',' )
438  {
439  AddMessageToList( _( "ICI command has no parameter" ) );
440  break;
441  }
442  text++; // skip separator
443  // Parameter should be ON or OFF
444  if( strncasecmp( text, "OFF", 3 ) == 0 )
445  m_Relative = false;
446  else if( strncasecmp( text, "ON", 2 ) == 0 )
447  m_Relative = true;
448  else
449  AddMessageToList( _( "ICI command has incorrect parameter" ) );
450  break;
451 
453  break;
454 
456  break;
457 
458  case DRILL_AXIS_VERSION:
459  break;
460 
461  case DRILL_RESET_CMD:
462  break;
463 
465  break;
466 
467  case DRILL_FMT:
468  break;
469 
471  readToolInformation( text );
472  break;
473  }
474 
475  while( *text )
476  text++;
477 
478  return true;
479 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
static EXCELLON_CMD excellonHeaderCmdList[]
std::string m_Name
excellon_state m_State
bool readToolInformation(char *&aText)
Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list...
void SelectUnits(bool aMetric)
bool GERBER_FILE_IMAGE::ExecuteRS274XCommand ( int  command,
char *  aBuff,
char *&  text 
)
inherited

Function ExecuteRS274XCommand executes 1 command.

Definition at line 245 of file rs274x.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), AP_DEFINITION, AP_MACRO, APERTURE_ATTRIBUTE, D_CODE::AppendParam(), APT_CIRCLE, APT_DEF_RECT_HOLE, APT_DEF_ROUND_HOLE, APT_MACRO, APT_OVAL, APT_POLYGON, APT_RECT, AXIS_SELECT, DBG, dummy(), FILE_ATTRIBUTE, GERBER_FILE_IMAGE::FindApertureMacro(), FORMAT_STATEMENT, fromGerberString(), GBR_NETLIST_METADATA::GBR_NETINFO_CMP, GBR_NETLIST_METADATA::GBR_NETINFO_NET, GBR_NETLIST_METADATA::GBR_NETINFO_PAD, GERB_INTERPOL_LINEAR_1X, GERBER_BUFZ, X2_ATTRIBUTE::GetAttribute(), GERBER_FILE_IMAGE::GetDCODEOrCreate(), GERBER_FILE_IMAGE::GetEndOfBlock(), GERBER_FILE_IMAGE::GetLayerParams(), X2_ATTRIBUTE::GetPrm(), X2_ATTRIBUTE::GetPrmCount(), IMAGE_JUSTIFY, IMAGE_NAME, IMAGE_OFFSET, IMAGE_POLARITY, IMAGE_ROTATION, INCH, X2_ATTRIBUTE::IsFileFunction(), X2_ATTRIBUTE::IsFileMD5(), X2_ATTRIBUTE::IsFilePart(), KiROUND(), KNOCKOUT, LOAD_NAME, LOAD_POLARITY, D_CODE::m_AperFunction, GERBER_FILE_IMAGE::m_AperFunction, GBR_NETLIST_METADATA::m_Cmpref, GERBER_FILE_IMAGE::m_Current_File, D_CODE::m_Defined, D_CODE::m_Drill, D_CODE::m_DrillShape, D_CODE::m_EdgesCount, GERBER_FILE_IMAGE::m_FileFunction, GERBER_FILE_IMAGE::m_FileName, GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_Has_DCode, GERBER_FILE_IMAGE::m_ImageJustifyOffset, GERBER_FILE_IMAGE::m_ImageJustifyXCenter, GERBER_FILE_IMAGE::m_ImageJustifyYCenter, GERBER_FILE_IMAGE::m_ImageName, GERBER_FILE_IMAGE::m_ImageNegative, GERBER_FILE_IMAGE::m_ImageOffset, GERBER_FILE_IMAGE::m_ImageRotation, GERBER_FILE_IMAGE::m_IsX2_file, GERBER_FILE_IMAGE::m_Iterpolation, GERBER_LAYER::m_LayerNegative, GERBER_FILE_IMAGE::m_LineNum, GERBER_FILE_IMAGE::m_LocalRotation, GERBER_FILE_IMAGE::m_MD5_value, GERBER_FILE_IMAGE::m_MirrorA, GERBER_FILE_IMAGE::m_MirrorB, GBR_NETLIST_METADATA::m_NetAttribType, GERBER_FILE_IMAGE::m_NetAttributeDict, GBR_NETLIST_METADATA::m_Netname, GERBER_FILE_IMAGE::m_NoTrailingZeros, GERBER_FILE_IMAGE::m_Offset, GBR_NETLIST_METADATA::m_Padname, GERBER_FILE_IMAGE::m_PartString, GERBER_FILE_IMAGE::m_Relative, D_CODE::m_Rotation, GERBER_FILE_IMAGE::m_Scale, D_CODE::m_Shape, D_CODE::m_Size, GERBER_LAYER::m_StepForRepeat, GERBER_LAYER::m_StepForRepeatMetric, GERBER_FILE_IMAGE::m_SwapAxis, GERBER_LAYER::m_XRepeatCount, GERBER_LAYER::m_YRepeatCount, MILLIMETER, MIRROR_IMAGE, MODE_OF_UNITS, APERTURE_MACRO::name, NET_ATTRIBUTE, OFFSET, X2_ATTRIBUTE::ParseAttribCmd(), GERBER_FILE_IMAGE::ReadApertureMacro(), ReadDouble(), ReadInt(), ReadXCommand(), REMOVE_APERTURE_ATTRIBUTE, GERBER_FILE_IMAGE::RemoveAttribute(), ROTATE, SCALE_FACTOR, D_CODE::SetMacro(), STEP_AND_REPEAT, TO_UTF8, wxPoint::x, and wxPoint::y.

Referenced by GERBER_FILE_IMAGE::ReadRS274XCommand().

246 {
247  int code;
248  int seq_len; // not used, just provided
249  int seq_char;
250  bool ok = true;
251  wxString msg;
252  double fcoord;
253  bool x_fmt_known = false;
254  bool y_fmt_known = false;
255 
256  // conv_scale = scaling factor from inch to Internal Unit
257  double conv_scale = IU_PER_MILS * 1000;
258  if( m_GerbMetric )
259  conv_scale /= 25.4;
260 
261 // DBG( printf( "%22s: Command <%c%c>\n", __func__, (command >> 8) & 0xFF, command & 0xFF ); )
262 
263  switch( command )
264  {
265  case FORMAT_STATEMENT:
266  seq_len = 2;
267 
268  while( *text != '*' )
269  {
270  switch( *text )
271  {
272  case ' ':
273  text++;
274  break;
275 
276  case 'D': // Non-standard option for all zeros (leading + tailing)
277  msg.Printf( _( "RS274X: Invalid GERBER format command '%c' at line %d: \"%s\"" ),
278  'D', m_LineNum, buff );
279  AddMessageToList( msg );
280  msg.Printf( _("GERBER file \"%s\" may not display as intended." ),
281  m_FileName.ToAscii() );
282  AddMessageToList( msg );
283  // Fallthrough
284 
285  case 'L': // No Leading 0
286  m_NoTrailingZeros = false;
287  text++;
288  break;
289 
290  case 'T': // No trailing 0
291  m_NoTrailingZeros = true;
292  text++;
293  break;
294 
295  case 'A': // Absolute coord
296  m_Relative = false;
297  text++;
298  break;
299 
300  case 'I': // Relative coord
301  m_Relative = true;
302  text++;
303  break;
304 
305  case 'G':
306  case 'N': // Sequence code (followed by one digit: the sequence len)
307  // (sometimes found before the X,Y sequence)
308  // Obscure option
309  text++;
310  seq_char = *text++;
311  if( (seq_char >= '0') && (seq_char <= '9') )
312  seq_len = seq_char - '0';
313  break;
314 
315  case 'M': // Sequence code (followed by one digit: the sequence len)
316  // (sometimes found after the X,Y sequence)
317  // Obscure option
318  code = *text++;
319  if( ( *text >= '0' ) && ( *text<= '9' ) )
320  text++; // skip the digit
321  break;
322 
323  case 'X':
324  case 'Y':
325  {
326  code = *(text++);
327  char ctmp = *(text++) - '0';
328  if( code == 'X' )
329  {
330  x_fmt_known = true;
331  // number of digits after the decimal point (0 to 7 allowed)
332  m_FmtScale.x = *text - '0';
333  m_FmtLen.x = ctmp + m_FmtScale.x;
334 
335  // m_FmtScale is 0 to 7
336  // (Old Gerber specification was 0 to 6)
337  if( m_FmtScale.x < 0 )
338  m_FmtScale.x = 0;
339  if( m_FmtScale.x > 7 )
340  m_FmtScale.x = 7;
341  }
342  else
343  {
344  y_fmt_known = true;
345  m_FmtScale.y = *text - '0';
346  m_FmtLen.y = ctmp + m_FmtScale.y;
347  if( m_FmtScale.y < 0 )
348  m_FmtScale.y = 0;
349  if( m_FmtScale.y > 7 )
350  m_FmtScale.y = 7;
351  }
352  text++;
353  }
354  break;
355 
356  case '*':
357  break;
358 
359  default:
360  msg.Printf( wxT( "Unknown id (%c) in FS command" ),
361  *text );
362  AddMessageToList( msg );
363  GetEndOfBlock( buff, text, m_Current_File );
364  ok = false;
365  break;
366  }
367  }
368  if( !x_fmt_known || !y_fmt_known )
369  AddMessageToList( wxT( "RS274X: Format Statement (FS) without X or Y format" ) );
370 
371  break;
372 
373  case AXIS_SELECT: // command ASAXBY*% or %ASAYBX*%
374  m_SwapAxis = false;
375  if( strncasecmp( text, "AYBX", 4 ) == 0 )
376  m_SwapAxis = true;
377  break;
378 
379  case MIRROR_IMAGE: // command %MIA0B0*%, %MIA0B1*%, %MIA1B0*%, %MIA1B1*%
380  m_MirrorA = m_MirrorB = 0;
381  while( *text && *text != '*' )
382  {
383  switch( *text )
384  {
385  case 'A': // Mirror A axis ?
386  text++;
387  if( *text == '1' )
388  m_MirrorA = true;
389  break;
390 
391  case 'B': // Mirror B axis ?
392  text++;
393  if( *text == '1' )
394  m_MirrorB = true;
395  break;
396 
397  default:
398  text++;
399  break;
400  }
401  }
402  break;
403 
404  case MODE_OF_UNITS:
405  code = ReadXCommand( text );
406  if( code == INCH )
407  m_GerbMetric = false;
408  else if( code == MILLIMETER )
409  m_GerbMetric = true;
410  conv_scale = m_GerbMetric ? IU_PER_MILS / 25.4 : IU_PER_MILS;
411  break;
412 
413  case FILE_ATTRIBUTE: // Command %TF ...
414  m_IsX2_file = true;
415  {
417  dummy.ParseAttribCmd( m_Current_File, buff, GERBER_BUFZ, text, m_LineNum );
418 
419  if( dummy.IsFileFunction() )
420  {
421  delete m_FileFunction;
423  }
424  else if( dummy.IsFileMD5() )
425  {
426  m_MD5_value = dummy.GetPrm( 1 );
427  }
428  else if( dummy.IsFilePart() )
429  {
430  m_PartString = dummy.GetPrm( 1 );
431  }
432  }
433  break;
434 
435  case APERTURE_ATTRIBUTE: // Command %TA ... Not yet supported
436  {
438  dummy.ParseAttribCmd( m_Current_File, buff, GERBER_BUFZ, text, m_LineNum );
439 
440  if( dummy.GetAttribute() == ".AperFunction" )
441  {
442  m_AperFunction = dummy.GetPrm( 1 );
443 
444  // A few function values can have other parameters. Add them
445  for( int ii = 2; ii < dummy.GetPrmCount(); ii++ )
446  m_AperFunction << "," << dummy.GetPrm( ii );
447  }
448  }
449  break;
450 
451  case NET_ATTRIBUTE: // Command %TO currently %TO.P %TO.N and %TO.C
452  {
454 
455  dummy.ParseAttribCmd( m_Current_File, buff, GERBER_BUFZ, text, m_LineNum );
456 
457  if( dummy.GetAttribute() == ".N" )
458  {
461  }
462  else if( dummy.GetAttribute() == ".C" )
463  {
466  }
467  else if( dummy.GetAttribute() == ".P" )
468  {
472  }
473  }
474  break;
475 
476  case REMOVE_APERTURE_ATTRIBUTE: // Command %TD ...
477  {
479  dummy.ParseAttribCmd( m_Current_File, buff, GERBER_BUFZ, text, m_LineNum );
480  RemoveAttribute( dummy );
481  }
482  break;
483 
484  case OFFSET: // command: OFAnnBnn (nn = float number) = layer Offset
485  m_Offset.x = m_Offset.y = 0;
486  while( *text != '*' )
487  {
488  switch( *text )
489  {
490  case 'A': // A axis offset in current unit (inch or mm)
491  text++;
492  fcoord = ReadDouble( text );
493  m_Offset.x = KiROUND( fcoord * conv_scale );
494  break;
495 
496  case 'B': // B axis offset in current unit (inch or mm)
497  text++;
498  fcoord = ReadDouble( text );
499  m_Offset.y = KiROUND( fcoord * conv_scale );
500  break;
501  }
502  }
503  break;
504 
505  case SCALE_FACTOR:
506  m_Scale.x = m_Scale.y = 1.0;
507  while( *text != '*' )
508  {
509  switch( *text )
510  {
511  case 'A': // A axis scale
512  text++;
513  m_Scale.x = ReadDouble( text );
514  break;
515 
516  case 'B': // B axis scale
517  text++;
518  m_Scale.y = ReadDouble( text );
519  break;
520  }
521  }
522  break;
523 
524  case IMAGE_OFFSET: // command: IOAnnBnn (nn = float number) = Image Offset
526  while( *text != '*' )
527  {
528  switch( *text )
529  {
530  case 'A': // A axis offset in current unit (inch or mm)
531  text++;
532  fcoord = ReadDouble( text );
533  m_ImageOffset.x = KiROUND( fcoord * conv_scale );
534  break;
535 
536  case 'B': // B axis offset in current unit (inch or mm)
537  text++;
538  fcoord = ReadDouble( text );
539  m_ImageOffset.y = KiROUND( fcoord * conv_scale );
540  break;
541  }
542  }
543  break;
544 
545  case IMAGE_ROTATION: // command IR0* or IR90* or IR180* or IR270*
546  if( strncasecmp( text, "0*", 2 ) == 0 )
547  m_ImageRotation = 0;
548  else if( strncasecmp( text, "90*", 3 ) == 0 )
549  m_ImageRotation = 90;
550  else if( strncasecmp( text, "180*", 4 ) == 0 )
551  m_ImageRotation = 180;
552  else if( strncasecmp( text, "270*", 4 ) == 0 )
553  m_ImageRotation = 270;
554  else
555  AddMessageToList( _( "RS274X: Command \"IR\" rotation value not allowed" ) );
556  break;
557 
558  case STEP_AND_REPEAT: // command SR, like %SRX3Y2I5.0J2*%
559  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Start a new Gerber layer
561  GetLayerParams().m_StepForRepeat.x = 0.0; // offset for Step and Repeat command
563  GetLayerParams().m_YRepeatCount = 1; // The repeat count
564  GetLayerParams().m_StepForRepeatMetric = m_GerbMetric; // the step units
565  while( *text && *text != '*' )
566  {
567  switch( *text )
568  {
569  case 'I': // X axis offset
570  text++;
572  break;
573 
574  case 'J': // Y axis offset
575  text++;
577  break;
578 
579  case 'X': // X axis repeat count
580  text++;
582  break;
583 
584  case 'Y': // Y axis offset
585  text++;
587  break;
588  default:
589  text++;
590  break;
591  }
592  }
593  break;
594 
595  case IMAGE_JUSTIFY: // Command IJAnBn*
596  m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
597  m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
598  m_ImageJustifyOffset = wxPoint(0,0); // Image Justify Offset on XY axis (default = 0,0)
599  while( *text && *text != '*' )
600  {
601  // IJ command is (for A or B axis) AC or AL or A<coordinate>
602  switch( *text )
603  {
604  case 'A': // A axis justify
605  text++;
606  if( *text == 'C' )
607  {
608  m_ImageJustifyXCenter = true;
609  text++;
610  }
611  else if( *text == 'L' )
612  {
613  m_ImageJustifyXCenter = true;
614  text++;
615  }
616  else m_ImageJustifyOffset.x = KiROUND( ReadDouble( text ) * conv_scale);
617  break;
618 
619  case 'B': // B axis justify
620  text++;
621  if( *text == 'C' )
622  {
623  m_ImageJustifyYCenter = true;
624  text++;
625  }
626  else if( *text == 'L' )
627  {
628  m_ImageJustifyYCenter = true;
629  text++;
630  }
631  else m_ImageJustifyOffset.y = KiROUND( ReadDouble( text ) * conv_scale);
632  break;
633  default:
634  text++;
635  break;
636  }
637  }
642  break;
643 
644  case KNOCKOUT:
645  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Start a new Gerber layer
646  msg = _( "RS274X: Command KNOCKOUT ignored by GerbView" ) ;
647  AddMessageToList( msg );
648  break;
649 
650  case ROTATE: // Layer rotation: command like %RO45*%
651  m_Iterpolation = GERB_INTERPOL_LINEAR_1X; // Start a new Gerber layer
652  m_LocalRotation =ReadDouble( text ); // Store layer rotation in degrees
653  break;
654 
655  case IMAGE_NAME:
656  m_ImageName.Empty();
657  while( *text != '*' )
658  {
659  m_ImageName.Append( *text++ );
660  }
661 
662  break;
663 
664  case LOAD_NAME:
665  // %LN is a (deprecated) equivalentto G04: a comment
666  while( *text && *text != '*' )
667  {
668  text++; // Skip text
669  }
670 
671  break;
672 
673  case IMAGE_POLARITY:
674  if( strncasecmp( text, "NEG", 3 ) == 0 )
675  m_ImageNegative = true;
676  else
677  m_ImageNegative = false;
678  DBG( printf( "%22s: IMAGE_POLARITY m_ImageNegative=%s\n", __func__,
679  m_ImageNegative ? "true" : "false" ); )
680  break;
681 
682  case LOAD_POLARITY:
683  if( *text == 'C' )
685  else
687 
688  break;
689 
690  case AP_MACRO: // lines like %AMMYMACRO*
691  // 5,1,8,0,0,1.08239X$1,22.5*
692  // %
693  /*ok = */ReadApertureMacro( buff, text, m_Current_File );
694  break;
695 
696  case AP_DEFINITION:
697  /* input example: %ADD30R,0.081800X0.101500*%
698  * Aperture definition has 4 options: C, R, O, P
699  * (Circle, Rect, Oval, regular Polygon)
700  * and shapes can have a hole (round or rectangular).
701  * All optional parameters values start by X
702  * at this point, text points to 2nd 'D'
703  */
704  if( *text++ != 'D' )
705  {
706  ok = false;
707  break;
708  }
709 
710  m_Has_DCode = true;
711 
712  code = ReadInt( text );
713 
714  D_CODE* dcode;
715  dcode = GetDCODEOrCreate( code );
716 
717  if( dcode == NULL )
718  break;
719 
721 
722  // at this point, text points to character after the ADD<num>,
723  // i.e. R in example above. If text[0] is one of the usual
724  // apertures: (C,R,O,P), there is a comma after it.
725  if( text[1] == ',' )
726  {
727  char stdAperture = *text;
728 
729  text += 2; // skip "C," for example
730 
731  dcode->m_Size.x = KiROUND( ReadDouble( text ) * conv_scale );
732  dcode->m_Size.y = dcode->m_Size.x;
733 
734  switch( stdAperture ) // Aperture desceiption has optional parameters. Read them
735  {
736  case 'C': // Circle
737  dcode->m_Shape = APT_CIRCLE;
738  while( *text == ' ' )
739  text++;
740 
741  if( *text == 'X' )
742  {
743  text++;
744  dcode->m_Drill.x = dcode->m_Drill.y =
745  KiROUND( ReadDouble( text ) * conv_scale );
747  }
748 
749  while( *text == ' ' )
750  text++;
751 
752  if( *text == 'X' )
753  {
754  text++;
755  dcode->m_Drill.y =
756  KiROUND( ReadDouble( text ) * conv_scale );
757 
759  }
760  dcode->m_Defined = true;
761  break;
762 
763  case 'O': // oval
764  case 'R': // rect
765  dcode->m_Shape = (stdAperture == 'O') ? APT_OVAL : APT_RECT;
766 
767  while( *text == ' ' )
768  text++;
769 
770  if( *text == 'X' )
771  {
772  text++;
773  dcode->m_Size.y =
774  KiROUND( ReadDouble( text ) * conv_scale );
775  }
776 
777  while( *text == ' ' )
778  text++;
779 
780  if( *text == 'X' )
781  {
782  text++;
783  dcode->m_Drill.x = KiROUND( ReadDouble( text ) * conv_scale );
784  dcode->m_Drill.y = dcode->m_Drill.x;
786  }
787 
788  while( *text == ' ' )
789  text++;
790 
791  if( *text == 'X' )
792  {
793  text++;
794  dcode->m_Drill.y =
795  KiROUND( ReadDouble( text ) * conv_scale );
797  }
798  dcode->m_Defined = true;
799  break;
800 
801  case 'P':
802 
803  /* Regular polygon: a command line like %ADD12P,0.040X10X25X0.025X0.025X0.0150*%
804  * params are: <diameter>, X<edge count>, X<Rotation>, X<X hole dim>, X<Y hole dim>
805  */
806  dcode->m_Shape = APT_POLYGON;
807  while( *text == ' ' )
808  text++;
809 
810  if( *text == 'X' )
811  {
812  text++;
813  dcode->m_EdgesCount = ReadInt( text );
814  }
815 
816  while( *text == ' ' )
817  text++;
818 
819  if( *text == 'X' )
820  {
821  text++;
822  dcode->m_Rotation = ReadDouble( text );
823  }
824 
825  while( *text == ' ' )
826  text++;
827 
828  if( *text == 'X' )
829  {
830  text++;
831  dcode->m_Drill.x = KiROUND( ReadDouble( text ) * conv_scale );
832  dcode->m_Drill.y = dcode->m_Drill.x =
834  }
835 
836  while( *text == ' ' )
837  text++;
838 
839  if( *text == 'X' )
840  {
841  text++;
842  dcode->m_Drill.y = KiROUND( ReadDouble( text ) * conv_scale );
844  }
845  dcode->m_Defined = true;
846  break;
847  }
848  }
849  else // text[0] starts an aperture macro name
850  {
851  APERTURE_MACRO am_lookup;
852 
853  while( *text && *text != '*' && *text != ',' )
854  am_lookup.name.Append( *text++ );
855 
856  // When an aperture definition is like %AMLINE2* 22,1,$1,$2,0,0,-45*
857  // the ADDxx<MACRO_NAME> command has parameters, like %ADD14LINE2,0.8X0.5*%
858  if( *text == ',' )
859  { // Read aperture macro parameters and store them
860  text++; // text points the first parameter
861 
862  while( *text && *text != '*' )
863  {
864  double param = ReadDouble( text );
865  dcode->AppendParam( param );
866 
867  while( isspace( *text ) )
868  text++;
869 
870  // Skip 'X' separator:
871  if( *text == 'X' || *text == 'x' )
872  text++;
873  }
874  }
875 
876  // lookup the aperture macro here.
877  APERTURE_MACRO* pam = FindApertureMacro( am_lookup );
878 
879  if( !pam )
880  {
881  msg.Printf( wxT( "RS274X: aperture macro %s not found\n" ),
882  TO_UTF8( am_lookup.name ) );
883  AddMessageToList( msg );
884  ok = false;
885  break;
886  }
887 
888  dcode->m_Shape = APT_MACRO;
889  dcode->SetMacro( pam );
890  }
891 
892  break;
893 
894  default:
895  ok = false;
896  break;
897  }
898 
899  (void) seq_len; // quiet g++, or delete the unused variable.
900 
901  ok = GetEndOfBlock( buff, text, m_Current_File );
902 
903  return ok;
904 }
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF...
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
class X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma ...
wxString name
The name of the aperture macro.
bool GetEndOfBlock(char *buff, char *&text, FILE *gerber_file)
Definition: rs274x.cpp:907
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
print info associated to a component (TO.C attribute)
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.
Definition: dcode.h:53
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
double m_Rotation
shape rotation in degrees
Definition: dcode.h:99
wxSize m_Drill
dimension of the hole (if any) (draill file)
Definition: dcode.h:97
wxRealPoint m_StepForRepeat
wxString m_Cmpref
the component reference parent of the data
bool ReadApertureMacro(char *aBuff, char *&text, FILE *gerber_file)
Function ReadApertureMacro reads in an aperture macro and saves it in m_aperture_macros.
Definition: rs274x.cpp:961
const wxString & GetPrm(int aIdx)
Definition: dcode.h:52
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes...
Definition: macros.h:47
double ReadDouble(char *&text, bool aSkipSeparator=true)
Function ReadDouble reads a double from an ASCII character buffer.
bool IsFileMD5()
return true if the attribute is .MD5
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
void AppendParam(double aValue)
AppendParam() Add a parameter to the D_CODE parameter list.
Definition: dcode.h:122
bool IsFilePart()
return true if the attribute is .Part
wxString m_Netname
for items associated to a net: the netname
APERTURE_MACRO * FindApertureMacro(const APERTURE_MACRO &aLookup)
Function FindApertureMacro looks up a previously read in aperture macro.
static const wxString fromGerberString(const wxString &aGbrString)
Convert a string read from a gerber file to an unicode string Usual chars (ASCII7 values) are the onl...
Definition: rs274x.cpp:156
bool IsFileFunction()
return true if the attribute is .FileFunction
wxString m_AperFunction
the aperture attribute (created by a TA.AperFunction command) attached to the D_CODE ...
Definition: dcode.h:105
void RemoveAttribute(X2_ATTRIBUTE &aAttribute)
Function RemoveAttribute.
APERTURE_DEF_HOLETYPE m_DrillShape
shape of the hole (0 = no hole, round = 1, rect = 2) */
Definition: dcode.h:98
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
Definition: rs274x.cpp:62
GBR_NETLIST_METADATA m_NetAttributeDict
void SetMacro(APERTURE_MACRO *aMacro)
Definition: dcode.h:151
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText, int &aLineNum)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
int m_EdgesCount
in aperture definition Polygon only: number of edges for the polygon
Definition: dcode.h:100
const wxString & GetAttribute()
#define GERBER_BUFZ
size of single line of a text from a gerber file.
Definition: gerbview.h:39
print info associated to a flashed pad (TO.P attribute)
#define DBG(x)
Definition: fctsys.h:33
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
print info associated to a net (TO.N attribute)
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE...
static int ReadXCommand(char *&text)
Function ReadXCommand reads in two bytes of data and assembles them into an int with the first byte i...
Definition: rs274x.cpp:123
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
int m_NetAttribType
the type of net info (used to define the gerber string to create)
APERTURE_MACRO * GERBER_FILE_IMAGE::FindApertureMacro ( const APERTURE_MACRO aLookup)
inherited

Function FindApertureMacro looks up a previously read in aperture macro.

Parameters
aLookupA dummy APERTURE_MACRO with [only] the name field set.
Returns
APERTURE_MACRO* - the one with a matching name, or NULL if not found.

Definition at line 164 of file class_gerber_file_image.cpp.

References GERBER_FILE_IMAGE::m_aperture_macros.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

165 {
166  APERTURE_MACRO_SET::iterator iter = m_aperture_macros.find( aLookup );
167 
168  if( iter != m_aperture_macros.end() )
169  {
170  APERTURE_MACRO* pam = (APERTURE_MACRO*) &(*iter);
171  return pam;
172  }
173 
174  return NULL; // not found
175 }
APERTURE_MACRO_SET m_aperture_macros
a collection of APERTURE_MACROS, sorted by name
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
int GERBER_FILE_IMAGE::GCodeNumber ( char *&  Text)
inherited

Definition at line 415 of file rs274d.cpp.

References IsNumber.

Referenced by GERBER_FILE_IMAGE::LoadGerberFile().

416 {
417  int ii = 0;
418  char* text;
419  char line[1024];
420 
421  if( Text == NULL )
422  return 0;
423  Text++;
424  text = line;
425  while( IsNumber( *Text ) )
426  {
427  *(text++) = *(Text++);
428  }
429 
430  *text = 0;
431  ii = atoi( line );
432  return ii;
433 }
#define IsNumber(x)
const EDA_RECT EDA_ITEM::GetBoundingBox ( ) const
virtualinherited

Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.

This box should be an enclosing perimeter for visible components of this object, and the units should be in the pcb or schematic coordinate system. It is OK to overestimate the size by a few counts.

Reimplemented in BOARD, D_PAD, SCH_SHEET, LIB_PART, SCH_HIERLABEL, SCH_COMPONENT, SCH_GLOBALLABEL, LIB_ITEM, SCH_LABEL, GERBER_DRAW_ITEM, DIMENSION, DRAWSEGMENT, LIB_FIELD, ZONE_CONTAINER, MODULE, TEXTE_MODULE, SCH_TEXT, TEXTE_PCB, LIB_PIN, TRACK, MARKER_PCB, SCH_LINE, GBR_LAYOUT, LIB_ARC, SCH_FIELD, LIB_TEXT, SCH_BITMAP, PCB_TARGET, SCH_BUS_ENTRY_BASE, LIB_POLYLINE, LIB_BEZIER, LIB_RECTANGLE, LIB_CIRCLE, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 112 of file base_struct.cpp.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), PCB_EDIT_FRAME::AppendBoardFile(), compareX(), compareY(), SCH_EDIT_FRAME::DeleteItem(), SELECTION_TOOL::findCallback(), getAnchorPoint(), LIB_ITEM::GetBoundingBox(), getRect(), SCH_EAGLE_PLUGIN::loadSheet(), and EDA_ITEM::ViewBBox().

113 {
114 #if defined(DEBUG)
115  printf( "Missing GetBoundingBox()\n" );
116  Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
117 #endif
118 
119  // return a zero-sized box per default. derived classes should override
120  // this
121  return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
122 }
Class EDA_RECT handles the component boundary box.
wxString GERBER_FILE_IMAGE::GetClass ( ) const
inlineoverridevirtualinherited

Function GetClass returns the class name.

Returns
wxString

Implements EDA_ITEM.

Definition at line 196 of file class_gerber_file_image.h.

Referenced by GERBER_FILE_IMAGE::Visit().

197  {
198  return wxT( "GERBER_FILE_IMAGE" );
199  }
D_CODE * GERBER_FILE_IMAGE::GetDCODE ( int  aDCODE) const
inherited

Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE.

Parameters
aDCODEThe numeric value of the D_CODE to look up.
Returns
D_CODE* - the one implied by the given aDCODE, or NULL if the requested aDCODE is out of range.

Definition at line 151 of file class_gerber_file_image.cpp.

References DIM, FIRST_DCODE, and GERBER_FILE_IMAGE::m_Aperture_List.

Referenced by GERBER_FILE_IMAGE::Execute_DCODE_Command(), Execute_Drill_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), GERBER_DRAW_ITEM::GetDcodeDescr(), GERBVIEW_FRAME::Liste_D_Codes(), Select_Tool(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().

152 {
153  unsigned ndx = aDCODE - FIRST_DCODE;
154 
155  if( ndx < (unsigned) DIM( m_Aperture_List ) )
156  {
157  return m_Aperture_List[ndx];
158  }
159 
160  return NULL;
161 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max 999)
#define FIRST_DCODE
Definition: dcode.h:71
D_CODE * GERBER_FILE_IMAGE::GetDCODEOrCreate ( int  aDCODE,
bool  aCreateIfNoExist = true 
)
inherited

Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE.

Parameters
aDCODEThe numeric value of the D_CODE to look up.
aCreateIfNoExistIf true, then create the D_CODE if it does not exist in list.
Returns
D_CODE* - the one implied by the given aDCODE, or NULL if the requested aDCODE is out of range.

Definition at line 131 of file class_gerber_file_image.cpp.

References DIM, FIRST_DCODE, and GERBER_FILE_IMAGE::m_Aperture_List.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand(), readToolInformation(), and Select_Tool().

132 {
133  unsigned ndx = aDCODE - FIRST_DCODE;
134 
135  if( ndx < (unsigned) DIM( m_Aperture_List ) )
136  {
137  // lazily create the D_CODE if it does not exist.
138  if( aCreateIfNoExist )
139  {
140  if( m_Aperture_List[ndx] == NULL )
141  m_Aperture_List[ndx] = new D_CODE( ndx + FIRST_DCODE );
142  }
143 
144  return m_Aperture_List[ndx];
145  }
146 
147  return NULL;
148 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max 999)
#define FIRST_DCODE
Definition: dcode.h:71
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
int GERBER_FILE_IMAGE::GetDcodesCount ( )
inherited
Returns
the count of Dcode tools in used by the image

Definition at line 260 of file class_gerber_file_image.cpp.

References DIM, GERBER_FILE_IMAGE::m_Aperture_List, and GERBER_FILE_IMAGE::m_InUse.

Referenced by GERBVIEW_FRAME::Liste_D_Codes(), GERBVIEW_FRAME::updateAperAttributesSelectBox(), and GERBVIEW_FRAME::updateDCodeSelectBox().

261 {
262  int count = 0;
263 
264  for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
265  {
266  if( m_Aperture_List[ii] )
267  if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )
268  ++count;
269  }
270 
271  return count;
272 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max 999)
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 269 of file base_struct.h.

References EDA_ITEM::m_Flags.

Referenced by AbortMoveAndEditTarget(), SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForBitmap(), AddMenusForBusEntry(), AddMenusForComponent(), AddMenusForComponentField(), AddMenusForEditComponent(), AddMenusForGLabel(), AddMenusForHierchicalSheet(), AddMenusForHLabel(), AddMenusForLabel(), AddMenusForSheetPin(), AddMenusForText(), SCH_EDIT_FRAME::BeginSegment(), SCH_EDIT_FRAME::ChangeTextOrient(), Collect_TrackSegmentsToDrag(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_EDIT_FRAME::CreatePin(), PCB_EDIT_FRAME::createPopUpMenuForFootprints(), PCB_EDIT_FRAME::createPopUpMenuForFpPads(), PCB_EDIT_FRAME::createPopUpMenuForFpTexts(), PCB_EDIT_FRAME::createPopUpMenuForTexts(), PCB_EDIT_FRAME::createPopupMenuForTracks(), PCB_EDIT_FRAME::createPopUpMenuForZones(), PCB_EDIT_FRAME::Delete_Segment_Edge(), BOARD::Draw(), PCB_EDIT_FRAME::Edit_TrackSegm_Width(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditImage(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_VIEW_FRAME::GeneralControl(), SCH_EDIT_FRAME::GeneralControl(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), LIB_EDIT_FRAME::LoadOneSymbol(), Magnetize(), SCH_EDIT_FRAME::MirrorImage(), SCH_EDIT_FRAME::MirrorSheet(), moveBitmap(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), LIB_EDIT_FRAME::OnEditPin(), FOOTPRINT_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyBeginRoute(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), GERBVIEW_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), SCH_EDIT_FRAME::SetBusEntryShape(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), Show_Drag_Track_Segment_With_Cte_Slope(), Show_MoveNode(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), and DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow().

269 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
GERBER_LAYER& GERBER_FILE_IMAGE::GetLayerParams ( )
inlineinherited
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
BITMAP_DEF EDA_ITEM::GetMenuImage ( ) const
virtualinherited

Function GetMenuImage returns a pointer to an image to be used in menus.

The default version returns the right arrow image. Override this function to provide object specific menu images.

Returns
The menu image associated with the item.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_SHEET_PIN, SCH_TEXT, SCH_FIELD, LIB_ARC, SCH_LINE, TEXTE_PCB, LIB_TEXT, SCH_BITMAP, EDGE_MODULE, LIB_POLYLINE, MARKER_PCB, SCH_BUS_ENTRY_BASE, LIB_RECTANGLE, LIB_CIRCLE, PCB_TARGET, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 282 of file base_struct.cpp.

References dummy_xpm.

Referenced by FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

283 {
284  return dummy_xpm;
285 }
static const BITMAP_OPAQUE dummy_xpm[1]
Definition: base_struct.cpp:56
const wxArrayString& GERBER_FILE_IMAGE::GetMessages ( ) const
inlineinherited
virtual void EDA_ITEM::GetMsgPanelInfo ( std::vector< MSG_PANEL_ITEM > &  aList)
inlinevirtualinherited

Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.

Note
This method replaces DisplayInfo() so that KiCad objects no longer have any knowledge of wxWidgets UI objects.
Parameters
aListis the list to populate.

Reimplemented in BOARD, D_PAD, MODULE, SCH_SHEET, SCH_COMPONENT, LIB_ITEM, GERBER_DRAW_ITEM, NETINFO_ITEM, TRACK, DIMENSION, SCH_TEXT, DRAWSEGMENT, TEXTE_MODULE, LIB_FIELD, LIB_PIN, ZONE_CONTAINER, EDGE_MODULE, MARKER_PCB, LIB_ARC, LIB_BEZIER, LIB_TEXT, SCH_MARKER, LIB_POLYLINE, TEXTE_PCB, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 291 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::LocateItem(), EDA_DRAW_FRAME::SetMsgPanel(), and PCB_BASE_FRAME::UpdateMsgPanel().

292  {
293  }
COLOR4D GERBER_FILE_IMAGE::GetPositiveDrawColor ( ) const
inlineinherited
wxString EDA_ITEM::GetSelectMenuText ( ) const
virtualinherited

Function GetSelectMenuText returns the text to display to be used in the selection clarification context menu when multiple items are found at the current cursor position.

The default version of this function raises an assertion in the debug mode and returns a string to indicate that it was not overridden to provide the object specific text.

Returns
The menu text string.

Reimplemented in D_PAD, ZONE_CONTAINER, SCH_COMPONENT, MODULE, SCH_SHEET, LIB_PIN, VIA, SEGZONE, SCH_HIERLABEL, GERBER_DRAW_ITEM, TRACK, SCH_GLOBALLABEL, SCH_LABEL, LIB_FIELD, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, SCH_SHEET_PIN, SCH_TEXT, SCH_FIELD, SCH_BUS_BUS_ENTRY, LIB_ARC, SCH_LINE, SCH_BUS_WIRE_ENTRY, TEXTE_PCB, LIB_TEXT, SCH_BITMAP, EDGE_MODULE, LIB_POLYLINE, MARKER_PCB, LIB_RECTANGLE, LIB_CIRCLE, PCB_TARGET, SCH_MARKER, SCH_NO_CONNECT, and SCH_JUNCTION.

Definition at line 175 of file base_struct.cpp.

References EDA_ITEM::GetClass().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), DRC::fillMarker(), SCH_FIND_COLLECTOR::GetText(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), and PCB_BASE_FRAME::PcbGeneralLocateAndDisplay().

176 {
177  wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) +
178  GetClass() );
179 
180  return wxString( wxT( "Undefined menu text for " ) + GetClass() );
181 }
virtual wxString GetClass() const =0
Function GetClass returns the class name.
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 264 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format().

264 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:175
bool GERBER_FILE_IMAGE::HasNegativeItems ( )
inherited

Function HasNegativeItems.

Returns
true if at least one item must be drawn in background color used to optimize screen refresh (when no items are in background color refresh can be faster)

Definition at line 236 of file class_gerber_file_image.cpp.

References GERBER_FILE_IMAGE::GetItemsList(), GERBER_FILE_IMAGE::m_GraphicLayer, GERBER_FILE_IMAGE::m_hasNegativeItems, GERBER_FILE_IMAGE::m_ImageNegative, and GERBER_DRAW_ITEM::Next().

Referenced by GBR_LAYOUT::Draw().

237 {
238  if( m_hasNegativeItems < 0 ) // negative items are not yet searched: find them if any
239  {
240  if( m_ImageNegative ) // A negative layer is expected having always negative objects.
241  m_hasNegativeItems = 1;
242  else
243  {
244  m_hasNegativeItems = 0;
245  for( GERBER_DRAW_ITEM* item = GetItemsList(); item; item = item->Next() )
246  {
247  if( item->GetLayer() != m_GraphicLayer )
248  continue;
249  if( item->HasNegativeItems() )
250  {
251  m_hasNegativeItems = 1;
252  break;
253  }
254  }
255  }
256  }
257  return m_hasNegativeItems == 1;
258 }
GERBER_DRAW_ITEM * Next() const
GERBER_DRAW_ITEM * GetItemsList()
Function GetItemsList.
virtual bool EDA_ITEM::HitTest ( const wxPoint aPosition) const
inlinevirtualinherited

Function HitTest tests if aPosition is contained within or on the bounding area of an item.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
Returns
True if aPosition is within or on the item bounding area.

Reimplemented in D_PAD, MODULE, VIA, SCH_ITEM, BOARD_ITEM, ZONE_CONTAINER, GERBER_DRAW_ITEM, LIB_ITEM, TRACK, DIMENSION, TEXTE_MODULE, DRAWSEGMENT, LIB_FIELD, LIB_PIN, MARKER_PCB, LIB_ARC, PCB_TARGET, LIB_TEXT, TEXTE_PCB, LIB_POLYLINE, LIB_BEZIER, LIB_RECTANGLE, and LIB_CIRCLE.

Definition at line 302 of file base_struct.h.

Referenced by LIB_ITEM::HitTest(), BOARD_ITEM::HitTest(), GERBER_COLLECTOR::Inspect(), and SCH_COLLECTOR::Inspect().

303  {
304  return false; // derived classes should override this function
305  }
void GERBER_FILE_IMAGE::InitToolTable ( )
inherited

Function InitToolTable.

Definition at line 275 of file class_gerber_file_image.cpp.

References D_CODE::Clear_D_CODE_Data(), FIRST_DCODE, GERBER_FILE_IMAGE::m_Aperture_List, GERBER_FILE_IMAGE::m_aperture_macros, D_CODE::m_Num_Dcode, and TOOLS_MAX_COUNT.

276 {
277  for( int count = 0; count < TOOLS_MAX_COUNT; count++ )
278  {
279  if( m_Aperture_List[count] == NULL )
280  continue;
281 
282  m_Aperture_List[count]->m_Num_Dcode = count + FIRST_DCODE;
284  }
285 
286  m_aperture_macros.clear();
287 }
APERTURE_MACRO_SET m_aperture_macros
a collection of APERTURE_MACROS, sorted by name
D_CODE * m_Aperture_List[TOOLS_MAX_COUNT]
Dcode (Aperture) List for this layer (max 999)
#define FIRST_DCODE
Definition: dcode.h:71
int m_Num_Dcode
D code value ( >= 10 )
Definition: dcode.h:96
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
void Clear_D_CODE_Data()
Definition: dcode.cpp:79
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 238 of file base_struct.h.

References BRIGHTENED.

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), KIGFX::GERBVIEW_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

238 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 237 of file base_struct.h.

References HIGHLIGHTED.

237 { return m_Flags & HIGHLIGHTED; }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsModified ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

231 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:123
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 230 of file base_struct.h.

References IS_NEW.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_MoveOrCopyModule(), Abort_Zone_Create_Outline(), AbortBuildDimension(), AbortMoveAndEditTarget(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), AbortSymbolTraceOn(), SCH_EDIT_FRAME::addCurrentItemToList(), SCH_EDIT_FRAME::addJunctionMenuEntries(), AddMenusForBus(), AddMenusForWire(), PCB_EDIT_FRAME::Delete_Segment(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_EDIT_FRAME::DeleteCurrentSegment(), LIB_ARC::drawEditGraphics(), LIB_ARC::drawGraphic(), DrawMovePin(), SCH_EDIT_FRAME::EditSheetPin(), LIB_PIN::EnableEditMode(), LIB_EDIT_FRAME::EndDrawGraphicItem(), SCH_EDIT_FRAME::EndSegment(), ExitSheet(), LIB_PART::LIB_PART(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

230 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:127
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
virtual bool EDA_ITEM::IsReplaceable ( ) const
inlinevirtualinherited

Function IsReplaceable.

Override this method in any derived object that supports test find and replace.

Returns
True if the item has replaceable text that can be modified using the find and replace dialog.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_LABEL, SCH_FIELD, SCH_SHEET_PIN, and SCH_TEXT.

Definition at line 458 of file base_struct.h.

Referenced by EDA_ITEM::Matches(), and EDA_ITEM::Replace().

458 { return false; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 236 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

236 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:128
bool EDA_ITEM::IsSelected ( ) const
inlineinherited

Definition at line 235 of file base_struct.h.

References SELECTED.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), AddMenusForPin(), KIGFX::PCB_PAINTER::draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_TEXT::drawGraphic(), LIB_ARC::drawGraphic(), LIB_FIELD::drawGraphic(), DrawMovingBlockOutlines(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinSymbol(), LIB_PIN::DrawPinTexts(), KIGFX::GERBVIEW_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), LIB_EDIT_FRAME::GlobalSetPins(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), MirrorMarkedItems(), MoveMarkedItems(), MoveMarkedItemsExactly(), LIB_TEXT::Plot(), RotateMarkedItems(), SELECTION_TOOL::SanitizeSelection(), GERBVIEW_SELECTION_TOOL::select(), SELECTION_TOOL::select(), SCH_SCREEN::SelectBlockItems(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), GERBVIEW_SELECTION_TOOL::unselect(), and SELECTION_TOOL::unselect().

235 { return m_Flags & SELECTED; }
#define SELECTED
Definition: base_struct.h:134
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

References IS_WIRE_IMAGE.

Referenced by abortMoveItem(), and SCH_FIELD::Draw().

234 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
SEARCH_RESULT EDA_ITEM::IterateForward ( EDA_ITEM listStart,
INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
staticinherited

Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes.

Parameters
listStartThe first in a list of EDA_ITEMs to iterate over.
inspectorIs an INSPECTOR to call on each object that is one of the requested scanTypes.
testDataIs an aid to testFunc, and should be sufficient to allow it to fully determine if an item meets the match criteria, but it may also be used to collect output.
scanTypesA KICAD_T array that is EOT terminated, and provides both the order and interest level of of the types of objects to be iterated over.
Returns
SEARCH_RESULT SEARCH_QUIT if the called INSPECTOR returned SEARCH_QUIT, else SCAN_CONTINUE;

Definition at line 132 of file base_struct.cpp.

References EDA_ITEM::Pnext, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Visit().

Referenced by SCH_COLLECTOR::Collect(), SCH_FIND_COLLECTOR::Collect(), SCH_TYPE_COLLECTOR::Collect(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

136 {
137  EDA_ITEM* p = listStart;
138 
139  for( ; p; p = p->Pnext )
140  {
141  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
142  return SEARCH_QUIT;
143  }
144 
145  return SEARCH_CONTINUE;
146 }
virtual SEARCH_RESULT Visit(INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function Visit may be re-implemented for each derived class in order to handle all the types given by...
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
bool EXCELLON_IMAGE::LoadFile ( const wxString &  aFullFileName)

Read and load a drill (EXCELLON format) file.

Parameters
aFullFileName= the full filename of the Gerber file when the file cannot be loaded Warning and info messages are stored in m_Messages
Returns
bool if OK, false if the gerber file was not loaded

Definition at line 230 of file excellon_read_drill_file.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), GERBER_FILE_IMAGE::ClearMessageList(), dummy(), Execute_Drill_Command(), Execute_EXCELLON_G_Command(), Execute_HEADER_Command(), file_attribute, LINE_READER::Line(), GERBER_FILE_IMAGE::m_Current_File, GERBER_FILE_IMAGE::m_FileFunction, GERBER_FILE_IMAGE::m_FileName, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_InUse, m_State, X2_ATTRIBUTE::ParseAttribCmd(), READ_HEADER_STATE, GERBER_FILE_IMAGE::ReadIJCoord(), FILE_LINE_READER::ReadLine(), ResetDefaultValues(), Select_Tool(), and StrPurge().

Referenced by GERBVIEW_FRAME::Read_EXCELLON_File().

231 {
232  // Set the default parmeter values:
235 
236  m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
237 
238  if( m_Current_File == NULL )
239  return false;
240 
241  m_FileName = aFullFileName;
242 
243  LOCALE_IO toggleIo;
244 
245  // FILE_LINE_READER will close the file.
246  FILE_LINE_READER excellonReader( m_Current_File, m_FileName );
247 
248  while( true )
249  {
250  if( excellonReader.ReadLine() == 0 )
251  break;
252 
253  char* line = excellonReader.Line();
254  char* text = StrPurge( line );
255 
256  if( *text == ';' ) // comment: skip line
257  continue;
258 
260  {
261  Execute_HEADER_Command( text );
262  }
263  else
264  {
265  switch( *text )
266  {
267  case 'M':
268  Execute_HEADER_Command( text );
269  break;
270 
271  case 'G': /* Line type Gxx : command */
273  break;
274 
275  case 'X':
276  case 'Y': // command like X12550Y19250
277  Execute_Drill_Command(text);
278  break;
279 
280  case 'I':
281  case 'J': /* Auxiliary Move command */
282  m_IJPos = ReadIJCoord( text );
283  if( *text == '*' ) // command like X35142Y15945J504
284  {
285  Execute_Drill_Command( text);
286  }
287  break;
288 
289  case 'T': // Tool command
290  Select_Tool( text );
291  break;
292 
293  case '%':
294  break;
295 
296  default:
297  {
298  wxString msg;
299  msg.Printf( wxT( "Unexpected symbol &lt;%c&gt;" ), *text );
300  AddMessageToList( msg );
301  }
302  break;
303  } // End switch
304  }
305  }
306 
307  // Add our file attribute, to identify the drill file
309  char* text = (char*)file_attribute;
310  int dummyline = 0;
311  dummy.ParseAttribCmd( m_Current_File, NULL, 0, text, dummyline );
312  delete m_FileFunction;
314 
315  m_InUse = true;
316 
317  return true;
318 }
class X2_ATTRIBUTE_FILEFUNCTION ( from TF.FileFunction in Gerber file) Example file function: TF...
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
X2_ATTRIBUTE_FILEFUNCTION * m_FileFunction
class X2_ATTRIBUTE The attribute value consists of a number of substrings separated by a comma ...
char * StrPurge(char *text)
Function StrPurge removes leading and training spaces, tabs and end of line chars in text return a po...
Definition: string.cpp:194
virtual void ResetDefaultValues() override
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:165
wxPoint ReadIJCoord(char *&Text)
Function ReadIJCoord Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These...
void ClearMessageList()
Function ClearMessageList Clear the message list Call it before reading a Gerber file.
bool Select_Tool(char *&text)
bool Execute_HEADER_Command(char *&text)
Class FILE_LINE_READER is a LINE_READER that reads from an open file.
Definition: richio.h:180
bool Execute_Drill_Command(char *&text)
excellon_state m_State
static const char file_attribute[]
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
bool ParseAttribCmd(FILE *aFile, char *aBuffer, int aBuffSize, char *&aText, int &aLineNum)
parse a TF command terminated with a % and fill m_Prms by the parameters found.
bool Execute_EXCELLON_G_Command(char *&text)
bool GERBER_FILE_IMAGE::LoadGerberFile ( const wxString &  aFullFileName)
inherited

Read and load a gerber file.

Parameters
aFullFileName= the full filename of the Gerber file when the file cannot be loaded Warning and info messages are stored in m_messagesList
Returns
bool if OK, false if the gerber file was not loaded

Definition at line 104 of file readgerb.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), GERBER_FILE_IMAGE::ClearMessageList(), CMD_IDLE, GERBER_FILE_IMAGE::DCodeNumber(), END_BLOCK, ENTER_RS274X_CMD, GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), GERBER_FILE_IMAGE::GCodeNumber(), GERBER_BUFZ, GERBER_FILE_IMAGE::m_CommandState, GERBER_FILE_IMAGE::m_Current_File, GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_FileName, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_InUse, GERBER_FILE_IMAGE::m_Last_Pen_Command, GERBER_FILE_IMAGE::m_LineNum, GERBER_FILE_IMAGE::ReadIJCoord(), GERBER_FILE_IMAGE::ReadRS274XCommand(), GERBER_FILE_IMAGE::ReadXYCoord(), GERBER_FILE_IMAGE::ResetDefaultValues(), and StrPurge().

Referenced by GERBVIEW_FRAME::Read_GERBER_File().

105 {
106  int G_command = 0; // command number for G commands like G04
107  int D_commande = 0; // command number for D commands like D02
108  char line[GERBER_BUFZ];
109  char* text;
110 
111  ClearMessageList( );
113 
114  // Read the gerber file */
115  m_Current_File = wxFopen( aFullFileName, wxT( "rt" ) );
116 
117  if( m_Current_File == 0 )
118  return false;
119 
120  m_FileName = aFullFileName;
121 
122  LOCALE_IO toggleIo;
123 
124  wxString msg;
125 
126  while( true )
127  {
128  if( fgets( line, sizeof(line), m_Current_File ) == NULL )
129  break;
130 
131  m_LineNum++;
132  text = StrPurge( line );
133 
134  while( text && *text )
135  {
136  switch( *text )
137  {
138  case ' ':
139  case '\r':
140  case '\n':
141  text++;
142  break;
143 
144  case '*': // End command
146  text++;
147  break;
148 
149  case 'M': // End file
151  while( *text )
152  text++;
153  break;
154 
155  case 'G': /* Line type Gxx : command */
156  G_command = GCodeNumber( text );
157  Execute_G_Command( text, G_command );
158  break;
159 
160  case 'D': /* Line type Dxx : Tool selection (xx > 0) or
161  * command if xx = 0..9 */
162  D_commande = DCodeNumber( text );
163  Execute_DCODE_Command( text, D_commande );
164  break;
165 
166  case 'X':
167  case 'Y': /* Move or draw command */
168  m_CurrentPos = ReadXYCoord( text );
169  if( *text == '*' ) // command like X12550Y19250*
170  {
171  Execute_DCODE_Command( text,
173  }
174  break;
175 
176  case 'I':
177  case 'J': /* Auxiliary Move command */
178  m_IJPos = ReadIJCoord( text );
179 
180  if( *text == '*' ) // command like X35142Y15945J504*
181  {
182  Execute_DCODE_Command( text,
184  }
185  break;
186 
187  case '%':
189  {
191  ReadRS274XCommand( line, text );
192  }
193  else //Error
194  {
195  AddMessageToList( wxT("Expected RS274X Command") );
197  text++;
198  }
199  break;
200 
201  default:
202  text++;
203  msg.Printf( wxT("Unexpected symbol <%c>"), *text );
204  AddMessageToList( msg );
205  break;
206  }
207  }
208  }
209 
210  fclose( m_Current_File );
211 
212  m_InUse = true;
213 
214  return true;
215 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
bool Execute_DCODE_Command(char *&text, int D_command)
Definition: rs274d.cpp:584
char * StrPurge(char *text)
Function StrPurge removes leading and training spaces, tabs and end of line chars in text return a po...
Definition: string.cpp:194
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:165
wxPoint ReadXYCoord(char *&Text)
Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) ...
wxPoint ReadIJCoord(char *&Text)
Function ReadIJCoord Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These...
void ClearMessageList()
Function ClearMessageList Clear the message list Call it before reading a Gerber file.
int GCodeNumber(char *&Text)
Definition: rs274d.cpp:415
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:438
bool Execute_G_Command(char *&text, int G_command)
Definition: rs274d.cpp:458
#define GERBER_BUFZ
size of single line of a text from a gerber file.
Definition: gerbview.h:39
bool ReadRS274XCommand(char *aBuff, char *&text)
Function ReadRS274XCommand reads a single RS274X command terminated with a %.
Definition: rs274x.cpp:192
virtual bool EDA_ITEM::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint aFindLocation 
)
inlinevirtualinherited

Function Matches compares the item against the search criteria in aSearchData.

The base class returns false since many of the objects derived from EDA_ITEM do not have any text to search.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
aFindLocationA pointer to a wxPoint object to store the location of matched item. The pointer can be NULL if it is not used.
Returns
True if the item's text matches the search criteria in aSearchData.

Reimplemented in SCH_COMPONENT, SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, SCH_TEXT, LIB_PIN, and SCH_MARKER.

Definition at line 414 of file base_struct.h.

Referenced by SCH_FIND_COLLECTOR::Inspect(), SCH_MARKER::Matches(), LIB_PIN::Matches(), SCH_TEXT::Matches(), SCH_FIELD::Matches(), SCH_SHEET_PIN::Matches(), and SCH_SHEET::Matches().

415  {
416  return false;
417  }
bool EDA_ITEM::Matches ( const wxString &  aText,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

Parameters
aTextA reference to a wxString object containing the string to test.
aSearchDataThe criteria to search against.
Returns
True if aText matches the search criteria in aSearchData.

Definition at line 184 of file base_struct.cpp.

References FR_MATCH_WILDCARD, FR_SEARCH_REPLACE, and EDA_ITEM::IsReplaceable().

185 {
186  wxString text = aText;
187  wxString searchText = aSearchData.GetFindString();
188 
189  // Don't match if searching for replaceable item and the item doesn't support text replace.
190  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
191  return false;
192 
193  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
194  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
195 
196  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
197  {
198  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
199  return text.Matches( searchText );
200 
201  return text.MakeUpper().Matches( searchText.MakeUpper() );
202  }
203 
204  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
205  return aText.Find( searchText ) != wxNOT_FOUND;
206 
207  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
208 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
Perform search using simple wild card matching (* & ?).
Perform a search for a item that has replaceable text.
bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

Parameters
aItem- Item to compare against.
Returns
- True if aItem is less than the item.

Definition at line 241 of file base_struct.cpp.

References Format(), GetChars(), and EDA_ITEM::GetClass().

242 {
243  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
244  GetChars( GetClass() ) ) );
245 
246  return false;
247 }
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool GERBER_FILE_IMAGE::ReadApertureMacro ( char *  aBuff,
char *&  text,
FILE *  gerber_file 
)
inherited

Function ReadApertureMacro reads in an aperture macro and saves it in m_aperture_macros.

Parameters
aBuffa character buffer at least GERBER_BUFZ long that can be used to read successive lines from the gerber file.
textA reference to a character pointer which gives the initial text to read from.
gerber_fileWhich file to read from for continuation.
Returns
bool - true if a macro was read in successfully, else false.

Definition at line 961 of file rs274x.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), AMP_CIRCLE, AMP_COMMENT, AMP_EOF, AMP_LINE2, AMP_LINE20, AMP_LINE_CENTER, AMP_LINE_LOWER_LEFT, AMP_MOIRE, AMP_OUTLINE, AMP_POLYGON, AMP_THERMAL, AMP_UNKNOWN, FROM_UTF8(), GetChars(), GERBER_FILE_IMAGE::GetNextLine(), GERBER_FILE_IMAGE::m_aperture_macros, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_LineNum, APERTURE_MACRO::m_localparamStack, APERTURE_MACRO::name, AM_PRIMITIVE::params, AM_PRIMITIVE::primitive_id, APERTURE_MACRO::primitives, ReadInt(), and AM_PARAM::ReadParam().

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

964 {
965  wxString msg;
966  APERTURE_MACRO am;
967 
968  // read macro name
969  while( *text )
970  {
971  if( *text == '*' )
972  {
973  ++text;
974  break;
975  }
976 
977  am.name.Append( *text++ );
978  }
979 
980  // Read aperture macro parameters
981  for( ; ; )
982  {
983  if( *text == '*' )
984  ++text;
985 
986  text = GetNextLine( buff, text, gerber_file );
987 
988  if( text == NULL ) // End of File
989  return false;
990 
991  // text points the beginning of a new line.
992 
993  // Test for the last line in aperture macro lis:
994  // last line is % or *% sometime found.
995  if( *text == '*' )
996  ++text;
997 
998  if( *text == '%' )
999  break; // exit with text still pointing at %
1000 
1001  int paramCount = 0; // will be set to the minimal parameters count,
1002  // depending on the actual primitive
1003  int primitive_type = AMP_UNKNOWN;
1004  // Test for a valid symbol at the beginning of a description:
1005  // it can be: a parameter declaration like $1=$2/4
1006  // or a digit (macro primitive selection)
1007  // all other symbols are illegal.
1008  if( *text == '$' ) // local parameter declaration, inside the aperture macro
1009  {
1010  am.m_localparamStack.push_back( AM_PARAM() );
1011  AM_PARAM& param = am.m_localparamStack.back();
1012  text = GetNextLine( buff, text, gerber_file );
1013  if( text == NULL) // End of File
1014  return false;
1015  param.ReadParam( text );
1016  continue;
1017  }
1018  else if( !isdigit(*text) ) // Ill. symbol
1019  {
1020  msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": ill. symbol, line: \"%s\"" ),
1021  GetChars( am.name ), GetChars( FROM_UTF8( buff ) ) );
1022  AddMessageToList( msg );
1023  primitive_type = AMP_COMMENT;
1024  }
1025  else
1026  primitive_type = ReadInt( text );
1027 
1028  bool is_comment = false;
1029 
1030  switch( primitive_type )
1031  {
1032  case AMP_COMMENT: // lines starting by 0 are a comment
1033  paramCount = 0;
1034  is_comment = true;
1035  // Skip comment
1036  while( *text && ( *text != '*' ) )
1037  text++;
1038  break;
1039 
1040  case AMP_CIRCLE:
1041  paramCount = 4; // minimal count. can have a optional parameter (rotation)
1042  break;
1043 
1044  case AMP_LINE2:
1045  case AMP_LINE20:
1046  paramCount = 7;
1047  break;
1048 
1049  case AMP_LINE_CENTER:
1050  case AMP_LINE_LOWER_LEFT:
1051  paramCount = 6;
1052  break;
1053 
1054  case AMP_EOF:
1055  paramCount = 0;
1056  break;
1057 
1058  case AMP_OUTLINE:
1059  paramCount = 4;
1060  break;
1061 
1062  case AMP_POLYGON:
1063  paramCount = 6;
1064  break;
1065 
1066  case AMP_MOIRE:
1067  paramCount = 9;
1068  break;
1069 
1070  case AMP_THERMAL:
1071  paramCount = 6;
1072  break;
1073 
1074  default:
1075  msg.Printf( wxT( "RS274X: Aperture Macro \"%s\": Invalid primitive id code %d, line %d: \"%s\"" ),
1076  GetChars( am.name ), primitive_type, m_LineNum, GetChars( FROM_UTF8( buff ) ) );
1077  AddMessageToList( msg );
1078  return false;
1079  }
1080 
1081  if( is_comment )
1082  continue;
1083 
1084  AM_PRIMITIVE prim( m_GerbMetric );
1085  prim.primitive_id = (AM_PRIMITIVE_ID) primitive_type;
1086  int ii;
1087 
1088  for( ii = 0; ii < *text && *text != '*'; ++ii )
1089  {
1090  prim.params.push_back( AM_PARAM() );
1091 
1092  AM_PARAM& param = prim.params.back();
1093 
1094  text = GetNextLine( buff, text, gerber_file );
1095 
1096  if( text == NULL) // End of File
1097  return false;
1098 
1099  param.ReadParam( text );
1100  }
1101 
1102  if( ii < paramCount )
1103  {
1104  // maybe some day we can throw an exception and track a line number
1105  msg.Printf( wxT( "RS274X: read macro descr type %d: read %d parameters, insufficient parameters\n" ),
1106  prim.primitive_id, ii );
1107  AddMessageToList( msg );
1108 
1109  }
1110  // there are more parameters to read if this is an AMP_OUTLINE
1111  if( prim.primitive_id == AMP_OUTLINE )
1112  {
1113  // so far we have read [0]:exposure, [1]:#points, [2]:X start, [3]: Y start
1114  // Now read all the points, plus trailing rotation in degrees.
1115 
1116  // params[1] is a count of polygon points, so it must be given
1117  // in advance, i.e. be immediate.
1118  wxASSERT( prim.params[1].IsImmediate() );
1119 
1120  paramCount = (int) prim.params[1].GetValue( 0 ) * 2 + 1;
1121 
1122  for( int jj = 0; jj < paramCount && *text != '*'; ++jj )
1123  {
1124  prim.params.push_back( AM_PARAM() );
1125 
1126  AM_PARAM& param = prim.params.back();
1127 
1128  text = GetNextLine( buff, text, gerber_file );
1129 
1130  if( text == NULL ) // End of File
1131  return false;
1132 
1133  param.ReadParam( text );
1134  }
1135  }
1136 
1137  am.primitives.push_back( prim );
1138  }
1139 
1140  m_aperture_macros.insert( am );
1141 
1142  return true;
1143 }
APERTURE_MACRO_SET m_aperture_macros
a collection of APERTURE_MACROS, sorted by name
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
wxString name
The name of the aperture macro.
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.
char * GetNextLine(char *aBuff, char *aText, FILE *aFile)
Function GetNextLine test for an end of line if an end of line is found: read a new line...
Definition: rs274x.cpp:933
AM_PRIMITIVE_ID
Enum AM_PRIMITIVE_ID is the set of all "aperture macro primitives" (primitive numbers).
bool ReadParam(char *&aText)
Function ReadParam Read one aperture macro parameter a parameter can be: a number a reference to an a...
Class AM_PARAM holds a parameter value for an "aperture macro" as defined within standard RS274X...
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
AM_PRIMITIVES primitives
A sequence of AM_PRIMITIVEs.
Struct AM_PRIMITIVE holds an aperture macro primitive as given in Table 3 of http://gerbv.sourceforge.net/docs/rs274xrevd_e.pdf.
Struct APERTURE_MACRO helps support the "aperture macro" defined within standard RS274X.
wxPoint GERBER_FILE_IMAGE::ReadIJCoord ( char *&  Text)
inherited

Function ReadIJCoord Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) These coordinates are relative, so if coordinate is absent, it's value defaults to 0.

Definition at line 172 of file rs274_read_XY_and_IJ_coordinates.cpp.

References IsNumber, KiROUND(), GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_IJPos, GERBER_FILE_IMAGE::m_NoTrailingZeros, scale_list, wxPoint::x, and wxPoint::y.

Referenced by LoadFile(), and GERBER_FILE_IMAGE::LoadGerberFile().

173 {
174  wxPoint pos( 0, 0 );
175 
176  int type_coord = 0, current_coord, nbdigits;
177  bool is_float = false;
178  char* text;
179  char line[256];
180 
181  if( Text == NULL )
182  return pos;
183 
184  text = line;
185  while( *Text )
186  {
187  if( (*Text == 'I') || (*Text == 'J') )
188  {
189  type_coord = *Text;
190  Text++;
191  text = line;
192  nbdigits = 0;
193  while( IsNumber( *Text ) )
194  {
195  if( *Text == '.' )
196  is_float = true;
197 
198  // count digits only (sign and decimal point are not counted)
199  if( (*Text >= '0') && (*Text <='9') )
200  nbdigits++;
201 
202  *(text++) = *(Text++);
203  }
204 
205  *text = 0;
206  if( is_float )
207  {
208  // When X or Y values are float numbers, they are given in mm or inches
209  if( m_GerbMetric ) // units are mm
210  current_coord = KiROUND( atof( line ) * IU_PER_MILS / 0.0254 );
211  else // units are inches
212  current_coord = KiROUND( atof( line ) * IU_PER_MILS * 1000 );
213  }
214  else
215  {
216  int fmt_scale =
217  (type_coord == 'I') ? m_FmtScale.x : m_FmtScale.y;
218 
219  if( m_NoTrailingZeros )
220  {
221  int min_digit =
222  (type_coord == 'I') ? m_FmtLen.x : m_FmtLen.y;
223  while( nbdigits < min_digit )
224  {
225  *(text++) = '0';
226  nbdigits++;
227  }
228 
229  *text = 0;
230  }
231 
232  current_coord = atoi( line );
233 
234  double real_scale = scale_list[fmt_scale];
235 
236  if( m_GerbMetric )
237  real_scale = real_scale / 25.4;
238 
239  current_coord = KiROUND( current_coord * real_scale );
240  }
241  if( type_coord == 'I' )
242  pos.x = current_coord;
243  else if( type_coord == 'J' )
244  pos.y = current_coord;
245 
246  continue;
247  }
248  else
249  break;
250  }
251 
252  m_IJPos = pos;
253  return pos;
254 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
#define IsNumber(x)
static double scale_list[SCALE_LIST_SIZE]
bool GERBER_FILE_IMAGE::ReadRS274XCommand ( char *  aBuff,
char *&  text 
)
inherited

Function ReadRS274XCommand reads a single RS274X command terminated with a %.

Definition at line 192 of file rs274x.cpp.

References CMD_IDLE, GERBER_FILE_IMAGE::ExecuteRS274XCommand(), GERBER_BUFZ, GERBER_FILE_IMAGE::m_CommandState, GERBER_FILE_IMAGE::m_Current_File, GERBER_FILE_IMAGE::m_LineNum, and ReadXCommand().

Referenced by GERBER_FILE_IMAGE::LoadGerberFile().

193 {
194  bool ok = true;
195  int code_command;
196 
197  text++;
198 
199  for( ; ; )
200  {
201  while( *text )
202  {
203  switch( *text )
204  {
205  case '%': // end of command
206  text++;
208  goto exit; // success completion
209 
210  case ' ':
211  case '\r':
212  case '\n':
213  text++;
214  break;
215 
216  case '*':
217  text++;
218  break;
219 
220  default:
221  code_command = ReadXCommand( text );
222  ok = ExecuteRS274XCommand( code_command, buff, text );
223  if( !ok )
224  goto exit;
225  break;
226  }
227  }
228 
229  // end of current line, read another one.
230  if( fgets( buff, GERBER_BUFZ, m_Current_File ) == NULL )
231  {
232  // end of file
233  ok = false;
234  break;
235  }
236  m_LineNum++;
237  text = buff;
238  }
239 
240 exit:
241  return ok;
242 }
bool ExecuteRS274XCommand(int command, char *aBuff, char *&text)
Function ExecuteRS274XCommand executes 1 command.
Definition: rs274x.cpp:245
#define GERBER_BUFZ
size of single line of a text from a gerber file.
Definition: gerbview.h:39
static int ReadXCommand(char *&text)
Function ReadXCommand reads in two bytes of data and assembles them into an int with the first byte i...
Definition: rs274x.cpp:123
bool EXCELLON_IMAGE::readToolInformation ( char *&  aText)
private

Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list.

Definition at line 482 of file excellon_read_drill_file.cpp.

References GERBER_FILE_IMAGE::AddMessageToList(), APT_CIRCLE, FIRST_DCODE, Format(), GERBER_FILE_IMAGE::GetDCODEOrCreate(), KiROUND(), D_CODE::m_Defined, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_Has_DCode, D_CODE::m_Shape, D_CODE::m_Size, ReadDouble(), and ReadInt().

Referenced by Execute_HEADER_Command(), and Select_Tool().

483 {
484  // Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00
485  // and enter the TCODE param in list (using the D_CODE param management, which
486  // is similar to TCODE params.
487  if( *aText == 'T' ) // This is the beginning of the definition
488  aText++;
489 
490  // Read tool number:
491  int iprm = ReadInt( aText, false );
492 
493  // Skip Feed rate and Spindle speed, if any here
494  while( *aText && ( *aText == 'F' || *aText == 'S' ) )
495  {
496  aText++;
497  ReadInt( aText, false );
498  }
499 
500  // Read tool shape
501  if( ! *aText )
503  _( "Tool definition shape not found" ) ) );
504  else if( *aText != 'C' )
506  _( "Tool definition '%c' not supported" ), *aText ) );
507  if( *aText )
508  aText++;
509 
510  //read tool diameter:
511  double dprm = ReadDouble( aText, false );
512  m_Has_DCode = true;
513 
514  // Initialize Dcode to handle this Tool
515  // Remember: dcodes are >= FIRST_DCODE
516  D_CODE* dcode = GetDCODEOrCreate( iprm + FIRST_DCODE );
517 
518  if( dcode == NULL )
519  return false;
520 
521  // conv_scale = scaling factor from inch to Internal Unit
522  double conv_scale = IU_PER_MILS * 1000;
523 
524  if( m_GerbMetric )
525  conv_scale /= 25.4;
526 
527  dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
528  dcode->m_Shape = APT_CIRCLE;
529  dcode->m_Defined = true;
530 
531  return true;
532 }
void AddMessageToList(const wxString &aMessage)
Function AddMessageToList Add a message to the message list.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
wxSize m_Size
Horizontal and vertical dimensions.
Definition: dcode.h:94
APERTURE_T m_Shape
shape ( Line, rectangle, circle , oval .. )
Definition: dcode.h:95
bool m_Defined
false if the aperture is not defined in the header
Definition: dcode.h:104
#define FIRST_DCODE
Definition: dcode.h:71
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
double ReadDouble(char *&text, bool aSkipSeparator=true)
Function ReadDouble reads a double from an ASCII character buffer.
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE...
int ReadInt(char *&text, bool aSkipSeparator=true)
Function ReadInt reads an int from an ASCII character buffer.
wxPoint GERBER_FILE_IMAGE::ReadXYCoord ( char *&  Text)
inherited

Function ReadXYCoord Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm)

Definition at line 72 of file rs274_read_XY_and_IJ_coordinates.cpp.

References IsNumber, KiROUND(), GERBER_FILE_IMAGE::m_CurrentPos, GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, GERBER_FILE_IMAGE::m_GerbMetric, GERBER_FILE_IMAGE::m_NoTrailingZeros, GERBER_FILE_IMAGE::m_Relative, scale_list, wxPoint::x, and wxPoint::y.

Referenced by Execute_Drill_Command(), Execute_EXCELLON_G_Command(), and GERBER_FILE_IMAGE::LoadGerberFile().

73 {
74  wxPoint pos;
75  int type_coord = 0, current_coord, nbdigits;
76  bool is_float = false;
77  char* text;
78  char line[256];
79 
80 
81  if( m_Relative )
82  pos.x = pos.y = 0;
83  else
84  pos = m_CurrentPos;
85 
86  if( Text == NULL )
87  return pos;
88 
89  text = line;
90  while( *Text )
91  {
92  if( (*Text == 'X') || (*Text == 'Y') )
93  {
94  type_coord = *Text;
95  Text++;
96  text = line;
97  nbdigits = 0;
98 
99  while( IsNumber( *Text ) )
100  {
101  if( *Text == '.' ) // Force decimat format if reading a floating point number
102  is_float = true;
103 
104  // count digits only (sign and decimal point are not counted)
105  if( (*Text >= '0') && (*Text <='9') )
106  nbdigits++;
107  *(text++) = *(Text++);
108  }
109 
110  *text = 0;
111 
112  if( is_float )
113  {
114  // When X or Y values are float numbers, they are given in mm or inches
115  if( m_GerbMetric ) // units are mm
116  current_coord = KiROUND( atof( line ) * IU_PER_MILS / 0.0254 );
117  else // units are inches
118  current_coord = KiROUND( atof( line ) * IU_PER_MILS * 1000 );
119  }
120  else
121  {
122  int fmt_scale = (type_coord == 'X') ? m_FmtScale.x : m_FmtScale.y;
123 
124  if( m_NoTrailingZeros )
125  {
126  int min_digit =
127  (type_coord == 'X') ? m_FmtLen.x : m_FmtLen.y;
128  while( nbdigits < min_digit )
129  {
130  *(text++) = '0';
131  nbdigits++;
132  }
133 
134  *text = 0;
135  }
136 
137  current_coord = atoi( line );
138  double real_scale = scale_list[fmt_scale];
139 
140  if( m_GerbMetric )
141  real_scale = real_scale / 25.4;
142 
143  current_coord = KiROUND( current_coord * real_scale );
144  }
145 
146  if( type_coord == 'X' )
147  pos.x = current_coord;
148  else if( type_coord == 'Y' )
149  pos.y = current_coord;
150 
151  continue;
152  }
153  else
154  break;
155  }
156 
157  if( m_Relative )
158  {
159  pos.x += m_CurrentPos.x;
160  pos.y += m_CurrentPos.y;
161  }
162 
163  m_CurrentPos = pos;
164  return pos;
165 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
#define IsNumber(x)
static double scale_list[SCALE_LIST_SIZE]
void GERBER_FILE_IMAGE::RemoveAttribute ( X2_ATTRIBUTE aAttribute)
inherited

Function RemoveAttribute.

Called when a TD command is found the Gerber file

Parameters
aAttributeis the X2_ATTRIBUTE which stores the full command Remove the attribute specified by the TD command. is no attribute, all current attributes specified by the TO and the TA commands are cleared. if a attribute name is specified (for instance TD.CN*%) is specified, only this attribute is cleared

Definition at line 374 of file class_gerber_file_image.cpp.

References GBR_NETLIST_METADATA::ClearAttribute(), X2_ATTRIBUTE::GetPrm(), GERBER_FILE_IMAGE::m_AperFunction, and GERBER_FILE_IMAGE::m_NetAttributeDict.

Referenced by GERBER_FILE_IMAGE::ExecuteRS274XCommand().

375 {
376  /* Called when a %TD command is found
377  * Remove the attribute specified by the %TD command.
378  * is no attribute, all current attributes specified by the %TO and the %TA
379  * commands are cleared.
380  * if a attribute name is specified (for instance %TD.CN*%) is specified,
381  * only this attribute is cleared
382  */
383  m_NetAttributeDict.ClearAttribute( &aAttribute.GetPrm( 1 ) );
384 
385  if( aAttribute.GetPrm( 1 ).IsEmpty() || aAttribute.GetPrm( 1 ) == ".AperFunction" )
386  m_AperFunction.Clear();
387 }
const wxString & GetPrm(int aIdx)
GBR_NETLIST_METADATA m_NetAttributeDict
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

Helper function used in search and replace dialog Function Replace performs a text replace on aText using the find and replace criteria in aSearchData on items that support text find and replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aTextA reference to a wxString object containing the text to be replaced.
Returns
True if aText was modified, otherwise false.

Definition at line 211 of file base_struct.cpp.

References GetChars(), EDA_ITEM::GetClass(), and EDA_ITEM::IsReplaceable().

Referenced by SCH_TEXT::Replace(), SCH_FIELD::Replace(), SCH_SHEET_PIN::Replace(), SCH_SHEET::Replace(), and SCH_FIND_COLLECTOR::ReplaceItem().

212 {
213  wxCHECK_MSG( IsReplaceable(), false,
214  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
215 
216  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
217 
218  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
219  aSearchData.GetFindString() :
220  aSearchData.GetFindString().Upper() );
221 
222  if( result == wxNOT_FOUND )
223  return false;
224 
225  wxString prefix = aText.Left( result );
226  wxString suffix;
227 
228  if( aSearchData.GetFindString().length() + result < aText.length() )
229  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
230 
231  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
232  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
233  GetChars( suffix ) );
234 
235  aText = prefix + aSearchData.GetReplaceString() + suffix;
236 
237  return true;
238 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:458
const wxString traceFindReplace
Flag to enable find and replace debug tracing.
Definition: base_struct.cpp:58
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual wxString GetClass() const =0
Function GetClass returns the class name.
virtual bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
inlinevirtualinherited

Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace.

This function must be overridden for items that support text replace.

Parameters
aSearchDataA reference to a wxFindReplaceData object containing the search and replace criteria.
aAuxDataA pointer to optional data required for the search or NULL if not used.
Returns
True if the item text was modified, otherwise false.

Reimplemented in SCH_SHEET, SCH_SHEET_PIN, SCH_FIELD, and SCH_TEXT.

Definition at line 446 of file base_struct.h.

446 { return false; }
virtual void EXCELLON_IMAGE::ResetDefaultValues ( )
inlineoverridevirtual

Reimplemented from GERBER_FILE_IMAGE.

Definition at line 110 of file class_excellon.h.

References GERBER_FILE_IMAGE::ResetDefaultValues(), and SelectUnits().

Referenced by LoadFile().

111  {
113  SelectUnits( false );
114  }
void SelectUnits(bool aMetric)
bool EXCELLON_IMAGE::Select_Tool ( char *&  text)
private

Definition at line 597 of file excellon_read_drill_file.cpp.

References FIRST_DCODE, GERBER_FILE_IMAGE::GetDCODE(), GERBER_FILE_IMAGE::GetDCODEOrCreate(), GERBER_FILE_IMAGE::m_Current_Tool, D_CODE::m_InUse, readToolInformation(), TCodeNumber(), and TOOLS_MAX_COUNT.

Referenced by LoadFile().

598 {
599  // Select the tool from the command line Tn, with n = 1 ... TOOLS_MAX_COUNT - 1
600  // Because some drill file have an embedded TCODE definition (like T1C.008F0S0)
601  // in tool selection command, if the tool is not defined in list,
602  // and the definition is embedded, it will be entered in list
603  char * startline = text; // the tool id starts here.
604  int tool_id = TCodeNumber( text );
605 
606  // T0 is legal, but is not a selection tool. it is a special command
607  if( tool_id >= 0 )
608  {
609  int dcode_id = tool_id + FIRST_DCODE; // Remember: dcodes are >= FIRST_DCODE
610 
611  if( dcode_id > (TOOLS_MAX_COUNT - 1) )
612  dcode_id = TOOLS_MAX_COUNT - 1;
613 
614  m_Current_Tool = dcode_id;
615  D_CODE* currDcode = GetDCODEOrCreate( dcode_id, true );
616 
617  if( currDcode == NULL && tool_id > 0 ) // if the definition is embedded, enter it
618  {
619  text = startline; // text starts at the beginning of the command
620  readToolInformation( text );
621  currDcode = GetDCODE( dcode_id );
622  }
623 
624  if( currDcode )
625  currDcode->m_InUse = true;
626  }
627 
628  while( *text )
629  text++;
630 
631  return tool_id >= 0;
632 }
D_CODE * GetDCODE(int aDCODE) const
Function GetDCODE returns a pointer to the D_CODE within this GERBER for the given aDCODE...
bool m_InUse
false if the aperure (previously defined) is not used to draw something
Definition: dcode.h:102
#define FIRST_DCODE
Definition: dcode.h:71
int TCodeNumber(char *&aText)
bool readToolInformation(char *&aText)
Read a tool definition like T1C0.02 or T1F00S00C0.02 or T1C0.02F00S00 and enter params in TCODE list...
Class D_CODE holds a gerber DCODE (also called Aperture) definition.
Definition: dcode.h:82
#define TOOLS_MAX_COUNT
Definition: dcode.h:73
D_CODE * GetDCODEOrCreate(int aDCODE, bool aCreateIfNoExist=true)
Function GetDCODEOrCreate returns a pointer to the D_CODE within this GERBER for the given aDCODE...
void EXCELLON_IMAGE::SelectUnits ( bool  aMetric)
private

Definition at line 716 of file excellon_read_drill_file.cpp.

References fmtIntegerInch, fmtIntegerMM, fmtMantissaInch, fmtMantissaMM, GERBER_FILE_IMAGE::m_FmtLen, GERBER_FILE_IMAGE::m_FmtScale, and GERBER_FILE_IMAGE::m_GerbMetric.

Referenced by Execute_HEADER_Command(), and ResetDefaultValues().

717 {
718  /* Coordinates are measured either in inch or metric (millimeters).
719  * Inch coordinates are in six digits (00.0000) with increments
720  * as small as 0.0001 (1/10,000).
721  * Metric coordinates can be measured in microns (thousandths of a millimeter)
722  * in one of the following three ways:
723  * Five digit 10 micron resolution (000.00)
724  * Six digit 10 micron resolution (0000.00)
725  * Six digit micron resolution (000.000)
726  *
727  * Inches: Default fmt = 2.4 for X and Y axis: 6 digits with 0.0001 resolution
728  * metric: Default fmt = 3.3 for X and Y axis: 6 digits, 1 micron resolution
729  */
730  if( aMetric )
731  {
732  m_GerbMetric = true;
733  // number of digits in mantissa
735  // number of digits (mantissa+interger)
737  }
738  else
739  {
740  m_GerbMetric = false;
743  }
744 }
static const int fmtMantissaInch
static const int fmtIntegerInch
static const int fmtMantissaMM
static const int fmtIntegerMM
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 226 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

226 { Pback = aBack; }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
void EDA_ITEM::SetBrightened ( )
inlineinherited

Definition at line 243 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), and SELECTION_TOOL::disambiguationMenu().

243 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:151
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 267 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::EditDimension(), LIB_PIN::EnableEditMode(), PCB_EDIT_FRAME::FlipTextePcb(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_SHEET::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), PCB_BASE_FRAME::LoadModuleFromLibrary(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), EDA_ITEM::SetSelected(), EDA_ITEM::SetWireImage(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), PCB_EDIT_FRAME::Start_Move_DrawItem(), FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod(), PCB_EDIT_FRAME::Start_Move_Zone_Corner(), PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge(), PCB_EDIT_FRAME::Start_Move_Zone_Outlines(), PCB_EDIT_FRAME::StartMoveModule(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), PCB_BASE_FRAME::StartMovePad(), LIB_EDIT_FRAME::StartMovePin(), PCB_BASE_FRAME::StartMoveTexteModule(), PCB_EDIT_FRAME::StartMoveTextePcb(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), and UndrawAndMarkSegmentsToDrag().

267 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
void EDA_ITEM::SetForceVisible ( bool  aEnable)
inlineinherited

Function SetForceVisible is used to set and cleag force visible flag used to force the item to be drawn even if it's draw attribute is set to not visible.

Parameters
aEnableTrue forces the item to be drawn. False uses the item's visibility setting to determine if the item is to be drawn.

Definition at line 279 of file base_struct.h.

Referenced by SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::updateFindReplaceView().

279 { m_forceVisible = aEnable; }
bool m_forceVisible
Set to true to override the visibility setting of the item.
Definition: base_struct.h:186
void EDA_ITEM::SetHighlighted ( )
inlineinherited

Definition at line 242 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

242 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:150
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 228 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), DHEAD::remove(), and SwapItemData().

228 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:180
void EDA_ITEM::SetModified ( )
inherited
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 225 of file base_struct.h.

Referenced by DHEAD::append(), DHEAD::insert(), SCH_EDIT_FRAME::PutDataInPreviousState(), DHEAD::remove(), and SwapItemData().

225 { Pnext = aNext; }
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
void EDA_ITEM::SetParent ( EDA_ITEM aParent)
inlineinherited

Definition at line 227 of file base_struct.h.

Referenced by MODULE::Add(), BOARD::Add(), BOARD_NETLIST_UPDATER::addNewComponent(), LIB_FIELD::Copy(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), SCH_EDIT_FRAME::CreateSheet(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_MODULE_BOARD_EDITOR::OnEditReference(), DIALOG_MODULE_BOARD_EDITOR::OnEditValue(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), SCH_COMPONENT::operator=(), PCB_PARSER::parseMODULE_unchecked(), PCBNEW_CONTROL::PasteItemsFromClipboard(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SaveCopyOfZones(), SCH_COMPONENT::SCH_COMPONENT(), SCH_SHEET::SCH_SHEET(), SCH_SHEET_PIN::SCH_SHEET_PIN(), LIB_PART::SetFields(), SetSchItemParent(), PCB_EDIT_FRAME::StartMoveModule(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), and SwapItemData().

227 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 241 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by GERBVIEW_SELECTION_TOOL::selectVisually(), and SELECTION_TOOL::selectVisually().

241 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited
void EDA_ITEM::SetTimeStamp ( time_t  aNewTimeStamp)
inlineinherited

Definition at line 217 of file base_struct.h.

Referenced by BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::CreateSheet(), Diagnose(), DuplicateItemsInList(), DuplicateStruct(), EDIT_TOOL::editFootprintInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), PCB_IO::FootprintSave(), DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), PCB_BASE_FRAME::LoadModuleFromLibrary(), LEGACY_PLUGIN::loadPCB_TARGET(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadSignals(), LEGACY_PLUGIN::loadTrackList(), EDA_ITEM::operator=(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), EAGLE_PLUGIN::packageRectangle(), EAGLE_PLUGIN::packageText(), SCH_EDIT_FRAME::PasteListOfItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), BOARD::ReplaceNetlist(), SCH_SHEET::SCH_SHEET(), SCH_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), SwapItemData(), and TestDuplicateSheetNames().

217 { m_TimeStamp = aNewTimeStamp; }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 240 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

240 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:131
static bool EDA_ITEM::Sort ( const EDA_ITEM aLeft,
const EDA_ITEM aRight 
)
inlinestaticinherited

Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers.

Parameters
aLeftThe left hand item to compare.
aRightThe right hand item to compare.
Returns
True if aLeft is less than aRight.

Definition at line 477 of file base_struct.h.

Referenced by PART_LIB::GetEntryTypePowerNames().

477 { return *aLeft < *aRight; }
void GERBER_FILE_IMAGE::StepAndRepeatItem ( const GERBER_DRAW_ITEM aItem)
inherited

Function StepAndRepeatItem Gerber format has a command Step an Repeat This function must be called when reading a gerber file and after creating a new gerber item that must be repeated (i.e when m_XRepeatCount or m_YRepeatCount are > 1)

Parameters
aItem= the item to repeat

Definition at line 298 of file class_gerber_file_image.cpp.

References DLIST< T >::Append(), GERBER_FILE_IMAGE::GetLayerParams(), GERBER_FILE_IMAGE::m_Drawings, GERBER_LAYER::m_XRepeatCount, GERBER_LAYER::m_YRepeatCount, GERBER_DRAW_ITEM::MoveXY(), scaletoIU(), wxPoint::x, and wxPoint::y.

Referenced by GERBER_FILE_IMAGE::Execute_DCODE_Command(), Execute_Drill_Command(), and GERBER_FILE_IMAGE::Execute_G_Command().

299 {
300  if( GetLayerParams().m_XRepeatCount < 2 &&
301  GetLayerParams().m_YRepeatCount < 2 )
302  return; // Nothing to repeat
303 
304  // Duplicate item:
305  for( int ii = 0; ii < GetLayerParams().m_XRepeatCount; ii++ )
306  {
307  for( int jj = 0; jj < GetLayerParams().m_YRepeatCount; jj++ )
308  {
309  // the first gerber item already exists (this is the template)
310  // create duplicate only if ii or jj > 0
311  if( jj == 0 && ii == 0 )
312  continue;
313  GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem );
314  wxPoint move_vector;
315  move_vector.x = scaletoIU( ii * GetLayerParams().m_StepForRepeat.x,
316  GetLayerParams().m_StepForRepeatMetric );
317  move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
318  GetLayerParams().m_StepForRepeatMetric );
319  dupItem->MoveXY( move_vector );
320  m_Drawings.Append( dupItem );
321  }
322  }
323 }
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
int scaletoIU(double aCoord, bool isMetric)
Function scaletoIU converts a distance given in floating point to our internal units.
DLIST< GERBER_DRAW_ITEM > m_Drawings
void MoveXY(const wxPoint &aMoveVector)
Function MoveXY move this object.
GERBER_LAYER & GetLayerParams()
Function GetLayerParams.
int EXCELLON_IMAGE::TCodeNumber ( char *&  aText)
inlineprivate

Definition at line 137 of file class_excellon.h.

References GERBER_FILE_IMAGE::DCodeNumber().

Referenced by Select_Tool().

138  {
139  return DCodeNumber( aText );
140  }
int DCodeNumber(char *&Text)
Definition: rs274d.cpp:438
KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

returns the type of object. This attribute should never be changed after a constructor sets it, so there is no public "setter" method.

Returns
KICAD_T - the type of object.

Definition at line 212 of file base_struct.h.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), MODULE::Add(), CN_CLUSTER::Add(), BOARD::Add(), CN_CONNECTIVITY_ALGO::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), POINT_EDITOR::addCornerCondition(), SCH_EDIT_FRAME::addCurrentItemToList(), AddMenusForComponent(), AddMenusForEditComponent(), SCH_SHEET::AddPin(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Autoroute(), PCB_EDIT_FRAME::Begin_Route(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), HIERARCHY_NAVIG_DLG::BuildTree(), calcArea(), calcMaxArea(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), SCH_SCREENS::ChangeSymbolLibNickname(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), TRACK::ClassOf(), NETINFO_ITEM::ClassOf(), MODULE::ClassOf(), D_PAD::ClassOf(), BOARD::ClassOf(), VIA::ClassOf(), SCH_SHEET::CleanupSheet(), Collect_TrackSegmentsToDrag(), LIB_BEZIER::compare(), LIB_CIRCLE::compare(), LIB_RECTANGLE::compare(), LIB_POLYLINE::compare(), LIB_TEXT::compare(), LIB_ARC::compare(), LIB_FIELD::compare(), LIB_PIN::compare(), SCH_SHEET::ComponentCount(), GRID_HELPER::computeAnchors(), SCH_SCREEN::CountConnectedItems(), SCH_SHEET::CountSheets(), LIB_EDIT_FRAME::CreateGraphicItem(), CINFO3D_VISU::createLayers(), BOARD::CreateLockPoint(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), PCB_EDIT_FRAME::createPopupMenuForTracks(), CreateRoutesSection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::D_PAD(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), LIB_EDIT_FRAME::deleteItem(), deleteItem(), SCH_EDIT_FRAME::DeleteItem(), DeleteItemsInList(), DeleteNullTrackSegments(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_ERC::DisplayERC_MarkersList(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovePin(), DrawMovingBlockOutlines(), drawPickedItems(), CN_ITEM::Dump(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), SCH_SCREEN::ExtractWires(), DRC::fillMarker(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), POINT_EDITOR::finishItem(), FootprintWriteShape(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), getAnchorPoint(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), NETLIST_OBJECT::GetComponentParent(), SCH_SCREEN::GetConnection(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), SCH_SHEET::GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClass(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), LIB_EDIT_FRAME::GlobalSetPins(), SELECTION_TOOL::guessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SHEET::HasUndefinedPins(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsDraggableJunction(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), SCH_SHEET::LocatePathOfScreen(), Magnetize(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), CONNECTIVITY_DATA::MarkItemNetAsDirty(), CN_CONNECTIVITY_ALGO::markItemNetAsDirty(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::mergeCollinearSegmentIfPossible(), TRACKS_CLEANER::MergeCollinearTracks(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), moveItemWithMouseCursor(), MoveMarkedItems(), MoveMarkedItemsExactly(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_SHEET::operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), SCH_SHEET::RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), CN_CONNECTIVITY_ALGO::searchConnections(), SCH_SHEET::SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), SELECTION_TOOL::selectVisually(), ITEM_PICKER::SetItem(), SetSchItemParent(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SCH_SHEET::SwapData(), SCH_COMPONENT::SwapData(), VIA::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), ZONE_CONTAINER::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TRACK::TransformShapeWithClearanceToPolygon(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), EDA_ITEM::Visit(), SCH_SHEET::Visit(), and SCH_COMPONENT::Visit().

213  {
214  return m_StructType;
215  }
KICAD_T m_StructType
Run time identification, keep private so it can never be changed after a constructor sets it...
Definition: base_struct.h:174
const BOX2I EDA_ITEM::ViewBBox ( ) const
overridevirtualinherited

Function ViewBBox() returns the bounding box of the item covering all its layers.

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, GERBER_DRAW_ITEM, DRAWSEGMENT, DIMENSION, TEXTE_MODULE, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::CENTRELINE_RECT_ITEM, KIGFX::PREVIEW::POLYGON_ITEM, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::ORIGIN_VIEWITEM, KIGFX::PREVIEW::RULER_ITEM, KIGFX::RATSNEST_VIEWITEM, BRIGHT_BOX, and KIGFX::PREVIEW::ARC_ASSISTANT.

Definition at line 267 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

Referenced by SELECTION_TOOL::selectMultiple(), BRIGHT_BOX::ViewBBox(), DIMENSION::ViewBBox(), DRAWSEGMENT::ViewBBox(), BRIGHT_BOX::ViewDraw(), and COMMON_TOOLS::ZoomFitScreen().

268 {
269  // Basic fallback
270  return BOX2I( VECTOR2I( GetBoundingBox().GetOrigin() ),
271  VECTOR2I( GetBoundingBox().GetSize() ) );
272 }
virtual const EDA_RECT GetBoundingBox() const
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
BOX2< VECTOR2I > BOX2I
Definition: box2.h:468
VECTOR2< int > VECTOR2I
Definition: vector2d.h:589
virtual void KIGFX::VIEW_ITEM::ViewDraw ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewDraw() Draws the parts of the object belonging to layer aLayer.

viewDraw() is an alternative way for drawing objects if if there is no PAINTER assigned for the view or if the PAINTER doesn't know how to paint this particular implementation of VIEW_ITEM. The preferred way of drawing is to design an appropriate PAINTER object, the method below is intended only for quick hacks and debugging purposes.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on

Reimplemented in EDIT_POINTS, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::VIEW_GROUP, KIGFX::PREVIEW::SELECTION_AREA, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::PREVIEW::RULER_ITEM, KIGFX::ORIGIN_VIEWITEM, KIGFX::RATSNEST_VIEWITEM, KIGFX::PREVIEW::ARC_ASSISTANT, and PCB_BRIGHT_BOX.

Definition at line 115 of file view_item.h.

Referenced by KIGFX::VIEW::draw(), and KIGFX::VIEW::updateItemGeometry().

116  {}
void EDA_ITEM::ViewGetLayers ( int  aLayers[],
int &  aCount 
) const
overridevirtualinherited

Function ViewGetLayers() Returns the all the layers within the VIEW the object is painted on.

For instance, a D_PAD spans zero or more copper layers and a few technical layers. ViewDraw() or PAINTER::Draw() is repeatedly called for each of the layers returned by ViewGetLayers(), depending on the rendering order.

Parameters
aLayers[]output layer index array
aCountnumber of layer indices in aLayers[]

Implements KIGFX::VIEW_ITEM.

Reimplemented in D_PAD, MODULE, EDIT_POINTS, VIA, BOARD_ITEM, GERBER_DRAW_ITEM, TRACK, TEXTE_MODULE, ZONE_CONTAINER, MARKER_PCB, KIGFX::WORKSHEET_VIEWITEM, ROUTER_PREVIEW_ITEM, KIGFX::PREVIEW::SIMPLE_OVERLAY_ITEM, BRIGHT_BOX, KIGFX::ORIGIN_VIEWITEM, KIGFX::RATSNEST_VIEWITEM, and KIGFX::PREVIEW::RULER_ITEM.

Definition at line 275 of file base_struct.cpp.

276 {
277  // Basic fallback
278  aCount = 1;
279  aLayers[0] = 0;
280 }
virtual unsigned int KIGFX::VIEW_ITEM::ViewGetLOD ( int  aLayer,
VIEW aView 
) const
inlinevirtualinherited

Function ViewGetLOD() Returns the level of detail (LOD) of the item.

A level of detail is the minimal VIEW scale that is sufficient for an item to be shown on a given layer.

Parameters
aLayercurrent drawing layer
aViewpointer to the VIEW device we are drawing on
Returns
the level of detail. 0 always show the item, because the actual zoom level (or VIEW scale) is always > 0

Reimplemented in D_PAD, MODULE, VIA, GERBER_DRAW_ITEM, TRACK, and TEXTE_MODULE.

Definition at line 139 of file view_item.h.

Referenced by KIGFX::VIEW::drawItem::operator()().

140  {
141  // By default always show the item
142  return 0;
143  }
SEARCH_RESULT GERBER_FILE_IMAGE::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
overridevirtualinherited

>

Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.

Parameters
inspectorAn INSPECTOR instance to use in the inspection.
testDataArbitrary data used by the inspector.
scanTypesWhich KICAD_T types are of interest and the order is significant too, terminated by EOT.
Returns
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan, else SCAN_CONTINUE, and determined by the inspector.

Reimplemented from EDA_ITEM.

Definition at line 390 of file class_gerber_file_image.cpp.

References GERBER_DRAW_ITEM_T, GERBER_IMAGE_LIST_T, GERBER_IMAGE_T, GERBER_FILE_IMAGE::GetClass(), EDA_ITEM::IterateForward(), GERBER_FILE_IMAGE::m_Drawings, SEARCH_CONTINUE, and SEARCH_QUIT.

Referenced by GBR_LAYOUT::Visit().

391 {
392  KICAD_T stype;
394  const KICAD_T* p = scanTypes;
395  bool done = false;
396 
397 #if 0 && defined(DEBUG)
398  std::cout << GetClass().mb_str() << ' ';
399 #endif
400 
401  while( !done )
402  {
403  stype = *p;
404 
405  switch( stype )
406  {
407  case GERBER_IMAGE_T:
408  case GERBER_IMAGE_LIST_T:
409  ++p;
410  break;
411 
412  case GERBER_DRAW_ITEM_T:
413  result = IterateForward( &m_Drawings[0], inspector, testData, p );
414  ++p;
415  break;
416 
417  default: // catch EOT or ANY OTHER type here and return.
418  done = true;
419  break;
420  }
421 
422  if( result == SEARCH_QUIT )
423  break;
424  }
425 
426  return result;
427 }
static SEARCH_RESULT IterateForward(EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
Function IterateForward walks through the object tree calling the inspector() on each object type req...
wxString GetClass() const override
Function GetClass returns the class name.
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78