KiCad PCB EDA Suite
Loading...
Searching...
No Matches
editor_tab_context.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef EDITOR_TAB_CONTEXT_H
21#define EDITOR_TAB_CONTEXT_H
22
23#include <memory>
24#include <vector>
25
26#include <wx/string.h>
27
28#include <kiid.h>
29#include <math/vector2d.h>
30#include <undo_redo_container.h>
31
32
36{
37public:
39 m_undo( std::make_unique<UNDO_REDO_CONTAINER>() ),
40 m_redo( std::make_unique<UNDO_REDO_CONTAINER>() )
41 {
42 }
43
44 virtual ~EDITOR_TAB_CONTEXT() = default;
45
49 virtual wxString GetTabKey() const = 0;
50
54 virtual wxString GetDisplayName() const = 0;
55
56 virtual bool IsModified() const = 0;
57
58 bool IsPreview() const { return m_preview; }
59 void SetPreview( bool aPreview ){ m_preview = aPreview; }
60
63
66 {
67 double scale = 0.0;
69 bool valid = false;
70 };
71
73
77 std::vector<KIID>& SavedSelection() { return m_savedSelection; }
78
79protected:
80 bool m_preview = false;
81 std::unique_ptr<UNDO_REDO_CONTAINER> m_undo;
82 std::unique_ptr<UNDO_REDO_CONTAINER> m_redo;
84 std::vector<KIID> m_savedSelection;
85};
86
87#endif // EDITOR_TAB_CONTEXT_H
VIEW_SNAPSHOT m_viewSnapshot
virtual ~EDITOR_TAB_CONTEXT()=default
void SetPreview(bool aPreview)
virtual bool IsModified() const =0
std::unique_ptr< UNDO_REDO_CONTAINER > m_undo
virtual wxString GetTabKey() const =0
Stable identity for persistence and de-duplication.
std::unique_ptr< UNDO_REDO_CONTAINER > m_redo
std::vector< KIID > m_savedSelection
VIEW_SNAPSHOT & ViewSnapshot()
std::vector< KIID > & SavedSelection()
Selection saved as resolved KIIDs, restored after the view is rebuilt.
UNDO_REDO_CONTAINER & RedoList()
UNDO_REDO_CONTAINER & UndoList()
virtual wxString GetDisplayName() const =0
Short label shown on the tab.
A holder to handle a list of undo (or redo) commands.
STL namespace.
View snapshot captured on detach, restored on activate.
VECTOR2< double > VECTOR2D
Definition vector2d.h:682