45 #include <wx/object.h> 71 wxTreeCtrl( (wxWindow*) parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
72 wxTR_HAS_BUTTONS, wxDefaultValidator, wxT(
"HierachyTreeCtrl" ) )
79 imageList =
new wxImageList( tree_nosel_bm.GetWidth(), tree_nosel_bm.GetHeight(),
true, 2 );
89 DIALOG_SHIM( aParent, wxID_ANY,
_(
"Navigator" ), wxDefaultPosition, wxDefaultSize,
92 wxASSERT( dynamic_cast< SCH_EDIT_FRAME* >( aParent ) );
101 m_Tree->SetItemBold( root,
true );
107 m_Tree->SelectItem( root );
118 m_Tree->GetBoundingRect( root, itemrect );
121 tree_size.x = itemrect.GetWidth() + 20;
122 tree_size.x = std::max( tree_size.x, 250 );
125 tree_size.y =
m_nbsheets * itemrect.GetHeight();
130 SetClientSize( tree_size );
157 if( event.GetKeyCode() == WXK_ESCAPE )
166 SCH_SHEET_PATH* item1Path = &static_cast<TreeItemData*>( GetItemData( item1 ) )->m_SheetPath;
167 SCH_SHEET_PATH* item2Path = &static_cast<TreeItemData*>( GetItemData( item2 ) )->m_SheetPath;
180 std::vector<SCH_ITEM*> sheetChildren;
183 for(
SCH_ITEM* aItem : sheetChildren )
185 SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
192 menu =
m_Tree->AppendItem( *aPreviousmenu, sheetName, 0, 1 );
197 m_Tree->EnsureVisible( menu );
198 m_Tree->SelectItem( menu );
208 m_Tree->SortChildren( *aPreviousmenu );
225 m_Tree->SetItemBold( root,
true );
232 m_Tree->SelectItem( root );
250 wxTreeItemId itemSel =
m_Tree->GetSelection();
251 TreeItemData* itemData = static_cast<TreeItemData*>(
m_Tree->GetItemData( itemSel ) );
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
void onSelectSheetPath(wxTreeEvent &event)
Open the selected sheet and display the corresponding screen when a tree item is selected.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
#define NB_MAX_SHEET
Max number of sheets in a hierarchy project.
virtual void RedrawScreen(const wxPoint &aCenterPoint, bool aWarpPointer)
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
This file is part of the common library.
void SetScreen(BASE_SCREEN *aScreen) override
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
double m_LastZoomLevel
last value for the zoom level, usefull in Eeschema when changing the current displayed sheet to reuse...
static TOOL_ACTION cancelInteractive
Store an SCH_SHEET_PATH of each sheet in hierarchy.
void GetSheets(std::vector< SCH_ITEM * > *aItems)
Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R,...
void UpdateTitle()
Set the main window title bar text.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2) override
Schematic editor (Eeschema) main window.
Handle hierarchy tree control.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
static int ComparePageNum(const wxString &aPageNumberA, const wxString aPageNumberB)
Compares page numbers of schematic sheets.
wxString getRootString()
getRootString
bool navigator_stays_open
void DisplayCurrentSheet()
Draw the current sheet on the display.
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
SCH_EDIT_FRAME * m_SchFrameEditor
wxIMPLEMENT_ABSTRACT_CLASS(HIERARCHY_TREE, wxTreeCtrl)
TreeItemData(SCH_SHEET_PATH &sheet)
void pop_back()
Forwarded method from std::vector.
SCH_SHEET_PATH m_currSheet
std::vector< SCH_FIELD > & GetFields()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
Handle actions specific to the schematic editor.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
void UpdateHierarchyTree()
Update the hierarchical tree of the schematic.
void HardRedraw() override
Rebuild the GAL and redraw the screen.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void initScreenZoom()
Initialize the zoom value of the current screen and mark the screen as zoom-initialized.
void onChar(wxKeyEvent &event)
SCHEMATIC & Schematic() const
HIERARCHY_NAVIG_DLG(SCH_EDIT_FRAME *aParent)
#define HIERARCHY_NAVIG_DLG_WNAME
const BITMAP_OPAQUE tree_sel_xpm[1]
static TOOL_ACTION clearSelection
Clears the current selection.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
int UpdateNetHighlighting(const TOOL_EVENT &aEvent)
Launch a tool to highlight nets.
void clear()
Forwarded method from std::vector.
HIERARCHY_TREE(HIERARCHY_NAVIG_DLG *parent)
void buildHierarchyTree(SCH_SHEET_PATH *aList, wxTreeItemId *aPreviousmenu)
Create the hierarchical tree of the schematic.
void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 }) override
Set the scaling factor, zooming around a given anchor point.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
SCH_SCREEN * LastScreen()
const BITMAP_OPAQUE tree_nosel_xpm[1]
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
HIERARCHY_NAVIG_DLG * m_parent
void OnCloseNav(wxCloseEvent &event)
wxString formatPageString(wxString aName, wxString aPage)
formatPageString
SCH_SHEET_PATH & GetCurrentSheet() const
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
SCH_SHEET_PATH m_SheetPath
Base class for any item which can be embedded within the SCHEMATIC container class,...
wxString GetPageNumber(const SCH_SHEET_PATH &aInstance) const
Return the sheet page number for aInstance.