KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21
22#ifndef SCH_NAVIGATE_TOOL_H
23#define SCH_NAVIGATE_TOOL_H
24
25#include <sch_base_frame.h>
26#include <tools/sch_tool_base.h>
27#include <status_popup.h>
28
29class SCH_EDIT_FRAME;
30
34class SCH_NAVIGATE_TOOL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_EDIT_FRAME>
35{
36public:
37 SCH_NAVIGATE_TOOL() : SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.NavigateTool" ) {}
38
40
42 void ResetHistory();
43
46 void CleanHistory();
47
49 int ChangeSheet( const TOOL_EVENT& aEvent );
50
52 int EnterSheet( const TOOL_EVENT& aEvent );
53
55 int LeaveSheet( const TOOL_EVENT& aEvent );
56
58 int Up( const TOOL_EVENT& aEvent );
59
61 int Forward( const TOOL_EVENT& aEvent );
62
64 int Back( const TOOL_EVENT& aEvent );
65
67 int Previous( const TOOL_EVENT& aEvent );
68
70 int Next( const TOOL_EVENT& aEvent );
71
72 void HypertextCommand( const wxString& aHref );
73
74 bool CanGoBack();
75 bool CanGoForward();
76 bool CanGoUp();
77 bool CanGoPrevious();
78 bool CanGoNext();
79
80public:
81 static wxString g_BackLink;
82
83private:
85 void setTransitions() override;
86
88 void pushToHistory( const SCH_SHEET_PATH& aPath );
89
91 void changeSheet( const SCH_SHEET_PATH& aPath );
92
93private:
94 std::list<SCH_SHEET_PATH> m_navHistory;
95 std::list<SCH_SHEET_PATH>::iterator m_navIndex;
96};
97
98
99#endif // SCH_NAVIGATE_TOOL_H
Schematic editor (Eeschema) main window.
void ResetHistory()
Reset navigation history. Must be done when schematic changes.
void CleanHistory()
Remove deleted pages from history.
int Back(const TOOL_EVENT &aEvent)
Navigate back in sheet history.
int Previous(const TOOL_EVENT &aEvent)
Navigate to previous sheet by numeric sheet number.
int Next(const TOOL_EVENT &aEvent)
Navigate to next sheet by numeric sheet number.
std::list< SCH_SHEET_PATH >::iterator m_navIndex
void changeSheet(const SCH_SHEET_PATH &aPath)
Change current sheet to aPath and handle history, zooming, etc.
int ChangeSheet(const TOOL_EVENT &aEvent)
Enter sheet provided in aEvent.
int Forward(const TOOL_EVENT &aEvent)
Navigate forward in sheet history.
int EnterSheet(const TOOL_EVENT &aEvent)
Enter selected sheet.
static wxString g_BackLink
void pushToHistory(const SCH_SHEET_PATH &aPath)
Clear history after this nav index and pushes aPath to history.
void HypertextCommand(const wxString &aHref)
int Up(const TOOL_EVENT &aEvent)
Navigate up in sheet hierarchy.
void setTransitions() override
Set up handlers for various events.
std::list< SCH_SHEET_PATH > m_navHistory
int LeaveSheet(const TOOL_EVENT &aEvent)
Return to parent sheet. Synonymous with Up.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_TOOL_BASE(const std::string &aName)
Generic, UI-independent tool event.
Definition tool_event.h:167