![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Singleton that owns and manages all open graph editor tabs. More...
#include <TabManager.h>
Public Member Functions | |
| ~TabManager () | |
| std::string | CreateNewTab (const std::string &graphType) |
| Creates a new empty tab of the given graph type. | |
| std::string | OpenFileInTab (const std::string &filePath) |
| Opens a file in a new tab. | |
| void | SetActiveTab (const std::string &tabID) |
| std::string | GetActiveTabID () const |
| EditorTab * | GetActiveTab () |
| EditorTab * | GetTab (const std::string &tabID) |
| const std::vector< EditorTab > & | GetAllTabs () const |
| bool | CloseTab (const std::string &tabID) |
| Closes the given tab. | |
| bool | CloseAllTabs () |
| Attempts to close all tabs. | |
| bool | SaveActiveTab () |
| Saves the active tab. | |
| bool | SaveActiveTabAs (const std::string &path) |
| Saves the active tab to a specific path. | |
| void | RenderTabBar () |
| Renders the horizontal tab bar (call before RenderActiveCanvas). | |
| void | RenderActiveCanvas () |
| Renders the graph canvas of the active tab. | |
| bool | HasDirtyTabs () const |
| Returns true when at least one tab has unsaved changes. | |
| bool | IsEmpty () const |
| Returns true when there are no open tabs. | |
Static Public Member Functions | |
| static TabManager & | Get () |
| Returns the global singleton instance. | |
Private Member Functions | |
| TabManager () | |
| TabManager (const TabManager &) | |
| TabManager & | operator= (const TabManager &) |
| int | ShowUnsavedDialog (const EditorTab &tab) |
| Shows a 3-button "Save / Don't Save / Cancel" modal dialog. | |
| bool | ShowSaveAsDialog (EditorTab *tab) |
| Shows the "Save As" input dialog for a tab without a path. | |
| std::string | NextTabID () |
| Generates the next unique tabID. | |
| void | DestroyTab (size_t index) |
| Deletes a renderer and removes its tab entry. | |
Static Private Member Functions | |
| static std::string | DetectGraphType (const std::string &filePath) |
| Detects the graph type by inspecting the JSON contents. | |
| static std::string | DisplayNameFromPath (const std::string &filePath) |
| Derives a display name from a file path (filename without dir). | |
Private Attributes | |
| std::vector< EditorTab > | m_tabs |
| std::string | m_activeTabID |
| int | m_nextTabNum |
| Counter for "Untitled-N" names. | |
| int | m_nextTabIDNum |
| Counter for unique tab IDs. | |
| std::string | m_pendingSelectTabID |
| std::string | m_pendingCloseTabID |
| bool | m_showSaveAsDialog |
| char | m_saveAsBuffer [512] |
| std::string | m_saveAsTabID |
Singleton that owns and manages all open graph editor tabs.
Definition at line 64 of file TabManager.h.
| Olympe::TabManager::~TabManager | ( | ) |
Definition at line 48 of file TabManager.cpp.
References GetComponentTypeID_Static(), and m_tabs.
Here is the call graph for this function:
|
private |
Definition at line 40 of file TabManager.cpp.
References m_saveAsBuffer.
|
private |
| bool Olympe::TabManager::CloseAllTabs | ( | ) |
Attempts to close all tabs.
Definition at line 421 of file TabManager.cpp.
References DestroyTab(), GetComponentTypeID_Static(), m_tabs, renderer, SaveActiveTabAs(), SetActiveTab(), and ShowUnsavedDialog().
Referenced by Olympe::BlueprintEditorGUI::HandleKeyboardShortcuts(), and Olympe::BlueprintEditorGUI::Render().
Here is the call graph for this function:
Here is the caller graph for this function:Closes the given tab.
Shows an "unsaved changes" dialog when the tab is dirty.
Definition at line 395 of file TabManager.cpp.
References DestroyTab(), GetComponentTypeID_Static(), m_pendingCloseTabID, m_tabs, and renderer.
Referenced by Olympe::BlueprintEditorGUI::HandleKeyboardShortcuts(), and Olympe::BlueprintEditorGUI::Render().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Olympe::TabManager::CreateNewTab | ( | const std::string & | graphType | ) |
Creates a new empty tab of the given graph type.
| graphType | "VisualScript" or "BehaviorTree". |
Definition at line 148 of file TabManager.cpp.
References GetComponentTypeID_Static(), Olympe::NodeGraphPanel::Initialize(), Olympe::PrefabCanvas::Initialize(), m_nextTabNum, m_tabs, NextTabID(), SetActiveTab(), and Olympe::EditorTab::tabID.
Referenced by Olympe::BlueprintEditorGUI::HandleKeyboardShortcuts(), Olympe::BlueprintEditorGUI::NewVisualScriptGraph(), Olympe::BlueprintEditorGUI::Render(), and RenderTabBar().
Here is the call graph for this function:
Here is the caller graph for this function:Deletes a renderer and removes its tab entry.
Definition at line 369 of file TabManager.cpp.
References GetComponentTypeID_Static(), m_activeTabID, m_tabs, and Olympe::EditorTab::tabID.
Referenced by CloseAllTabs(), CloseTab(), and RenderTabBar().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Detects the graph type by inspecting the JSON contents.
Definition at line 85 of file TabManager.cpp.
References GetComponentTypeID_Static().
Referenced by OpenFileInTab().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Derives a display name from a file path (filename without dir).
Definition at line 69 of file TabManager.cpp.
References GetComponentTypeID_Static().
Referenced by OpenFileInTab(), RenderTabBar(), SaveActiveTab(), and SaveActiveTabAs().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Returns the global singleton instance.
Definition at line 34 of file TabManager.cpp.
References GetComponentTypeID_Static().
Referenced by Olympe::BlueprintEditorGUI::HandleKeyboardShortcuts(), Olympe::BlueprintEditorGUI::LoadBlueprint(), Olympe::BlueprintEditorGUI::NewVisualScriptGraph(), Olympe::VisualScriptEditorPanel::OnNodeDoubleClicked(), Olympe::BlueprintEditor::OpenGraphInEditor(), Olympe::BlueprintEditorGUI::Render(), and Olympe::BlueprintEditorGUI::RenderFixedLayout().
Here is the call graph for this function:
Here is the caller graph for this function:| EditorTab * Olympe::TabManager::GetActiveTab | ( | ) |
Definition at line 345 of file TabManager.cpp.
References GetComponentTypeID_Static(), m_activeTabID, and m_tabs.
Referenced by RenderActiveCanvas(), SaveActiveTab(), SaveActiveTabAs(), and SetActiveTab().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Olympe::TabManager::GetActiveTabID | ( | ) | const |
Definition at line 340 of file TabManager.cpp.
References m_activeTabID.
Definition at line 100 of file TabManager.h.
References m_tabs.
Definition at line 355 of file TabManager.cpp.
References GetComponentTypeID_Static(), and m_tabs.
Referenced by RenderTabBar().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::TabManager::HasDirtyTabs | ( | ) | const |
Returns true when at least one tab has unsaved changes.
Definition at line 515 of file TabManager.cpp.
References GetComponentTypeID_Static(), m_tabs, and renderer.
Here is the call graph for this function:
|
inline |
Returns true when there are no open tabs.
Definition at line 150 of file TabManager.h.
References m_tabs.
Referenced by Olympe::BlueprintEditorGUI::Render().
Here is the caller graph for this function:
|
private |
Generates the next unique tabID.
Definition at line 62 of file TabManager.cpp.
References GetComponentTypeID_Static(), and m_nextTabIDNum.
Referenced by CreateNewTab(), and OpenFileInTab().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Olympe::TabManager::OpenFileInTab | ( | const std::string & | filePath | ) |
Opens a file in a new tab.
If the file is already open, activates that tab instead.
| filePath | Full path to the .ats / .json file. |
Definition at line 207 of file TabManager.cpp.
References DetectGraphType(), DisplayNameFromPath(), GetComponentTypeID_Static(), Olympe::NodeGraphPanel::Initialize(), Olympe::PrefabCanvas::Initialize(), m_tabs, NextTabID(), SetActiveTab(), and Olympe::EditorTab::tabID.
Referenced by Olympe::BlueprintEditorGUI::LoadBlueprint(), Olympe::VisualScriptEditorPanel::OnNodeDoubleClicked(), and Olympe::BlueprintEditor::OpenGraphInEditor().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
| void Olympe::TabManager::RenderActiveCanvas | ( | ) |
Renders the graph canvas of the active tab.
Definition at line 683 of file TabManager.cpp.
References GetActiveTab(), and GetComponentTypeID_Static().
Referenced by Olympe::BlueprintEditorGUI::RenderFixedLayout().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::TabManager::RenderTabBar | ( | ) |
Renders the horizontal tab bar (call before RenderActiveCanvas).
Definition at line 531 of file TabManager.cpp.
References CreateNewTab(), DestroyTab(), DisplayNameFromPath(), GetComponentTypeID_Static(), GetTab(), Olympe::EditorTab::isDirty, m_activeTabID, m_pendingCloseTabID, m_pendingSelectTabID, m_tabs, SaveActiveTab(), and SetActiveTab().
Referenced by Olympe::BlueprintEditorGUI::RenderFixedLayout().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::TabManager::SaveActiveTab | ( | ) |
Saves the active tab.
Opens "Save As" if no path is set.
Definition at line 453 of file TabManager.cpp.
References DisplayNameFromPath(), GetActiveTab(), GetComponentTypeID_Static(), m_saveAsBuffer, m_saveAsTabID, and m_showSaveAsDialog.
Referenced by Olympe::BlueprintEditorGUI::HandleKeyboardShortcuts(), Olympe::BlueprintEditorGUI::Render(), and RenderTabBar().
Here is the call graph for this function:
Here is the caller graph for this function:Saves the active tab to a specific path.
Definition at line 485 of file TabManager.cpp.
References DisplayNameFromPath(), GetActiveTab(), GetComponentTypeID_Static(), m_saveAsBuffer, m_saveAsTabID, and m_showSaveAsDialog.
Referenced by CloseAllTabs(), Olympe::BlueprintEditorGUI::HandleKeyboardShortcuts(), and Olympe::BlueprintEditorGUI::Render().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 313 of file TabManager.cpp.
References GetActiveTab(), GetComponentTypeID_Static(), m_activeTabID, m_pendingSelectTabID, and m_tabs.
Referenced by CloseAllTabs(), CreateNewTab(), OpenFileInTab(), and RenderTabBar().
Here is the call graph for this function:
Here is the caller graph for this function:Shows the "Save As" input dialog for a tab without a path.
Shows a 3-button "Save / Don't Save / Cancel" modal dialog.
| tab | Tab whose unsaved state is being queried. |
Definition at line 698 of file TabManager.cpp.
References GetComponentTypeID_Static().
Referenced by CloseAllTabs().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 189 of file TabManager.h.
Referenced by DestroyTab(), GetActiveTab(), GetActiveTabID(), RenderTabBar(), and SetActiveTab().
|
private |
|
private |
Counter for "Untitled-N" names.
Definition at line 190 of file TabManager.h.
Referenced by CreateNewTab().
|
private |
Definition at line 199 of file TabManager.h.
Referenced by CloseTab(), and RenderTabBar().
|
private |
Definition at line 196 of file TabManager.h.
Referenced by RenderTabBar(), and SetActiveTab().
|
private |
Definition at line 203 of file TabManager.h.
Referenced by SaveActiveTab(), SaveActiveTabAs(), and TabManager().
|
private |
Definition at line 204 of file TabManager.h.
Referenced by SaveActiveTab(), and SaveActiveTabAs().
|
private |
Definition at line 202 of file TabManager.h.
Referenced by SaveActiveTab(), and SaveActiveTabAs().
|
private |
Definition at line 188 of file TabManager.h.
Referenced by CloseAllTabs(), CloseTab(), CreateNewTab(), DestroyTab(), GetActiveTab(), GetAllTabs(), GetTab(), HasDirtyTabs(), IsEmpty(), OpenFileInTab(), RenderTabBar(), SetActiveTab(), and ~TabManager().