39#include <wx/generic/textdlgg.h>
79 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
85 wxBitmap tree_nosel_bm(
KiBitmap( BITMAPS::tree_nosel ) );
86 wxImageList* imageList =
new wxImageList( tree_nosel_bm.GetWidth(), tree_nosel_bm.GetHeight(),
89 imageList->Add( tree_nosel_bm );
90 imageList->Add(
KiBitmap( BITMAPS::tree_sel ) );
92 m_tree->AssignImageList( imageList );
94 sizer->Add(
m_tree, 1, wxEXPAND, wxBORDER_NONE, 0 );
119 std::vector<SCH_ITEM*> sheetChildren;
122 for(
SCH_ITEM* aItem : sheetChildren )
129 wxTreeItemId child =
m_tree->AppendItem( aParent, sheetName, 0, 1 );
136 m_tree->SortChildren( aParent );
144 if( eventsWereBound )
154 bool sheetSelected =
false;
157 [&](
const wxTreeItemId& id )
159 wxCHECK_RET(
id.IsOk(), wxT(
"Invalid tree item" ) );
165 m_tree->EnsureVisible(
id );
166 m_tree->SetItemBold(
id,
true );
170 m_tree->SetItemBold(
id,
false );
175 m_tree->EnsureVisible(
id );
177 sheetSelected =
true;
180 wxTreeItemIdValue cookie;
181 wxTreeItemId child =
m_tree->GetFirstChild(
id, cookie );
183 while( child.IsOk() )
186 child =
m_tree->GetNextChild(
id, cookie );
192 if( !sheetSelected &&
m_tree->GetSelection() )
195 if( eventsWereBound )
213 if( eventsWereBound )
236 if( eventsWereBound )
252 wxTreeItemId itemSel =
m_tree->GetSelection();
255 SetCursor( wxCURSOR_ARROWWAIT );
258 SetCursor( wxCURSOR_ARROW );
264 wxTreeItemId itemSel =
m_tree->GetFocusedItem();
266 if( !itemSel.IsOk() )
276 ctxMenu.Append( 1,
_(
"Edit Page Number" ) );
278 if( GetPopupMenuSelectionFromUser( ctxMenu ) == 1 )
284 msg.Printf(
_(
"Enter page number for sheet path %s" ),
285 ( sheetPath.Length() > 20 ) ? wxS(
" \n" ) + sheetPath + wxT(
": " )
286 : sheetPath + wxT(
": " ) );
288 wxTextEntryDialog dlg(
m_frame, msg,
_(
"Edit Sheet Page Number" ), pageNumber );
290 dlg.SetTextValidator( wxFILTER_ALPHANUMERIC );
298 UNDO_REDO::CHANGED,
false );
326 return aName + wxT(
" " ) + wxString::Format(
_(
"(page %s)" ), aPage );
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
void SetPageNumber(const wxString &aPageNumber)
static TOOL_ACTION changeSheet
void onSelectSheetPath(wxTreeEvent &aEvent)
Open the selected sheet and display the corresponding screen when a tree item is selected.
wxString formatPageString(const wxString &aName, const wxString &aPage)
void UpdateHierarchySelection()
Updates the tree's selection to match current page.
HIERARCHY_PANE(SCH_EDIT_FRAME *aParent)
void UpdateHierarchyTree()
Update the hierarchical tree of the schematic.
void buildHierarchyTree(SCH_SHEET_PATH *aList, const wxTreeItemId &aParent)
Create the hierarchical tree of the schematic.
void onRightClick(wxTreeEvent &aEvent)
Handle a right-click in the tree.
Navigation hierarchy tree control.
int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2) override
Schematic editor (Eeschema) main window.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCH_SHEET_PATH & GetCurrentSheet() const
SCHEMATIC & Schematic() const
void OnPageSettingsChange() override
Called when modifying the page settings.
Base class for any item which can be embedded within the SCHEMATIC container class,...
void GetSheets(std::vector< SCH_ITEM * > *aItems) const
Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a deterministic order (L-R,...
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
int ComparePageNum(const SCH_SHEET_PATH &aSheetPathToTest) const
Compare sheets by their page number.
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false) const
Return the sheet path in a human readable form made from the sheet names.
SCH_SCREEN * LastScreen()
wxString GetPageNumber() const
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
SCH_SHEET * Last() const
Return a pointer to the last SCH_SHEET of the list.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
void clear()
Forwarded method from std::vector.
void pop_back()
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
Store an SCH_SHEET_PATH of each sheet in hierarchy.
SCH_SHEET_PATH m_SheetPath
TREE_ITEM_DATA(SCH_SHEET_PATH &sheet)
static void recursiveDescent(wxSizer *aSizer, std::map< int, wxString > &aLabels)
wxIMPLEMENT_ABSTRACT_CLASS(HIERARCHY_TREE, wxTreeCtrl)
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.