|
KiCad PCB EDA Suite
|
GUI-free preview/dirty/close state machine. More...
#include <editor_tabs_panel.h>
Classes | |
| struct | ENTRY |
Public Member Functions | |
| int | OpenDocument (const wxString &aKey, bool aAsPreview) |
| Return the index to display the document at, reusing a preview slot or appending a new tab. | |
| void | CloseDocument (const wxString &aKey) |
Drop the document with aKey, freeing the preview slot if it held it. | |
| void | MarkModified (const wxString &aKey, bool aModified) |
| Update the modified flag. | |
| void | Promote (const wxString &aKey) |
| Clear the preview flag so the tab becomes permanent and is no longer reused. | |
| bool | CanCloseWithoutPrompt (const wxString &aKey) const |
| True when the document has no unsaved edits and can be closed silently. | |
| int | FindIndex (const wxString &aKey) const |
| int | PreviewIndex () const |
| Index of the current reusable preview tab, or -1 if none. | |
| const std::vector< ENTRY > & | Entries () const |
Private Attributes | |
| std::vector< ENTRY > | m_entries |
GUI-free preview/dirty/close state machine.
One unedited preview tab is reused for the next preview; editing it or double-clicking its tab promotes it to permanent.
Definition at line 40 of file editor_tabs_panel.h.
| bool EDITOR_TABS_MODEL::CanCloseWithoutPrompt | ( | const wxString & | aKey | ) | const |
True when the document has no unsaved edits and can be closed silently.
Definition at line 134 of file editor_tabs_panel.cpp.
References FindIndex(), and m_entries.
Referenced by BOOST_AUTO_TEST_CASE().
| void EDITOR_TABS_MODEL::CloseDocument | ( | const wxString & | aKey | ) |
Drop the document with aKey, freeing the preview slot if it held it.
Definition at line 101 of file editor_tabs_panel.cpp.
References FindIndex(), and m_entries.
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 82 of file editor_tabs_panel.h.
References m_entries.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and showTabSwitcher().
| int EDITOR_TABS_MODEL::FindIndex | ( | const wxString & | aKey | ) | const |
Definition at line 44 of file editor_tabs_panel.cpp.
References m_entries.
Referenced by CanCloseWithoutPrompt(), CloseDocument(), MarkModified(), OpenDocument(), and Promote().
| void EDITOR_TABS_MODEL::MarkModified | ( | const wxString & | aKey, |
| bool | aModified ) |
Update the modified flag.
Turning it on promotes a preview tab to permanent.
Definition at line 110 of file editor_tabs_panel.cpp.
References FindIndex(), and m_entries.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| int EDITOR_TABS_MODEL::OpenDocument | ( | const wxString & | aKey, |
| bool | aAsPreview ) |
Return the index to display the document at, reusing a preview slot or appending a new tab.
Definition at line 70 of file editor_tabs_panel.cpp.
References FindIndex(), m_entries, and PreviewIndex().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| int EDITOR_TABS_MODEL::PreviewIndex | ( | ) | const |
Index of the current reusable preview tab, or -1 if none.
Definition at line 56 of file editor_tabs_panel.cpp.
References m_entries, EDITOR_TABS_MODEL::ENTRY::modified, and EDITOR_TABS_MODEL::ENTRY::preview.
Referenced by BOOST_AUTO_TEST_CASE(), and OpenDocument().
| void EDITOR_TABS_MODEL::Promote | ( | const wxString & | aKey | ) |
Clear the preview flag so the tab becomes permanent and is no longer reused.
Definition at line 125 of file editor_tabs_panel.cpp.
References FindIndex(), and m_entries.
Referenced by BOOST_AUTO_TEST_CASE().
|
private |
Definition at line 85 of file editor_tabs_panel.h.
Referenced by CanCloseWithoutPrompt(), CloseDocument(), Entries(), FindIndex(), MarkModified(), OpenDocument(), PreviewIndex(), and Promote().