mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-06 15:48:48 +00:00
CogWindow: Save the windows "Show Menu" state (used to be called "Hide Menu")
This commit is contained in:
@@ -60,7 +60,7 @@ void FCogWindow::Render(float DeltaTime)
|
|||||||
|
|
||||||
const FString WindowTitle = GetTitle() + "##" + Name;
|
const FString WindowTitle = GetTitle() + "##" + Name;
|
||||||
|
|
||||||
if (bHasMenu && bHideMenu == false)
|
if (bHasMenu && bShowMenu)
|
||||||
{
|
{
|
||||||
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
WindowFlags |= ImGuiWindowFlags_MenuBar;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ void FCogWindow::Render(float DeltaTime)
|
|||||||
{
|
{
|
||||||
if (bHasMenu)
|
if (bHasMenu)
|
||||||
{
|
{
|
||||||
ImGui::Checkbox("Hide Menu", &bHideMenu);
|
ImGui::Checkbox("Show Menu", &bShowMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Reset Settings"))
|
if (ImGui::Button("Reset Settings"))
|
||||||
|
|||||||
@@ -670,11 +670,15 @@ void* UCogWindowManager::SettingsHandler_ReadOpen(ImGuiContext* Context, ImGuiSe
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSettingsHandler* Handler, void* Entry, const char* Line)
|
void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSettingsHandler* Handler, void* Entry, const char* Line)
|
||||||
{
|
{
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
// Load the visibility of windows.
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
if (Entry == (void*)1)
|
if (Entry == (void*)1)
|
||||||
{
|
{
|
||||||
ImGuiID Id;
|
ImGuiID Id;
|
||||||
|
int32 ShowMenu;
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MICROSOFT
|
#if PLATFORM_WINDOWS || PLATFORM_MICROSOFT
|
||||||
if (sscanf_s(Line, "0x%08X", &Id) == 1)
|
if (sscanf_s(Line, "0x%08X %d", &Id, &ShowMenu) == 2)
|
||||||
#else
|
#else
|
||||||
if (sscanf(Line, "0x%08X", &Id) == 1)
|
if (sscanf(Line, "0x%08X", &Id) == 1)
|
||||||
#endif
|
#endif
|
||||||
@@ -683,9 +687,13 @@ void UCogWindowManager::SettingsHandler_ReadLine(ImGuiContext* Context, ImGuiSet
|
|||||||
if (FCogWindow* Window = Manager->FindWindowByID(Id))
|
if (FCogWindow* Window = Manager->FindWindowByID(Id))
|
||||||
{
|
{
|
||||||
Window->SetIsVisible(true);
|
Window->SetIsVisible(true);
|
||||||
|
Window->bShowMenu = (ShowMenu > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
// Load which widgets are present in the main menu bar and with what order.
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
else if (Entry == (void*)2)
|
else if (Entry == (void*)2)
|
||||||
{
|
{
|
||||||
ImGuiID Id;
|
ImGuiID Id;
|
||||||
@@ -713,16 +721,28 @@ void UCogWindowManager::SettingsHandler_WriteAll(ImGuiContext* Context, ImGuiSet
|
|||||||
{
|
{
|
||||||
const UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
const UCogWindowManager* Manager = (UCogWindowManager*)Handler->UserData;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
// Save the visibility of windows. Example:
|
||||||
|
// [Cog][Windows]
|
||||||
|
// 0xB5D96693
|
||||||
|
// 0xBF3390B5
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
Buffer->appendf("[%s][Windows]\n", Handler->TypeName);
|
Buffer->appendf("[%s][Windows]\n", Handler->TypeName);
|
||||||
for (const FCogWindow* Window : Manager->Windows)
|
for (const FCogWindow* Window : Manager->Windows)
|
||||||
{
|
{
|
||||||
if (Window->GetIsVisible())
|
if (Window->GetIsVisible())
|
||||||
{
|
{
|
||||||
Buffer->appendf("0x%08X\n", Window->GetID());
|
Buffer->appendf("0x%08X %d\n", Window->GetID(), (int32)Window->bShowMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Buffer->append("\n");
|
Buffer->append("\n");
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
// Save which widgets are present in the main menu bar and with what order. Example:
|
||||||
|
// [Cog][Widgets]
|
||||||
|
// 0x639F1181 1
|
||||||
|
// 0x52BDE3E0 1
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
Buffer->appendf("[%s][Widgets]\n", Handler->TypeName);
|
Buffer->appendf("[%s][Widgets]\n", Handler->TypeName);
|
||||||
for (const FCogWindow* Window : Manager->Widgets)
|
for (const FCogWindow* Window : Manager->Widgets)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
/** The short name of the window. "Effect" if the window full name is "Gameplay.Character.Effect" */
|
/** The short name of the window. "Effect" if the window full name is "Gameplay.Character.Effect" */
|
||||||
const FString& GetName() const { return Name; }
|
const FString& GetName() const { return Name; }
|
||||||
|
|
||||||
AActor* GetSelection() { return CurrentSelection.Get(); }
|
AActor* GetSelection() const { return CurrentSelection.Get(); }
|
||||||
|
|
||||||
void SetSelection(AActor* Actor);
|
void SetSelection(AActor* Actor);
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool bHideMenu = false;
|
bool bShowMenu = false;
|
||||||
|
|
||||||
bool bNoPadding = false;
|
bool bNoPadding = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user