KiCad PCB EDA Suite
SCH_SHEET Class Reference

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

#include <sch_sheet.h>

Inheritance diagram for SCH_SHEET:
SCH_ITEM EDA_ITEM KIGFX::VIEW_ITEM

Public Member Functions

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

Static Public Member Functions

static std::string FormatInternalUnits (int aValue)
 Function FormatInternalUnits converts aValue from schematic internal units to a string appropriate for writing to file. More...
 
static std::string FormatInternalUnits (const wxPoint &aPoint)
 
static std::string FormatInternalUnits (const wxSize &aSize)
 
static std::string FormatAngle (double aAngle)
 Function FormatAngle converts aAngle from board units to a string appropriate for writing to file. More...
 
static SEARCH_RESULT IterateForward (EDA_ITEM *listStart, INSPECTOR inspector, void *testData, const KICAD_T scanTypes[])
 Function IterateForward walks through the object tree calling the inspector() on each object type requested in scanTypes. More...
 
static bool Sort (const EDA_ITEM *aLeft, const EDA_ITEM *aRight)
 Function Sort is a helper function to be used by the C++ STL sort algorithm for sorting a STL container of EDA_ITEM pointers. More...
 

Protected Member Functions

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

Protected Attributes

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

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

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

Private Attributes

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

Friends

class SCH_SHEET_PIN
 

Detailed Description

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

Definition at line 216 of file sch_sheet.h.

Constructor & Destructor Documentation

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

Definition at line 46 of file sch_sheet.cpp.

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

Referenced by Clone().

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

Copy Constructor clones aSheet into a new object.

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

Definition at line 61 of file sch_sheet.cpp.

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

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

Definition at line 83 of file sch_sheet.cpp.

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

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

Member Function Documentation

void SCH_SHEET::AddPin ( SCH_SHEET_PIN aSheetPin)

Add aSheetPin to the sheet.

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

Parameters
aSheetPinThe sheet pin item to add to the sheet.

Definition at line 360 of file sch_sheet.cpp.

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

Referenced by Load().

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

Definition at line 145 of file sch_item_struct.h.

References EDA_ITEM::Pback.

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

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

Reimplemented in SCH_TEXT.

Definition at line 346 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::RepeatDrawItem().

346 { 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.

Delete sheet labels which do not have 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 497 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::Process_Special_Functions().

498 {
499  SCH_SHEET_PINS::iterator i = m_pins.begin();
500 
501  while( i != m_pins.end() )
502  {
503  /* Search the schematic for a hierarchical label corresponding to this sheet label. */
504  EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
505  const SCH_HIERLABEL* HLabel = NULL;
506 
507  for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
508  {
509  if( DrawStruct->Type() != SCH_HIERARCHICAL_LABEL_T )
510  continue;
511 
512  HLabel = static_cast<SCH_HIERLABEL*>( DrawStruct );
513 
514  if( i->GetText().CmpNoCase( HLabel->GetText() ) == 0 )
515  break; // Found!
516 
517  HLabel = NULL;
518  }
519 
520  if( HLabel == NULL ) // Hlabel not found: delete sheet label.
521  i = m_pins.erase( i );
522  else
523  ++i;
524  }
525 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
EDA_ITEM * Next() const
Definition: base_struct.h:206
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
void EDA_ITEM::ClearBrightened ( )
inlineinherited

Definition at line 233 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::ClearFlags().

Referenced by SELECTION_TOOL::disambiguationMenu().

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

305 { 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 254 of file base_struct.h.

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

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

Definition at line 232 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and HIGHLIGHTED.

232 { ClearFlags( HIGHLIGHTED ); }
#define HIGHLIGHTED
item is drawn in normal colors, when the rest is darkened
Definition: base_struct.h:136
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void EDA_ITEM::ClearSelected ( )
inlineinherited

Definition at line 231 of file base_struct.h.

References EDA_ITEM::ClearFlags(), and SELECTED.

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

231 { ClearFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:120
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
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 99 of file sch_sheet.cpp.

References SCH_SHEET().

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

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

Returns
the component count.

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

684 {
685  int n = 0;
686 
687  if( m_screen )
688  {
689  EDA_ITEM* bs;
690 
691  for( bs = m_screen->GetDrawItems(); bs != NULL; bs = bs->Next() )
692  {
693  if( bs->Type() == SCH_COMPONENT_T )
694  {
695  SCH_COMPONENT* Cmp = (SCH_COMPONENT*) bs;
696 
697  if( Cmp->GetField( VALUE )->GetText().GetChar( 0 ) != '#' )
698  n++;
699  }
700 
701  if( bs->Type() == SCH_SHEET_T )
702  {
703  SCH_SHEET* sheet = (SCH_SHEET*) bs;
704  n += sheet->ComponentCount();
705  }
706  }
707  }
708 
709  return n;
710 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
int ComponentCount()
Function ComponentCount count our own components, without the power components.
Definition: sch_sheet.cpp:683
EDA_ITEM * Next() const
Definition: base_struct.h:206
SCH_FIELD * GetField(int aFieldNdx) const
Function GetField returns a field.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
Field Value of part, i.e. "3.3K".
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
int SCH_SHEET::CountSheets ( )

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

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

Definition at line 828 of file sch_sheet.cpp.

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

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

829 {
830  int count = 1; //1 = this!!
831 
832  if( m_screen )
833  {
834  EDA_ITEM* strct = m_screen->GetDrawItems();
835 
836  for( ; strct; strct = strct->Next() )
837  {
838  if( strct->Type() == SCH_SHEET_T )
839  {
840  SCH_SHEET* subsheet = (SCH_SHEET*) strct;
841  count += subsheet->CountSheets();
842  }
843  }
844  }
845  return count;
846 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
int CountSheets()
Function CountSheets calculates the number of sheets found in "this" this number includes the full su...
Definition: sch_sheet.cpp:828
EDA_ITEM * Next() const
Definition: base_struct.h:206
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
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 583 of file sch_sheet.cpp.

References color, DrawGraphicText(), EDA_DRAW_PANEL::GetClipBox(), GetFileNamePosition(), GetLayerColor(), GetPenSize(), GetSheetNamePosition(), GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_TOP, 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().

585 {
586  COLOR4D txtcolor;
587  wxString Text;
588  COLOR4D color;
589  int name_orientation;
590  wxPoint pos_sheetname,pos_filename;
591  wxPoint pos = m_pos + aOffset;
592  int lineWidth = GetPenSize();
593  EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
594 
595  if( aColor != COLOR4D::UNSPECIFIED )
596  color = aColor;
597  else
598  color = GetLayerColor( m_Layer );
599 
600  GRSetDrawMode( aDC, aDrawMode );
601 
602  GRRect( clipbox, aDC, pos.x, pos.y,
603  pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
604 
605  pos_sheetname = GetSheetNamePosition() + aOffset;
606  pos_filename = GetFileNamePosition() + aOffset;
607 
608  if( IsVerticalOrientation() )
609  name_orientation = TEXT_ANGLE_VERT;
610  else
611  name_orientation = TEXT_ANGLE_HORIZ;
612 
613  /* Draw text : SheetName */
614  if( aColor != COLOR4D::UNSPECIFIED )
615  txtcolor = aColor;
616  else
617  txtcolor = GetLayerColor( LAYER_SHEETNAME );
618 
619  Text = wxT( "Sheet: " ) + m_name;
620  DrawGraphicText( clipbox, aDC, pos_sheetname,
621  txtcolor, Text, name_orientation,
622  wxSize( m_sheetNameSize, m_sheetNameSize ),
624  false, false );
625 
626  /* Draw text : FileName */
627  if( aColor != COLOR4D::UNSPECIFIED )
628  txtcolor = aColor;
629  else
630  txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
631 
632  Text = wxT( "File: " ) + m_fileName;
633  DrawGraphicText( clipbox, aDC, pos_filename,
634  txtcolor, Text, name_orientation,
635  wxSize( m_fileNameSize, m_fileNameSize ),
637  false, false );
638 
639 
640  /* Draw text : SheetLabel */
641  for( SCH_SHEET_PIN& sheetPin : m_pins )
642  {
643  if( !sheetPin.IsMoving() )
644  sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor );
645  }
646 }
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
SCH_LAYER_ID m_Layer
void DrawGraphicText(EDA_RECT *aClipBox, wxDC *aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, void(*aCallback)(int x0, int y0, int xf, int yf), PLOTTER *aPlotter)
Function DrawGraphicText Draw a graphic text (like module texts)
Definition: drawtxt.cpp:122
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:166
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:540
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
#define TEXT_ANGLE_VERT
Definition: common.h:92
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1077
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
EDA_RECT * GetClipBox()
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
wxPoint GetFileNamePosition()
Function GetFileNamePosition.
Definition: sch_sheet.cpp:564
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
wxPoint GetSheetNamePosition()
Function GetSheetNamePosition.
Definition: sch_sheet.cpp:546
Class EDA_RECT handles the component boundary box.
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:404
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
std::string SCH_ITEM::FormatAngle ( double  aAngle)
staticinherited

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

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

Definition at line 131 of file sch_item_struct.cpp.

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

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

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

Definition at line 107 of file sch_item_struct.cpp.

Referenced by SCH_ITEM::FormatInternalUnits().

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

Definition at line 142 of file sch_item_struct.cpp.

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

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

Definition at line 148 of file sch_item_struct.cpp.

References SCH_ITEM::FormatInternalUnits().

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 649 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(), HitTest(), IsSelectStateChanged(), SCH_EDIT_FRAME::MirrorSheet(), SCH_EDIT_FRAME::Process_Special_Functions(), and SCH_EDIT_FRAME::RotateHierarchicalSheet().

650 {
651  wxPoint end;
652  EDA_RECT box( m_pos, m_size );
653  int lineWidth = GetPenSize();
654 
655  // Determine length of texts
656  wxString text = wxT( "Sheet: " ) + m_name;
657  int textlen = GraphicTextWidth( text, wxSize( m_sheetNameSize, m_sheetNameSize ),
658  false, false );
659 
660  text = wxT( "File: " ) + m_fileName;
661  int textlen2 = GraphicTextWidth( text, wxSize( m_fileNameSize, m_fileNameSize ),
662  false, false );
663 
664  // Calculate bounding box X size:
665  textlen = std::max( textlen, textlen2 );
666  end.x = std::max( m_size.x, textlen );
667 
668  // Calculate bounding box pos:
669  end.y = m_size.y;
670  end += m_pos;
671 
672  // Move upper and lower limits to include texts:
673  box.SetY( box.GetY() - ( KiROUND( m_sheetNameSize * 1.3 ) + 8 ) );
674  end.y += KiROUND( m_fileNameSize * 1.3 ) + 8;
675 
676  box.SetEnd( end );
677  box.Inflate( lineWidth / 2 );
678 
679  return box;
680 }
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:540
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
int GraphicTextWidth(const wxString &aText, const wxSize &aSize, bool aItalic, bool aBold)
Function GraphicTextWidth.
Definition: drawtxt.cpp:88
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
wxString SCH_SHEET::GetClass ( ) const
inlineoverridevirtual

Function GetClass returns the class name.

Returns
wxString

Reimplemented from SCH_ITEM.

Definition at line 259 of file sch_sheet.h.

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

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

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

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

Parameters
aPointsList of connection points to add to.

Reimplemented from SCH_ITEM.

Definition at line 1038 of file sch_sheet.cpp.

References GetPins(), and GetPosition().

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

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

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

Parameters
aItemList- List of DANGLING_END_ITEMS to add to.

Reimplemented from SCH_ITEM.

Definition at line 983 of file sch_sheet.cpp.

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

984 {
985  for( unsigned ii = 0; ii < GetPins().size(); ii++ )
986  {
987  SCH_SHEET_PIN &pinsheet = GetPins()[ii];
988 
989  wxCHECK2_MSG( pinsheet.Type() == SCH_SHEET_PIN_T, continue,
990  wxT( "Invalid item in schematic sheet pin list. Bad programmer!" ) );
991 
992  pinsheet.GetEndPoints( aItemList );
993  }
994 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList) override
Function GetEndPoints adds the schematic item end points to aItemList if the item has end points...
wxString SCH_SHEET::GetFileName ( void  ) const

Function GetFileName return the filename corresponding to this sheet.

Returns
a wxString containing the filename

Definition at line 849 of file sch_sheet.cpp.

References m_fileName.

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

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

Function GetFileNamePosition.

Returns
the position of the anchor of filename text

Definition at line 564 of file sch_sheet.cpp.

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

Referenced by Draw(), and Matches().

565 {
566  wxPoint pos = m_pos;
567  int margin = GetPenSize() + 4;
568 
569  if( IsVerticalOrientation() )
570  {
571  pos.x += m_size.x + margin;
572  pos.y += m_size.y;
573  }
574  else
575  {
576  pos.y += m_size.y + margin;
577  }
578 
579  return pos;
580 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:540
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:404
int SCH_SHEET::GetFileNameSize ( ) const
inline

Definition at line 282 of file sch_sheet.h.

References m_fileNameSize.

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

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

Definition at line 255 of file base_struct.h.

References EDA_ITEM::m_Flags.

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

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

1081 {
1082  return add_hierarchical_subsheet_xpm;
1083 }
int SCH_SHEET::GetMinHeight ( ) const

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

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

Returns
The minimum height the sheet can be resized.

Definition at line 478 of file sch_sheet.cpp.

References m_pins, m_pos, MIN_SHEET_HEIGHT, and wxPoint::y.

Referenced by resizeSheetWithMouseCursor().

479 {
480  int height = MIN_SHEET_HEIGHT;
481 
482  for( size_t i = 0; i < m_pins.size(); i++ )
483  {
484  int pinY = m_pins[i].GetPosition().y - m_pos.y;
485 
486  if( pinY > height )
487  height = pinY;
488  }
489 
490  return height;
491 }
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
#define MIN_SHEET_HEIGHT
Definition: sch_sheet.h:48
int SCH_SHEET::GetMinWidth ( ) const

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

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

Returns
The minimum width the sheet can be resized.

Definition at line 444 of file sch_sheet.cpp.

References EDA_RECT::GetWidth(), m_pins, and MIN_SHEET_WIDTH.

Referenced by resizeSheetWithMouseCursor().

445 {
446  int width = MIN_SHEET_WIDTH;
447 
448  for( size_t i = 0; i < m_pins.size(); i++ )
449  {
450  int edge = m_pins[i].GetEdge();
451 
452  // Make sure pin is on right or left side of sheet.
453  if( edge >= 2 )
454  continue;
455 
456  EDA_RECT rect = m_pins[i].GetBoundingBox();
457 
458  if( width < rect.GetWidth() )
459  width = rect.GetWidth();
460 
461  for( size_t j = 0; j < m_pins.size(); j++ )
462  {
463  if( (i == j) || (m_pins[i].GetPosition().y != m_pins[j].GetPosition().y) )
464  continue;
465 
466  if( width < rect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth() )
467  {
468  width = rect.GetWidth() + m_pins[j].GetBoundingBox().GetWidth();
469  break;
470  }
471  }
472  }
473 
474  return width;
475 }
#define MIN_SHEET_WIDTH
Definition: sch_sheet.h:47
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class EDA_RECT handles the component boundary box.
int GetWidth() const
void SCH_SHEET::GetMsgPanelInfo ( std::vector< MSG_PANEL_ITEM > &  aList)
overridevirtual

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

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

Reimplemented from EDA_ITEM.

Definition at line 855 of file sch_sheet.cpp.

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

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

Definition at line 274 of file sch_sheet.h.

References m_name.

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

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

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

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

Reimplemented from SCH_ITEM.

Definition at line 1115 of file sch_sheet.cpp.

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

1117 {
1118  SCH_SHEET_PATH sheetPath = *aSheetPath;
1119  sheetPath.push_back( this );
1120 
1121  for( size_t i = 0; i < m_pins.size(); i++ )
1122  {
1123  NETLIST_OBJECT* item = new NETLIST_OBJECT();
1124  item->m_SheetPathInclude = sheetPath;
1125  item->m_SheetPath = *aSheetPath;
1126  item->m_Comp = &m_pins[i];
1127  item->m_Link = this;
1128  item->m_Type = NET_SHEETLABEL;
1129  item->m_Label = m_pins[i].GetText();
1130  item->m_Start = item->m_End = m_pins[i].GetPosition();
1131  aNetListItems.push_back( item );
1132 
1133  if( IsBusLabel( m_pins[i].GetText() ) )
1134  item->ConvertBusToNetListItems( aNetListItems );
1135  }
1136 }
bool IsBusLabel(const wxString &aLabel)
Function IsBusLabel test if aLabel has a bus notation.
SCH_SHEET_PATH m_SheetPathInclude
SCH_SHEET_PATH m_SheetPath
NETLIST_ITEM_T m_Type
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
wxString GetText(GRAPHIC_PINSHAPE shape)
Definition: pin_shape.cpp:33
Class SCH_SHEET_PATH.
void ConvertBusToNetListItems(NETLIST_OBJECT_LIST &aNetListItems)
Function ConvertBusToNetListItems breaks the text of a bus label type net list object into as many me...
int SCH_SHEET::GetPenSize ( ) const
overridevirtual

Function GetPenSize virtual pure.

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

Reimplemented from SCH_ITEM.

Definition at line 540 of file sch_sheet.cpp.

References GetDefaultLineThickness().

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

541 {
542  return GetDefaultLineThickness();
543 }
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 528 of file sch_sheet.cpp.

References m_pins.

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

529 {
530  for( SCH_SHEET_PIN& pin : m_pins )
531  {
532  if( pin.HitTest( aPosition, 0 ) )
533  return &pin;
534  }
535 
536  return NULL;
537 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
SCH_SHEET_PINS& SCH_SHEET::GetPins ( )
inline

Definition at line 348 of file sch_sheet.h.

References m_pins.

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

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

Definition at line 350 of file sch_sheet.h.

References m_pins.

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

Function GetPosition.

Returns
A wxPoint object containing the schematic item position.

Implements SCH_ITEM.

Definition at line 582 of file sch_sheet.h.

References m_pos.

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

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

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

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

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

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

Function GetRootSheet.

returns the root sheet of this SCH_SHEET object.

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

Returns
a SCH_SHEET pointer to the root sheet.

Definition at line 137 of file sch_sheet.cpp.

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

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

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

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

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

Definition at line 128 of file sch_sheet.cpp.

References SCH_SCREEN::GetRefCount(), and m_screen.

Referenced by SCH_EDIT_FRAME::EditSheet().

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

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

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

Returns
The menu text string.

Reimplemented from EDA_ITEM.

Definition at line 1072 of file sch_sheet.cpp.

References GetChars(), and m_name.

Referenced by Matches().

1073 {
1074  wxString tmp;
1075  tmp.Printf( _( "Hierarchical Sheet %s" ), GetChars( m_name ) );
1076  return tmp;
1077 }
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
wxPoint SCH_SHEET::GetSheetNamePosition ( )

Function GetSheetNamePosition.

Returns
the position of the anchor of sheet name text

Definition at line 546 of file sch_sheet.cpp.

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

Referenced by Draw(), and Matches().

547 {
548  wxPoint pos = m_pos;
549 
550  if( IsVerticalOrientation() )
551  {
552  pos.x -= 8;
553  pos.y += m_size.y;
554  }
555  else
556  {
557  pos.y -= 8;
558  }
559 
560  return pos;
561 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:404
int SCH_SHEET::GetSheetNameSize ( ) const
inline

Definition at line 278 of file sch_sheet.h.

References m_sheetNameSize.

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

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

Definition at line 288 of file sch_sheet.h.

References m_size.

Referenced by SCH_LEGACY_PLUGIN::saveSheet().

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

Definition at line 250 of file base_struct.h.

References EDA_ITEM::m_Status.

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

Definition at line 156 of file sch_item_struct.h.

References SCH_ITEM::m_storedPos.

Referenced by moveItemWithMouseCursor().

156 { 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 392 of file sch_sheet.cpp.

References m_pins.

Referenced by SCH_EDIT_FRAME::ImportSheetPin().

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

Definition at line 388 of file sch_sheet.h.

Referenced by resizeSheetWithMouseCursor().

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

Check all sheet labels against schematic for undefined hierarchical labels.

Returns
True if there are any undefined labels.

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

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

Reimplemented from EDA_ITEM.

Definition at line 317 of file sch_item_struct.h.

318  {
319  return HitTest( aPosition, 0 );
320  }
virtual bool HitTest(const wxPoint &aPosition) const override
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 1086 of file sch_sheet.cpp.

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

1087 {
1088  EDA_RECT rect = GetBoundingBox();
1089 
1090  rect.Inflate( aAccuracy );
1091 
1092  return rect.Contains( aPosition );
1093 }
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:649
Class EDA_RECT handles the component boundary box.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool SCH_SHEET::HitTest ( const EDA_RECT aRect,
bool  aContained = false,
int  aAccuracy = 0 
) const
overridevirtual

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

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

Reimplemented from SCH_ITEM.

Definition at line 1096 of file sch_sheet.cpp.

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

1097 {
1098  EDA_RECT rect = aRect;
1099 
1100  rect.Inflate( aAccuracy );
1101 
1102  if( aContained )
1103  return rect.Contains( GetBoundingBox() );
1104 
1105  return rect.Intersects( GetBoundingBox() );
1106 }
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:649
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
Class EDA_RECT handles the component boundary box.
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
bool EDA_ITEM::IsBrightened ( ) const
inlineinherited

Definition at line 224 of file base_struct.h.

References BRIGHTENED.

Referenced by SELECTION_TOOL::disambiguationMenu().

224 { return m_Flags & BRIGHTENED; }
#define BRIGHTENED
item is drawn with a bright contour
Definition: base_struct.h:137
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool SCH_SHEET::IsConnectable ( ) const
inlineoverridevirtual

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

Reimplemented from SCH_ITEM.

Definition at line 567 of file sch_sheet.h.

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

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

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

Definition at line 79 of file sch_item_struct.cpp.

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

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

80 {
82  return false;
83 
84  return doIsConnected( aPosition );
85 }
#define SKIP_STRUCT
flag indicating that the structure should be ignored
Definition: base_struct.h:124
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:122
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool SCH_SHEET::IsDangling ( ) const
overridevirtual

Reimplemented from SCH_ITEM.

Definition at line 1010 of file sch_sheet.cpp.

References GetPins().

Referenced by IsDanglingStateChanged().

1011 {
1012  // If any hierarchical label in the sheet is dangling, then the sheet is dangling.
1013  for( size_t i = 0; i < GetPins().size(); i++ )
1014  {
1015  if( GetPins()[i].IsDangling() )
1016  return true;
1017  }
1018 
1019  return false;
1020 }
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
bool SCH_SHEET::IsDanglingStateChanged ( std::vector< DANGLING_END_ITEM > &  aItemList)
overridevirtual

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

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

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

Reimplemented from SCH_ITEM.

Definition at line 997 of file sch_sheet.cpp.

References GetPins(), and IsDangling().

998 {
999  bool currentState = IsDangling();
1000 
1001  for( SCH_SHEET_PIN& pinsheet : GetPins() )
1002  {
1003  pinsheet.IsDanglingStateChanged( aItemList );
1004  }
1005 
1006  return currentState != IsDangling();
1007 }
bool IsDangling() const override
Definition: sch_sheet.cpp:1010
SCH_SHEET_PINS & GetPins()
Definition: sch_sheet.h:348
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
bool EDA_ITEM::IsDragging ( ) const
inlineinherited
bool EDA_ITEM::IsHighlighted ( ) const
inlineinherited

Definition at line 223 of file base_struct.h.

References HIGHLIGHTED.

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

Definition at line 217 of file base_struct.h.

References IS_CHANGED.

Referenced by LIB_EDIT_FRAME::OnEditPin().

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

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

Returns
false for a hierarchical sheet

Reimplemented from SCH_ITEM.

Definition at line 272 of file sch_sheet.h.

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

Definition at line 216 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(), SCH_EDIT_FRAME::OnAutoplaceFields(), SCH_EDIT_FRAME::OnConvertTextType(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), FOOTPRINT_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), PCB_EDIT_FRAME::Place_Texte_Pcb(), PCB_BASE_FRAME::PlaceModule(), LIB_EDIT_FRAME::PlacePin(), PCB_EDIT_FRAME::PlaceTarget(), SCH_EDIT_FRAME::PrepareMoveItem(), SCH_EDIT_FRAME::ReSizeSheet(), ShowClearance(), PCB_EDIT_FRAME::StartMoveTextePcb(), PCB_EDIT_FRAME::SwitchLayer(), and DIALOG_LABEL_EDITOR::TextPropertiesAccept().

216 { return m_Flags & IS_NEW; }
#define IS_NEW
New item, just created.
Definition: base_struct.h:113
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
bool SCH_SHEET::IsReplaceable ( ) const
inlineoverridevirtual

Function IsReplaceable.

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

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

Reimplemented from EDA_ITEM.

Definition at line 538 of file sch_sheet.h.

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

Definition at line 222 of file base_struct.h.

References IS_RESIZED.

Referenced by ExitSheet().

222 { return m_Flags & IS_RESIZED; }
STATUS_FLAGS m_Flags
Flag bits for editing and other uses.
Definition: base_struct.h:175
#define IS_RESIZED
Item being resized.
Definition: base_struct.h:114
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 1023 of file sch_sheet.cpp.

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

1024 {
1025  bool previousState = IsSelected();
1026 
1028 
1029  if( aRect.Intersects( boundingBox ) )
1030  SetFlags( SELECTED );
1031  else
1032  ClearFlags( SELECTED );
1033 
1034  return previousState != IsSelected();
1035 }
bool IsSelected() const
Definition: base_struct.h:221
BOX2I boundingBox(T aObject)
boundingBox template method
Definition: shape_index.h:59
#define SELECTED
Definition: base_struct.h:120
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
EDA_RECT const GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
Definition: sch_sheet.cpp:649
Class EDA_RECT handles the component boundary box.
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
bool SCH_SHEET::IsVerticalOrientation ( ) const

Definition at line 404 of file sch_sheet.cpp.

References m_pins.

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

405 {
406  for( SCH_SHEET_PIN pin : m_pins )
407  {
408  if( pin.GetEdge() > 1 )
409  return true;
410  }
411  return false;
412 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
bool EDA_ITEM::IsWireImage ( ) const
inlineinherited

Definition at line 220 of file base_struct.h.

References IS_WIRE_IMAGE.

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

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

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

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

Definition at line 132 of file base_struct.cpp.

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

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

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

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

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

Reimplemented from SCH_ITEM.

Definition at line 190 of file sch_sheet.cpp.

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

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

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

Function Load.

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

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

Definition at line 775 of file sch_sheet.cpp.

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

776 {
777  bool success = true;
778 
779  SCH_SCREEN* screen = NULL;
780 
781  if( !m_screen )
782  {
784 
785  if( screen )
786  {
787  SetScreen( screen );
788 
789  //do not need to load the sub-sheets - this has already been done.
790  }
791  else
792  {
793  SetScreen( new SCH_SCREEN( &aFrame->Kiway() ) );
794 
795  success = aFrame->LoadOneEEFile( m_screen, m_fileName );
796 
797  if( success )
798  {
799  EDA_ITEM* bs = m_screen->GetDrawItems();
800 
801  while( bs )
802  {
803  if( bs->Type() == SCH_SHEET_T )
804  {
805  SCH_SHEET* sheet = (SCH_SHEET*) bs;
806 
807  // Set the parent to this sheet. This effectively creates a method
808  // to find the root sheet from any sheet so a pointer to the root
809  // sheet does not need to be stored globally. Note: this is not the
810  // same as a hierarchy. Complex hierarchies can have multiple copies
811  // of a sheet. This only provides a simple tree to find the root sheet.
812  sheet->SetParent( this );
813 
814  if( !sheet->Load( aFrame ) )
815  success = false;
816  }
817 
818  bs = bs->Next();
819  }
820  }
821  }
822  }
823 
824  return success;
825 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool Load(LINE_READER &aLine, wxString &aErrorMsg) override
Function Load reads a schematic item from aLine in a .sch file.
Definition: sch_sheet.cpp:190
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName".
Definition: sch_sheet.cpp:713
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
void SetScreen(SCH_SCREEN *aScreen)
Function SetScreen sets the screen associated with this sheet to aScreen.
Definition: sch_sheet.cpp:105
EDA_ITEM * Next() const
Definition: base_struct.h:206
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:54
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
bool LoadOneEEFile(SCH_SCREEN *aScreen, const wxString &aFullFileName, bool append=false)
Function LoadOneEEFile loads the schematic (.sch) file aFullFileName into aScreen.
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
bool SCH_SHEET::LocatePathOfScreen ( SCH_SCREEN aScreen,
SCH_SHEET_PATH aList 
)

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

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

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

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

745 {
746  if( m_screen )
747  {
748  aList->push_back( this );
749 
750  if( m_screen == aScreen )
751  return true;
752 
753  EDA_ITEM* strct = m_screen->GetDrawItems();
754 
755  while( strct )
756  {
757  if( strct->Type() == SCH_SHEET_T )
758  {
759  SCH_SHEET* ss = (SCH_SHEET*) strct;
760 
761  if( ss->LocatePathOfScreen( aScreen, aList ) )
762  return true;
763  }
764 
765  strct = strct->Next();
766  }
767 
768  aList->pop_back();
769  }
770 
771  return false;
772 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
EDA_ITEM * Next() const
Definition: base_struct.h:206
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
bool LocatePathOfScreen(SCH_SCREEN *aScreen, SCH_SHEET_PATH *aList)
Function LocatePathOfScreen search the existing hierarchy for an instance of screen "FileName"...
Definition: sch_sheet.cpp:744
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
bool EDA_ITEM::Matches ( const wxString &  aText,
wxFindReplaceData &  aSearchData 
)
protectedinherited

Function Matches compares aText against search criteria in aSearchData.

This is a helper function for simplify derived class logic.

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

Definition at line 184 of file base_struct.cpp.

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

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

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

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

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

Reimplemented from EDA_ITEM.

Definition at line 939 of file sch_sheet.cpp.

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

940 {
941  wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText() );
942 
943  // Ignore the sheet file name if searching to replace.
944  if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE)
945  && SCH_ITEM::Matches( m_fileName, aSearchData ) )
946  {
947  if( aFindLocation )
948  *aFindLocation = GetFileNamePosition();
949 
950  return true;
951  }
952 
953  if( SCH_ITEM::Matches( m_name, aSearchData ) )
954  {
955  if( aFindLocation )
956  *aFindLocation = GetSheetNamePosition();
957 
958  return true;
959  }
960 
961  return false;
962 }
const wxString traceFindItem
Flag to enable find item tracing using the WXTRACE environment variable.
virtual bool Matches(wxFindReplaceData &aSearchData, void *aAuxData, wxPoint *aFindLocation)
Function Matches compares the item against the search criteria in aSearchData.
Definition: base_struct.h:400
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxString m_fileName
The file name is also in the SCH_SCREEN object associated with the sheet.
Definition: sch_sheet.h:229
wxString GetSelectMenuText() const override
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
Definition: sch_sheet.cpp:1072
wxPoint GetFileNamePosition()
Function GetFileNamePosition.
Definition: sch_sheet.cpp:564
wxPoint GetSheetNamePosition()
Function GetSheetNamePosition.
Definition: sch_sheet.cpp:546
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 892 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::MirrorSheet().

893 {
894  MIRROR( m_pos.y, aXaxis_position );
895  m_pos.y -= m_size.y;
896 
897  for( SCH_SHEET_PIN& sheetPin : m_pins )
898  {
899  sheetPin.MirrorX( aXaxis_position );
900  }
901 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SCH_SHEET::MirrorY ( int  aYaxis_position)
overridevirtual

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

Parameters
aYaxis_positionThe Y axis position to mirror around.

Implements SCH_ITEM.

Definition at line 904 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::MirrorSheet().

905 {
906  MIRROR( m_pos.x, aYaxis_position );
907  m_pos.x -= m_size.x;
908 
909  for( SCH_SHEET_PIN& label : m_pins )
910  {
911  label.MirrorY( aYaxis_position );
912  }
913 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void MIRROR(T &aPoint, const T &aMirrorRef)
Definition: macros.h:111
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SCH_SHEET::Move ( const wxPoint aMoveVector)
inlineoverridevirtual

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

Parameters
aMoveVector= the displacement vector

Implements SCH_ITEM.

Definition at line 518 of file sch_sheet.h.

Referenced by SetPosition().

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

Definition at line 144 of file sch_item_struct.h.

References EDA_ITEM::Pnext.

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

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

Reimplemented in SCH_COMPONENT, and SCH_LINE.

Definition at line 94 of file sch_item_struct.cpp.

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

95 {
96  wxCHECK_MSG( false, this->Type() < aItem.Type(),
97  wxT( "Less than operator not defined for " ) + GetClass() );
98 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
virtual wxString GetClass() const override
Function GetClass returns the class name.
bool EDA_ITEM::operator< ( const EDA_ITEM aItem) const
inherited

Test if another item is less than this object.

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

Definition at line 241 of file base_struct.cpp.

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

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

Definition at line 1217 of file sch_sheet.cpp.

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

1218 {
1219  wxLogDebug( wxT( "Sheet assignment operator." ) );
1220 
1221  wxCHECK_MSG( Type() == aItem.Type(), *this,
1222  wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
1223  GetClass() );
1224 
1225  if( &aItem != this )
1226  {
1227  SCH_ITEM::operator=( aItem );
1228 
1229  SCH_SHEET* sheet = (SCH_SHEET*) &aItem;
1230 
1231  m_pos = sheet->m_pos;
1232  m_size = sheet->m_size;
1233  m_name = sheet->m_name;
1235  m_fileNameSize = sheet->m_fileNameSize;
1236  m_pins = sheet->m_pins;
1237 
1238  // Ensure sheet labels have their #m_Parent member pointing really on their
1239  // parent, after assigning.
1240  for( SCH_SHEET_PIN& sheetPin : m_pins )
1241  {
1242  sheetPin.SetParent( this );
1243  }
1244  }
1245 
1246  return *this;
1247 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
wxString GetClass() const override
Function GetClass returns the class name.
Definition: sch_sheet.h:259
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Operator assignment is used to assign the members of aItem to another object.
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
void SCH_SHEET::Plot ( PLOTTER aPlotter)
overridevirtual

Function Plot plots the schematic item to aPlotter.

Parameters
aPlotterA pointer to a PLOTTER object.

Reimplemented from SCH_ITEM.

Definition at line 1139 of file sch_sheet.cpp.

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

1140 {
1141  COLOR4D txtcolor = COLOR4D::UNSPECIFIED;
1142  wxSize size;
1143  wxString Text;
1144  int name_orientation;
1145  wxPoint pos_sheetname, pos_filename;
1146  wxPoint pos;
1147 
1148  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
1149 
1150  int thickness = GetPenSize();
1151  aPlotter->SetCurrentLineWidth( thickness );
1152 
1153  aPlotter->MoveTo( m_pos );
1154  pos = m_pos;
1155  pos.x += m_size.x;
1156 
1157  aPlotter->LineTo( pos );
1158  pos.y += m_size.y;
1159 
1160  aPlotter->LineTo( pos );
1161  pos = m_pos;
1162  pos.y += m_size.y;
1163 
1164  aPlotter->LineTo( pos );
1165  aPlotter->FinishTo( m_pos );
1166 
1167  if( IsVerticalOrientation() )
1168  {
1169  pos_sheetname = wxPoint( m_pos.x - 8, m_pos.y + m_size.y );
1170  pos_filename = wxPoint( m_pos.x + m_size.x + 4, m_pos.y + m_size.y );
1171  name_orientation = TEXT_ANGLE_VERT;
1172  }
1173  else
1174  {
1175  pos_sheetname = wxPoint( m_pos.x, m_pos.y - 4 );
1176  pos_filename = wxPoint( m_pos.x, m_pos.y + m_size.y + 4 );
1177  name_orientation = TEXT_ANGLE_HORIZ;
1178  }
1179 
1180  /* Draw texts: SheetName */
1181  Text = m_name;
1182  size = wxSize( m_sheetNameSize, m_sheetNameSize );
1183 
1184  //pos = m_pos; pos.y -= 4;
1185  thickness = GetDefaultLineThickness();
1186  thickness = Clamp_Text_PenSize( thickness, size, false );
1187 
1188  aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
1189 
1190  bool italic = false;
1191  aPlotter->Text( pos_sheetname, txtcolor, Text, name_orientation, size,
1193  thickness, italic, false );
1194 
1195  /*Draw texts : FileName */
1196  Text = GetFileName();
1197  size = wxSize( m_fileNameSize, m_fileNameSize );
1198  thickness = GetDefaultLineThickness();
1199  thickness = Clamp_Text_PenSize( thickness, size, false );
1200 
1201  aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) );
1202 
1203  aPlotter->Text( pos_filename, txtcolor, Text, name_orientation, size,
1205  thickness, italic, false );
1206 
1207  aPlotter->SetColor( GetLayerColor( GetLayer() ) );
1208 
1209  /* Draw texts : SheetLabel */
1210  for( size_t i = 0; i < m_pins.size(); i++ )
1211  {
1212  m_pins[i].Plot( aPlotter );
1213  }
1214 }
void FinishTo(const wxPoint &pos)
Definition: plot_common.h:241
#define TEXT_ANGLE_HORIZ
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to...
Definition: common.h:91
virtual void SetColor(COLOR4D color)=0
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:166
int GetPenSize() const override
Function GetPenSize virtual pure.
Definition: sch_sheet.cpp:540
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
#define TEXT_ANGLE_VERT
Definition: common.h:92
virtual void Text(const wxPoint &aPos, const COLOR4D aColor, const wxString &aText, double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed=false, void *aData=NULL)
Draws text with the plotter.
Definition: drawtxt.cpp:227
void LineTo(const wxPoint &pos)
Definition: plot_common.h:236
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aBold)
Function Clamp_Text_PenSize As a rule, pen width should not be >1/4em, otherwise the character will b...
Definition: drawtxt.cpp:67
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:849
void MoveTo(const wxPoint &pos)
Definition: plot_common.h:231
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
bool IsVerticalOrientation() const
Definition: sch_sheet.cpp:404
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 370 of file sch_sheet.cpp.

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

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

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

Renumber the sheet pins in the sheet.

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

Definition at line 971 of file sch_sheet.cpp.

References m_pins.

Referenced by AddPin(), and RemovePin().

972 {
973  int id = 2;
974 
975  for( SCH_SHEET_PIN& pin : m_pins )
976  {
977  pin.SetNumber( id );
978  id++;
979  }
980 }
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
bool EDA_ITEM::Replace ( wxFindReplaceData &  aSearchData,
wxString &  aText 
)
inherited

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

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

Definition at line 211 of file base_struct.cpp.

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

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

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

References m_name, and EDA_ITEM::Replace().

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

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

Parameters
aSize- The new size for this sheet.

Definition at line 924 of file sch_sheet.cpp.

References m_pins, and m_size.

Referenced by resizeSheetWithMouseCursor().

925 {
926  if( aSize == m_size )
927  return;
928 
929  m_size = aSize;
930 
931  /* Move the sheet labels according to the new sheet size. */
932  for( SCH_SHEET_PIN& label : m_pins )
933  {
934  label.ConstrainOnEdge( label.GetPosition() );
935  }
936 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
void SCH_SHEET::Rotate ( wxPoint  aPosition)
overridevirtual

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

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

Implements SCH_ITEM.

Definition at line 868 of file sch_sheet.cpp.

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

Referenced by SCH_EDIT_FRAME::RotateHierarchicalSheet().

869 {
870  RotatePoint( &m_pos, aPosition, 900 );
871  RotatePoint( &m_size.x, &m_size.y, 900 );
872 
873  if( m_size.x < 0 )
874  {
875  m_pos.x += m_size.x;
876  m_size.x = -m_size.x;
877  }
878 
879  if( m_size.y < 0 )
880  {
881  m_pos.y += m_size.y;
882  m_size.y = -m_size.y;
883  }
884 
885  for( SCH_SHEET_PIN& sheetPin : m_pins )
886  {
887  sheetPin.Rotate( aPosition );
888  }
889 }
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:317
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
bool SCH_SHEET::Save ( FILE *  aFile) const
overridevirtual

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

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

Implements SCH_ITEM.

Definition at line 149 of file sch_sheet.cpp.

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

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

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

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

Definition at line 713 of file sch_sheet.cpp.

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

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

714 {
715  if( m_screen )
716  {
717  EDA_ITEM* item = m_screen->GetDrawItems();
718 
719  while( item )
720  {
721  if( item->Type() == SCH_SHEET_T )
722  {
723  SCH_SHEET* sheet = (SCH_SHEET*) item;
724 
725  if( sheet->m_screen
726  && sheet->m_screen->GetFileName().CmpNoCase( aFilename ) == 0 )
727  {
728  *aScreen = sheet->m_screen;
729  return true;
730  }
731 
732  if( sheet->SearchHierarchy( aFilename, aScreen ) )
733  return true;
734  }
735 
736  item = item->Next();
737  }
738  }
739 
740  return false;
741 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool SearchHierarchy(const wxString &aFilename, SCH_SCREEN **aScreen)
Function SearchHierarchy search the existing hierarchy for an instance of screen "FileName".
Definition: sch_sheet.cpp:713
const wxString & GetFileName() const
EDA_ITEM * Next() const
Definition: base_struct.h:206
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
SCH_ITEM * GetDrawItems() const
Function GetDrawItems().
SCH_SCREEN * m_screen
Screen that contains the physical data for the sheet.
Definition: sch_sheet.h:222
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
void EDA_ITEM::SetBack ( EDA_ITEM aBack)
inlineinherited

Definition at line 212 of file base_struct.h.

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

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

Definition at line 229 of file base_struct.h.

References BRIGHTENED, and EDA_ITEM::SetFlags().

Referenced by SELECTION_TOOL::disambiguationMenu().

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

Definition at line 503 of file sch_sheet.h.

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

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

Definition at line 284 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet().

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

Definition at line 253 of file base_struct.h.

Referenced by SCH_SCREEN::addConnectedItemsToBlock(), AddSegmentToDragList(), PCBNEW_CONTROL::AppendBoard(), PCB_EDIT_FRAME::AppendBoardFile(), PCB_EDIT_FRAME::Begin_DrawSegment(), FOOTPRINT_EDIT_FRAME::Begin_Edge_Module(), PCB_EDIT_FRAME::Begin_Route(), PCB_EDIT_FRAME::Begin_Zone(), PCB_EDIT_FRAME::BeginMoveDimensionText(), PCB_EDIT_FRAME::BeginMoveTarget(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Change_Side_Module(), SCH_EDIT_FRAME::ConvertPart(), CopyMarkedItems(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), LIB_PART::CopySelectedItems(), SCH_EDIT_FRAME::CreateBusBusEntry(), SCH_EDIT_FRAME::CreateBusWireEntry(), SCH_EDIT_FRAME::CreateNewImage(), SCH_EDIT_FRAME::CreateNewText(), LIB_EDIT_FRAME::CreatePin(), SCH_EDIT_FRAME::CreateSheet(), SCH_EDIT_FRAME::CreateSheetPin(), PCB_EDIT_FRAME::CreateTarget(), PCB_EDIT_FRAME::CreateTextePcb(), FOOTPRINT_EDIT_FRAME::CreateTextModule(), PCB_EDIT_FRAME::EditDimension(), LIB_PIN::EnableEditMode(), PCB_EDIT_FRAME::FlipTextePcb(), SCH_SCREEN::GetConnection(), PCB_BASE_FRAME::GlobalChange_PadSettings(), FOOTPRINT_EDIT_FRAME::HandleBlockEnd(), PCB_BASE_FRAME::Import_Pad_Settings(), SCH_EDIT_FRAME::ImportSheetPin(), SCH_JUNCTION::IsSelectStateChanged(), SCH_NO_CONNECT::IsSelectStateChanged(), SCH_MARKER::IsSelectStateChanged(), SCH_BUS_ENTRY_BASE::IsSelectStateChanged(), SCH_LINE::IsSelectStateChanged(), SCH_BITMAP::IsSelectStateChanged(), SCH_TEXT::IsSelectStateChanged(), SCH_COMPONENT::IsSelectStateChanged(), IsSelectStateChanged(), SCH_EDIT_FRAME::Load_Component(), PCB_BASE_FRAME::LoadModuleFromLibrary(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), moveBitmap(), SCH_EDIT_FRAME::MoveImage(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), LIB_EDIT_FRAME::OnEditPin(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), SCH_EDIT_FRAME::OnSelectUnit(), PCB_EDIT_FRAME::Other_Layer_Route(), DRAWING_TOOL::PlaceText(), SCH_EDIT_FRAME::PrepareMoveItem(), LIB_EDIT_FRAME::Process_Special_Functions(), EDIT_TOOL::Properties(), SCH_EDIT_FRAME::PutDataInPreviousState(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_EDIT_FRAME::ReSizeSheet(), PCB_BASE_FRAME::Rotate_Module(), PCB_EDIT_FRAME::Rotate_Texte_Pcb(), SCH_SCREEN::SchematicCleanUp(), SCH_SCREEN::SelectBlockItems(), EDA_ITEM::SetBrightened(), LIB_PIN::SetConversion(), EDA_ITEM::SetHighlighted(), EDA_ITEM::SetModified(), LIB_PIN::SetNumber(), 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().

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

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

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

Definition at line 228 of file base_struct.h.

References HIGHLIGHTED, and EDA_ITEM::SetFlags().

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

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

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

Definition at line 214 of file base_struct.h.

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

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

Definition at line 276 of file sch_sheet.h.

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

276 { m_name = aName; }
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
void EDA_ITEM::SetNext ( EDA_ITEM aNext)
inlineinherited

Definition at line 211 of file base_struct.h.

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

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

Definition at line 213 of file base_struct.h.

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

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

References m_pos, and Move().

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

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

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

Parameters
aScreenThe new screen to associate with the sheet.

Definition at line 105 of file sch_sheet.cpp.

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

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

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

Definition at line 227 of file base_struct.h.

References SELECTED, and EDA_ITEM::SetFlags().

Referenced by SELECTION_TOOL::selectVisually().

227 { SetFlags( SELECTED ); }
#define SELECTED
Definition: base_struct.h:120
void SetFlags(STATUS_FLAGS aMask)
Definition: base_struct.h:253
void SCH_SHEET::SetSheetNameSize ( int  aSize)
inline

Definition at line 280 of file sch_sheet.h.

Referenced by SCH_EDIT_FRAME::EditSheet().

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

Definition at line 290 of file sch_sheet.h.

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

Definition at line 157 of file sch_item_struct.h.

Referenced by SCH_EDIT_FRAME::PrepareMoveItem().

157 { m_storedPos = aPos; }
wxPoint m_storedPos
a temporary variable used in some move commands to store a initial pos (of the item or mouse cursor) ...
void EDA_ITEM::SetTimeStamp ( time_t  aNewTimeStamp)
inlineinherited

Definition at line 203 of file base_struct.h.

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

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

Definition at line 226 of file base_struct.h.

References IS_WIRE_IMAGE, and EDA_ITEM::SetFlags().

Referenced by moveItemWithMouseCursor().

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

Referenced by PART_LIB::GetEntryTypePowerNames().

463 { 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 331 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().

332 {
333  wxCHECK_RET( aItem->Type() == SCH_SHEET_T,
334  wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ),
335  GetChars( aItem->GetClass() ) ) );
336 
337  SCH_SHEET* sheet = ( SCH_SHEET* ) aItem;
338 
339  std::swap( m_pos, sheet->m_pos );
340  std::swap( m_size, sheet->m_size );
341  std::swap( m_name, sheet->m_name );
342  std::swap( m_sheetNameSize, sheet->m_sheetNameSize );
343  std::swap( m_fileNameSize, sheet->m_fileNameSize );
344  m_pins.swap( sheet->m_pins );
345 
346  // Ensure sheet labels have their .m_Parent member pointing really on their
347  // parent, after swapping.
348  for( SCH_SHEET_PIN& sheetPin : m_pins )
349  {
350  sheetPin.SetParent( this );
351  }
352 
353  for( SCH_SHEET_PIN& sheetPin : sheet->m_pins )
354  {
355  sheetPin.SetParent( sheet );
356  }
357 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
int m_sheetNameSize
The height of the text used to draw the sheet name.
Definition: sch_sheet.h:236
wxSize m_size
The size of the sheet.
Definition: sch_sheet.h:245
wxString m_name
This is equivalent to the reference designator for components and is stored in F0 sheet pin in the sc...
Definition: sch_sheet.h:233
wxPoint m_pos
The position of the sheet.
Definition: sch_sheet.h:242
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
int m_fileNameSize
The height of the text used to draw the file name.
Definition: sch_sheet.h:239
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual wxString GetClass() const override
Function GetClass returns the class name.
KICAD_T EDA_ITEM::Type ( ) const
inlineinherited

Function Type()

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

Returns
KICAD_T - the type of object.

Definition at line 198 of file base_struct.h.

References EDA_ITEM::m_StructType.

Referenced by Abort_Move_ModuleOutline(), abortMoveBitmap(), abortMoveItem(), AbortPinMove(), DIALOG_GLOBAL_DELETION::AcceptPcbDelete(), MODULE::Add(), BOARD::Add(), RN_DATA::Add(), PCB_EDIT_FRAME::Add45DegreeSegment(), RN_DATA::AddBlocked(), SCH_SCREEN::addConnectedItemsToBlock(), POINT_EDITOR::addCorner(), POINT_EDITOR::addCornerCondition(), SCH_EDIT_FRAME::addCurrentItemToList(), AddMenusForComponent(), AddMenusForEditComponent(), AddPin(), RN_DATA::AddSimple(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::Attribut_Track(), PCB_EDIT_FRAME::Autoroute(), PCB_EDIT_FRAME::Begin_Route(), SCH_EDIT_FRAME::BeginSegment(), PCB_EDIT_FRAME::Block_Delete(), PCB_EDIT_FRAME::Block_Duplicate(), PCB_EDIT_FRAME::Block_Flip(), PCB_EDIT_FRAME::Block_Move(), PCB_EDIT_FRAME::Block_Rotate(), SCH_SCREENS::BuildScreenList(), SCH_SHEET_LIST::BuildSheetList(), HIERARCHY_NAVIG_DLG::BuildSheetsTree(), calcArea(), calcMaxArea(), calcMinArea(), DIALOG_EXCHANGE_MODULE::changeAllFootprints(), DIALOG_EXCHANGE_MODULE::changeSameFootprints(), TEXTE_PCB::ClassOf(), EDGE_MODULE::ClassOf(), BOARD_CONNECTED_ITEM::ClassOf(), TEXTE_MODULE::ClassOf(), DRAWSEGMENT::ClassOf(), TRACK::ClassOf(), MODULE::ClassOf(), D_PAD::ClassOf(), NETINFO_ITEM::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(), LIB_PART::CopySelectedItems(), SCH_SCREEN::CountConnectedItems(), CountSheets(), LIB_EDIT_FRAME::CreateGraphicItem(), CINFO3D_VISU::createLayers(), BOARD::CreateLockPoint(), SCH_EDIT_FRAME::CreateNewText(), CINFO3D_VISU::createNewTrack(), PCB_EDIT_FRAME::createPopupMenuForTracks(), CreateRoutesSection(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), D_PAD::D_PAD(), FOOTPRINT_EDIT_FRAME::Delete_Edge_Module(), PCB_EDIT_FRAME::Delete_Segment_Edge(), SCH_SCREENS::DeleteAllMarkers(), SCH_SCREEN::DeleteItem(), LIB_EDIT_FRAME::deleteItem(), deleteItem(), SCH_EDIT_FRAME::DeleteItem(), DeleteItemsInList(), DeleteNullTrackSegments(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_ERC::DisplayERC_MarkersList(), DRC::doTrackDrc(), DRC::doTrackKeepoutDrc(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), DrawMovePin(), DrawMovingBlockOutlines(), drawPickedItems(), EDIT_TOOL::Duplicate(), BOARD::Duplicate(), MODULE::Duplicate(), PCB_EDIT_FRAME::duplicateItems(), DuplicateItemsInList(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditSymbolText(), SCH_EDIT_FRAME::EndSegment(), PCB_EDIT_FRAME::EraseRedundantTrack(), ExitSheet(), SCH_SCREEN::ExtractWires(), DRC::fillMarker(), find_vias_and_tracks_at(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_EXPORTER::findNextComponent(), NETLIST_EXPORTER::findNextComponentAndCreatePinList(), SCH_SHEET_PATH::FindNextItem(), SCH_SHEET_LIST::FindNextItem(), SCH_SHEET_PATH::FindPreviousItem(), SCH_SHEET_LIST::FindPreviousItem(), POINT_EDITOR::finishItem(), FootprintWriteShape(), FormatProbeItem(), genPlacementRoutingMatrix(), POINT_EDITOR::get45DegConstrainer(), TRACK::GetBestInsertPoint(), BOARD_ITEM::GetBoard(), LIB_PART::GetBodyBoundingBox(), TRACK::GetBoundingBox(), BOARD_CONNECTED_ITEM::GetClearance(), NETLIST_OBJECT::GetComponentParent(), SCH_SCREEN::GetConnection(), SCH_TEXT::GetConnectionPoints(), SCH_TEXT::GetEndPoints(), GetEndPoints(), GetFirstVia(), SCH_SCREEN::GetHierarchicalItems(), TEXTE_PCB::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetClass(), LIB_PART::GetNextDrawItem(), RN_NET::GetNodes(), CONNECTED_POINT::GetPad(), DRAWSEGMENT::GetParentModule(), SCH_SCREEN::GetPin(), LIB_PART::GetPin(), SCH_COMPONENT::GetPinPhysicalPosition(), getRect(), SELECTION::GetTopLeftItem(), CONNECTED_POINT::GetTrack(), LIB_PART::GetUnitBoundingBox(), LIB_EDIT_FRAME::GlobalSetPins(), SELECTION_TOOL::guessSelectionCandidates(), SCH_SCREENS::HasNoFullyDefinedLibIds(), HasUndefinedPins(), SCH_EDIT_FRAME::ImportSheetPin(), DIALOG_LABEL_EDITOR::InitDialog(), ROUTER_TOOL::InlineDrag(), SCH_COLLECTOR::Inspect(), GENERAL_COLLECTOR::Inspect(), SCH_FIND_COLLECTOR::Inspect(), ARRAY_CREATOR::Invoke(), SCH_TEXT::IsDanglingStateChanged(), SCH_COLLECTOR::IsDraggableJunction(), SCH_COLLECTOR::IsNode(), TRACK::IsNull(), SCH_SCREEN::IsTerminalPoint(), BOARD_ITEM::IsTrack(), itemIsIncludedByFilter(), Load(), PNS_PCBNEW_RULE_RESOLVER::localPadClearance(), SCH_EDIT_FRAME::LocateAndShowItem(), SCH_EDIT_FRAME::LocateItem(), LocatePathOfScreen(), Magnetize(), EDIT_POINTS_FACTORY::Make(), SCH_SCREEN::MarkConnections(), MarkItemsInBloc(), BOARD::MarkTrace(), TRACKS_CLEANER::merge_collinear_of_track(), TRACKS_CLEANER::mergeCollinearSegmentIfPossible(), SCH_LINE::MergeOverlap(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), EDIT_TOOL::MoveExact(), moveItemWithMouseCursor(), MoveMarkedItems(), MoveMarkedItemsExactly(), SCH_EDIT_FRAME::OnConvertTextType(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), SCH_EDIT_FRAME::OnDragItem(), SCH_EDIT_FRAME::OnEditItem(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), LIB_EDIT_FRAME::OnEditPin(), LIB_EDIT_FRAME::OnHotKey(), SCH_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotkeyCopyItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem(), PCB_EDIT_FRAME::OnHotkeyDeleteItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyDuplicateItem(), PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyEditItem(), PCB_EDIT_FRAME::OnHotkeyFlipItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem(), PCB_EDIT_FRAME::OnHotkeyMoveItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItemExact(), PCB_EDIT_FRAME::OnHotkeyPlaceItem(), FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem(), PCB_EDIT_FRAME::OnHotkeyRotateItem(), FOOTPRINT_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftClick(), SCH_EDIT_FRAME::OnLeftClick(), PCB_EDIT_FRAME::OnLeftClick(), LIB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnLeftDClick(), PCB_EDIT_FRAME::OnLeftDClick(), SCH_EDIT_FRAME::OnMoveItem(), SCH_EDIT_FRAME::OnOpenLibraryEditor(), SCH_EDIT_FRAME::OnOrient(), FOOTPRINT_EDIT_FRAME::OnRightClick(), LIB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRightClick(), PCB_EDIT_FRAME::OnRightClick(), SCH_EDIT_FRAME::OnRotate(), SCH_EDIT_FRAME::OnSelectUnit(), SCH_LINE::operator<(), LIB_ITEM::operator<(), SCH_ITEM::operator<(), SCH_COMPONENT::operator<(), SCH_BITMAP::operator=(), SCH_COMPONENT::operator=(), operator=(), LIB_ITEM::operator==(), OrCell_Trace(), SCH_EDIT_FRAME::OrientComponent(), BOARD_COMMIT::parentObject(), MODULE_EDITOR_TOOLS::PasteItems(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_FRAME::PcbGeneralLocateAndDisplay(), LIB_EDIT_FRAME::PlacePin(), SCH_FIELD::Plot(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), SCH_EDIT_FRAME::PrepareMoveItem(), GAL_ARRAY_CREATOR::prePushAction(), PCB_EDIT_FRAME::PrintPage(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), LIB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), BOARD_COMMIT::Push(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), RedrawWhileMovingCursor(), DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable(), MODULE::Remove(), BOARD::Remove(), RN_DATA::Remove(), TRACKS_CLEANER::remove_duplicates_of_track(), POINT_EDITOR::removeCorner(), POINT_EDITOR::removeCornerCondition(), LIB_PART::RemoveDrawItem(), RemovePin(), FOOTPRINT_EDIT_FRAME::RemoveStruct(), PCB_EDIT_FRAME::RemoveStruct(), SCH_EDIT_FRAME::RepeatDrawItem(), LIB_EDIT_FRAME::RepeatPinItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), SCH_SCREEN::ReplaceWires(), SELECTION_TOOL::RequestSelection(), PCB_EDIT_FRAME::Reset_All_Tracks_And_Vias_To_Netclass_Values(), PCB_BASE_FRAME::ResetTextSize(), SCH_EDIT_FRAME::ReSizeSheet(), BOARD_COMMIT::Revert(), SCH_EDIT_FRAME::RotateField(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), SCH_EDIT_FRAME::SaveUndoItemInUndoList(), CONNECTIONS::SearchConnectedTracks(), SearchHierarchy(), SELECTION_TOOL::select(), SELECTION_TOOL::selectable(), SCH_SCREEN::SelectBlockItems(), PCB_EDIT_FRAME::SelectHighLight(), SELECTION_TOOL::selectVisually(), ITEM_PICKER::SetItem(), SetSchItemParent(), DIALOG_LABEL_EDITOR::SetTitle(), PCB_EDIT_FRAME::SetTrackSegmentWidth(), PCB_EDIT_FRAME::Show_1_Ratsnest(), Show_MoveNode(), ShowClearance(), ShowNewTrackWhenMovingCursor(), SortByTimeStamp(), PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope(), LIB_EDIT_FRAME::StartMoveDrawSymbol(), PCB_EDIT_FRAME::StartMoveOneNodeOrSegment(), SCH_JUNCTION::SwapData(), SCH_NO_CONNECT::SwapData(), SCH_BITMAP::SwapData(), SCH_FIELD::SwapData(), SCH_SHEET_PIN::SwapData(), BOARD_ITEM::SwapData(), SCH_COMPONENT::SwapData(), SwapData(), PCB_EDIT_FRAME::SwitchLayer(), BOARD::Test_Connections_To_Copper_Areas(), TestDuplicateSheetNames(), TEXTE_MODULE::TEXTE_MODULE(), TraceSegmentPcb(), TRACK::TransformShapeWithClearanceToPolygon(), SELECTION_TOOL::unselectVisually(), SCH_SHEET_PATH::UpdateAllScreenReferences(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), POINT_EDITOR::updateItem(), POINT_EDITOR::updatePoints(), PCB_BRIGHT_BOX::ViewDraw(), TRACK::Visit(), EDA_ITEM::Visit(), SCH_COMPONENT::Visit(), and Visit().

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

Implements KIGFX::VIEW_ITEM.

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

Definition at line 267 of file base_struct.cpp.

References EDA_ITEM::GetBoundingBox().

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

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

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

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

Parameters
aLayercurrent drawing layer
aGalpointer to the GAL device we are drawing on

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

Definition at line 114 of file view_item.h.

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

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

Implements KIGFX::VIEW_ITEM.

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

Definition at line 275 of file base_struct.cpp.

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

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

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

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

Definition at line 133 of file view_item.h.

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

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

Function Visit may be re-implemented for each derived class in order to handle all the types given by its member data.

Implementations should call inspector->Inspect() on types in scanTypes[], and may use IterateForward() to do so on lists of such data.

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

Reimplemented from EDA_ITEM.

Definition at line 1045 of file sch_sheet.cpp.

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

1046 {
1047  KICAD_T stype;
1048 
1049  for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
1050  {
1051  // If caller wants to inspect my type
1052  if( stype == Type() )
1053  {
1054  if( SEARCH_QUIT == aInspector( this, NULL ) )
1055  return SEARCH_QUIT;
1056  }
1057  else if( stype == SCH_SHEET_PIN_T )
1058  {
1059  // Test the sheet labels.
1060  for( size_t i = 0; i < m_pins.size(); i++ )
1061  {
1062  if( SEARCH_QUIT == aInspector( &m_pins[ i ], this ) )
1063  return SEARCH_QUIT;
1064  }
1065  }
1066  }
1067 
1068  return SEARCH_CONTINUE;
1069 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
search types array terminator (End Of Types)
Definition: typeinfo.h:94
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:90
SCH_SHEET_PINS m_pins
The list of sheet connection points.
Definition: sch_sheet.h:225

Friends And Related Function Documentation

friend class SCH_SHEET_PIN
friend

Definition at line 218 of file sch_sheet.h.

Referenced by Load().

Member Data Documentation

EDA_ITEMS SCH_ITEM::m_connections
protectedinherited

List of items connected to this item.

Definition at line 120 of file sch_item_struct.h.

Referenced by SCH_ITEM::~SCH_ITEM().

wxString SCH_SHEET::m_fileName
private

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

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

Definition at line 229 of file sch_sheet.h.

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

int SCH_SHEET::m_fileNameSize
private

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

Definition at line 239 of file sch_sheet.h.

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

STATUS_FLAGS EDA_ITEM::m_Flags
protectedinherited

Flag bits for editing and other uses.

Definition at line 175 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(), D_PAD::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_FIELD::EndEdit(), LIB_ITEM::EndEdit(), EDA_ITEM::GetFlags(), TRACK::GetMsgPanelInfoBase_Common(), SCH_JUNCTION::HitTest(), SCH_LINE::HitTest(), SCH_COMPONENT::HitTest(), LIB_ITEM::InEditMode(), EDA_ITEM::initVars(), SCH_ITEM::IsConnected(), SCH_COMPONENT::Load(), SCH_LINE::Move(), EDA_ITEM::operator=(), SCH_COMPONENT::SCH_COMPONENT(), LIB_PIN::SetConversion(), LIB_PIN::SetLength(), LIB_PIN::SetName(), LIB_PIN::SetNameTextSize(), LIB_PIN::SetNumberTextSize(), LIB_PIN::SetOrientation(), LIB_PIN::SetPartNumber(), LIB_PIN::SetPinPosition(), LIB_PIN::SetShape(), LIB_PIN::SetType(), and LIB_PIN::SetVisible().

bool EDA_ITEM::m_forceVisible
protectedinherited

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

Definition at line 172 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 166 of file base_struct.h.

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

wxString SCH_SHEET::m_name
private

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

Definition at line 233 of file sch_sheet.h.

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

SCH_SCREEN* SCH_SHEET::m_screen
private

Screen that contains the physical data for the sheet.

In complex hierarchies multiple sheets can share a common screen.

Definition at line 222 of file sch_sheet.h.

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

int SCH_SHEET::m_sheetNameSize
private

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

Definition at line 236 of file sch_sheet.h.

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

wxPoint SCH_ITEM::m_storedPos
protectedinherited

a temporary variable used in some move commands

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

Definition at line 121 of file sch_item_struct.h.

Referenced by SCH_ITEM::GetStoredPos().


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