KiCad PCB EDA Suite
SCH_SHEET Class Reference

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 aSheet into a new object. More...
 
 ~SCH_SHEET ()
 
wxString GetClass () const override
 Function GetClass returns the class name. More...
 
bool IsMovableFromAnchorPoint () override
 Return true for items which are moved with the anchor point at mouse cursor and false for items moved with no reference to anchor. 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 ()
 Return the root sheet of this SCH_SHEET object. More...
 
void SetScreen (SCH_SCREEN *aScreen)
 Set the SCH_SCREEN associated with this sheet to aScreen. More...
 
int GetScreenCount () const
 Return the number of times the associated screen for the sheet is being used. 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
 Return the minimum width of the sheet based on the widths of the sheet pin text. More...
 
int GetMinHeight () const
 Return 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
 Return 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 ()
 Count our own components, without the power components. More...
 
bool SearchHierarchy (const wxString &aFilename, SCH_SCREEN **aScreen)
 Search the existing hierarchy for an instance of screen loaded from aFileName. More...
 
bool LocatePathOfScreen (SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
 Search the existing hierarchy for an instance of screen loaded from aFileName. More...
 
int CountSheets ()
 Count the number of sheets found in "this" sheet includeing all of the subsheets. More...
 
wxString GetFileName (void) const
 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 ()
 
wxPoint GetFileNamePosition ()
 
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...
 
bool CanConnect (const SCH_ITEM *aItem) const override
 
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...
 
virtual bool Load (LINE_READER &aLine, wxString &aErrorMsg)
 Function Load reads a schematic item from aLine in a .sch file. 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 (timestamp_t aNewTimeStamp)
 
timestamp_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 (LOD) 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...
 
timestamp_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

Sheet symbol placed in a schematic, and is the entry point for a sub schematic.

Definition at line 209 of file sch_sheet.h.

Constructor & Destructor Documentation

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

Definition at line 47 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().

47  :
48  SCH_ITEM( NULL, SCH_SHEET_T )
49 {
51  m_pos = pos;
56  m_screen = NULL;
57  m_name.Printf( wxT( "Sheet%8.8lX" ), (long) m_TimeStamp );
58  m_fileName.Printf( wxT( "file%8.8lX.sch" ), (long) m_TimeStamp );
59 }
SCH_LAYER_ID m_Layer
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:180
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:229
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
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:226
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:47
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
timestamp_t GetNewTimeStamp()
Definition: common.cpp:167
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:48
int GetDefaultTextSize()
Default size for text in general.
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_SHEET::SCH_SHEET ( const SCH_SHEET aSheet)

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

References i, 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().

62  :
63  SCH_ITEM( aSheet )
64 {
65  m_pos = aSheet.m_pos;
66  m_size = aSheet.m_size;
67  m_Layer = aSheet.m_Layer;
68  SetTimeStamp( aSheet.m_TimeStamp );
71  m_screen = aSheet.m_screen;
72  m_name = aSheet.m_name;
73  m_fileName = aSheet.m_fileName;
74  m_pins = aSheet.m_pins;
75 
76  for( size_t i = 0; i < m_pins.size(); i++ )
77  m_pins[i].SetParent( this );
78 
79  if( m_screen )
81 }
SCH_LAYER_ID m_Layer
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:180
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:229
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
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:226
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
size_t i
Definition: json11.cpp:597
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
void IncRefCount()
Definition: sch_screen.cpp:124
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:214
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType)
SCH_SHEET::~SCH_SHEET ( )

Definition at line 84 of file sch_sheet.cpp.

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

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

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

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

178 {
179  wxASSERT( aSheetPin != NULL );
180  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
181 
182  m_pins.push_back( aSheetPin );
183  renumberPins();
184 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
void renumberPins()
Renumber the sheet pins in the sheet.
Definition: sch_sheet.cpp:768
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
SCH_ITEM* SCH_ITEM::Back ( ) const
inlineinherited

Definition at line 144 of file sch_item_struct.h.

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

144 { return static_cast<SCH_ITEM*>( Pback ); }
EDA_ITEM * Pback
previous in linked list
Definition: base_struct.h:176
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
bool SCH_SHEET::CanConnect ( const SCH_ITEM aItem) const
inlineoverridevirtual

Reimplemented from SCH_ITEM.

Definition at line 527 of file sch_sheet.h.

References SCH_TEXT::GetConnectionPoints(), SCH_ITEM::GetLayer(), SCH_SHEET_PIN::GetMenuImage(), SCH_TEXT::GetNetListItem(), SCH_SHEET_PIN::GetSelectMenuText(), LAYER_BUS, LAYER_WIRE, EDA_ITEM::operator=(), SCH_LINE_T, SCH_NO_CONNECT_T, EDA_ITEM::Type(), and EDA_ITEM::Visit().

528  {
529  return ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_WIRE ) ||
530  ( aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS ) ||
531  ( aItem->Type() == SCH_NO_CONNECT_T );
532  }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
virtual bool SCH_ITEM::CanIncrementLabel ( ) const
inlinevirtualinherited

Reimplemented in SCH_TEXT.

Definition at line 338 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem().

338 { 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 340 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::Process_Special_Functions().

341 {
342  SCH_SHEET_PINS::iterator i = m_pins.begin();
343 
344  while( i != m_pins.end() )
345  {
346  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
347  EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
348  const SCH_HIERLABEL* HLabel = NULL;
349 
350  for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
351  {
352  if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
353  continue;
354 
355  HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
356 
357  if( i->GetText().CmpNoCase( HLabel->GetText() ) == 0 )
358  break; // Found!
359 
360  HLabel = NULL;
361  }
362 
363  if( HLabel == NULL ) // Hlabel not found: delete sheet label.
364  i = m_pins.erase( i );
365  else
366  ++i;
367  }
368 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
EDA_ITEM * Next() const
Definition: base_struct.h:217
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
size_t i
Definition: json11.cpp:597
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 244 of file base_struct.h.

References BRIGHTENED, EDA_ITEM::ClearFlags(), and EDA_ITEM::SetModified().

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

244 { ClearFlags( BRIGHTENED ); }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:133
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
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 298 of file sch_item_struct.h.

298 { 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 265 of file base_struct.h.

Referenced by Abort_Edit_Pcb_Text(), Abort_EditEdge(), Abort_Move_ModuleOutline(), Abort_Move_Pad(), Abort_MoveOrCopyModule(), Abort_MoveTrack(), Abort_Zone_Create_Outline(), Abort_Zone_Move_Corner_Or_Outlines(), AbortMoveAndEditTarget(), abortMoveBitmap(), AbortMoveDimensionText(), abortMoveItem(), AbortMoveTextModule(), AbortPinMove(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_EDIT_FRAME::addCurrentItemToList(), PNS_KICAD_IFACE::AddItem(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_SCREEN::ClearAnnotation(), EDA_ITEM::ClearBrightened(), EDA_ITEM::ClearHighlighted(), DRAG_LIST::ClearList(), 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(), 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(), EraseDragList(), PCB_EDIT_FRAME::Exchange_Module(), ExitSheet(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), 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(), FOOTPRINT_EDIT_FRAME::OpenProjectFiles(), SCH_FIELD::Place(), PCB_EDIT_FRAME::Place_DrawItem(), FOOTPRINT_EDIT_FRAME::Place_EdgeMod(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceDimensionText(), PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment(), PCB_BASE_FRAME::PlaceModule(), PCB_BASE_FRAME::PlacePad(), PCB_EDIT_FRAME::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_BASE_FRAME::PlaceTexteModule(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), BOARD_COMMIT::Revert(), PCB_BASE_FRAME::Rotate_Module(), RotateListOfItems(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::savePin(), 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().

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

Definition at line 243 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

243 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:132
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
void EDA_ITEM::ClearSelected ( )
inlineinherited
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 98 of file sch_sheet.cpp.

References SCH_SHEET().

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

Count our own components, without the power components.

Returns
the component count.

Definition at line 533 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().

534 {
535  int n = 0;
536 
537  if( m_screen )
538  {
539  EDA_ITEM* bs;
540 
541  for( bs = m_screen->GetDrawItems(); bs != NULL; bs = bs->Next() )
542  {
543  if( bs->Type() == SCH_COMPONENT_T )
544  {
545  SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
546 
547  if( Cmp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
548  n++;
549  }
550 
551  if( bs->Type() == SCH_SHEET_T )
552  {
553  SCH_SHEET* sheet = (SCH_SHEET*) bs;
554  n += sheet->ComponentCount();
555  }
556  }
557  }
558 
559  return n;
560 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
int ComponentCount()
Count our own components, without the power components.
Definition: sch_sheet.cpp:533
EDA_ITEM * Next() const
Definition: base_struct.h:217
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:128
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
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:215
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
#define VALUE
int SCH_SHEET::CountSheets ( )

Count the number of sheets found in "this" sheet includeing all of the subsheets.

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

Definition at line 625 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(), DIALOG_PRINT_USING_PRINTER::GetPrintOptions(), SCH_PRINTOUT::HasPage(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnFindSchematicItem(), and SCH_EDIT_FRAME::SetSheetNumberAndCount().

626 {
627  int count = 1; //1 = this!!
628 
629  if( m_screen )
630  {
631  EDA_ITEM* strct = m_screen->GetDrawItems();
632 
633  for( ; strct; strct = strct->Next() )
634  {
635  if( strct->Type() == SCH_SHEET_T )
636  {
637  SCH_SHEET* subsheet = (SCH_SHEET*) strct;
638  count += subsheet->CountSheets();
639  }
640  }
641  }
642  return count;
643 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
int CountSheets()
Count the number of sheets found in "this" sheet includeing all of the subsheets. ...
Definition: sch_sheet.cpp:625
EDA_ITEM * Next() const
Definition: base_struct.h:217
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
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 426 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().

428 {
429  COLOR4D txtcolor;
430  wxString Text;
431  COLOR4D color;
432  int name_orientation;
433  wxPoint pos_sheetname,pos_filename;
434  wxPoint pos = m_pos + aOffset;
435  int lineWidth = GetPenSize();
436  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
437 
438  if( aColor != COLOR4D::UNSPECIFIED )
439  color = aColor;
440  else
441  color = GetLayerColor( m_Layer );
442 
443  GRSetDrawMode( aDC, aDrawMode );
444 
445  GRRect( clipbox, aDC, pos.x, pos.y,
446  pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
447 
448  pos_sheetname = GetSheetNamePosition() + aOffset;
449  pos_filename = GetFileNamePosition() + aOffset;
450 
451  if( IsVerticalOrientation() )
452  name_orientation = TEXT_ANGLE_VERT;
453  else
454  name_orientation = TEXT_ANGLE_HORIZ;
455 
456  /* Draw text : SheetName */
457  if( aColor != COLOR4D::UNSPECIFIED )
458  txtcolor = aColor;
459  else
460  txtcolor = GetLayerColor( LAYER_SHEETNAME );
461 
462  Text = wxT( "Sheet: " ) + m_name;
463  DrawGraphicText( clipbox, aDC, pos_sheetname,
464  txtcolor, Text, name_orientation,
465  wxSize( m_sheetNameSize, m_sheetNameSize ),
467  false, false );
468 
469  /* Draw text : FileName */
470  if( aColor != COLOR4D::UNSPECIFIED )
471  txtcolor = aColor;
472  else
473  txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
474 
475  Text = wxT( "File: " ) + m_fileName;
476  DrawGraphicText( clipbox, aDC, pos_filename,
477  txtcolor, Text, name_orientation,
478  wxSize( m_fileNameSize, m_fileNameSize ),
480  false, false );
481 
482  /* Draw text : SheetLabel */
483  for( SCH_SHEET_PIN& sheetPin : m_pins )
484  {
485  if( !sheetPin.IsMoving() )
486  sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor );
487  }
488 
489 
490 #if 0
491  // Only for testing purposes, draw the component bounding box
493  GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
494  GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x, m_pos.y, 10, 0, color, color );
495 #endif
496 }
#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 GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:318
int color
Definition: DXF_plotter.cpp:62
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:229
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
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:226
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:167
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:383
void GRFilledCircle(EDA_RECT *ClipBox, wxDC *DC, int x, int y, int r, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:873
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
#define TEXT_ANGLE_VERT
Definition: common.h:92
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, void *aData), void *aCallbackData, PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
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:1098
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:499
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
EDA_RECT * GetClipBox()
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
wxPoint GetFileNamePosition()
Definition: sch_sheet.cpp:407
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
wxPoint GetSheetNamePosition()
Definition: sch_sheet.cpp:389
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:221
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 123 of file sch_item_struct.cpp.

124 {
125  char temp[50];
126  int len;
127 
128  len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
129 
130  return std::string( temp, len );
131 }
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 99 of file sch_item_struct.cpp.

Referenced by SCH_ITEM::FormatInternalUnits().

100 {
101  char buf[50];
102  double engUnits = aValue;
103  int len;
104 
105  if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
106  {
107  len = snprintf( buf, sizeof(buf), "%.10f", engUnits );
108 
109  while( --len > 0 && buf[len] == '0' )
110  buf[len] = '\0';
111 
112  ++len;
113  }
114  else
115  {
116  len = snprintf( buf, sizeof(buf), "%.10g", engUnits );
117  }
118 
119  return std::string( buf, len );
120 }
std::string SCH_ITEM::FormatInternalUnits ( const wxPoint aPoint)
staticinherited

Definition at line 134 of file sch_item_struct.cpp.

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

135 {
136  return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
137 }
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 140 of file sch_item_struct.cpp.

References SCH_ITEM::FormatInternalUnits().

141 {
142  return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
143 }
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 499 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().

500 {
501  wxPoint end;
502  EDA_RECT box( m_pos, m_size );
503  int lineWidth = GetPenSize();
504 
505  // Determine length of texts
506  wxString text = wxT( "Sheet: " ) + m_name;
507  int textlen = GraphicTextWidth( text, wxSize( m_sheetNameSize, m_sheetNameSize ),
508  false, false );
509 
510  text = wxT( "File: " ) + m_fileName;
511  int textlen2 = GraphicTextWidth( text, wxSize( m_fileNameSize, m_fileNameSize ),
512  false, false );
513 
514  // Calculate bounding box X size:
515  textlen = std::max( textlen, textlen2 );
516  end.x = std::max( m_size.x, textlen );
517 
518  // Calculate bounding box pos:
519  end.y = m_size.y;
520  end += m_pos;
521 
522  // Move upper and lower limits to include texts:
523  box.SetY( box.GetY() - ( KiROUND( m_sheetNameSize * 1.3 ) + 8 ) );
524  end.y += KiROUND( m_fileNameSize * 1.3 ) + 8;
525 
526  box.SetEnd( end );
527  box.Inflate( lineWidth / 2 );
528 
529  return box;
530 }
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:229
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
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:226
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:383
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool aItalic, bool aBold)
Function GraphicTextWidth.
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
wxString SCH_SHEET::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from SCH_ITEM.

Definition at line 251 of file sch_sheet.h.

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

252  {
253  return wxT( "SCH_SHEET" );
254  }
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 835 of file sch_sheet.cpp.

References GetPins(), GetPosition(), and i.

836 {
837  for( size_t i = 0; i < GetPins().size(); i++ )
838  aPoints.push_back( GetPins()[i].GetPosition() );
839 }
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:334
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_sheet.h:547
size_t i
Definition: json11.cpp:597
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 780 of file sch_sheet.cpp.

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

781 {
782  for( unsigned ii = 0; ii < GetPins().size(); ii++ )
783  {
784  SCH_SHEET_PIN &pinsheet = GetPins()[ii];
785 
786  wxCHECK2_MSG( pinsheet.Type() == SCH_SHEET_PIN_T, continue,
787  wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
788 
789  pinsheet.GetEndPoints( aItemList );
790  }
791 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:334
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
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

Return the filename corresponding to this sheet.

Returns
a wxString containing the filename

Definition at line 646 of file sch_sheet.cpp.

References m_fileName.

Referenced by SCH_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), SCH_LEGACY_PLUGIN::Load(), 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().

647 {
648  return m_fileName;
649 }
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
wxPoint SCH_SHEET::GetFileNamePosition ( )
Returns
the position of the anchor of filename text

Definition at line 407 of file sch_sheet.cpp.

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

Referenced by Draw(), and Matches().

408 {
409  wxPoint pos = m_pos;
410  int margin = GetPenSize() + 4;
411 
412  if( IsVerticalOrientation() )
413  {
414  pos.x += m_size.x + margin;
415  pos.y += m_size.y;
416  }
417  else
418  {
419  pos.y += m_size.y + margin;
420  }
421 
422  return pos;
423 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:383
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:221
int SCH_SHEET::GetFileNameSize ( ) const
inline

Definition at line 275 of file sch_sheet.h.

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

275 { return m_fileNameSize; }
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
STATUS_FLAGS EDA_ITEM::GetFlags ( ) const
inlineinherited

Definition at line 266 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(), SCH_EDIT_FRAME::copyBlockItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_EDIT_FRAME::copySelectedItems(), 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(), SCH_EDIT_FRAME::DeleteItem(), SCH_EDIT_FRAME::DeleteItemsInList(), SCH_EDIT_FRAME::DeleteJunction(), 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(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), InitialiseDragParameters(), EDA_DRAW_FRAME::isBusy(), 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(), EDA_DRAW_PANEL::OnMouseEvent(), 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(), SCH_EDIT_FRAME::OrientComponent(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDIT_FRAME::PlaceTarget(), FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), TRACKS_CLEANER::removeDuplicatesOfTrack(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_EDIT_FRAME::RotateField(), SCH_EDIT_FRAME::RotateHierarchicalSheet(), SCH_EDIT_FRAME::RotateImage(), PCB_BASE_FRAME::RotateTextModule(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), 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_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow().

266 { return m_Flags; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 877 of file sch_sheet.cpp.

878 {
879  return add_hierarchical_subsheet_xpm;
880 }
int SCH_SHEET::GetMinHeight ( ) const

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

References EDA_RECT::GetBottom(), EDA_RECT::GetHeight(), i, 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().

302 {
303  int height = MIN_SHEET_HEIGHT;
304 
305  for( size_t i = 0; i < m_pins.size(); i++ )
306  {
307  int edge = m_pins[i].GetEdge();
308  EDA_RECT pinRect = m_pins[i].GetBoundingBox();
309 
310  // Make sure pin is on top or bottom side of sheet.
312  {
313  if( height < pinRect.GetBottom() - m_pos.y )
314  height = pinRect.GetBottom() - m_pos.y;
315  }
316  else
317  {
318  if( height < pinRect.GetHeight() )
319  height = pinRect.GetHeight();
320 
321  for( size_t j = 0; j < m_pins.size(); j++ )
322  {
323  // Check for pin directly above or below the current pin.
324  if( (i == j) || (m_pins[i].GetPosition().x != m_pins[j].GetPosition().x) )
325  continue;
326 
327  if( height < pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight() )
328  {
329  height = pinRect.GetHeight() + m_pins[j].GetBoundingBox().GetHeight();
330  break;
331  }
332  }
333  }
334  }
335 
336  return height;
337 }
int GetHeight() const
Definition: eda_rect.h:118
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
int GetBottom() const
Definition: eda_rect.h:122
size_t i
Definition: json11.cpp:597
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:48
int SCH_SHEET::GetMinWidth ( ) const

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

References EDA_RECT::GetRight(), EDA_RECT::GetWidth(), i, 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().

262 {
263  int width = MIN_SHEET_WIDTH;
264 
265  for( size_t i = 0; i < m_pins.size(); i++ )
266  {
267  int edge = m_pins[i].GetEdge();
268  EDA_RECT pinRect = m_pins[i].GetBoundingBox();
269 
270  wxASSERT( edge != SCH_SHEET_PIN::SHEET_UNDEFINED_SIDE );
271 
273  {
274  if( width < pinRect.GetRight() - m_pos.x )
275  width = pinRect.GetRight() - m_pos.x;
276  }
277  else
278  {
279  if( width < pinRect.GetWidth() )
280  width = pinRect.GetWidth();
281 
282  for( size_t j = 0; j < m_pins.size(); j++ )
283  {
284  // Check for pin directly across from the current pin.
285  if( (i == j) || (m_pins[i].GetPosition().y != m_pins[j].GetPosition().y) )
286  continue;
287 
288  if( width < pinRect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth() )
289  {
290  width = pinRect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth();
291  break;
292  }
293  }
294  }
295  }
296 
297  return width;
298 }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:47
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
int GetRight() const
Definition: eda_rect.h:119
size_t i
Definition: json11.cpp:597
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int GetWidth() const
Definition: eda_rect.h:117
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 652 of file sch_sheet.cpp.

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

653 {
654  aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) );
655  aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
656 
657 #if 0 // Set to 1 to display the sheet time stamp (mainly for test)
658  wxString msg;
659  msg.Printf( wxT( "%.8X" ), m_TimeStamp );
660  aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), msg, BLUE ) );
661 #endif
662 }
Definition: colors.h:57
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:180
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:226
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
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 267 of file sch_sheet.h.

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

267 { 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:226
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 912 of file sch_sheet.cpp.

References NETLIST_OBJECT::ConvertBusToNetListItems(), GetText(), i, 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.

914 {
915  SCH_SHEET_PATH sheetPath = *aSheetPath;
916  sheetPath.push_back( this );
917 
918  for( size_t i = 0; i < m_pins.size(); i++ )
919  {
920  NETLIST_OBJECT* item = new NETLIST_OBJECT();
921  item->m_SheetPathInclude = sheetPath;
922  item->m_SheetPath = *aSheetPath;
923  item->m_Comp = &m_pins[i];
924  item->m_Link = this;
925  item->m_Type = NET_SHEETLABEL;
926  item->m_Label = m_pins[i].GetText();
927  item->m_Start = item->m_End = m_pins[i].GetPosition();
928  aNetListItems.push_back( item );
929 
930  if( IsBusLabel( m_pins[i].GetText() ) )
931  item->ConvertBusToNetListItems( aNetListItems );
932  }
933 }
SCH_SHEET_PATH m_SheetPathInclude
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
EDA_ITEM * m_Comp
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
Class SCH_SHEET_PATH.
bool IsBusLabel(const wxString &aLabel)
Function IsBusLabel test if aLabel has a bus notation.
size_t i
Definition: json11.cpp:597
SCH_ITEM * m_Link
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 383 of file sch_sheet.cpp.

References GetDefaultLineThickness().

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

384 {
385  return GetDefaultLineThickness();
386 }
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 371 of file sch_sheet.cpp.

References m_pins.

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

372 {
373  for( SCH_SHEET_PIN& pin : m_pins )
374  {
375  if( pin.HitTest( aPosition, 0 ) )
376  return &pin;
377  }
378 
379  return NULL;
380 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
SCH_SHEET_PINS& SCH_SHEET::GetPins ( )
inline

Definition at line 334 of file sch_sheet.h.

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

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

Definition at line 336 of file sch_sheet.h.

337  {
338  return const_cast< SCH_SHEET_PINS& >( m_pins );
339  }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
boost::ptr_vector< SCH_SHEET_PIN > SCH_SHEET_PINS
Definition: sch_sheet.h:203
wxPoint SCH_SHEET::GetPosition ( ) const
inlineoverridevirtual

Function GetPosition.

Returns
A wxPoint object containing the schematic item position.

Implements SCH_ITEM.

Definition at line 547 of file sch_sheet.h.

References SCH_SHEET_PIN::Clone(), SCH_SHEET_PIN::HitTest(), SCH_TEXT::Plot(), and SCH_SHEET_PIN::SetPosition().

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

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

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

907 {
908  return wxPoint( m_pos.x + m_size.GetWidth(), m_pos.y + m_size.GetHeight() );
909 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
SCH_SHEET * SCH_SHEET::GetRootSheet ( )

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

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

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

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

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

References SCH_SCREEN::GetRefCount(), and m_screen.

Referenced by SCH_EDIT_FRAME::EditSheet().

128 {
129  if( m_screen == NULL )
130  return 0;
131 
132  return m_screen->GetRefCount();
133 }
int GetRefCount() const
Definition: sch_screen.h:133
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
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 869 of file sch_sheet.cpp.

References GetChars(), and m_name.

Referenced by Matches().

870 {
871  wxString tmp;
872  tmp.Printf( _( "Hierarchical Sheet %s" ), GetChars( m_name ) );
873  return tmp;
874 }
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:226
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 ( )
Returns
the position of the anchor of sheet name text

Definition at line 389 of file sch_sheet.cpp.

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

Referenced by Draw(), and Matches().

390 {
391  wxPoint pos = m_pos;
392 
393  if( IsVerticalOrientation() )
394  {
395  pos.x -= 8;
396  pos.y += m_size.y;
397  }
398  else
399  {
400  pos.y -= 8;
401  }
402 
403  return pos;
404 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:221
int SCH_SHEET::GetSheetNameSize ( ) const
inline

Definition at line 271 of file sch_sheet.h.

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

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

Definition at line 281 of file sch_sheet.h.

Referenced by SCH_LEGACY_PLUGIN::saveSheet().

281 { return m_size; }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
STATUS_FLAGS EDA_ITEM::GetStatus ( ) const
inlineinherited

Definition at line 261 of file base_struct.h.

References EDA_ITEM::m_Status.

Referenced by PCB_IO::format(), and GERBER_DRAW_ITEM::HitTest().

261 { return m_Status; }
STATUS_FLAGS m_Status
Definition: base_struct.h:172
wxPoint& SCH_ITEM::GetStoredPos ( )
inlineinherited

Definition at line 155 of file sch_item_struct.h.

Referenced by moveItemWithMouseCursor().

155 { 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 209 of file sch_sheet.cpp.

References m_pins.

Referenced by SCH_EDIT_FRAME::ImportSheetPin().

210 {
211  for( const SCH_SHEET_PIN& pin : m_pins )
212  {
213  if( pin.GetText().CmpNoCase( aName ) == 0 )
214  return true;
215  }
216 
217  return false;
218 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
bool SCH_SHEET::HasPins ( )
inline

Definition at line 374 of file sch_sheet.h.

References SCH_SHEET_PIN::Draw(), SCH_HIERLABEL::GetBoundingBox(), SCH_SHEET_PIN::GetPenSize(), and SCH_SHEET_PIN::SwapData().

Referenced by resizeSheetWithMouseCursor().

374 { return !m_pins.empty(); }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
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 232 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().

233 {
234  for( const SCH_SHEET_PIN& pin : m_pins )
235  {
236  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
237  EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
238  const SCH_HIERLABEL* HLabel = NULL;
239 
240  for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
241  {
242  if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
243  continue;
244 
245  HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
246 
247  if( pin.GetText().CmpNoCase( HLabel->GetText() ) == 0 )
248  break; // Found!
249 
250  HLabel = NULL;
251  }
252 
253  if( HLabel == NULL ) // Corresponding hierarchical label not found.
254  return true;
255  }
256 
257  return false;
258 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
EDA_ITEM * Next() const
Definition: base_struct.h:217
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
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 309 of file sch_item_struct.h.

Referenced by SCH_SCREEN::addConnectedItemsToBlock().

310  {
311  return HitTest( aPosition, 0 );
312  }
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 883 of file sch_sheet.cpp.

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

884 {
885  EDA_RECT rect = GetBoundingBox();
886 
887  rect.Inflate( aAccuracy );
888 
889  return rect.Contains( aPosition );
890 }
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:499
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
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 893 of file sch_sheet.cpp.

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

894 {
895  EDA_RECT rect = aRect;
896 
897  rect.Inflate( aAccuracy );
898 
899  if( aContained )
900  return rect.Contains( GetBoundingBox() );
901 
902  return rect.Intersects( GetBoundingBox() );
903 }
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:499
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
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 235 of file base_struct.h.

References BRIGHTENED.

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

235 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:133
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 525 of file sch_sheet.h.

525 { 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 71 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().

72 {
74  return false;
75 
76  return doIsConnected( aPosition );
77 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:120
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:118
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
bool SCH_SHEET::IsDangling ( ) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 807 of file sch_sheet.cpp.

References GetPins(), and i.

Referenced by IsDanglingStateChanged().

808 {
809  // If any hierarchical label in the sheet is dangling, then the sheet is dangling.
810  for( size_t i = 0; i < GetPins().size(); i++ )
811  {
812  if( GetPins()[i].IsDangling() )
813  return true;
814  }
815 
816  return false;
817 }
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:334
size_t i
Definition: json11.cpp:597
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 794 of file sch_sheet.cpp.

References GetPins(), and IsDangling().

795 {
796  bool currentState = IsDangling();
797 
798  for( SCH_SHEET_PIN& pinsheet : GetPins() )
799  {
800  pinsheet.IsDanglingStateChanged( aItemList );
801  }
802 
803  return currentState != IsDangling();
804 }
bool IsDangling() const override
Definition: sch_sheet.cpp:807
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:334
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 234 of file base_struct.h.

References HIGHLIGHTED.

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

Definition at line 228 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

228 { return m_Flags & IS_CHANGED; }
#define IS_CHANGED
std::function passed to nested users by ref, avoids copying std::function
Definition: base_struct.h:105
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
bool SCH_SHEET::IsMovableFromAnchorPoint ( )
inlineoverridevirtual

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 265 of file sch_sheet.h.

265 { return false; }
bool EDA_ITEM::IsNew ( ) const
inlineinherited

Definition at line 227 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(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_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().

227 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:109
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 498 of file sch_sheet.h.

References SCH_SHEET_PIN::GetEndPoints(), SCH_TEXT::IsDangling(), SCH_TEXT::IsDanglingStateChanged(), and SCH_TEXT::IsSelectStateChanged().

498 { return true; }
bool EDA_ITEM::IsResized ( ) const
inlineinherited

Definition at line 233 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

233 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:110
bool EDA_ITEM::IsSelected ( ) const
inlineinherited
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 820 of file sch_sheet.cpp.

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

821 {
822  bool previousState = IsSelected();
823 
825 
826  if( aRect.Intersects( boundingBox ) )
827  SetFlags( SELECTED );
828  else
829  ClearFlags( SELECTED );
830 
831  return previousState != IsSelected();
832 }
bool IsSelected() const
Definition: base_struct.h:232
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
#define SELECTED
Definition: base_struct.h:116
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:499
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:265
bool SCH_SHEET::IsVerticalOrientation ( ) const

Definition at line 221 of file sch_sheet.cpp.

References m_pins.

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

222 {
223  for( const SCH_SHEET_PIN& pin : m_pins )
224  {
225  if( pin.GetEdge() > 1 )
226  return true;
227  }
228  return false;
229 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 231 of file base_struct.h.

References IS_WIRE_IMAGE.

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

231 { return m_Flags & IS_WIRE_IMAGE; }
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 131 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(), SCH_FIND_COLLECTOR::GetItem(), EDA_ITEM::HitTest(), GERBER_FILE_IMAGE::Visit(), MODULE::Visit(), and BOARD::Visit().

135 {
136  EDA_ITEM* p = listStart;
137 
138  for( ; p; p = p->Pnext )
139  {
140  if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
141  return SEARCH_QUIT;
142  }
143 
144  return SEARCH_CONTINUE;
145 }
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:162
EDA_ITEM * Pnext
next in linked list
Definition: base_struct.h:175
virtual bool SCH_ITEM::Load ( LINE_READER aLine,
wxString &  aErrorMsg 
)
inlinevirtualinherited

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.

Definition at line 229 of file sch_item_struct.h.

229 { return false; }
bool SCH_SHEET::LocatePathOfScreen ( SCH_SCREEN aScreen,
SCH_SHEET_PATH aList 
)

Search the existing hierarchy for an instance of screen loaded from aFileName.

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

595 {
596  if( m_screen )
597  {
598  aList->push_back( this );
599 
600  if( m_screen == aScreen )
601  return true;
602 
603  EDA_ITEM* strct = m_screen->GetDrawItems();
604 
605  while( strct )
606  {
607  if( strct->Type() == SCH_SHEET_T )
608  {
609  SCH_SHEET* ss = (SCH_SHEET*) strct;
610 
611  if( ss->LocatePathOfScreen( aScreen, aList ) )
612  return true;
613  }
614 
615  strct = strct->Next();
616  }
617 
618  aList->pop_back();
619  }
620 
621  return false;
622 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
EDA_ITEM * Next() const
Definition: base_struct.h:217
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:594
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
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 736 of file sch_sheet.cpp.

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

737 {
738  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
739 
740  // Ignore the sheet file name if searching to replace.
741  if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE)
742  && SCH_ITEM::Matches( m_fileName, aSearchData ) )
743  {
744  if( aFindLocation )
745  *aFindLocation = GetFileNamePosition();
746 
747  return true;
748  }
749 
750  if( SCH_ITEM::Matches( m_name, aSearchData ) )
751  {
752  if( aFindLocation )
753  *aFindLocation = GetSheetNamePosition();
754 
755  return true;
756  }
757 
758  return false;
759 }
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:411
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:226
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_sheet.cpp:869
wxPoint GetFileNamePosition()
Definition: sch_sheet.cpp:407
const wxChar *const traceFindItem
Flag to enable find debug tracing.
wxPoint GetSheetNamePosition()
Definition: sch_sheet.cpp:389
Perform a search for a item that has replaceable text.
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 183 of file base_struct.cpp.

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

184 {
185  wxString text = aText;
186  wxString searchText = aSearchData.GetFindString();
187 
188  // Don't match if searching for replaceable item and the item doesn't support text replace.
189  if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
190  return false;
191 
192  if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
193  return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
194 
195  if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
196  {
197  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
198  return text.Matches( searchText );
199 
200  return text.MakeUpper().Matches( searchText.MakeUpper() );
201  }
202 
203  if( aSearchData.GetFlags() & wxFR_MATCHCASE )
204  return aText.Find( searchText ) != wxNOT_FOUND;
205 
206  return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
207 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:455
Perform search using simple wild card matching (* & ?).
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 689 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::MirrorSheet().

690 {
691  MIRROR( m_pos.y, aXaxis_position );
692  m_pos.y -= m_size.y;
693 
694  for( SCH_SHEET_PIN& sheetPin : m_pins )
695  {
696  sheetPin.MirrorX( aXaxis_position );
697  }
698 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
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:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
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 701 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::MirrorSheet().

702 {
703  MIRROR( m_pos.x, aYaxis_position );
704  m_pos.x -= m_size.x;
705 
706  for( SCH_SHEET_PIN& label : m_pins )
707  {
708  label.MirrorY( aYaxis_position );
709  }
710 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
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:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
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 478 of file sch_sheet.h.

References SCH_SHEET_PIN::Matches(), SCH_SHEET_PIN::MirrorX(), SCH_SHEET_PIN::MirrorY(), SCH_SHEET_PIN::Replace(), and SCH_SHEET_PIN::Rotate().

Referenced by SetPosition().

479  {
480  m_pos += aMoveVector;
481 
482  for( SCH_SHEET_PIN& pin : m_pins )
483  {
484  pin.Move( aMoveVector );
485  }
486  }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
SCH_ITEM* SCH_ITEM::Next ( ) const
inlineinherited

Definition at line 143 of file sch_item_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), SCH_SHEET_LIST::AnnotatePowerSymbols(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), NETLIST_OBJECT_LIST::BuildNetListInfo(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_SCREEN::CheckIfOnDrawList(), SCH_SCREEN::ClearAnnotation(), SCH_SCREEN::ClearDrawingState(), SCH_SCREEN::CountConnectedItems(), SCH_EDIT_FRAME::CreateArchiveLibrary(), SCH_SCREENS::DeleteAllMarkers(), SCH_EDIT_FRAME::DeleteJunction(), 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_SCREENS::GetLibNicknames(), SCH_SCREEN::GetLine(), SCH_SCREENS::GetMarkerCount(), SCH_SHEET_PATH::GetMultiUnitComponents(), SCH_SCREEN::GetNode(), SCH_SCREEN::GetPin(), SCH_SCREEN::GetSheet(), getSheetBbox(), SCH_SCREEN::GetSheetLabel(), SCH_SCREEN::GetWireOrBus(), SCH_SCREENS::HasNoFullyDefinedLibIds(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), SCH_SCREEN::IsJunctionNeeded(), SCH_EAGLE_PLUGIN::loadSheet(), SCH_SCREEN::MarkConnections(), SCH_EAGLE_PLUGIN::moveLabels(), SCH_EDIT_FRAME::OnConvertTextType(), DIALOG_ERC::OnLeftClickMarkersList(), SCH_EDIT_FRAME::OnUpdateFields(), SCH_SCREEN::Plot(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), SCH_SCREEN::ReplaceWires(), SCH_EDIT_FRAME::SchematicCleanUp(), SCH_SCREEN::SetComponentFootprint(), SCH_EDIT_FRAME::SetCurrentSheetHighlightFlags(), SCH_SCREEN::TestDanglingEnds(), TestDuplicateSheetNames(), SCH_EDIT_FRAME::TrimWire(), and SCH_SCREEN::UpdatePickList().

143 { 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:175
bool SCH_ITEM::operator< ( const SCH_ITEM aItem) const
virtualinherited

Reimplemented in SCH_COMPONENT, and SCH_LINE.

Definition at line 86 of file sch_item_struct.cpp.

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

87 {
88  wxCHECK_MSG( false, this->Type() < aItem.Type(),
89  wxT( "Less than operator not defined for " ) + GetClass() );
90 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
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 240 of file base_struct.cpp.

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

Referenced by EDA_ITEM::IsReplaceable(), and LIB_ALIAS::operator==().

241 {
242  wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
243  GetChars( GetClass() ) ) );
244 
245  return false;
246 }
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 1014 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=(), TO_UTF8, and EDA_ITEM::Type().

1015 {
1016  wxLogDebug( wxT( "Sheet assignment operator." ) );
1017 
1018  wxCHECK_MSG( Type() == aItem.Type(), *this,
1019  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1020  GetClass() );
1021 
1022  if( &aItem != this )
1023  {
1024  SCH_ITEM::operator=( aItem );
1025 
1026  SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
1027 
1028  m_pos = sheet->m_pos;
1029  m_size = sheet->m_size;
1030  m_name = sheet->m_name;
1032  m_fileNameSize = sheet->m_fileNameSize;
1033  m_pins = sheet->m_pins;
1034 
1035  // Ensure sheet labels have their #m_Parent member pointing really on their
1036  // parent, after assigning.
1037  for( SCH_SHEET_PIN& sheetPin : m_pins )
1038  {
1039  sheetPin.SetParent( this );
1040  }
1041  }
1042 
1043  return *this;
1044 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:229
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
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:226
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_sheet.h:251
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
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 936 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, i, 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.

937 {
938  COLOR4D txtcolor = COLOR4D::UNSPECIFIED;
939  wxSize size;
940  wxString Text;
941  int name_orientation;
942  wxPoint pos_sheetname, pos_filename;
943  wxPoint pos;
944 
945  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
946 
947  int thickness = GetPenSize();
948  aPlotter->SetCurrentLineWidth( thickness );
949 
950  aPlotter->MoveTo( m_pos );
951  pos = m_pos;
952  pos.x += m_size.x;
953 
954  aPlotter->LineTo( pos );
955  pos.y += m_size.y;
956 
957  aPlotter->LineTo( pos );
958  pos = m_pos;
959  pos.y += m_size.y;
960 
961  aPlotter->LineTo( pos );
962  aPlotter->FinishTo( m_pos );
963 
964  if( IsVerticalOrientation() )
965  {
966  pos_sheetname = wxPoint( m_pos.x - 8, m_pos.y + m_size.y );
967  pos_filename = wxPoint( m_pos.x + m_size.x + 4, m_pos.y + m_size.y );
968  name_orientation = TEXT_ANGLE_VERT;
969  }
970  else
971  {
972  pos_sheetname = wxPoint( m_pos.x, m_pos.y - 4 );
973  pos_filename = wxPoint( m_pos.x, m_pos.y + m_size.y + 4 );
974  name_orientation = TEXT_ANGLE_HORIZ;
975  }
976 
977  /* Draw texts: SheetName */
978  Text = m_name;
979  size = wxSize( m_sheetNameSize, m_sheetNameSize );
980 
981  //pos = m_pos; pos.y -= 4;
982  thickness = GetDefaultLineThickness();
983  thickness = Clamp_Text_PenSize( thickness, size, false );
984 
985  aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
986 
987  bool italic = false;
988  aPlotter->Text( pos_sheetname, txtcolor, Text, name_orientation, size,
990  thickness, italic, false );
991 
992  /*Draw texts : FileName */
993  Text = GetFileName();
994  size = wxSize( m_fileNameSize, m_fileNameSize );
995  thickness = GetDefaultLineThickness();
996  thickness = Clamp_Text_PenSize( thickness, size, false );
997 
999 
1000  aPlotter->Text( pos_filename, txtcolor, Text, name_orientation, size,
1002  thickness, italic, false );
1003 
1004  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
1005 
1006  /* Draw texts : SheetLabel */
1007  for( size_t i = 0; i < m_pins.size(); i++ )
1008  {
1009  m_pins[i].Plot( aPlotter );
1010  }
1011 }
void FinishTo(const wxPoint &pos)
Definition: plotter.h:250
#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
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...
virtual void SetColor(COLOR4D color)=0
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:229
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:238
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:226
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:383
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
#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.
void LineTo(const wxPoint &pos)
Definition: plotter.h:245
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:646
void MoveTo(const wxPoint &pos)
Definition: plotter.h:240
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
size_t i
Definition: json11.cpp:597
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:221
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 187 of file sch_sheet.cpp.

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

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

188 {
189  wxASSERT( aSheetPin != NULL );
190  wxASSERT( aSheetPin->Type() == SCH_SHEET_PIN_T );
191 
192  SCH_SHEET_PINS::iterator i;
193 
194  for( i = m_pins.begin(); i < m_pins.end(); ++i )
195  {
196  if( *i == aSheetPin )
197  {
198  m_pins.erase( i );
199  renumberPins();
200  return;
201  }
202  }
203 
204  wxLogDebug( wxT( "Fix me: attempt to remove label %s which is not in sheet %s." ),
205  GetChars( aSheetPin->GetShownText() ), GetChars( m_name ) );
206 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
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:226
virtual wxString GetShownText() const
Returns the string actually shown after processing of the base text.
Definition: eda_text.h:133
void renumberPins()
Renumber the sheet pins in the sheet.
Definition: sch_sheet.cpp:768
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
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
size_t i
Definition: json11.cpp:597
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 768 of file sch_sheet.cpp.

References m_pins.

Referenced by AddPin(), and RemovePin().

769 {
770  int id = 2;
771 
772  for( SCH_SHEET_PIN& pin : m_pins )
773  {
774  pin.SetNumber( id );
775  id++;
776  }
777 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
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 210 of file base_struct.cpp.

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

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

211 {
212  wxCHECK_MSG( IsReplaceable(), false,
213  wxT( "Attempt to replace text in <" ) + GetClass() + wxT( "> item." ) );
214 
215  wxString searchString = (aSearchData.GetFlags() & wxFR_MATCHCASE) ? aText : aText.Upper();
216 
217  int result = searchString.Find( (aSearchData.GetFlags() & wxFR_MATCHCASE) ?
218  aSearchData.GetFindString() :
219  aSearchData.GetFindString().Upper() );
220 
221  if( result == wxNOT_FOUND )
222  return false;
223 
224  wxString prefix = aText.Left( result );
225  wxString suffix;
226 
227  if( aSearchData.GetFindString().length() + result < aText.length() )
228  suffix = aText.Right( aText.length() - ( aSearchData.GetFindString().length() + result ) );
229 
230  wxLogTrace( traceFindReplace, wxT( "Replacing '%s', prefix '%s', replace '%s', suffix '%s'." ),
231  GetChars( aText ), GetChars( prefix ), GetChars( aSearchData.GetReplaceString() ),
232  GetChars( suffix ) );
233 
234  aText = prefix + aSearchData.GetReplaceString() + suffix;
235 
236  return true;
237 }
virtual bool IsReplaceable() const
Function IsReplaceable.
Definition: base_struct.h:455
const wxChar *const traceFindReplace
Flag to enable find and replace debug tracing.
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 762 of file sch_sheet.cpp.

References m_name, and EDA_ITEM::Replace().

763 {
764  return EDA_ITEM::Replace( aSearchData, m_name );
765 }
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:226
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 721 of file sch_sheet.cpp.

References m_pins, and m_size.

Referenced by resizeSheetWithMouseCursor().

722 {
723  if( aSize == m_size )
724  return;
725 
726  m_size = aSize;
727 
728  /* Move the sheet labels according to the new sheet size. */
729  for( SCH_SHEET_PIN& label : m_pins )
730  {
731  label.ConstrainOnEdge( label.GetPosition() );
732  }
733 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
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 665 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::RotateHierarchicalSheet().

666 {
667  RotatePoint( &m_pos, aPosition, 900 );
668  RotatePoint( &m_size.x, &m_size.y, 900 );
669 
670  if( m_size.x < 0 )
671  {
672  m_pos.x += m_size.x;
673  m_size.x = -m_size.x;
674  }
675 
676  if( m_size.y < 0 )
677  {
678  m_pos.y += m_size.y;
679  m_size.y = -m_size.y;
680  }
681 
682  for( SCH_SHEET_PIN& sheetPin : m_pins )
683  {
684  sheetPin.Rotate( aPosition );
685  }
686 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
bool SCH_SHEET::SearchHierarchy ( const wxString &  aFilename,
SCH_SCREEN **  aScreen 
)

Search the existing hierarchy for an instance of screen loaded from aFileName.

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 563 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(), and SearchHierarchy().

564 {
565  if( m_screen )
566  {
567  EDA_ITEM* item = m_screen->GetDrawItems();
568 
569  while( item )
570  {
571  if( item->Type() == SCH_SHEET_T )
572  {
573  SCH_SHEET* sheet = (SCH_SHEET*) item;
574 
575  if( sheet->m_screen
576  && sheet->m_screen->GetFileName().CmpNoCase( aFilename ) == 0 )
577  {
578  *aScreen = sheet->m_screen;
579  return true;
580  }
581 
582  if( sheet->SearchHierarchy( aFilename, aScreen ) )
583  return true;
584  }
585 
586  item = item->Next();
587  }
588  }
589 
590  return false;
591 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Search the existing hierarchy for an instance of screen loaded from aFileName.
Definition: sch_sheet.cpp:563
const wxString & GetFileName() const
Definition: sch_screen.h:120
EDA_ITEM * Next() const
Definition: base_struct.h:217
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
SCH_ITEM * GetDrawItems() const
Definition: sch_screen.h:138
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:215
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 223 of file base_struct.h.

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

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

Definition at line 240 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

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

240 { SetFlags( BRIGHTENED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:133
void SCH_SHEET::SetFileName ( const wxString &  aFilename)
inline

Definition at line 467 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet(), SCH_EDIT_FRAME::importFile(), and SCH_EDIT_FRAME::OpenProjectFiles().

468  {
469  m_fileName = aFilename;
470  // Filenames are stored using unix notation
471  m_fileName.Replace( wxT("\\"), wxT("/") );
472  }
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:222
void SCH_SHEET::SetFileNameSize ( int  aSize)
inline

Definition at line 277 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet().

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

Definition at line 264 of file base_struct.h.

Referenced by SCH_EAGLE_PLUGIN::addBusEntries(), SCH_SCREEN::addConnectedItemsToBlock(), PCB_BASE_FRAME::AddModuleToBoard(), 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(), SCH_EDIT_FRAME::copyBlockItems(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), LIB_EDIT_FRAME::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(), SCH_EDIT_FRAME::DeleteItem(), PCB_EDIT_FRAME::EditDimension(), PCB_EDIT_FRAME::FlipTextePcb(), LIB_EDIT_FRAME::GetComponentFromRedoList(), LIB_EDIT_FRAME::GetComponentFromUndoList(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), 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(), KIGFX::ORIGIN_VIEWITEM::ORIGIN_VIEWITEM(), 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(), LIB_EDIT_FRAME::SaveCopyInUndoList(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), BLOCK_SELECTOR::SetFlags(), 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().

264 { m_Flags |= aMask; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:186
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 276 of file base_struct.h.

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

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

Definition at line 239 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

239 { SetFlags( HIGHLIGHTED ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:132
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 170 of file sch_item_struct.h.

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

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

Definition at line 225 of file base_struct.h.

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

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

Definition at line 269 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::AppendSchematic(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditSheet(), and SCH_EDIT_FRAME::PasteListOfItems().

269 { 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:226
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 222 of file base_struct.h.

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

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

Definition at line 224 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(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties(), LIB_PART::LIB_PART(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), SCH_LEGACY_PLUGIN::loadHierarchy(), LIB_EDIT_FRAME::LoadOneSymbol(), MODULE::MODULE(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue(), DIALOG_LIB_EDIT_PIN::OnPaintShowPanel(), MODULE::operator=(), SCH_COMPONENT::operator=(), PCB_PARSER::parseMODULE_unchecked(), LIB_EDIT_FRAME::pasteClipboard(), PCBNEW_CONTROL::PasteItemsFromClipboard(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), FOOTPRINT_PREVIEW_PANEL::renderFootprint(), BOARD_NETLIST_UPDATER::replaceComponent(), BOARD::ReplaceNetlist(), 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(), SwapData(), SCH_COMPONENT::SwapData(), and SwapItemData().

224 { m_Parent = aParent; }
EDA_ITEM * m_Parent
Linked list: Link (parent struct)
Definition: base_struct.h:179
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 712 of file sch_sheet.cpp.

References m_pos, and Move().

713 {
714  // Remember the sheet and all pin sheet positions must be
715  // modified. So use Move function to do that.
716  Move( aPosition - m_pos );
717 }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
void Move(const wxPoint &aMoveVector) override
Function Move moves the item by aMoveVector to a new position.
Definition: sch_sheet.h:478
void SCH_SHEET::SetScreen ( SCH_SCREEN aScreen)

Set the SCH_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 104 of file sch_sheet.cpp.

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

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

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

Definition at line 238 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

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

238 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:116
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
void SCH_SHEET::SetSheetNameSize ( int  aSize)
inline

Definition at line 273 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet().

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

Definition at line 283 of file sch_sheet.h.

References SCH_TEXT::GetMsgPanelInfo().

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

Definition at line 156 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::PrepareMoveItem().

156 { 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 ( timestamp_t  aNewTimeStamp)
inlineinherited

Definition at line 214 of file base_struct.h.

Referenced by PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), PCAD2KICAD::PCB_TEXT::AddToBoard(), PCAD2KICAD::PCB_LINE::AddToBoard(), PCAD2KICAD::PCB_ARC::AddToBoard(), PCAD2KICAD::PCB_PAD::AddToBoard(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), PCAD2KICAD::PCB_MODULE::AddToBoard(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::CreateSheet(), Diagnose(), DuplicateItemsInList(), DuplicateStruct(), EDIT_TOOL::editFootprintInFpEditor(), PCB_EDIT_FRAME::Exchange_Module(), DIALOG_FOOTPRINT_BOARD_EDITOR::GotoModuleEditor(), EDA_ITEM::initVars(), BOARD::InsertArea(), LEGACY_PLUGIN::loadMODULE(), 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(), PCB_PARSER::parseDIMENSION(), 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(), SwapItemData(), TestDuplicateSheetNames(), and DIALOG_ERC::TestErc().

214 { m_TimeStamp = aNewTimeStamp; }
timestamp_t m_TimeStamp
Time stamp used for logical links.
Definition: base_struct.h:180
void EDA_ITEM::SetWireImage ( )
inlineinherited

Definition at line 237 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

237 { SetFlags( IS_WIRE_IMAGE ); }
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:264
#define IS_WIRE_IMAGE
Item to be drawn as wireframe while editing.
Definition: base_struct.h:113
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 474 of file base_struct.h.

References EDA_ITEM::Matches(), EDA_ITEM::operator=(), EDA_ITEM::ViewBBox(), and EDA_ITEM::ViewGetLayers().

Referenced by PART_LIB::GetEntryTypePowerNames().

474 { 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 148 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().

149 {
150  wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
151  wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
152  GetChars( aItem->GetClass() ) ) );
153 
154  SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
155 
156  std::swap( m_pos, sheet->m_pos );
157  std::swap( m_size, sheet->m_size );
158  std::swap( m_name, sheet->m_name );
159  std::swap( m_sheetNameSize, sheet->m_sheetNameSize );
160  std::swap( m_fileNameSize, sheet->m_fileNameSize );
161  m_pins.swap( sheet->m_pins );
162 
163  // Ensure sheet labels have their .m_Parent member pointing really on their
164  // parent, after swapping.
165  for( SCH_SHEET_PIN& sheetPin : m_pins )
166  {
167  sheetPin.SetParent( this );
168  }
169 
170  for( SCH_SHEET_PIN& sheetPin : sheet->m_pins )
171  {
172  sheetPin.SetParent( sheet );
173  }
174 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:229
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:238
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:226
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:235
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:224
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:232
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 209 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(), ALIGN_DISTRIBUTE_TOOL::AlignBottom(), ALIGN_DISTRIBUTE_TOOL::AlignCenterX(), ALIGN_DISTRIBUTE_TOOL::AlignCenterY(), ALIGN_DISTRIBUTE_TOOL::AlignTop(), 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(), HIERARCHY_NAVIG_DLG::buildHierarchyTree(), SCH_SCREENS::buildScreenList(), SCH_SHEET_LIST::BuildSheetList(), calcArea(), calcMaxArea(), SCH_NO_CONNECT::CanConnect(), SCH_JUNCTION::CanConnect(), SCH_BUS_WIRE_ENTRY::CanConnect(), SCH_LINE::CanConnect(), SCH_BUS_BUS_ENTRY::CanConnect(), SCH_LABEL::CanConnect(), SCH_GLOBALLABEL::CanConnect(), SCH_HIERLABEL::CanConnect(), CanConnect(), SCH_COMPONENT::CanConnect(), ROUTER_TOOL::CanInlineDrag(), DIALOG_EXCHANGE_FOOTPRINTS::changeSameFootprints(), SCH_SCREENS::ChangeSymbolLibNickname(), SCH_EDIT_FRAME::CheckListConnections(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_PCB::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(), MODULE::CoverageRatio(), 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(), DeleteNullTrackSegments(), PYTHON_ACTION_PLUGINS::deregister_action(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_ERC::DisplayERC_MarkersList(), ALIGN_DISTRIBUTE_TOOL::doAlignLeft(), ALIGN_DISTRIBUTE_TOOL::doAlignRight(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), KIGFX::GERBVIEW_PAINTER::Draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovePin(), DrawMovingBlockOutlines(), drawPickedItems(), CN_ITEM::Dump(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), SCH_SCREEN::ExtractWires(), DRC::fillMarker(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), EDIT_TOOL::FootprintFilter(), FootprintWriteShape(), PCB_IO::Format(), PCB_IO::format(), FormatProbeItem(), POINT_EDITOR::get45DegConstrainer(), getAnchorPoint(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), NETLIST_OBJECT::GetComponentParent(), SCH_SCREEN::GetConnection(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), GetEndPoints(), GetFirstTrack(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), SCH_SCREENS::GetLibNicknames(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClass(), CONNECTIVITY_DATA::GetNetItems(), LIB_PART::GetNextDrawItem(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), LIB_EDIT_FRAME::GlobalSetPins(), SELECTION_TOOL::guessSelectionCandidates(), hash_eda(), SCH_SCREENS::HasNoFullyDefinedLibIds(), HasUndefinedPins(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), PCB_LAYER_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), CN_ANCHOR::IsDangling(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_LINE::IsParallel(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), CLIPBOARD_IO::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(), ROUTER_TOOL::NeighboringSegmentFilter(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), 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(), SCH_EDIT_FRAME::OnLeftDClick(), LIB_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(), PCBNEW_CONTROL::PasteItemsFromClipboard(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), CN_CONNECTIVITY_ALGO::Remove(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), TRACKS_CLEANER::removeDuplicatesOfTrack(), RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), SCH_EDIT_FRAME::SchematicCleanUp(), 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_NO_CONNECT::SwapData(), SCH_JUNCTION::SwapData(), SCH_BITMAP::SwapData(), PCB_TARGET::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), TEXTE_PCB::SwapData(), DIMENSION::SwapData(), DRAWSEGMENT::SwapData(), TRACK::SwapData(), SwapData(), SCH_COMPONENT::SwapData(), VIA::SwapData(), ZONE_CONTAINER::SwapData(), MODULE::SwapData(), D_PAD::SwapData(), SwapItemData(), PCB_EDIT_FRAME::SwitchLayer(), TestDuplicateSheetNames(), TRACKS_CLEANER::testTrackEndpointDangling(), TEXTE_MODULE::TEXTE_MODULE(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), TraceSegmentPcb(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), GERBER_DRAW_ITEM::Visit(), EDA_ITEM::Visit(), Visit(), and SCH_COMPONENT::Visit().

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

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

Returns
BOX2I - the current bounding box

Implements KIGFX::VIEW_ITEM.

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

Definition at line 266 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

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

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

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

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

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

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

Definition at line 116 of file view_item.h.

References KIGFX::VIEW_ITEM::ViewGetLayers().

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

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

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

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

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

Implements KIGFX::VIEW_ITEM.

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

Definition at line 274 of file base_struct.cpp.

Referenced by EDA_ITEM::Sort().

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

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

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

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

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

Definition at line 140 of file view_item.h.

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

141  {
142  // By default always show the item
143  return 0;
144  }
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 842 of file sch_sheet.cpp.

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

843 {
844  KICAD_T stype;
845 
846  for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
847  {
848  // If caller wants to inspect my type
849  if( stype == Type() )
850  {
851  if( SEARCH_QUIT == aInspector( this, NULL ) )
852  return SEARCH_QUIT;
853  }
854  else if( stype == SCH_SHEET_PIN_T )
855  {
856  // Test the sheet labels.
857  for( size_t i = 0; i < m_pins.size(); i++ )
858  {
859  if( SEARCH_QUIT == aInspector( &m_pins[ i ], this ) )
860  return SEARCH_QUIT;
861  }
862  }
863  }
864 
865  return SEARCH_CONTINUE;
866 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:218
size_t i
Definition: json11.cpp:597

Friends And Related Function Documentation

friend class SCH_SHEET_PIN
friend

Definition at line 211 of file sch_sheet.h.

Member Data Documentation

EDA_ITEMS SCH_ITEM::m_connections
protectedinherited

List of items connected to this item.

Definition at line 119 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 222 of file sch_sheet.h.

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

int SCH_SHEET::m_fileNameSize
private

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

Definition at line 232 of file sch_sheet.h.

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

STATUS_FLAGS EDA_ITEM::m_Flags
protectedinherited

Flag bits for editing and other uses.

Definition at line 186 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(), 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(), GERBER_DRAW_ITEM::HitTest(), SCH_COMPONENT::HitTest(), LIB_ITEM::InEditMode(), EDA_ITEM::initVars(), SCH_ITEM::IsConnected(), 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 183 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 177 of file base_struct.h.

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

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 226 of file sch_sheet.h.

Referenced by Draw(), GetBoundingBox(), GetMsgPanelInfo(), GetSelectMenuText(), Matches(), operator=(), Plot(), RemovePin(), Replace(), 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 215 of file sch_sheet.h.

Referenced by CleanupSheet(), ComponentCount(), CountSheets(), GetScreenCount(), HasUndefinedPins(), 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 229 of file sch_sheet.h.

Referenced by Draw(), GetBoundingBox(), operator=(), Plot(), 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 120 of file sch_item_struct.h.

EDA_ITEM* EDA_ITEM::Pback
protectedinherited

previous in linked list

Definition at line 176 of file base_struct.h.

Referenced by SCH_LINE::Back(), TRACK::Back(), BOARD_ITEM::Back(), EDA_ITEM::Back(), EDA_ITEM::initVars(), and TRACK::SetBack().


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