mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Log/Capture: renaming ImGuiLogType to ImGuiLogFlags
This commit is contained in:
parent
9a0dff1bc5
commit
a4fcc93f4a
2 changed files with 29 additions and 24 deletions
33
imgui.cpp
33
imgui.cpp
|
|
@ -4007,7 +4007,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|||
memset(LocalizationTable, 0, sizeof(LocalizationTable));
|
||||
|
||||
LogEnabled = false;
|
||||
LogType = ImGuiLogType_None;
|
||||
LogFlags = ImGuiLogFlags_None;
|
||||
LogNextPrefix = LogNextSuffix = NULL;
|
||||
LogFile = NULL;
|
||||
LogLinePosY = FLT_MAX;
|
||||
|
|
@ -14324,15 +14324,16 @@ void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char*
|
|||
}
|
||||
|
||||
// Start logging/capturing text output
|
||||
void ImGui::LogBegin(ImGuiLogType type, int auto_open_depth)
|
||||
void ImGui::LogBegin(ImGuiLogFlags flags, int auto_open_depth)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
IM_ASSERT(g.LogEnabled == false);
|
||||
IM_ASSERT(g.LogFile == NULL);
|
||||
IM_ASSERT(g.LogBuffer.empty());
|
||||
IM_ASSERT(g.LogFile == NULL && g.LogBuffer.empty());
|
||||
IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiLogFlags_OutputMask_)); // Check that only 1 type flag is used
|
||||
|
||||
g.LogEnabled = g.ItemUnclipByLog = true;
|
||||
g.LogType = type;
|
||||
g.LogFlags = flags;
|
||||
g.LogNextPrefix = g.LogNextSuffix = NULL;
|
||||
g.LogDepthRef = window->DC.TreeDepth;
|
||||
g.LogDepthToExpand = ((auto_open_depth >= 0) ? auto_open_depth : g.LogDepthToExpandDefault);
|
||||
|
|
@ -14355,7 +14356,7 @@ void ImGui::LogToTTY(int auto_open_depth)
|
|||
return;
|
||||
IM_UNUSED(auto_open_depth);
|
||||
#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
|
||||
LogBegin(ImGuiLogType_TTY, auto_open_depth);
|
||||
LogBegin(ImGuiLogFlags_OutputTTY, auto_open_depth);
|
||||
g.LogFile = stdout;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -14381,7 +14382,7 @@ void ImGui::LogToFile(int auto_open_depth, const char* filename)
|
|||
return;
|
||||
}
|
||||
|
||||
LogBegin(ImGuiLogType_File, auto_open_depth);
|
||||
LogBegin(ImGuiLogFlags_OutputFile, auto_open_depth);
|
||||
g.LogFile = f;
|
||||
}
|
||||
|
||||
|
|
@ -14391,7 +14392,7 @@ void ImGui::LogToClipboard(int auto_open_depth)
|
|||
ImGuiContext& g = *GImGui;
|
||||
if (g.LogEnabled)
|
||||
return;
|
||||
LogBegin(ImGuiLogType_Clipboard, auto_open_depth);
|
||||
LogBegin(ImGuiLogFlags_OutputClipboard, auto_open_depth);
|
||||
}
|
||||
|
||||
void ImGui::LogToBuffer(int auto_open_depth)
|
||||
|
|
@ -14399,7 +14400,7 @@ void ImGui::LogToBuffer(int auto_open_depth)
|
|||
ImGuiContext& g = *GImGui;
|
||||
if (g.LogEnabled)
|
||||
return;
|
||||
LogBegin(ImGuiLogType_Buffer, auto_open_depth);
|
||||
LogBegin(ImGuiLogFlags_OutputBuffer, auto_open_depth);
|
||||
}
|
||||
|
||||
void ImGui::LogFinish()
|
||||
|
|
@ -14409,29 +14410,29 @@ void ImGui::LogFinish()
|
|||
return;
|
||||
|
||||
LogText(IM_NEWLINE);
|
||||
switch (g.LogType)
|
||||
switch (g.LogFlags & ImGuiLogFlags_OutputMask_)
|
||||
{
|
||||
case ImGuiLogType_TTY:
|
||||
case ImGuiLogFlags_OutputTTY:
|
||||
#ifndef IMGUI_DISABLE_TTY_FUNCTIONS
|
||||
fflush(g.LogFile);
|
||||
#endif
|
||||
break;
|
||||
case ImGuiLogType_File:
|
||||
case ImGuiLogFlags_OutputFile:
|
||||
ImFileClose(g.LogFile);
|
||||
break;
|
||||
case ImGuiLogType_Buffer:
|
||||
case ImGuiLogFlags_OutputBuffer:
|
||||
break;
|
||||
case ImGuiLogType_Clipboard:
|
||||
case ImGuiLogFlags_OutputClipboard:
|
||||
if (!g.LogBuffer.empty())
|
||||
SetClipboardText(g.LogBuffer.begin());
|
||||
break;
|
||||
case ImGuiLogType_None:
|
||||
default:
|
||||
IM_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
g.LogEnabled = g.ItemUnclipByLog = false;
|
||||
g.LogType = ImGuiLogType_None;
|
||||
g.LogFlags = ImGuiLogFlags_None;
|
||||
g.LogFile = NULL;
|
||||
g.LogBuffer.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue