KiCad PCB EDA Suite
SCH_SHEET Class Reference

Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic. More...

#include <sch_sheet.h>

Inheritance diagram for SCH_SHEET:
SCH_ITEM EDA_ITEM KIGFX::VIEW_ITEM

Public Member Functions

 SCH_SHEET (const wxPoint &pos=wxPoint(0, 0))
 
 SCH_SHEET (const SCH_SHEET &aSheet)
 Copy Constructor clones aSheet into a new object. More...
 
 ~SCH_SHEET ()
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
bool IsMovableFromAnchorPoint () override
 Virtual function IsMovableFromAnchorPoint Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor Usually return true for small items (labels, junctions) and false for items which can be large (hierarchical sheets, compoments) More...
 
wxString GetName () const
 
void SetName (const wxString &aName)
 
int GetSheetNameSize () const
 
void SetSheetNameSize (int aSize)
 
int GetFileNameSize () const
 
void SetFileNameSize (int aSize)
 
SCH_SCREENGetScreen ()
 
wxSize GetSize ()
 
void SetSize (const wxSize &aSize)
 
SCH_SHEETGetRootSheet ()
 Function GetRootSheet. More...
 
void SetScreen (SCH_SCREEN *aScreen)
 Function SetScreen sets the screen associated with this sheet to aScreen. More...
 
int GetScreenCount () const
 Function GetScreenCount returns the number of times the associated screen for the sheet is being used. More...
 
bool Save (FILE *aFile) const override
 Function Save writes the data structures for this object out to a FILE in "*.sch" format. More...
 
bool Load (LINE_READER &aLine, wxString &aErrorMsg) override
 Function Load reads a schematic item from aLine in a .sch file. More...
 
void GetMsgPanelInfo (std::vector< MSG_PANEL_ITEM > &aList) override
 Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for display purposes. More...
 
bool IsVerticalOrientation () const
 
void AddPin (SCH_SHEET_PIN *aSheetPin)
 Add aSheetPin to the sheet. More...
 
SCH_SHEET_PINSGetPins ()
 
SCH_SHEET_PINSGetPins () const
 
void RemovePin (SCH_SHEET_PIN *aSheetPin)
 Remove aSheetPin from the sheet. More...
 
void CleanupSheet ()
 Delete sheet label which do not have a corresponding hierarchical label. More...
 
SCH_SHEET_PINGetPin (const wxPoint &aPosition)
 Return the sheet pin item found at aPosition in the sheet. More...
 
bool HasPin (const wxString &aName)
 Checks if the sheet already has a sheet pin named aName. More...
 
bool HasPins ()
 
bool HasUndefinedPins ()
 Check all sheet labels against schematic for undefined hierarchical labels. More...
 
int GetMinWidth () const
 Function GetMinWidth returns the minimum width of the sheet based on the widths of the sheet pin text. More...
 
int GetMinHeight () const
 Function GetMinHeight returns the minimum height that the sheet can be resized based on the sheet pin positions. More...
 
int GetPenSize () const override
 Function GetPenSize virtual pure. More...
 
void Draw (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED) override
 Function Draw Draw a schematic item. More...
 
EDA_RECT const GetBoundingBox () const override
 Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes. More...
 
wxPoint GetResizePosition () const
 Function GetResizePos returns the position of the lower right corner of the sheet in drawing units. More...
 
void SwapData (SCH_ITEM *aItem) override
 Function SwapData swap the internal data structures aItem with the schematic item. More...
 
int ComponentCount ()
 Function ComponentCount count our own components, without the power components. More...
 
bool Load (SCH_EDIT_FRAME *aFrame)
 Function Load. More...
 
bool SearchHierarchy (const wxString &aFilename, SCH_SCREEN **aScreen)
 Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName". More...
 
bool LocatePathOfScreen (SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
 Function LocatePathOfScreen search the existing hierarchy for an instance of screen "FileName". More...
 
int CountSheets ()
 Function CountSheets calculates the number of sheets found in "this" this number includes the full subsheets count. More...
 
wxString GetFileName (void) const
 Function GetFileName return the filename corresponding to this sheet. More...
 
void SetFileName (const wxString &aFilename)
 
bool ChangeFileName (SCH_EDIT_FRAME *aFrame, const wxString &aFileName)
 
void Move (const wxPoint &aMoveVector) override
 Function Move moves the item by aMoveVector to a new position. More...
 
void MirrorY (int aYaxis_position) override
 Function MirrorY mirrors item relative to the Y axis about aYaxis_position. More...
 
void MirrorX (int aXaxis_position) override
 Function MirrorX mirrors item relative to the X axis about aXaxis_position. More...
 
void Rotate (wxPoint aPosition) override
 Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction. More...
 
bool Matches (wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation) override
 Function Matches compares the item against the search criteria in aSearchData. More...
 
bool Replace (wxFindReplaceData &aSearchData, void *aAuxData=NULL) override
 Function Replace performs a text replace using the find and replace criteria in aSearchData on items that support text find and replace. More...
 
bool IsReplaceable () const override
 Function IsReplaceable. More...
 
void Resize (const wxSize &aSize)
 Resize this sheet to aSize and adjust all of the labels accordingly. More...
 
wxPoint GetSheetNamePosition ()
 Function GetSheetNamePosition. More...
 
wxPoint GetFileNamePosition ()
 Function GetFileNamePosition. More...
 
void GetEndPoints (std::vector< DANGLING_END_ITEM > &aItemList) override
 Function GetEndPoints adds the schematic item end points to aItemList if the item has end points. More...
 
bool IsDanglingStateChanged (std::vector< DANGLING_END_ITEM > &aItemList) override
 Function IsDanglingStateChanged tests the schematic item to aItemList to check if it's dangling state has changed. More...
 
bool IsDangling () const override
 
bool IsSelectStateChanged (const wxRect &aRect) override
 Function IsSelectStateChanged checks if the selection state of an item inside aRect has changed. More...
 
bool IsConnectable () const override
 Function IsConnectable returns true if the schematic item can connect to another schematic item. More...
 
void GetConnectionPoints (std::vector< wxPoint > &aPoints) const override
 Function GetConnectionPoints add all the connection points for this item to aPoints. More...
 
SEARCH_RESULT Visit (INSPECTOR inspector, void *testData, const KICAD_T scanTypes[]) override
 Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data. More...
 
wxString GetSelectMenuText () const override
 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...
 
BITMAP_DEF GetMenuImage () const override
 Function GetMenuImage returns a pointer to an image to be used in menus. More...
 
void GetNetListItem (NETLIST_OBJECT_LIST &aNetListItems, SCH_SHEET_PATH *aSheetPath) override
 Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems. More...
 
SCH_ITEMoperator= (const SCH_ITEM &aSheet)
 
wxPoint GetPosition () const override
 Function GetPosition. More...
 
void SetPosition (const wxPoint &aPosition) override
 Function SetPosition set the schematic item position to aPosition. More...
 
bool HitTest (const wxPoint &aPosition, int aAccuracy) const override
 Function HitTest tests if aPosition is contained within or on the bounding box of an item. More...
 
bool HitTest (const EDA_RECT &aRect, bool aContained=false, int aAccuracy=0) const override
 Function HitTest tests if aRect intersects or is contained within the bounding box of an item. More...
 
void Plot (PLOTTER *aPlotter) override
 Function Plot plots the schematic item to aPlotter. More...
 
EDA_ITEMClone () const override
 Function Clone creates a duplicate of this item with linked list members set to NULL. More...
 
SCH_ITEMNext () const
 
SCH_ITEMBack () const
 
wxPointGetStoredPos ()
 
void SetStoredPos (wxPoint aPos)
 
SCH_LAYER_ID GetLayer () const
 Function GetLayer returns the layer this item is on. More...
 
void SetLayer (SCH_LAYER_ID aLayer)
 Function SetLayer sets the layer this item is on. More...
 
void ClearConnections ()
 Function ClearConnections clears all of the connection items from the list. More...
 
bool IsConnected (const wxPoint &aPoint) const
 Function IsConnected tests the item to see if it is connected to aPoint. More...
 
virtual bool HitTest (const wxPoint &aPosition) const override
 Function HitTest tests if aPosition is contained within or on the bounding area of an item. More...
 
virtual bool CanIncrementLabel () const
 
virtual bool operator< (const SCH_ITEM &aItem) const
 
bool operator< (const EDA_ITEM &aItem) const
 Test if another item is less than this object. More...
 
KICAD_T Type () const
 Function Type() More...
 
void SetTimeStamp (time_t aNewTimeStamp)
 
time_t GetTimeStamp () 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...
 
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 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 of the item. More...
 
VIEW_ITEM_DATA * viewPrivData () const
 

Static Public Member Functions

static std::string FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate for writing to file. More...
 
static std::string FormatInternalUnits (const wxPoint &aPoint)
 
static std::string FormatInternalUnits (const wxSize &aSize)
 
static std::string FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. More...
 
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...
 

Protected Member Functions

void renumberPins ()
 Renumber the sheet pins in the sheet. More...
 
bool Matches (const wxString &aText, wxFindReplaceData &aSearchData)
 Function Matches compares aText against search criteria in aSearchData. More...
 

Protected Attributes

SCH_LAYER_ID m_Layer
 
EDA_ITEMS m_connections
 List of items connected to this item. More...
 
wxPoint m_storedPos
 a temporary variable used in some move commands

to store a initial pos (of the item or mouse cursor)

More...
 
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 Attributes

SCH_SCREENm_screen
 Screen that contains the physical data for the sheet. More...
 
SCH_SHEET_PINS m_pins
 The list of sheet connection points. More...
 
wxString m_fileName
 The file name is also in the SCH_SCREEN object associated with the sheet. More...
 
wxString m_name
 This is equivalent to the reference designator for components and is stored in F0 sheet pin in the schematic file. More...
 
int m_sheetNameSize
 The height of the text used to draw the sheet name. More...
 
int m_fileNameSize
 The height of the text used to draw the file name. More...
 
wxPoint m_pos
 The position of the sheet. More...
 
wxSize m_size
 The size of the sheet. More...
 

Friends

class SCH_SHEET_PIN
 

Detailed Description

Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic.

Definition at line 216 of file sch_sheet.h.

Constructor & Destructor Documentation

SCH_SHEET::SCH_SHEET ( const wxPoint pos = wxPoint( 0, 0 ))

Definition at line 46 of file sch_sheet.cpp.

References GetDefaultTextSize(), GetNewTimeStamp(), LAYER_SHEET, m_fileName, m_fileNameSize, SCH_ITEM::m_Layer, m_name, m_pos, m_screen, m_sheetNameSize, m_size, EDA_ITEM::m_TimeStamp, MIN_SHEET_HEIGHT, MIN_SHEET_WIDTH, and EDA_ITEM::SetTimeStamp().

Referenced by Clone().

46  :
47  SCH_ITEM( NULL, SCH_SHEET_T )
48 {
50  m_pos = pos;
55  m_screen = NULL;
56  m_name.Printf( wxT( "Sheet%8.8lX" ), (long) m_TimeStamp );
57  m_fileName.Printf( wxT( "file%8.8lX.sch" ), (long) m_TimeStamp );
58 }
SCH_LAYER_ID m_Layer
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
time_t GetNewTimeStamp()
Definition: common.cpp:166
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:47
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:48
int GetDefaultTextSize()
Default size for text in general.
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_SHEET::SCH_SHEET ( const SCH_SHEET aSheet)

Copy Constructor clones aSheet into a new object.

All sheet pins are copied as is except and the SCH_SHEET_PIN's m_Parent pointers are set to the new copied parent object.

Definition at line 61 of file sch_sheet.cpp.

References SCH_SCREEN::IncRefCount(), m_fileName, m_fileNameSize, SCH_ITEM::m_Layer, m_name, m_pins, m_pos, m_screen, m_sheetNameSize, m_size, EDA_ITEM::m_TimeStamp, EDA_ITEM::SetParent(), and EDA_ITEM::SetTimeStamp().

61  :
62  SCH_ITEM( aSheet )
63 {
64  m_pos = aSheet.m_pos;
65  m_size = aSheet.m_size;
66  m_Layer = aSheet.m_Layer;
67  SetTimeStamp( aSheet.m_TimeStamp );
70  m_screen = aSheet.m_screen;
71  m_name = aSheet.m_name;
72  m_fileName = aSheet.m_fileName;
73  m_pins = aSheet.m_pins;
74 
75  for( size_t i = 0; i < m_pins.size(); i++ )
76  m_pins[i].SetParent( this );
77 
78  if( m_screen )
80 }
SCH_LAYER_ID m_Layer
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
void IncRefCount()
Definition: sch_screen.cpp:127
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_SHEET::~SCH_SHEET ( )

Definition at line 83 of file sch_sheet.cpp.

References SCH_SCREEN::DecRefCount(), SCH_SCREEN::GetRefCount(), and m_screen.

84 {
85  // also, look at the associated sheet & its reference count
86  // perhaps it should be deleted also.
87  if( m_screen )
88  {
90 
91  if( m_screen->GetRefCount() == 0 )
92  delete m_screen;
93  }
94 }
int GetRefCount() const
void DecRefCount()
Definition: sch_screen.cpp:133
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222

Member Function Documentation

void SCH_SHEET::AddPin ( SCH_SHEET_PIN aSheetPin)

Add aSheetPin to the sheet.

Note: Once a sheet pin is added to the sheet, it is owned by the sheet. Do not delete the sheet pin object or you will likely get a segfault when the sheet is destroyed.

Parameters
aSheetPinThe sheet pin item to add to the sheet.

Definition at line 358 of file sch_sheet.cpp.

References m_pins, renumberPins(), SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by Load().

359 {
360  wxASSERT( aSheetPin != NULL );
361  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
362 
363  m_pins.push_back( aSheetPin );
364  renumberPins();
365 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void renumberPins()
Renumber the sheet pins in the sheet.
Definition: sch_sheet.cpp:1002
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
SCH_ITEM* SCH_ITEM::Back ( ) const
inlineinherited

Definition at line 150 of file sch_item_struct.h.

References EDA_ITEM::Pback.

Referenced by DrawSegment(), SCH_SHEET_PATH::FindPreviousItem(), and SCH_SHEET_LIST::FindPreviousItem().

150 { return static_cast<SCH_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:179
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
virtual bool SCH_ITEM::CanIncrementLabel ( ) const
inlinevirtualinherited

Reimplemented in SCH_TEXT.

Definition at line 350 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem().

350 { return false; }
bool SCH_SHEET::ChangeFileName ( SCH_EDIT_FRAME aFrame,
const wxString &  aFileName 
)
void SCH_SHEET::CleanupSheet ( )

Delete sheet label which do not have a corresponding hierarchical label.

Note: Make sure you save a copy of the sheet in the undo list before calling CleanupSheet() otherwise any unreferenced sheet labels will be lost.

Definition at line 521 of file sch_sheet.cpp.

References SCH_SCREEN::GetDrawItems(), EDA_TEXT::GetText(), m_pins, m_screen, EDA_ITEM::Next(), SCH_HIERARCHICAL_LABEL_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_FRAME::Process_Special_Functions().

522 {
523  SCH_SHEET_PINS::iterator i = m_pins.begin();
524 
525  while( i != m_pins.end() )
526  {
527  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
528  EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
529  const SCH_HIERLABEL* HLabel = NULL;
530 
531  for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
532  {
533  if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
534  continue;
535 
536  HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
537 
538  if( i->GetText().CmpNoCase( HLabel->GetText() ) == 0 )
539  break; // Found!
540 
541  HLabel = NULL;
542  }
543 
544  if( HLabel == NULL ) // Hlabel not found: delete sheet label.
545  i = m_pins.erase( i );
546  else
547  ++i;
548  }
549 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
EDA_ITEM * Next() const
Definition: base_struct.h:220
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 247 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by 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 SCH_ITEM::ClearConnections ( )
inlineinherited

Function ClearConnections clears all of the connection items from the list.

The vector release method is used to prevent the item pointers from being deleted. Do not use the vector erase method on the connection list.

Definition at line 310 of file sch_item_struct.h.

310 { m_connections.clear(); }
EDA_ITEMS m_connections
List of items connected to this item.
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(), SCH_EDIT_FRAME::AppendOneEEProject(), 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_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), 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(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), 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 EDA_ITEM::ClearSelected ( )
inlineinherited

Definition at line 245 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

Referenced by POINT_EDITOR::addCorner(), EDIT_TOOL::Duplicate(), GAL_ARRAY_CREATOR::prePushAction(), SELECTION_TOOL::unselectVisually(), and PCB_EDITOR_CONTROL::ZoneDuplicate().

245 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
EDA_ITEM * SCH_SHEET::Clone ( ) const
overridevirtual

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 from EDA_ITEM.

Definition at line 97 of file sch_sheet.cpp.

References SCH_SHEET().

98 {
99  return new SCH_SHEET( *this );
100 }
SCH_SHEET(const wxPoint &pos=wxPoint(0, 0))
Definition: sch_sheet.cpp:46
int SCH_SHEET::ComponentCount ( )

Function ComponentCount count our own components, without the power components.

Returns
the component count.

Definition at line 714 of file sch_sheet.cpp.

References ComponentCount(), SCH_SCREEN::GetDrawItems(), SCH_COMPONENT::GetField(), EDA_TEXT::GetText(), m_screen, EDA_ITEM::Next(), SCH_COMPONENT_T, SCH_SHEET_T, EDA_ITEM::Type(), and VALUE.

Referenced by ComponentCount().

715 {
716  int n = 0;
717 
718  if( m_screen )
719  {
720  EDA_ITEM* bs;
721 
722  for( bs = m_screen->GetDrawItems(); bs != NULL; bs = bs->Next() )
723  {
724  if( bs->Type() == SCH_COMPONENT_T )
725  {
726  SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
727 
728  if( Cmp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
729  n++;
730  }
731 
732  if( bs->Type() == SCH_SHEET_T )
733  {
734  SCH_SHEET* sheet = (SCH_SHEET*) bs;
735  n += sheet->ComponentCount();
736  }
737  }
738  }
739 
740  return n;
741 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
int ComponentCount()
Function ComponentCount count our own components, without the power components.
Definition: sch_sheet.cpp:714
EDA_ITEM * Next() const
Definition: base_struct.h:220
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
Field Value of part, i.e. "3.3K".
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
int SCH_SHEET::CountSheets ( )

Function CountSheets calculates the number of sheets found in "this" this number includes the full subsheets count.

Returns
the full count of sheets+subsheets contained by "this"

Definition at line 859 of file sch_sheet.cpp.

References CountSheets(), SCH_SCREEN::GetDrawItems(), m_screen, EDA_ITEM::Next(), SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by CountSheets(), SCH_PRINTOUT::GetPageInfo(), SCH_PRINTOUT::HasPage(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::SetSheetNumberAndCount().

860 {
861  int count = 1; //1 = this!!
862 
863  if( m_screen )
864  {
865  EDA_ITEM* strct = m_screen->GetDrawItems();
866 
867  for( ; strct; strct = strct->Next() )
868  {
869  if( strct->Type() == SCH_SHEET_T )
870  {
871  SCH_SHEET* subsheet = (SCH_SHEET*) strct;
872  count += subsheet->CountSheets();
873  }
874  }
875  }
876  return count;
877 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
int CountSheets()
Function CountSheets calculates the number of sheets found in "this" this number includes the full su...
Definition: sch_sheet.cpp:859
EDA_ITEM * Next() const
Definition: base_struct.h:220
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
void SCH_SHEET::Draw ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aOffset,
GR_DRAWMODE  aDrawMode,
COLOR4D  aColor = COLOR4D::UNSPECIFIED 
)
overridevirtual

Function Draw Draw a schematic item.

Each schematic item should have its own method

Parameters
aPanelDrawPanel to use (can be null) mainly used for clipping purposes.
aDCDevice Context (can be null)
aOffsetdrawing Offset (usually wxPoint(0,0), but can be different when moving an object)
aDrawModeGR_OR, GR_XOR, ...
aColorCOLOR4D::UNSPECIFIED to use the normal body item color, or force this color if it is a valid color

Implements SCH_ITEM.

Definition at line 607 of file sch_sheet.cpp.

References boundingBox(), BROWN, color, DrawGraphicText(), GetBoundingBox(), EDA_DRAW_PANEL::GetClipBox(), GetFileNamePosition(), GetLayerColor(), GetPenSize(), GetSheetNamePosition(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_TOP, GRFilledCircle(), GRRect(), GRSetDrawMode(), IsVerticalOrientation(), LAYER_SHEETFILENAME, LAYER_SHEETNAME, m_fileName, m_fileNameSize, SCH_ITEM::m_Layer, m_name, m_pins, m_pos, m_sheetNameSize, m_size, TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

Referenced by resizeSheetWithMouseCursor().

609 {
610  COLOR4D txtcolor;
611  wxString Text;
612  COLOR4D color;
613  int name_orientation;
614  wxPoint pos_sheetname,pos_filename;
615  wxPoint pos = m_pos + aOffset;
616  int lineWidth = GetPenSize();
617  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
618 
619  if( aColor != COLOR4D::UNSPECIFIED )
620  color = aColor;
621  else
622  color = GetLayerColor( m_Layer );
623 
624  GRSetDrawMode( aDC, aDrawMode );
625 
626  GRRect( clipbox, aDC, pos.x, pos.y,
627  pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
628 
629  pos_sheetname = GetSheetNamePosition() + aOffset;
630  pos_filename = GetFileNamePosition() + aOffset;
631 
632  if( IsVerticalOrientation() )
633  name_orientation = TEXT_ANGLE_VERT;
634  else
635  name_orientation = TEXT_ANGLE_HORIZ;
636 
637  /* Draw text : SheetName */
638  if( aColor != COLOR4D::UNSPECIFIED )
639  txtcolor = aColor;
640  else
641  txtcolor = GetLayerColor( LAYER_SHEETNAME );
642 
643  Text = wxT( "Sheet: " ) + m_name;
644  DrawGraphicText( clipbox, aDC, pos_sheetname,
645  txtcolor, Text, name_orientation,
646  wxSize( m_sheetNameSize, m_sheetNameSize ),
648  false, false );
649 
650  /* Draw text : FileName */
651  if( aColor != COLOR4D::UNSPECIFIED )
652  txtcolor = aColor;
653  else
654  txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
655 
656  Text = wxT( "File: " ) + m_fileName;
657  DrawGraphicText( clipbox, aDC, pos_filename,
658  txtcolor, Text, name_orientation,
659  wxSize( m_fileNameSize, m_fileNameSize ),
661  false, false );
662 
663  /* Draw text : SheetLabel */
664  for( SCH_SHEET_PIN& sheetPin : m_pins )
665  {
666  if( !sheetPin.IsMoving() )
667  sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor );
668  }
669 
670 
671 #if 0
672  // Only for testing purposes, draw the component bounding box
674  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
675  GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x, m_pos.y, 10, 0, color, color );
676 #endif
677 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
SCH_LAYER_ID m_Layer
void DrawGraphicText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf), PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
Definition: drawtxt.cpp:122
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:564
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:833
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
#define TEXT_ANGLE_VERT
Definition: common.h:92
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:680
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
EDA_RECT * GetClipBox()
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
wxPoint GetFileNamePosition()
Function GetFileNamePosition.
Definition: sch_sheet.cpp:588
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
wxPoint GetSheetNamePosition()
Function GetSheetNamePosition.
Definition: sch_sheet.cpp:570
Class EDA_RECT handles the component boundary box.
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:402
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62
std::string SCH_ITEM::FormatAngle ( double  aAngle)
staticinherited

Function FormatAngle converts aAngle from board units to a string appropriate for writing to file.

Note
Internal angles for board items can be either degrees or tenths of degree on how KiCad is built.
Parameters
aAngleA angle value to convert.
Returns
A std::string object containing the converted angle.

Definition at line 131 of file sch_item_struct.cpp.

132 {
133  char temp[50];
134  int len;
135 
136  len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
137 
138  return std::string( temp, len );
139 }
std::string SCH_ITEM::FormatInternalUnits ( int  aValue)
staticinherited

Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate for writing to file.

Parameters
aValueA coordinate value to convert.
Returns
A std::string object containing the converted value.

Definition at line 107 of file sch_item_struct.cpp.

Referenced by SCH_ITEM::FormatInternalUnits().

108 {
109  char buf[50];
110  double engUnits = aValue;
111  int len;
112 
113  if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
114  {
115  len = snprintf( buf, sizeof(buf), "%.10f", engUnits );
116 
117  while( --len > 0 && buf[len] == '0' )
118  buf[len] = '\0';
119 
120  ++len;
121  }
122  else
123  {
124  len = snprintf( buf, sizeof(buf), "%.10g", engUnits );
125  }
126 
127  return std::string( buf, len );
128 }
std::string SCH_ITEM::FormatInternalUnits ( const wxPoint aPoint)
staticinherited

Definition at line 142 of file sch_item_struct.cpp.

References SCH_ITEM::FormatInternalUnits(), wxPoint::x, and wxPoint::y.

143 {
144  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
145 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate fo...
std::string SCH_ITEM::FormatInternalUnits ( const wxSize &  aSize)
staticinherited

Definition at line 148 of file sch_item_struct.cpp.

References SCH_ITEM::FormatInternalUnits().

149 {
150  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
151 }
static std::string FormatInternalUnits(int aValue)
Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate fo...
const EDA_RECT SCH_SHEET::GetBoundingBox ( ) const
overridevirtual

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 from EDA_ITEM.

Definition at line 680 of file sch_sheet.cpp.

References GetPenSize(), EDA_RECT::GetY(), GraphicTextWidth(), EDA_RECT::Inflate(), KiROUND(), m_fileName, m_fileNameSize, m_name, m_pos, m_sheetNameSize, m_size, max, EDA_RECT::SetEnd(), EDA_RECT::SetY(), wxPoint::x, and wxPoint::y.

Referenced by SCH_EDIT_FRAME::DeleteItem(), Draw(), HitTest(), IsSelectStateChanged(), SCH_EDIT_FRAME::MirrorSheet(), SCH_EDIT_FRAME::Process_Special_Functions(), and SCH_EDIT_FRAME::RotateHierarchicalSheet().

681 {
682  wxPoint end;
683  EDA_RECT box( m_pos, m_size );
684  int lineWidth = GetPenSize();
685 
686  // Determine length of texts
687  wxString text = wxT( "Sheet: " ) + m_name;
688  int textlen = GraphicTextWidth( text, wxSize( m_sheetNameSize, m_sheetNameSize ),
689  false, false );
690 
691  text = wxT( "File: " ) + m_fileName;
692  int textlen2 = GraphicTextWidth( text, wxSize( m_fileNameSize, m_fileNameSize ),
693  false, false );
694 
695  // Calculate bounding box X size:
696  textlen = std::max( textlen, textlen2 );
697  end.x = std::max( m_size.x, textlen );
698 
699  // Calculate bounding box pos:
700  end.y = m_size.y;
701  end += m_pos;
702 
703  // Move upper and lower limits to include texts:
704  box.SetY( box.GetY() - ( KiROUND( m_sheetNameSize * 1.3 ) + 8 ) );
705  end.y += KiROUND( m_fileNameSize * 1.3 ) + 8;
706 
707  box.SetEnd( end );
708  box.Inflate( lineWidth / 2 );
709 
710  return box;
711 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:564
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool aItalic, bool aBold)
Function GraphicTextWidth.
Definition: drawtxt.cpp:88
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
wxString SCH_SHEET::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from SCH_ITEM.

Definition at line 259 of file sch_sheet.h.

Referenced by operator=(), and SCH_EDIT_FRAME::ReSizeSheet().

260  {
261  return wxT( "SCH_SHEET" );
262  }
void SCH_SHEET::GetConnectionPoints ( std::vector< wxPoint > &  aPoints) const
overridevirtual

Function GetConnectionPoints add all the connection points for this item to aPoints.

Not all schematic items have connection points so the default method does nothing.

Parameters
aPointsList of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 1069 of file sch_sheet.cpp.

References GetPins(), and GetPosition().

1070 {
1071  for( size_t i = 0; i < GetPins().size(); i++ )
1072  aPoints.push_back( GetPins()[i].GetPosition() );
1073 }
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:582
void SCH_SHEET::GetEndPoints ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Function GetEndPoints adds the schematic item end points to aItemList if the item has end points.

The default version doesn't do anything since many of the schematic object cannot be tested for dangling ends. If you add a new schematic item that can have a dangling end ( no connect ), override this method to provide the correct end points.

Parameters
aItemList- List of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Definition at line 1014 of file sch_sheet.cpp.

References SCH_SHEET_PIN::GetEndPoints(), GetPins(), SCH_SHEET_PIN_T, and EDA_ITEM::Type().

1015 {
1016  for( unsigned ii = 0; ii < GetPins().size(); ii++ )
1017  {
1018  SCH_SHEET_PIN &pinsheet = GetPins()[ii];
1019 
1020  wxCHECK2_MSG( pinsheet.Type() == SCH_SHEET_PIN_T, continue,
1021  wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
1022 
1023  pinsheet.GetEndPoints( aItemList );
1024  }
1025 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Function GetEndPoints adds the schematic item end points to aItemList if the item has end points...
wxString SCH_SHEET::GetFileName ( void  ) const

Function GetFileName return the filename corresponding to this sheet.

Returns
a wxString containing the filename

Definition at line 880 of file sch_sheet.cpp.

References m_fileName.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), SCH_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), SCH_LEGACY_PLUGIN::loadHierarchy(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), SCH_EDIT_FRAME::OnSaveProject(), SCH_EDIT_FRAME::PasteListOfItems(), Plot(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SHEET_PATH::TestForRecursion(), and SCH_SHEET_LIST::TestForRecursion().

881 {
882  return m_fileName;
883 }
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
wxPoint SCH_SHEET::GetFileNamePosition ( )

Function GetFileNamePosition.

Returns
the position of the anchor of filename text

Definition at line 588 of file sch_sheet.cpp.

References GetPenSize(), IsVerticalOrientation(), m_pos, m_size, wxPoint::x, and wxPoint::y.

Referenced by Draw(), and Matches().

589 {
590  wxPoint pos = m_pos;
591  int margin = GetPenSize() + 4;
592 
593  if( IsVerticalOrientation() )
594  {
595  pos.x += m_size.x + margin;
596  pos.y += m_size.y;
597  }
598  else
599  {
600  pos.y += m_size.y + margin;
601  }
602 
603  return pos;
604 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:564
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:402
int SCH_SHEET::GetFileNameSize ( ) const
inline

Definition at line 282 of file sch_sheet.h.

References m_fileNameSize.

Referenced by SCH_EDIT_FRAME::EditSheet(), and SCH_LEGACY_PLUGIN::saveSheet().

282 { return m_fileNameSize; }
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
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(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), 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
DHEAD* EDA_ITEM::GetList ( ) const
inlineinherited
BITMAP_DEF SCH_SHEET::GetMenuImage ( ) const
overridevirtual

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 from EDA_ITEM.

Definition at line 1111 of file sch_sheet.cpp.

1112 {
1113  return add_hierarchical_subsheet_xpm;
1114 }
int SCH_SHEET::GetMinHeight ( ) const

Function GetMinHeight returns the minimum height that the sheet can be resized based on the sheet pin positions.

The minimum width of a sheet is determined by the Y axis location of the bottom most sheet pin. If at some point in the future sheet objects can be rotated or pins can be placed in the vertical orientation, this function will need to be changed.

Returns
The minimum height the sheet can be resized.

Definition at line 482 of file sch_sheet.cpp.

References EDA_RECT::GetBottom(), EDA_RECT::GetHeight(), m_pins, m_pos, MIN_SHEET_HEIGHT, SCH_SHEET_PIN::SHEET_LEFT_SIDE, SCH_SHEET_PIN::SHEET_RIGHT_SIDE, and wxPoint::y.

Referenced by resizeSheetWithMouseCursor().

483 {
484  int height = MIN_SHEET_HEIGHT;
485 
486  for( size_t i = 0; i < m_pins.size(); i++ )
487  {
488  int edge = m_pins[i].GetEdge();
489  EDA_RECT pinRect = m_pins[i].GetBoundingBox();
490 
491  // Make sure pin is on top or bottom side of sheet.
493  {
494  if( height < pinRect.GetBottom() - m_pos.y )
495  height = pinRect.GetBottom() - m_pos.y;
496  }
497  else
498  {
499  if( height < pinRect.GetHeight() )
500  height = pinRect.GetHeight();
501 
502  for( size_t j = 0; j < m_pins.size(); j++ )
503  {
504  // Check for pin directly above or below the current pin.
505  if( (i == j) || (m_pins[i].GetPosition().x != m_pins[j].GetPosition().x) )
506  continue;
507 
508  if( height < pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight() )
509  {
510  height = pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight();
511  break;
512  }
513  }
514  }
515  }
516 
517  return height;
518 }
int GetHeight() const
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
int GetBottom() const
Class EDA_RECT handles the component boundary box.
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:48
int SCH_SHEET::GetMinWidth ( ) const

Function GetMinWidth returns the minimum width of the sheet based on the widths of the sheet pin text.

The minimum sheet width is determined by the width of the bounding box of each hierarchical sheet pin. If two pins are horizontally adjacent ( same Y position ) to each other, the sum of the bounding box widths is used. If at some point in the future sheet objects can be rotated or pins can be placed in the vertical orientation, this function will need to be changed.

Returns
The minimum width the sheet can be resized.

Definition at line 442 of file sch_sheet.cpp.

References EDA_RECT::GetRight(), EDA_RECT::GetWidth(), m_pins, m_pos, MIN_SHEET_WIDTH, SCH_SHEET_PIN::SHEET_BOTTOM_SIDE, SCH_SHEET_PIN::SHEET_TOP_SIDE, SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE, and wxPoint::x.

Referenced by resizeSheetWithMouseCursor().

443 {
444  int width = MIN_SHEET_WIDTH;
445 
446  for( size_t i = 0; i < m_pins.size(); i++ )
447  {
448  int edge = m_pins[i].GetEdge();
449  EDA_RECT pinRect = m_pins[i].GetBoundingBox();
450 
451  wxASSERT( edge != SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE );
452 
454  {
455  if( width < pinRect.GetRight() - m_pos.x )
456  width = pinRect.GetRight() - m_pos.x;
457  }
458  else
459  {
460  if( width < pinRect.GetWidth() )
461  width = pinRect.GetWidth();
462 
463  for( size_t j = 0; j < m_pins.size(); j++ )
464  {
465  // Check for pin directly across from the current pin.
466  if( (i == j) || (m_pins[i].GetPosition().y != m_pins[j].GetPosition().y) )
467  continue;
468 
469  if( width < pinRect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth() )
470  {
471  width = pinRect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth();
472  break;
473  }
474  }
475  }
476  }
477 
478  return width;
479 }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:47
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
int GetRight() const
Class EDA_RECT handles the component boundary box.
int GetWidth() const
void SCH_SHEET::GetMsgPanelInfo ( std::vector< MSG_PANEL_ITEM > &  aList)
overridevirtual

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 from EDA_ITEM.

Definition at line 886 of file sch_sheet.cpp.

References BLUE, BROWN, CYAN, m_fileName, m_name, and EDA_ITEM::m_TimeStamp.

887 {
888  aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) );
889  aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
890 
891 #if 0 // Set to 1 to display the sheet time stamp (mainly for test)
892  wxString msg;
893  msg.Printf( wxT( "%.8X" ), m_TimeStamp );
894  aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), msg, BLUE ) );
895 #endif
896 }
Definition: colors.h:57
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
Definition: colors.h:59
Class EDA_MSG_ITEM is used EDA_MSG_PANEL as the item type for displaying messages.
Definition: msgpanel.h:53
Definition: colors.h:62
wxString SCH_SHEET::GetName ( void  ) const
inline

Definition at line 274 of file sch_sheet.h.

References m_name.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), HIERARCHY_NAVIG_DLG::BuildTree(), SCH_EDIT_FRAME::EditSheet(), SCH_SCREEN::GetSheet(), and SCH_LEGACY_PLUGIN::saveSheet().

274 { return m_name; }
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
void SCH_SHEET::GetNetListItem ( NETLIST_OBJECT_LIST aNetListItems,
SCH_SHEET_PATH aSheetPath 
)
overridevirtual

Function GetNetListItem creates a new NETLIST_OBJECT for the schematic object and adds it to aNetListItems.

Not all schematic objects have net list items associated with them. This method only needs to be overridden for those schematic objects that have net list objects associated with them.

Reimplemented from SCH_ITEM.

Definition at line 1146 of file sch_sheet.cpp.

References NETLIST_OBJECT::ConvertBusToNetListItems(), GetText(), IsBusLabel(), NETLIST_OBJECT::m_Comp, NETLIST_OBJECT::m_End, NETLIST_OBJECT::m_Label, NETLIST_OBJECT::m_Link, m_pins, NETLIST_OBJECT::m_SheetPath, NETLIST_OBJECT::m_SheetPathInclude, NETLIST_OBJECT::m_Start, NETLIST_OBJECT::m_Type, and NET_SHEETLABEL.

1148 {
1149  SCH_SHEET_PATH sheetPath = *aSheetPath;
1150  sheetPath.push_back( this );
1151 
1152  for( size_t i = 0; i < m_pins.size(); i++ )
1153  {
1154  NETLIST_OBJECT* item = new NETLIST_OBJECT();
1155  item->m_SheetPathInclude = sheetPath;
1156  item->m_SheetPath = *aSheetPath;
1157  item->m_Comp = &m_pins[i];
1158  item->m_Link = this;
1159  item->m_Type = NET_SHEETLABEL;
1160  item->m_Label = m_pins[i].GetText();
1161  item->m_Start = item->m_End = m_pins[i].GetPosition();
1162  aNetListItems.push_back( item );
1163 
1164  if( IsBusLabel( m_pins[i].GetText() ) )
1165  item->ConvertBusToNetListItems( aNetListItems );
1166  }
1167 }
bool IsBusLabel(const wxString &aLabel)
Function IsBusLabel test if aLabel has a bus notation.
SCH_SHEET_PATH m_SheetPathInclude
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
Class SCH_SHEET_PATH.
void ConvertBusToNetListItems(NETLIST_OBJECT_LIST &aNetListItems)
Function ConvertBusToNetListItems breaks the text of a bus label type net list object into as many me...
int SCH_SHEET::GetPenSize ( ) const
overridevirtual

Function GetPenSize virtual pure.

Returns
the size of the "pen" that be used to draw or plot this item

Reimplemented from SCH_ITEM.

Definition at line 564 of file sch_sheet.cpp.

References GetDefaultLineThickness().

Referenced by Draw(), GetBoundingBox(), GetFileNamePosition(), and Plot().

565 {
566  return GetDefaultLineThickness();
567 }
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
SCH_SHEET_PIN * SCH_SHEET::GetPin ( const wxPoint aPosition)

Return the sheet pin item found at aPosition in the sheet.

Parameters
aPositionThe position to check for a sheet pin.
Returns
The sheet pin found at aPosition or NULL if no sheet pin is found.

Definition at line 552 of file sch_sheet.cpp.

References m_pins.

Referenced by SCH_SCREEN::GetItem(), and SCH_SCREEN::GetSheetLabel().

553 {
554  for( SCH_SHEET_PIN& pin : m_pins )
555  {
556  if( pin.HitTest( aPosition, 0 ) )
557  return &pin;
558  }
559 
560  return NULL;
561 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
SCH_SHEET_PINS& SCH_SHEET::GetPins ( )
inline

Definition at line 348 of file sch_sheet.h.

References m_pins.

Referenced by GetConnectionPoints(), GetEndPoints(), IsDangling(), IsDanglingStateChanged(), and SCH_LEGACY_PLUGIN::saveSheet().

348 { return m_pins; }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
SCH_SHEET_PINS& SCH_SHEET::GetPins ( ) const
inline

Definition at line 350 of file sch_sheet.h.

References m_pins.

351  {
352  return const_cast< SCH_SHEET_PINS& >( m_pins );
353  }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PINS
Definition: sch_sheet.h:209
wxPoint SCH_SHEET::GetPosition ( ) const
inlineoverridevirtual

Function GetPosition.

Returns
A wxPoint object containing the schematic item position.

Implements SCH_ITEM.

Definition at line 582 of file sch_sheet.h.

References m_pos.

Referenced by GetConnectionPoints(), resizeSheetWithMouseCursor(), and SCH_LEGACY_PLUGIN::saveSheet().

582 { return m_pos; }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
wxPoint SCH_SHEET::GetResizePosition ( ) const

Function GetResizePos returns the position of the lower right corner of the sheet in drawing units.

Returns
A wxPoint containing lower right corner of the sheet in drawing units.

Definition at line 1140 of file sch_sheet.cpp.

References m_pos, m_size, wxPoint::x, and wxPoint::y.

Referenced by SCH_EDIT_FRAME::CreateSheet(), and SCH_EDIT_FRAME::ReSizeSheet().

1141 {
1142  return wxPoint( m_pos.x + m_size.GetWidth(), m_pos.y + m_size.GetHeight() );
1143 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
SCH_SHEET * SCH_SHEET::GetRootSheet ( )

Function GetRootSheet.

returns the root sheet of this SCH_SHEET object.

The root (top level) sheet can be found by walking up the parent links until the only sheet that has no parent is found. The root sheet can be found from any sheet without having to maintain a global root sheet pointer.

Returns
a SCH_SHEET pointer to the root sheet.

Definition at line 135 of file sch_sheet.cpp.

References EDA_ITEM::GetParent(), and GetRootSheet().

Referenced by GetRootSheet(), and SCH_LEGACY_PLUGIN::Load().

136 {
137  SCH_SHEET* sheet = dynamic_cast< SCH_SHEET* >( GetParent() );
138 
139  if( sheet == NULL )
140  return this;
141 
142  // Recurse until a sheet is found with no parent which is the root sheet.
143  return sheet->GetRootSheet();
144 }
EDA_ITEM * GetParent() const
Definition: base_struct.h:222
SCH_SHEET * GetRootSheet()
Function GetRootSheet.
Definition: sch_sheet.cpp:135
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
int SCH_SHEET::GetScreenCount ( ) const

Function GetScreenCount returns the number of times the associated screen for the sheet is being used.

If no screen is associated with the sheet, then zero is returned.

Definition at line 126 of file sch_sheet.cpp.

References SCH_SCREEN::GetRefCount(), and m_screen.

Referenced by SCH_EDIT_FRAME::EditSheet().

127 {
128  if( m_screen == NULL )
129  return 0;
130 
131  return m_screen->GetRefCount();
132 }
int GetRefCount() const
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
wxString SCH_SHEET::GetSelectMenuText ( ) const
overridevirtual

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 from EDA_ITEM.

Definition at line 1103 of file sch_sheet.cpp.

References GetChars(), and m_name.

Referenced by Matches().

1104 {
1105  wxString tmp;
1106  tmp.Printf( _( "Hierarchical Sheet %s" ), GetChars( m_name ) );
1107  return tmp;
1108 }
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
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
wxPoint SCH_SHEET::GetSheetNamePosition ( )

Function GetSheetNamePosition.

Returns
the position of the anchor of sheet name text

Definition at line 570 of file sch_sheet.cpp.

References IsVerticalOrientation(), m_pos, m_size, wxPoint::x, and wxPoint::y.

Referenced by Draw(), and Matches().

571 {
572  wxPoint pos = m_pos;
573 
574  if( IsVerticalOrientation() )
575  {
576  pos.x -= 8;
577  pos.y += m_size.y;
578  }
579  else
580  {
581  pos.y -= 8;
582  }
583 
584  return pos;
585 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:402
int SCH_SHEET::GetSheetNameSize ( ) const
inline

Definition at line 278 of file sch_sheet.h.

References m_sheetNameSize.

Referenced by SCH_EDIT_FRAME::EditSheet(), and SCH_LEGACY_PLUGIN::saveSheet().

278 { return m_sheetNameSize; }
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize SCH_SHEET::GetSize ( )
inline

Definition at line 288 of file sch_sheet.h.

References m_size.

Referenced by SCH_LEGACY_PLUGIN::saveSheet().

288 { return m_size; }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
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
wxPoint& SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 161 of file sch_item_struct.h.

References SCH_ITEM::m_storedPos.

Referenced by moveItemWithMouseCursor().

161 { return m_storedPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor) ...
bool SCH_SHEET::HasPin ( const wxString &  aName)

Checks if the sheet already has a sheet pin named aName.

Parameters
aNameName of the sheet pin to search for.
Returns
True if sheet pin with aName is found, otherwise false.

Definition at line 390 of file sch_sheet.cpp.

References m_pins.

Referenced by SCH_EDIT_FRAME::ImportSheetPin().

391 {
392  for( SCH_SHEET_PIN pin : m_pins )
393  {
394  if( pin.GetText().CmpNoCase( aName ) == 0 )
395  return true;
396  }
397 
398  return false;
399 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
bool SCH_SHEET::HasPins ( )
inline

Definition at line 388 of file sch_sheet.h.

Referenced by resizeSheetWithMouseCursor().

388 { return !m_pins.empty(); }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
bool SCH_SHEET::HasUndefinedPins ( )

Check all sheet labels against schematic for undefined hierarchical labels.

Returns
True if there are any undefined labels.

Definition at line 413 of file sch_sheet.cpp.

References SCH_SCREEN::GetDrawItems(), EDA_TEXT::GetText(), m_pins, m_screen, EDA_ITEM::Next(), SCH_HIERARCHICAL_LABEL_T, and EDA_ITEM::Type().

Referenced by AddMenusForHierchicalSheet(), and SCH_EDIT_FRAME::Process_Special_Functions().

414 {
415  for( SCH_SHEET_PIN pin : m_pins )
416  {
417  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
418  EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
419  const SCH_HIERLABEL* HLabel = NULL;
420 
421  for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
422  {
423  if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
424  continue;
425 
426  HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
427 
428  if( pin.GetText().CmpNoCase( HLabel->GetText() ) == 0 )
429  break; // Found!
430 
431  HLabel = NULL;
432  }
433 
434  if( HLabel == NULL ) // Corresponding hierarchical label not found.
435  return true;
436  }
437 
438  return false;
439 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
EDA_ITEM * Next() const
Definition: base_struct.h:220
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
virtual bool SCH_ITEM::HitTest ( const wxPoint aPosition) const
inlineoverridevirtualinherited

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 from EDA_ITEM.

Definition at line 321 of file sch_item_struct.h.

322  {
323  return HitTest( aPosition, 0 );
324  }
virtual bool HitTest(const wxPoint &aPosition) const override
Function HitTest tests if aPosition is contained within or on the bounding area of an item...
bool SCH_SHEET::HitTest ( const wxPoint aPosition,
int  aAccuracy 
) const
overridevirtual

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

Parameters
aPositionA reference to a wxPoint object containing the coordinates to test.
aAccuracyIncrease the item bounding box by this amount.
Returns
True if aPosition is within the item bounding box.

Reimplemented from SCH_ITEM.

Definition at line 1117 of file sch_sheet.cpp.

References EDA_RECT::Contains(), GetBoundingBox(), and EDA_RECT::Inflate().

1118 {
1119  EDA_RECT rect = GetBoundingBox();
1120 
1121  rect.Inflate( aAccuracy );
1122 
1123  return rect.Contains( aPosition );
1124 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:680
Class EDA_RECT handles the component boundary box.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool SCH_SHEET::HitTest ( const EDA_RECT aRect,
bool  aContained = false,
int  aAccuracy = 0 
) const
overridevirtual

Function HitTest tests if aRect intersects or is contained within the bounding box of an item.

Parameters
aRectA reference to a EDA_RECT object containing the rectangle to test.
aContainedSet to true to test for containment instead of an intersection.
aAccuracyIncrease aRect by this amount.
Returns
True if aRect contains or intersects the item bounding box.

Reimplemented from SCH_ITEM.

Definition at line 1127 of file sch_sheet.cpp.

References EDA_RECT::Contains(), GetBoundingBox(), EDA_RECT::Inflate(), and EDA_RECT::Intersects().

1128 {
1129  EDA_RECT rect = aRect;
1130 
1131  rect.Inflate( aAccuracy );
1132 
1133  if( aContained )
1134  return rect.Contains( GetBoundingBox() );
1135 
1136  return rect.Intersects( GetBoundingBox() );
1137 }
bool Contains(const wxPoint &aPoint) const
Function Contains.
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:680
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class EDA_RECT handles the component boundary box.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 238 of file base_struct.h.

References BRIGHTENED.

Referenced by SELECTION_TOOL::disambiguationMenu().

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 SCH_SHEET::IsConnectable ( ) const
inlineoverridevirtual

Function IsConnectable returns true if the schematic item can connect to another schematic item.

Reimplemented from SCH_ITEM.

Definition at line 567 of file sch_sheet.h.

567 { return true; }
bool SCH_ITEM::IsConnected ( const wxPoint aPoint) const
inherited

Function IsConnected tests the item to see if it is connected to aPoint.

Parameters
aPointA reference to a wxPoint object containing the coordinates to test.
Returns
True if connection to aPoint exists.

Definition at line 79 of file sch_item_struct.cpp.

References SCH_ITEM::doIsConnected(), EDA_ITEM::m_Flags, SKIP_STRUCT, and STRUCT_DELETED.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), SCH_SCREEN::CountConnectedItems(), and SCH_SCREEN::IsTerminalPoint().

80 {
82  return false;
83 
84  return doIsConnected( aPosition );
85 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:138
virtual bool doIsConnected(const wxPoint &aPosition) const
Function doIsConnected provides the object specific test to see if it is connected to aPosition...
#define STRUCT_DELETED
flag indication structures to be erased
Definition: base_struct.h:136
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:189
bool SCH_SHEET::IsDangling ( ) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1041 of file sch_sheet.cpp.

References GetPins().

Referenced by IsDanglingStateChanged().

1042 {
1043  // If any hierarchical label in the sheet is dangling, then the sheet is dangling.
1044  for( size_t i = 0; i < GetPins().size(); i++ )
1045  {
1046  if( GetPins()[i].IsDangling() )
1047  return true;
1048  }
1049 
1050  return false;
1051 }
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
bool SCH_SHEET::IsDanglingStateChanged ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

Function IsDanglingStateChanged tests the schematic item to aItemList to check if it's dangling state has changed.

Note that the return value only true when the state of the test has changed. Use the IsDangling() method to get the current dangling state of the item. Some of the schematic objects cannot be tested for a dangling state, the default method always returns false. Only override the method if the item can be tested for a dangling state.

Parameters
aItemList- List of items to test item against.
Returns
True if the dangling state has changed from it's current setting.

Reimplemented from SCH_ITEM.

Definition at line 1028 of file sch_sheet.cpp.

References GetPins(), and IsDangling().

1029 {
1030  bool currentState = IsDangling();
1031 
1032  for( SCH_SHEET_PIN& pinsheet : GetPins() )
1033  {
1034  pinsheet.IsDanglingStateChanged( aItemList );
1035  }
1036 
1037  return currentState != IsDangling();
1038 }
bool IsDangling() const override
Definition: sch_sheet.cpp:1041
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
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 SCH_SHEET::IsMovableFromAnchorPoint ( )
inlineoverridevirtual

Virtual function IsMovableFromAnchorPoint Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor Usually return true for small items (labels, junctions) and false for items which can be large (hierarchical sheets, compoments)

Returns
false for a hierarchical sheet

Reimplemented from SCH_ITEM.

Definition at line 272 of file sch_sheet.h.

272 { return false; }
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
bool SCH_SHEET::IsReplaceable ( ) const
inlineoverridevirtual

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 from EDA_ITEM.

Definition at line 538 of file sch_sheet.h.

538 { return true; }
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 SCH_SHEET::IsSelectStateChanged ( const wxRect &  aRect)
overridevirtual

Function IsSelectStateChanged checks if the selection state of an item inside aRect has changed.

This is used by the block selection code to verify if an item is selected or not. True is be return anytime the select state changes. If you need to know the the current selection state, use the IsSelected() method.

Parameters
aRect- Rectangle to test against.

Reimplemented from SCH_ITEM.

Definition at line 1054 of file sch_sheet.cpp.

References boundingBox(), EDA_ITEM::ClearFlags(), GetBoundingBox(), EDA_ITEM::IsSelected(), SELECTED, and EDA_ITEM::SetFlags().

1055 {
1056  bool previousState = IsSelected();
1057 
1059 
1060  if( aRect.Intersects( boundingBox ) )
1061  SetFlags( SELECTED );
1062  else
1063  ClearFlags( SELECTED );
1064 
1065  return previousState != IsSelected();
1066 }
bool IsSelected() const
Definition: base_struct.h:235
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:680
Class EDA_RECT handles the component boundary box.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:268
bool SCH_SHEET::IsVerticalOrientation ( ) const

Definition at line 402 of file sch_sheet.cpp.

References m_pins.

Referenced by Draw(), GetFileNamePosition(), GetSheetNamePosition(), Plot(), and SCH_SHEET_PIN::SCH_SHEET_PIN().

403 {
404  for( SCH_SHEET_PIN pin : m_pins )
405  {
406  if( pin.GetEdge() > 1 )
407  return true;
408  }
409  return false;
410 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
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(), 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 SCH_SHEET::Load ( LINE_READER aLine,
wxString &  aErrorMsg 
)
overridevirtual

Function Load reads a schematic item from aLine in a .sch file.

Parameters
aLine- Essentially this is file to read the object from.
aErrorMsg- Description of the error if an error occurs while loading the object.
Returns
True if the object loaded successfully.

Reimplemented from SCH_ITEM.

Definition at line 188 of file sch_sheet.cpp.

References AddPin(), FROM_UTF8(), GetDefaultTextSize(), GetNewTimeStamp(), LINE_READER::LineNumber(), SCH_SHEET_PIN::Load(), m_fileNameSize, m_name, m_pos, m_sheetNameSize, m_size, EDA_ITEM::m_TimeStamp, ReadDelimitedText(), LINE_READER::ReadLine(), SCH_SHEET_PIN, SetFileName(), EDA_ITEM::SetTimeStamp(), timeStamp(), wxPoint::x, and wxPoint::y.

Referenced by SCH_EDIT_FRAME::EditSheet(), and Load().

189 {
190  int fieldNdx, size;
191  SCH_SHEET_PIN* sheetPin;
192  char* ptcar;
193  unsigned long timeStamp = 0UL;
194 
196 
197  // sheets are added to the GetDrawItems() like other schematic components.
198  // however, in order to preserve the hierarchy (through m_Parent pointers),
199  // a duplicate of the sheet is added to m_SubSheet array.
200  // must be a duplicate, references just work for a two-layer structure.
201  // this is accomplished through the Sync() function.
202 
203  if( ((char*)aLine)[0] == '$' ) // line should be "$Sheet"
204  {
205  if( !aLine.ReadLine() )
206  {
207  aErrorMsg.Printf( wxT( "Read File Error" ) );
208  return false;
209  }
210  }
211 
212  /* Next line: must be "S xx yy nn mm" with xx, yy = sheet position
213  * ( upper left corner ) et nn,mm = sheet size */
214  if( ( sscanf( &((char*)aLine)[1], "%d %d %d %d",
215  &m_pos.x, &m_pos.y, &m_size.x, &m_size.y ) != 4 )
216  || ( ((char*)aLine)[0] != 'S' ) )
217  {
218  aErrorMsg.Printf( wxT( " ** Eeschema file sheet struct error at line %d, aborted\n" ),
219  aLine.LineNumber() );
220 
221  aErrorMsg << FROM_UTF8( ((char*)aLine) );
222  return false;
223  }
224 
225  /* Read fields */
226  for( ; ; ) /* Analysis of lines "Fn" text. */
227  {
228  if( !aLine.ReadLine() )
229  return false;
230 
231  if( ((char*)aLine)[0] == 'U' )
232  {
233  sscanf( ((char*)aLine) + 1, "%lX", &timeStamp );
234 
235  m_TimeStamp = (time_t) timeStamp;
236 
237  if( m_TimeStamp == 0 ) // zero is not unique!
239 
240  continue;
241  }
242 
243  if( ((char*)aLine)[0] != 'F' )
244  break;
245 
246  sscanf( ((char*)aLine) + 1, "%d", &fieldNdx );
247 
248  /* Read the field:
249  * If fieldNdx> = 2: Fn "text" t s posx posy
250  * If F0 "text" for SheetName
251  * F1 and "text" for filename
252  */
253  ptcar = ((char*)aLine);
254 
255  while( *ptcar && ( *ptcar != '"' ) )
256  ptcar++;
257 
258  if( *ptcar != '"' )
259  {
260  aErrorMsg.Printf( wxT( "Eeschema file sheet label F%d at line %d, aborted\n" ),
261  fieldNdx, aLine.LineNumber() );
262  aErrorMsg << FROM_UTF8( (char*) aLine );
263  return false;
264  }
265 
266  wxString sheetName;
267  ptcar += ReadDelimitedText( &sheetName, ptcar );
268 
269  if( *ptcar == 0 )
270  {
271  aErrorMsg.Printf( wxT( "Eeschema file sheet field F at line %d, aborted\n" ),
272  aLine.LineNumber() );
273  aErrorMsg << FROM_UTF8( (char*) aLine );
274  return false;
275  }
276 
277  if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) )
278  {
279  if( sscanf( ptcar, "%d", &size ) != 1 )
280  {
281  aErrorMsg.Printf( wxT( "Eeschema file sheet Label error line %d, aborted\n" ),
282  aLine.LineNumber() );
283 
284  aErrorMsg << FROM_UTF8( (char*) aLine );
285  }
286 
287  if( size == 0 )
288  size = GetDefaultTextSize();
289 
290  if( fieldNdx == 0 )
291  {
292  m_name = sheetName;
293  m_sheetNameSize = size;
294  }
295  else
296  {
297  SetFileName( sheetName );
298  m_fileNameSize = size;
299  }
300  }
301 
302  if( fieldNdx > 1 )
303  {
304  sheetPin = new SCH_SHEET_PIN( this );
305 
306  if( !sheetPin->Load( aLine, aErrorMsg ) )
307  {
308  delete sheetPin;
309  sheetPin = NULL;
310  return false;
311  }
312 
313  AddPin( sheetPin );
314  }
315  }
316 
317  if( strncasecmp( "$End", ((char*)aLine), 4 ) != 0 )
318  {
319  aErrorMsg.Printf( wxT( "**Eeschema file end_sheet struct error at line %d, aborted\n" ),
320  aLine.LineNumber() );
321  aErrorMsg << FROM_UTF8( ((char*)aLine) );
322  return false;
323  }
324 
325  return true;
326 }
virtual unsigned LineNumber() const
Function Line Number returns the line number of the last line read from this LINE_READER.
Definition: richio.h:159
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
void SetFileName(const wxString &aFilename)
Definition: sch_sheet.h:503
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
unsigned long timeStamp(wxXmlNode *aTree)
Make a unique time stamp.
friend class SCH_SHEET_PIN
Definition: sch_sheet.h:218
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
time_t GetNewTimeStamp()
Definition: common.cpp:166
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void AddPin(SCH_SHEET_PIN *aSheetPin)
Add aSheetPin to the sheet.
Definition: sch_sheet.cpp:358
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
bool Load(LINE_READER &aLine, wxString &aErrorMsg) override
Function Load reads a schematic item from aLine in a .sch file.
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
virtual char * ReadLine()=0
Function ReadLine reads a line of text into the buffer and increments the line number counter...
int ReadDelimitedText(wxString *aDest, const char *aSource)
Function ReadDelimitedText copies bytes from aSource delimited string segment to aDest wxString...
Definition: string.cpp:43
int GetDefaultTextSize()
Default size for text in general.
bool SCH_SHEET::Load ( SCH_EDIT_FRAME aFrame)

Function Load.

for the sheet: load the file m_fileName if a screen already exists, the file is already read. m_screen point on the screen, and its m_RefCount is incremented else creates a new associated screen and load the data file.

Parameters
aFrame= a SCH_EDIT_FRAME pointer to the maim schematic frame
Returns
true if OK

Definition at line 806 of file sch_sheet.cpp.

References g_RootSheet, SCH_SCREEN::GetDrawItems(), KIWAY_HOLDER::Kiway(), Load(), SCH_EDIT_FRAME::LoadOneEEFile(), m_fileName, m_screen, EDA_ITEM::Next(), SCH_SHEET_T, SearchHierarchy(), EDA_ITEM::SetParent(), SetScreen(), and EDA_ITEM::Type().

807 {
808  bool success = true;
809 
810  SCH_SCREEN* screen = NULL;
811 
812  if( !m_screen )
813  {
815 
816  if( screen )
817  {
818  SetScreen( screen );
819 
820  //do not need to load the sub-sheets - this has already been done.
821  }
822  else
823  {
824  SetScreen( new SCH_SCREEN( &aFrame->Kiway() ) );
825 
826  success = aFrame->LoadOneEEFile( m_screen, m_fileName );
827 
828  if( success )
829  {
830  EDA_ITEM* bs = m_screen->GetDrawItems();
831 
832  while( bs )
833  {
834  if( bs->Type() == SCH_SHEET_T )
835  {
836  SCH_SHEET* sheet = (SCH_SHEET*) bs;
837 
838  // Set the parent to this sheet. This effectively creates a method
839  // to find the root sheet from any sheet so a pointer to the root
840  // sheet does not need to be stored globally. Note: this is not the
841  // same as a hierarchy. Complex hierarchies can have multiple copies
842  // of a sheet. This only provides a simple tree to find the root sheet.
843  sheet->SetParent( this );
844 
845  if( !sheet->Load( aFrame ) )
846  success = false;
847  }
848 
849  bs = bs->Next();
850  }
851  }
852  }
853  }
854 
855  return success;
856 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
bool Load(LINE_READER &aLine, wxString &aErrorMsg) override
Function Load reads a schematic item from aLine in a .sch file.
Definition: sch_sheet.cpp:188
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName".
Definition: sch_sheet.cpp:744
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:103
EDA_ITEM * Next() const
Definition: base_struct.h:220
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
bool LoadOneEEFile(SCH_SCREEN *aScreen, const wxString &aFullFileName, bool append=false)
Function LoadOneEEFile loads the schematic (.sch) file aFullFileName into aScreen.
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
bool SCH_SHEET::LocatePathOfScreen ( SCH_SCREEN aScreen,
SCH_SHEET_PATH aList 
)

Function LocatePathOfScreen search the existing hierarchy for an instance of screen "FileName".

don't bother looking at the root sheet - it must be unique, no other references to its m_screen otherwise there would be loops in the hierarchy.

Parameters
aScreen= the SCH_SCREEN* screen that we search for
aList= the SCH_SHEET_PATH* that must be used
Returns
true if found

Definition at line 775 of file sch_sheet.cpp.

References SCH_SCREEN::GetDrawItems(), LocatePathOfScreen(), m_screen, EDA_ITEM::Next(), SCH_SHEET_T, and EDA_ITEM::Type().

Referenced by LocatePathOfScreen().

776 {
777  if( m_screen )
778  {
779  aList->push_back( this );
780 
781  if( m_screen == aScreen )
782  return true;
783 
784  EDA_ITEM* strct = m_screen->GetDrawItems();
785 
786  while( strct )
787  {
788  if( strct->Type() == SCH_SHEET_T )
789  {
790  SCH_SHEET* ss = (SCH_SHEET*) strct;
791 
792  if( ss->LocatePathOfScreen( aScreen, aList ) )
793  return true;
794  }
795 
796  strct = strct->Next();
797  }
798 
799  aList->pop_back();
800  }
801 
802  return false;
803 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
EDA_ITEM * Next() const
Definition: base_struct.h:220
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Function LocatePathOfScreen search the existing hierarchy for an instance of screen "FileName"...
Definition: sch_sheet.cpp:775
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
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 SCH_SHEET::Matches ( wxFindReplaceData &  aSearchData,
void *  aAuxData,
wxPoint aFindLocation 
)
overridevirtual

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 from EDA_ITEM.

Definition at line 970 of file sch_sheet.cpp.

References FR_SEARCH_REPLACE, GetFileNamePosition(), GetSelectMenuText(), GetSheetNamePosition(), m_fileName, m_name, EDA_ITEM::Matches(), and traceFindItem.

971 {
972  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
973 
974  // Ignore the sheet file name if searching to replace.
975  if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE)
976  && SCH_ITEM::Matches( m_fileName, aSearchData ) )
977  {
978  if( aFindLocation )
979  *aFindLocation = GetFileNamePosition();
980 
981  return true;
982  }
983 
984  if( SCH_ITEM::Matches( m_name, aSearchData ) )
985  {
986  if( aFindLocation )
987  *aFindLocation = GetSheetNamePosition();
988 
989  return true;
990  }
991 
992  return false;
993 }
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:414
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
const wxString traceFindItem
Flag to enable finding schematic item debug output.
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_sheet.cpp:1103
wxPoint GetFileNamePosition()
Function GetFileNamePosition.
Definition: sch_sheet.cpp:588
wxPoint GetSheetNamePosition()
Function GetSheetNamePosition.
Definition: sch_sheet.cpp:570
Perform a search for a item that has replaceable text.
void SCH_SHEET::MirrorX ( int  aXaxis_position)
overridevirtual

Function MirrorX mirrors item relative to the X axis about aXaxis_position.

Parameters
aXaxis_positionThe X axis position to mirror around.

Implements SCH_ITEM.

Definition at line 923 of file sch_sheet.cpp.

References m_pins, m_pos, m_size, MIRROR(), and wxPoint::y.

Referenced by SCH_EDIT_FRAME::MirrorSheet().

924 {
925  MIRROR( m_pos.y, aXaxis_position );
926  m_pos.y -= m_size.y;
927 
928  for( SCH_SHEET_PIN& sheetPin : m_pins )
929  {
930  sheetPin.MirrorX( aXaxis_position );
931  }
932 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SCH_SHEET::MirrorY ( int  aYaxis_position)
overridevirtual

Function MirrorY mirrors item relative to the Y axis about aYaxis_position.

Parameters
aYaxis_positionThe Y axis position to mirror around.

Implements SCH_ITEM.

Definition at line 935 of file sch_sheet.cpp.

References m_pins, m_pos, m_size, MIRROR(), and wxPoint::x.

Referenced by SCH_EDIT_FRAME::MirrorSheet().

936 {
937  MIRROR( m_pos.x, aYaxis_position );
938  m_pos.x -= m_size.x;
939 
940  for( SCH_SHEET_PIN& label : m_pins )
941  {
942  label.MirrorY( aYaxis_position );
943  }
944 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SCH_SHEET::Move ( const wxPoint aMoveVector)
inlineoverridevirtual

Function Move moves the item by aMoveVector to a new position.

Parameters
aMoveVector= the displacement vector

Implements SCH_ITEM.

Definition at line 518 of file sch_sheet.h.

Referenced by SetPosition().

519  {
520  m_pos += aMoveVector;
521 
522  for( SCH_SHEET_PIN& pin : m_pins )
523  {
524  pin.Move( aMoveVector );
525  }
526  }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
SCH_ITEM* SCH_ITEM::Next ( ) const
inlineinherited

Definition at line 149 of file sch_item_struct.h.

References EDA_ITEM::Pnext.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), SCH_SHEET_LIST::AnnotatePowerSymbols(), SCH_EDIT_FRAME::AppendOneEEProject(), SCH_SCREEN::BreakSegment(), SCH_SCREEN::BreakSegmentsOnJunctions(), NETLIST_OBJECT_LIST::BuildNetListInfo(), HIERARCHY_NAVIG_DLG::BuildTree(), SCH_SCREEN::CheckIfOnDrawList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::ClearDrawingState(), SCH_SCREEN::CountConnectedItems(), SCH_EDIT_FRAME::CreateArchiveLibrary(), SCH_SCREENS::DeleteAllMarkers(), DIALOG_ERC::DisplayERC_MarkersList(), SCH_SCREEN::Draw(), SCH_EDIT_FRAME::EndSegment(), SCH_SCREEN::ExtractWires(), SCH_EDIT_FRAME::FindComponentAndItem(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FirstDrawList(), SCH_LEGACY_PLUGIN::Format(), get_components(), AUTOPLACER::get_possible_colliders(), SCH_SHEET_PATH::GetComponents(), SCH_SCREEN::GetConnection(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREEN::GetItem(), SCH_SCREEN::GetLabel(), SCH_SCREEN::GetLine(), SCH_SCREENS::GetMarkerCount(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SCREEN::GetNode(), SCH_SCREEN::GetPin(), SCH_SCREEN::GetSheet(), SCH_SCREEN::GetSheetLabel(), SCH_SCREEN::GetWireOrBus(), SCH_SCREENS::HasNoFullyDefinedLibIds(), SCH_SCREEN::MarkConnections(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_ERC::OnLeftClickMarkersList(), SCH_SCREEN::Plot(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_SCREEN::ReplaceWires(), SCH_SCREEN::Save(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SetComponentFootprint(), SCH_EDIT_FRAME::SetCurrentSheetHighlightFlags(), SCH_SCREEN::TestDanglingEnds(), TestDuplicateSheetNames(), and SCH_SCREEN::UpdatePickList().

149 { return static_cast<SCH_ITEM*>( Pnext ); }
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:178
bool SCH_ITEM::operator< ( const SCH_ITEM aItem) const
virtualinherited

Reimplemented in SCH_COMPONENT, and SCH_LINE.

Definition at line 94 of file sch_item_struct.cpp.

References SCH_ITEM::GetClass(), and EDA_ITEM::Type().

95 {
96  wxCHECK_MSG( false, this->Type() < aItem.Type(),
97  wxT( "Less than operator not defined for " ) + GetClass() );
98 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
virtual wxString GetClass() const override
Function GetClass returns the class name.
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
SCH_ITEM & SCH_SHEET::operator= ( const SCH_ITEM aSheet)

Definition at line 1248 of file sch_sheet.cpp.

References SCH_ITEM::GetClass(), GetClass(), m_fileNameSize, m_name, m_pins, m_pos, m_sheetNameSize, m_size, EDA_ITEM::operator=(), and EDA_ITEM::Type().

1249 {
1250  wxLogDebug( wxT( "Sheet assignment operator." ) );
1251 
1252  wxCHECK_MSG( Type() == aItem.Type(), *this,
1253  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1254  GetClass() );
1255 
1256  if( &aItem != this )
1257  {
1258  SCH_ITEM::operator=( aItem );
1259 
1260  SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
1261 
1262  m_pos = sheet->m_pos;
1263  m_size = sheet->m_size;
1264  m_name = sheet->m_name;
1266  m_fileNameSize = sheet->m_fileNameSize;
1267  m_pins = sheet->m_pins;
1268 
1269  // Ensure sheet labels have their #m_Parent member pointing really on their
1270  // parent, after assigning.
1271  for( SCH_SHEET_PIN& sheetPin : m_pins )
1272  {
1273  sheetPin.SetParent( this );
1274  }
1275  }
1276 
1277  return *this;
1278 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_sheet.h:259
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
void SCH_SHEET::Plot ( PLOTTER aPlotter)
overridevirtual

Function Plot plots the schematic item to aPlotter.

Parameters
aPlotterA pointer to a PLOTTER object.

Reimplemented from SCH_ITEM.

Definition at line 1170 of file sch_sheet.cpp.

References Clamp_Text_PenSize(), PLOTTER::FinishTo(), GetDefaultLineThickness(), GetFileName(), SCH_ITEM::GetLayer(), GetLayerColor(), GetPenSize(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_TOP, IsVerticalOrientation(), LAYER_SHEETFILENAME, LAYER_SHEETNAME, PLOTTER::LineTo(), m_fileNameSize, m_name, m_pins, m_pos, m_sheetNameSize, m_size, PLOTTER::MoveTo(), PLOTTER::SetColor(), PLOTTER::SetCurrentLineWidth(), PLOTTER::Text(), TEXT_ANGLE_HORIZ, TEXT_ANGLE_VERT, wxPoint::x, and wxPoint::y.

1171 {
1172  COLOR4D txtcolor = COLOR4D::UNSPECIFIED;
1173  wxSize size;
1174  wxString Text;
1175  int name_orientation;
1176  wxPoint pos_sheetname, pos_filename;
1177  wxPoint pos;
1178 
1179  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
1180 
1181  int thickness = GetPenSize();
1182  aPlotter->SetCurrentLineWidth( thickness );
1183 
1184  aPlotter->MoveTo( m_pos );
1185  pos = m_pos;
1186  pos.x += m_size.x;
1187 
1188  aPlotter->LineTo( pos );
1189  pos.y += m_size.y;
1190 
1191  aPlotter->LineTo( pos );
1192  pos = m_pos;
1193  pos.y += m_size.y;
1194 
1195  aPlotter->LineTo( pos );
1196  aPlotter->FinishTo( m_pos );
1197 
1198  if( IsVerticalOrientation() )
1199  {
1200  pos_sheetname = wxPoint( m_pos.x - 8, m_pos.y + m_size.y );
1201  pos_filename = wxPoint( m_pos.x + m_size.x + 4, m_pos.y + m_size.y );
1202  name_orientation = TEXT_ANGLE_VERT;
1203  }
1204  else
1205  {
1206  pos_sheetname = wxPoint( m_pos.x, m_pos.y - 4 );
1207  pos_filename = wxPoint( m_pos.x, m_pos.y + m_size.y + 4 );
1208  name_orientation = TEXT_ANGLE_HORIZ;
1209  }
1210 
1211  /* Draw texts: SheetName */
1212  Text = m_name;
1213  size = wxSize( m_sheetNameSize, m_sheetNameSize );
1214 
1215  //pos = m_pos; pos.y -= 4;
1216  thickness = GetDefaultLineThickness();
1217  thickness = Clamp_Text_PenSize( thickness, size, false );
1218 
1219  aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
1220 
1221  bool italic = false;
1222  aPlotter->Text( pos_sheetname, txtcolor, Text, name_orientation, size,
1224  thickness, italic, false );
1225 
1226  /*Draw texts : FileName */
1227  Text = GetFileName();
1228  size = wxSize( m_fileNameSize, m_fileNameSize );
1229  thickness = GetDefaultLineThickness();
1230  thickness = Clamp_Text_PenSize( thickness, size, false );
1231 
1232  aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) );
1233 
1234  aPlotter->Text( pos_filename, txtcolor, Text, name_orientation, size,
1236  thickness, italic, false );
1237 
1238  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
1239 
1240  /* Draw texts : SheetLabel */
1241  for( size_t i = 0; i < m_pins.size(); i++ )
1242  {
1243  m_pins[i].Plot( aPlotter );
1244  }
1245 }
void FinishTo(const wxPoint &pos)
Definition: plot_common.h:241
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
virtual void SetColor(COLOR4D color)=0
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:564
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
#define TEXT_ANGLE_VERT
Definition: common.h:92
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Definition: drawtxt.cpp:229
void LineTo(const wxPoint &pos)
Definition: plot_common.h:236
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
Definition: drawtxt.cpp:67
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:880
void MoveTo(const wxPoint &pos)
Definition: plot_common.h:231
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:402
virtual void SetCurrentLineWidth(int width, void *aData=NULL)=0
Set the line width for the next drawing.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void SCH_SHEET::RemovePin ( SCH_SHEET_PIN aSheetPin)

Remove aSheetPin from the sheet.

Parameters
aSheetPinThe sheet pin item to remove from the sheet.

Definition at line 368 of file sch_sheet.cpp.

References GetChars(), EDA_TEXT::GetShownText(), m_name, m_pins, renumberPins(), SCH_SHEET_PIN_T, and EDA_ITEM::Type().

Referenced by SCH_SCREEN::DeleteItem(), and SCH_EDIT_FRAME::DeleteItem().

369 {
370  wxASSERT( aSheetPin != NULL );
371  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
372 
373  SCH_SHEET_PINS::iterator i;
374 
375  for( i = m_pins.begin(); i < m_pins.end(); ++i )
376  {
377  if( *i == aSheetPin )
378  {
379  m_pins.erase( i );
380  renumberPins();
381  return;
382  }
383  }
384 
385  wxLogDebug( wxT( "Fix me: attempt to remove label %s which is not in sheet %s." ),
386  GetChars( aSheetPin->GetShownText() ), GetChars( m_name ) );
387 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:135
void renumberPins()
Renumber the sheet pins in the sheet.
Definition: sch_sheet.cpp:1002
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
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
void SCH_SHEET::renumberPins ( )
protected

Renumber the sheet pins in the sheet.

This method is used internally by SCH_SHEET to update the pin numbering when the pin list changes. Make sure you call this method any time a sheet pin is added or removed.

Definition at line 1002 of file sch_sheet.cpp.

References m_pins.

Referenced by AddPin(), and RemovePin().

1003 {
1004  int id = 2;
1005 
1006  for( SCH_SHEET_PIN& pin : m_pins )
1007  {
1008  pin.SetNumber( id );
1009  id++;
1010  }
1011 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
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(), 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.
bool SCH_SHEET::Replace ( wxFindReplaceData &  aSearchData,
void *  aAuxData = NULL 
)
overridevirtual

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 from EDA_ITEM.

Definition at line 996 of file sch_sheet.cpp.

References m_name, and EDA_ITEM::Replace().

997 {
998  return EDA_ITEM::Replace( aSearchData, m_name );
999 }
bool Replace(wxFindReplaceData &aSearchData, wxString &aText)
Helper function used in search and replace dialog Function Replace performs a text replace on aText u...
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
void SCH_SHEET::Resize ( const wxSize &  aSize)

Resize this sheet to aSize and adjust all of the labels accordingly.

Parameters
aSize- The new size for this sheet.

Definition at line 955 of file sch_sheet.cpp.

References m_pins, and m_size.

Referenced by resizeSheetWithMouseCursor().

956 {
957  if( aSize == m_size )
958  return;
959 
960  m_size = aSize;
961 
962  /* Move the sheet labels according to the new sheet size. */
963  for( SCH_SHEET_PIN& label : m_pins )
964  {
965  label.ConstrainOnEdge( label.GetPosition() );
966  }
967 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SCH_SHEET::Rotate ( wxPoint  aPosition)
overridevirtual

Function Rotate rotates the item around aPosition 90 degrees in the clockwise direction.

Parameters
aPositionA reference to a wxPoint object containing the coordinates to rotate around.

Implements SCH_ITEM.

Definition at line 899 of file sch_sheet.cpp.

References m_pins, m_pos, m_size, RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by SCH_EDIT_FRAME::RotateHierarchicalSheet().

900 {
901  RotatePoint( &m_pos, aPosition, 900 );
902  RotatePoint( &m_size.x, &m_size.y, 900 );
903 
904  if( m_size.x < 0 )
905  {
906  m_pos.x += m_size.x;
907  m_size.x = -m_size.x;
908  }
909 
910  if( m_size.y < 0 )
911  {
912  m_pos.y += m_size.y;
913  m_size.y = -m_size.y;
914  }
915 
916  for( SCH_SHEET_PIN& sheetPin : m_pins )
917  {
918  sheetPin.Rotate( aPosition );
919  }
920 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
bool SCH_SHEET::Save ( FILE *  aFile) const
overridevirtual

Function Save writes the data structures for this object out to a FILE in "*.sch" format.

Parameters
aFileThe FILE to write to.
Returns
bool - true if success writing else false.

Implements SCH_ITEM.

Definition at line 147 of file sch_sheet.cpp.

References EscapedUTF8(), m_fileName, m_fileNameSize, m_name, m_pins, m_pos, m_sheetNameSize, m_size, EDA_ITEM::m_TimeStamp, wxPoint::x, and wxPoint::y.

148 {
149  if( fprintf( aFile, "$Sheet\n" ) == EOF
150  || fprintf( aFile, "S %-4d %-4d %-4d %-4d\n",
151  m_pos.x, m_pos.y, m_size.x, m_size.y ) == EOF )
152  return false;
153 
154  //save the unique timestamp, like other schematic parts.
155  if( fprintf( aFile, "U %8.8lX\n", (unsigned long) m_TimeStamp ) == EOF )
156  return false;
157 
158  /* Save schematic sheetname and filename. */
159  if( !m_name.IsEmpty() )
160  {
161  if( fprintf( aFile, "F0 %s %d\n", EscapedUTF8( m_name ).c_str(),
162  m_sheetNameSize ) == EOF )
163  return false;
164  }
165 
166  if( !m_fileName.IsEmpty() )
167  {
168  if( fprintf( aFile, "F1 %s %d\n", EscapedUTF8( m_fileName ).c_str(),
169  m_fileNameSize ) == EOF )
170  return false;
171  }
172 
173  /* Save the list of labels in the sheet. */
174 
175  for( const SCH_SHEET_PIN& label : m_pins )
176  {
177  if( !label.Save( aFile ) )
178  return false;
179  }
180 
181  if( fprintf( aFile, "$EndSheet\n" ) == EOF )
182  return false;
183 
184  return true;
185 }
time_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:183
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
std::string EscapedUTF8(const wxString &aString)
Function EscapedUTF8 returns an 8 bit UTF8 string given aString in unicode form.
Definition: string.cpp:137
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
bool SCH_SHEET::SearchHierarchy ( const wxString &  aFilename,
SCH_SCREEN **  aScreen 
)

Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName".

Parameters
aFilename= the filename to find
aScreen= a location to return a pointer to the screen (if found)
Returns
bool if found, and a pointer to the screen

Definition at line 744 of file sch_sheet.cpp.

References SCH_SCREEN::GetDrawItems(), SCH_SCREEN::GetFileName(), m_screen, EDA_ITEM::Next(), SCH_SHEET_T, SearchHierarchy(), and EDA_ITEM::Type().

Referenced by SCH_EDIT_FRAME::EditSheet(), Load(), SCH_LEGACY_PLUGIN::loadHierarchy(), and SearchHierarchy().

745 {
746  if( m_screen )
747  {
748  EDA_ITEM* item = m_screen->GetDrawItems();
749 
750  while( item )
751  {
752  if( item->Type() == SCH_SHEET_T )
753  {
754  SCH_SHEET* sheet = (SCH_SHEET*) item;
755 
756  if( sheet->m_screen
757  && sheet->m_screen->GetFileName().CmpNoCase( aFilename ) == 0 )
758  {
759  *aScreen = sheet->m_screen;
760  return true;
761  }
762 
763  if( sheet->SearchHierarchy( aFilename, aScreen ) )
764  return true;
765  }
766 
767  item = item->Next();
768  }
769  }
770 
771  return false;
772 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName".
Definition: sch_sheet.cpp:744
const wxString & GetFileName() const
EDA_ITEM * Next() const
Definition: base_struct.h:220
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:165
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(), and DHEAD::remove().

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 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 SCH_SHEET::SetFileName ( const wxString &  aFilename)
inline

Definition at line 503 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), SCH_EDIT_FRAME::EditSheet(), Load(), and SCH_EDIT_FRAME::OpenProjectFiles().

504  {
505  m_fileName = aFilename;
506  // Filenames are stored using unix notation
507  m_fileName.Replace( wxT("\\"), wxT("/") );
508  }
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
void SCH_SHEET::SetFileNameSize ( int  aSize)
inline

Definition at line 284 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet().

284 { m_fileNameSize = aSize; }
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
void EDA_ITEM::SetFlags ( STATUS_FLAGS  aMask)
inlineinherited

Definition at line 267 of file base_struct.h.

Referenced by 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_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), 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 SCH_ITEM::SetLayer ( SCH_LAYER_ID  aLayer)
inlineinherited

Function SetLayer sets the layer this item is on.

Parameters
aLayerThe layer number.

Definition at line 176 of file sch_item_struct.h.

Referenced by SCH_COMPONENT::Init(), SCH_FIELD::SCH_FIELD(), and SCH_NO_CONNECT::SCH_NO_CONNECT().

176 { m_Layer = aLayer; }
SCH_LAYER_ID m_Layer
void EDA_ITEM::SetList ( DHEAD aList)
inlineinherited

Definition at line 228 of file base_struct.h.

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

228 { m_List = aList; }
DHEAD * m_List
which DLIST I am on.
Definition: base_struct.h:180
void EDA_ITEM::SetModified ( )
inherited
void SCH_SHEET::SetName ( const wxString &  aName)
inline

Definition at line 276 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), SCH_EDIT_FRAME::EditSheet(), and SCH_EDIT_FRAME::PasteListOfItems().

276 { m_name = aName; }
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
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(), and DHEAD::remove().

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(), Load(), 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(), MODULE_EDITOR_TOOLS::PasteItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), 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_PIN::SCH_SHEET_PIN(), LIB_PART::SetFields(), SetSchItemParent(), PCB_EDIT_FRAME::StartMoveModule(), BOARD_ITEM::SwapData(), SwapData(), and SCH_COMPONENT::SwapData().

227 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:182
void SCH_SHEET::SetPosition ( const wxPoint aPosition)
overridevirtual

Function SetPosition set the schematic item position to aPosition.

Parameters
aPositionA reference to a wxPoint object containing the new position.

Implements SCH_ITEM.

Definition at line 946 of file sch_sheet.cpp.

References m_pos, and Move().

947 {
948  // Remember the sheet and all pin sheet positions must be
949  // modified. So use Move function to do that.
950  Move( aPosition - m_pos );
951 }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
Definition: sch_sheet.h:518
void SCH_SHEET::SetScreen ( SCH_SCREEN aScreen)

Function SetScreen sets the screen associated with this sheet to aScreen.

The screen reference counting is performed by SetScreen. If aScreen is not the same as the current screen, the current screen reference count is decremented and aScreen becomes the screen for the sheet. If the current screen reference count reaches zero, the current screen is deleted. NULL is a valid value for aScreen.

Parameters
aScreenThe new screen to associate with the sheet.

Definition at line 103 of file sch_sheet.cpp.

References SCH_SCREEN::DecRefCount(), SCH_SCREEN::GetRefCount(), SCH_SCREEN::IncRefCount(), and m_screen.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), SCH_EDIT_FRAME::CreateScreens(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::EditSheet(), Load(), and SCH_LEGACY_PLUGIN::loadHierarchy().

104 {
105  if( aScreen == m_screen )
106  return;
107 
108  if( m_screen != NULL )
109  {
111 
112  if( m_screen->GetRefCount() == 0 )
113  {
114  delete m_screen;
115  m_screen = NULL;
116  }
117  }
118 
119  m_screen = aScreen;
120 
121  if( m_screen )
123 }
int GetRefCount() const
void DecRefCount()
Definition: sch_screen.cpp:133
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
void IncRefCount()
Definition: sch_screen.cpp:127
void EDA_ITEM::SetSelected ( )
inlineinherited

Definition at line 241 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by SELECTION_TOOL::selectVisually().

241 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:134
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:267
void SCH_SHEET::SetSheetNameSize ( int  aSize)
inline

Definition at line 280 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet().

280 { m_sheetNameSize = aSize; }
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
void SCH_SHEET::SetSize ( const wxSize &  aSize)
inline

Definition at line 290 of file sch_sheet.h.

290 { m_size = aSize; }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
void EDA_ITEM::SetStatus ( STATUS_FLAGS  aStatus)
inlineinherited
void SCH_ITEM::SetStoredPos ( wxPoint  aPos)
inlineinherited

Definition at line 162 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::PrepareMoveItem().

162 { m_storedPos = aPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor) ...
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::AppendOneEEProject(), 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(), Load(), 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_COMPONENT::SetTimeStamp(), SimilarLabelsDiagnose(), BOARD_ITEM::SwapData(), 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 SCH_SHEET::SwapData ( SCH_ITEM aItem)
overridevirtual

Function SwapData swap the internal data structures aItem with the schematic item.

Obviously, aItem must have the same type than me

Parameters
aItemThe item to swap the data structures with.

Reimplemented from SCH_ITEM.

Definition at line 329 of file sch_sheet.cpp.

References Format(), GetChars(), SCH_ITEM::GetClass(), m_fileNameSize, m_name, m_pins, m_pos, m_sheetNameSize, m_size, SCH_SHEET_T, EDA_ITEM::SetParent(), and EDA_ITEM::Type().

330 {
331  wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
332  wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
333  GetChars( aItem->GetClass() ) ) );
334 
335  SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
336 
337  std::swap( m_pos, sheet->m_pos );
338  std::swap( m_size, sheet->m_size );
339  std::swap( m_name, sheet->m_name );
340  std::swap( m_sheetNameSize, sheet->m_sheetNameSize );
341  std::swap( m_fileNameSize, sheet->m_fileNameSize );
342  m_pins.swap( sheet->m_pins );
343 
344  // Ensure sheet labels have their .m_Parent member pointing really on their
345  // parent, after swapping.
346  for( SCH_SHEET_PIN& sheetPin : m_pins )
347  {
348  sheetPin.SetParent( this );
349  }
350 
351  for( SCH_SHEET_PIN& sheetPin : sheet->m_pins )
352  {
353  sheetPin.SetParent( sheet );
354  }
355 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:227
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
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
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
virtual wxString GetClass() const override
Function GetClass returns the class name.
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(), AddPin(), SCH_EDIT_FRAME::AppendOneEEProject(), 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(), 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(), 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(), ComponentCount(), GRID_HELPER::computeAnchors(), SCH_SCREEN::CountConnectedItems(), 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::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(), GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), 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(), SCH_SCREENS::HasNoFullyDefinedLibIds(), 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(), Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), 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=(), operator=(), SCH_COMPONENT::operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), MODULE_EDITOR_TOOLS::PasteItems(), 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(), RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), 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(), 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(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), BOARD_ITEM::SwapData(), SwapData(), SCH_COMPONENT::SwapData(), 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(), EDA_ITEM::Visit(), 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, 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:590
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 114 of file view_item.h.

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

115  {}
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, TRACK, TEXTE_MODULE, 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 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.

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

Definition at line 133 of file view_item.h.

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

134  {
135  // By default always show the item
136  return 0;
137  }
SEARCH_RESULT SCH_SHEET::Visit ( INSPECTOR  inspector,
void *  testData,
const KICAD_T  scanTypes[] 
)
overridevirtual

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 1076 of file sch_sheet.cpp.

References EOT, m_pins, SCH_SHEET_PIN_T, SEARCH_CONTINUE, SEARCH_QUIT, and EDA_ITEM::Type().

1077 {
1078  KICAD_T stype;
1079 
1080  for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
1081  {
1082  // If caller wants to inspect my type
1083  if( stype == Type() )
1084  {
1085  if( SEARCH_QUIT == aInspector( this, NULL ) )
1086  return SEARCH_QUIT;
1087  }
1088  else if( stype == SCH_SHEET_PIN_T )
1089  {
1090  // Test the sheet labels.
1091  for( size_t i = 0; i < m_pins.size(); i++ )
1092  {
1093  if( SEARCH_QUIT == aInspector( &m_pins[ i ], this ) )
1094  return SEARCH_QUIT;
1095  }
1096  }
1097  }
1098 
1099  return SEARCH_CONTINUE;
1100 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
search types array terminator (End Of Types)
Definition: typeinfo.h:94
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225

Friends And Related Function Documentation

friend class SCH_SHEET_PIN
friend

Definition at line 218 of file sch_sheet.h.

Referenced by Load().

Member Data Documentation

EDA_ITEMS SCH_ITEM::m_connections
protectedinherited

List of items connected to this item.

Definition at line 125 of file sch_item_struct.h.

Referenced by SCH_ITEM::~SCH_ITEM().

wxString SCH_SHEET::m_fileName
private

The file name is also in the SCH_SCREEN object associated with the sheet.

It is also needed here for loading after reading the sheet description from file.

Definition at line 229 of file sch_sheet.h.

Referenced by Draw(), GetBoundingBox(), GetFileName(), GetMsgPanelInfo(), Load(), Matches(), Save(), and SCH_SHEET().

int SCH_SHEET::m_fileNameSize
private

The height of the text used to draw the file name.

Definition at line 239 of file sch_sheet.h.

Referenced by Draw(), GetBoundingBox(), GetFileNameSize(), Load(), operator=(), Plot(), Save(), SCH_SHEET(), and SwapData().

STATUS_FLAGS EDA_ITEM::m_Flags
protectedinherited

Flag bits for editing and other uses.

Definition at line 189 of file base_struct.h.

Referenced by LIB_CIRCLE::BeginEdit(), LIB_RECTANGLE::BeginEdit(), LIB_POLYLINE::BeginEdit(), LIB_TEXT::BeginEdit(), LIB_ARC::BeginEdit(), LIB_FIELD::BeginEdit(), LIB_CIRCLE::calcEdit(), LIB_POLYLINE::calcEdit(), LIB_RECTANGLE::calcEdit(), LIB_TEXT::calcEdit(), LIB_ARC::calcEdit(), LIB_FIELD::calcEdit(), LIB_TEXT::Clone(), LIB_CIRCLE::ContinueEdit(), LIB_RECTANGLE::ContinueEdit(), LIB_POLYLINE::ContinueEdit(), LIB_TEXT::ContinueEdit(), LIB_ARC::ContinueEdit(), LIB_FIELD::ContinueEdit(), SCH_LINE::Draw(), TRACK::Draw(), DRAWSEGMENT::Draw(), MODULE::Draw(), SEGZONE::Draw(), D_PAD::Draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_ARC::drawGraphic(), DRAWSEGMENT::DRAWSEGMENT(), LIB_CIRCLE::EndEdit(), LIB_RECTANGLE::EndEdit(), LIB_POLYLINE::EndEdit(), LIB_TEXT::EndEdit(), LIB_ARC::EndEdit(), LIB_ITEM::EndEdit(), LIB_FIELD::EndEdit(), EDA_ITEM::GetFlags(), TRACK::GetMsgPanelInfoBase_Common(), SCH_JUNCTION::HitTest(), SCH_LINE::HitTest(), SCH_COMPONENT::HitTest(), LIB_ITEM::InEditMode(), EDA_ITEM::initVars(), SCH_ITEM::IsConnected(), SCH_COMPONENT::Load(), SCH_LINE::Move(), EDA_ITEM::operator=(), SCH_COMPONENT::SCH_COMPONENT(), LIB_PIN::SetConversion(), LIB_PIN::SetLength(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPartNumber(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), LIB_PIN::SetType(), and LIB_PIN::SetVisible().

bool EDA_ITEM::m_forceVisible
protectedinherited

Set to true to override the visibility setting of the item.

Definition at line 186 of file base_struct.h.

Referenced by SCH_FIELD::Draw(), EDA_ITEM::initVars(), and EDA_ITEM::operator=().

DHEAD* EDA_ITEM::m_List
protectedinherited

which DLIST I am on.

Definition at line 180 of file base_struct.h.

Referenced by EDA_ITEM::GetList(), EDA_ITEM::initVars(), and BOARD_ITEM::SwapData().

wxString SCH_SHEET::m_name
private

This is equivalent to the reference designator for components and is stored in F0 sheet pin in the schematic file.

Definition at line 233 of file sch_sheet.h.

Referenced by Draw(), GetBoundingBox(), GetMsgPanelInfo(), GetName(), GetSelectMenuText(), Load(), Matches(), operator=(), Plot(), RemovePin(), Replace(), Save(), SCH_SHEET(), and SwapData().

SCH_SCREEN* SCH_SHEET::m_screen
private

Screen that contains the physical data for the sheet.

In complex hierarchies multiple sheets can share a common screen.

Definition at line 222 of file sch_sheet.h.

Referenced by CleanupSheet(), ComponentCount(), CountSheets(), GetScreen(), GetScreenCount(), HasUndefinedPins(), Load(), LocatePathOfScreen(), SCH_SHEET(), SearchHierarchy(), SetScreen(), and ~SCH_SHEET().

int SCH_SHEET::m_sheetNameSize
private

The height of the text used to draw the sheet name.

Definition at line 236 of file sch_sheet.h.

Referenced by Draw(), GetBoundingBox(), GetSheetNameSize(), Load(), operator=(), Plot(), Save(), SCH_SHEET(), and SwapData().

wxPoint SCH_ITEM::m_storedPos
protectedinherited

a temporary variable used in some move commands

to store a initial pos (of the item or mouse cursor)

Definition at line 126 of file sch_item_struct.h.

Referenced by SCH_ITEM::GetStoredPos().


The documentation for this class was generated from the following files: