KiCad PCB EDA Suite
Loading...
Searching...
No Matches
hierarchy_pane.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2022 Mike Williams <mike at mikebwilliams.com>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27
28#ifndef HIERARCHY_PANE_H
29#define HIERARCHY_PANE_H
30
31#include <wx/imaglist.h>
32#include <wx/object.h> // wxRTTI macros
33#include <wx/treectrl.h>
34#include <set>
35#include <vector>
36#include "widgets/wx_panel.h"
37
38
39class SCH_COMMIT;
40class SCH_EDIT_FRAME;
41class SCH_SHEET_PATH;
42
43class HIERARCHY_PANE;
44
45
52class HIERARCHY_TREE : public wxTreeCtrl
53{
54public:
56 wxTreeCtrl( (wxWindow*) parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
57 wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator,
58 wxT( "HierachyTreeCtrl" ) )
59 {
60 }
61
62 int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) override;
63
64private:
65 // Need to use wxRTTI macros in order for OnCompareItems to work properly
66 // See: https://docs.wxwidgets.org/3.1/classwx_tree_ctrl.html#ab90a465793c291ca7aa827a576b7d146
68};
69
70
72{
73public:
81
83
85
89 void UpdateHierarchyTree( bool aClear = false );
90
95
102
106 std::vector<wxString> GetCollapsedPaths() const;
107
108private:
117 void buildHierarchyTree( SCH_SHEET_PATH* aList, const wxTreeItemId& aParent );
118
123 void onSelectSheetPath( wxTreeEvent& aEvent );
124
125 void onTreeItemRightClick( wxTreeEvent& aEvent );
126 void onRightClick( wxTreeItemId aItem );
127 void onCharHook( wxKeyEvent& aKeyStroke );
128 void onTreeRightClick( wxTreeEvent& event );
129 void onTreeEditFinished( wxTreeEvent& event );
130
134 wxString getRootString();
135
139 wxString formatPageString( const wxString& aName, const wxString& aPage );
140
145 void setIdenticalSheetsHighlighted( const SCH_SHEET_PATH& path, bool highLighted = true );
146
150 void renameIdenticalSheets( const SCH_SHEET_PATH& renamedSheet, const wxString newName,
151 SCH_COMMIT* commit );
152
153private:
157
159 std::set<wxString> m_collapsedPaths;
160};
161
162#endif // HIERARCHY_PANE_H
SCH_EDIT_FRAME * m_frame
void onRightClick(wxTreeItemId aItem)
HIERARCHY_TREE * m_tree
void UpdateHierarchyTree(bool aClear=false)
Update the hierarchical tree of the schematic.
void onSelectSheetPath(wxTreeEvent &aEvent)
Open the selected sheet and display the corresponding screen when a tree item is selected.
void UpdateLabelsHierarchyTree()
Update the labels of the hierarchical tree of the schematic.
void onTreeRightClick(wxTreeEvent &event)
wxString formatPageString(const wxString &aName, const wxString &aPage)
wxString getRootString()
SCH_SHEET_PATH m_list
void UpdateHierarchySelection()
Updates the tree's selection to match current page.
HIERARCHY_PANE(SCH_EDIT_FRAME *aParent)
std::set< wxString > m_collapsedPaths
void onCharHook(wxKeyEvent &aKeyStroke)
void renameIdenticalSheets(const SCH_SHEET_PATH &renamedSheet, const wxString newName, SCH_COMMIT *commit)
Rename all sheets in a hierarchial desing which has the same source renamed sheet.
void buildHierarchyTree(SCH_SHEET_PATH *aList, const wxTreeItemId &aParent)
Create the hierarchical tree of the schematic.
void onTreeItemRightClick(wxTreeEvent &aEvent)
std::vector< wxString > GetCollapsedPaths() const
Returns a list of sheet paths for nodes that are currently collapsed.
void onTreeEditFinished(wxTreeEvent &event)
void setIdenticalSheetsHighlighted(const SCH_SHEET_PATH &path, bool highLighted=true)
When renaming the sheets in tree it is helpful to highlight the identical sheets which got renamed by...
Navigation hierarchy tree control.
HIERARCHY_TREE(HIERARCHY_PANE *parent)
int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2) override
wxDECLARE_ABSTRACT_CLASS(HIERARCHY_TREE)
Schematic editor (Eeschema) main window.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
WX_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
Definition wx_panel.cpp:28