KiCad PCB EDA Suite
sch_navigate_tool.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) 2019 CERN
5 * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25
26#ifndef SCH_NAVIGATE_TOOL_H
27#define SCH_NAVIGATE_TOOL_H
28
29#include <sch_base_frame.h>
30#include <tools/ee_tool_base.h>
31#include <status_popup.h>
32
33class SCH_EDIT_FRAME;
34
38class SCH_NAVIGATE_TOOL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
39{
40public:
41 SCH_NAVIGATE_TOOL() : EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.NavigateTool" ) {}
42
44
46 void ResetHistory();
48 // hierarchy changes.
49 void CleanHistory();
50
52 int ChangeSheet( const TOOL_EVENT& aEvent );
54 int EnterSheet( const TOOL_EVENT& aEvent );
56 int LeaveSheet( const TOOL_EVENT& aEvent );
58 int Up( const TOOL_EVENT& aEvent );
60 int Forward( const TOOL_EVENT& aEvent );
62 int Back( const TOOL_EVENT& aEvent );
64 int Previous( const TOOL_EVENT& aEvent );
66 int Next( const TOOL_EVENT& aEvent );
67
68 void HypertextCommand( const wxString& href );
69
70 bool CanGoBack();
71 bool CanGoForward();
72 bool CanGoUp();
73 bool CanGoPrevious();
74 bool CanGoNext();
75
76public:
77 static wxString g_BackLink;
78
79private:
81 void setTransitions() override;
83 void pushToHistory( SCH_SHEET_PATH aPath );
85 void changeSheet( SCH_SHEET_PATH aPath );
86
87private:
88 std::list<SCH_SHEET_PATH> m_navHistory;
89 std::list<SCH_SHEET_PATH>::iterator m_navIndex;
90};
91
92
93#endif // SCH_NAVIGATE_TOOL_H
A foundation class for a tool operating on a schematic or symbol.
Definition: ee_tool_base.h:50
Schematic editor (Eeschema) main window.
Handle actions specific to the schematic editor.
void pushToHistory(SCH_SHEET_PATH aPath)
Change current sheet to aPath and handle history, zooming, etc.
~SCH_NAVIGATE_TOOL()
Reset navigation history. Must be done when schematic changes.
void ResetHistory()
Remove deleted pages from history. Must be done when schematic.
void CleanHistory()
Enter sheet provided in aEvent.
int Back(const TOOL_EVENT &aEvent)
Navigate to previous sheet by numeric sheet number.
int Previous(const TOOL_EVENT &aEvent)
Navigate to next sheet by numeric sheet number.
int Next(const TOOL_EVENT &aEvent)
std::list< SCH_SHEET_PATH >::iterator m_navIndex
int ChangeSheet(const TOOL_EVENT &aEvent)
Enter selected sheet.
int Forward(const TOOL_EVENT &aEvent)
Navigate back in sheet history.
int EnterSheet(const TOOL_EVENT &aEvent)
Return to parent sheet. Synonymous with Up.
static wxString g_BackLink
void changeSheet(SCH_SHEET_PATH aPath)
int Up(const TOOL_EVENT &aEvent)
Navigate forward in sheet history.
void HypertextCommand(const wxString &href)
void setTransitions() override
< Set up handlers for various events.
std::list< SCH_SHEET_PATH > m_navHistory
int LeaveSheet(const TOOL_EVENT &aEvent)
Navigate up in sheet hierarchy.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Generic, UI-independent tool event.
Definition: tool_event.h:156