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 (C) 2004-2024 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 "widgets/wx_panel.h"
35
36
37class SCH_COMMIT;
38class SCH_EDIT_FRAME;
39class SCH_SHEET_PATH;
40
41class HIERARCHY_PANE;
42
43
50class HIERARCHY_TREE : public wxTreeCtrl
51{
52public:
54 wxTreeCtrl( (wxWindow*) parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
55 wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS, wxDefaultValidator,
56 wxT( "HierachyTreeCtrl" ) )
57 {
58 }
59
60 int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) override;
61
62private:
63 // Need to use wxRTTI macros in order for OnCompareItems to work properly
64 // See: https://docs.wxwidgets.org/3.1/classwx_tree_ctrl.html#ab90a465793c291ca7aa827a576b7d146
66};
67
68
70{
71public:
73 {
77 RENAME
78 };
79
81
83
88
93
100
101private:
110 void buildHierarchyTree( SCH_SHEET_PATH* aList, const wxTreeItemId& aParent );
111
116 void onSelectSheetPath( wxTreeEvent& aEvent );
117
118 void onTreeItemRightClick( wxTreeEvent& aEvent );
119 void onRightClick( wxMouseEvent& aEvent );
120 void onRightClick( wxTreeItemId aItem );
121 void onCharHook( wxKeyEvent& aKeyStroke );
122 void onTreeRightClick( wxTreeEvent& event );
123 void onTreeEditFinished( wxTreeEvent& event );
124
128 wxString getRootString();
129
133 wxString formatPageString( const wxString& aName, const wxString& aPage );
134
139 void setIdenticalSheetsHighlighted( const SCH_SHEET_PATH& path, bool highLighted = true );
140
144 void renameIdenticalSheets( const SCH_SHEET_PATH& renamedSheet, const wxString newName,
145 SCH_COMMIT* commit );
146
147private:
151
153};
154
155#endif // HIERARCHY_PANE_H
SCH_EDIT_FRAME * m_frame
HIERARCHY_TREE * m_tree
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.
void onCharHook(wxKeyEvent &aKeyStroke)
void UpdateHierarchyTree()
Update the hierarchical tree of the schematic.
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)
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...
void onRightClick(wxMouseEvent &aEvent)
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...