Merge branch 'master' into navigation

# Conflicts:
#	imgui_demo.cpp
This commit is contained in:
omar 2018-01-31 23:38:05 +01:00
commit eaa6f490a2
2 changed files with 12 additions and 6 deletions

View File

@ -6174,7 +6174,8 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
void ImGui::BringWindowToFront(ImGuiWindow* window) void ImGui::BringWindowToFront(ImGuiWindow* window)
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
if (g.Windows.back() == window) ImGuiWindow* current_front_window = g.Windows.back();
if (current_front_window == window || current_front_window->RootWindow == window)
return; return;
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window
if (g.Windows[i] == window) if (g.Windows[i] == window)
@ -7650,8 +7651,9 @@ void ImGui::LogToTTY(int max_depth)
return; return;
ImGuiWindow* window = g.CurrentWindow; ImGuiWindow* window = g.CurrentWindow;
g.LogEnabled = true; IM_ASSERT(g.LogFile == NULL);
g.LogFile = stdout; g.LogFile = stdout;
g.LogEnabled = true;
g.LogStartDepth = window->DC.TreeDepth; g.LogStartDepth = window->DC.TreeDepth;
if (max_depth >= 0) if (max_depth >= 0)
g.LogAutoExpandMaxDepth = max_depth; g.LogAutoExpandMaxDepth = max_depth;
@ -7672,6 +7674,7 @@ void ImGui::LogToFile(int max_depth, const char* filename)
return; return;
} }
IM_ASSERT(g.LogFile == NULL);
g.LogFile = ImFileOpen(filename, "ab"); g.LogFile = ImFileOpen(filename, "ab");
if (!g.LogFile) if (!g.LogFile)
{ {
@ -7692,8 +7695,9 @@ void ImGui::LogToClipboard(int max_depth)
return; return;
ImGuiWindow* window = g.CurrentWindow; ImGuiWindow* window = g.CurrentWindow;
g.LogEnabled = true; IM_ASSERT(g.LogFile == NULL);
g.LogFile = NULL; g.LogFile = NULL;
g.LogEnabled = true;
g.LogStartDepth = window->DC.TreeDepth; g.LogStartDepth = window->DC.TreeDepth;
if (max_depth >= 0) if (max_depth >= 0)
g.LogAutoExpandMaxDepth = max_depth; g.LogAutoExpandMaxDepth = max_depth;
@ -7706,7 +7710,6 @@ void ImGui::LogFinish()
return; return;
LogText(IM_NEWLINE); LogText(IM_NEWLINE);
g.LogEnabled = false;
if (g.LogFile != NULL) if (g.LogFile != NULL)
{ {
if (g.LogFile == stdout) if (g.LogFile == stdout)
@ -7720,6 +7723,7 @@ void ImGui::LogFinish()
SetClipboardText(g.LogClipboard->begin()); SetClipboardText(g.LogClipboard->begin());
g.LogClipboard->clear(); g.LogClipboard->clear();
} }
g.LogEnabled = false;
} }
// Helper to display logging buttons // Helper to display logging buttons

View File

@ -1054,7 +1054,9 @@ void ImGui::ShowDemoWindow(bool* p_open)
if (ImGui::TreeNode("Child regions")) if (ImGui::TreeNode("Child regions"))
{ {
static bool disable_mouse_wheel = false; static bool disable_mouse_wheel = false;
static bool disable_menu = false;
ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
ImGui::Checkbox("Disable Menu", &disable_menu);
static int line = 50; static int line = 50;
bool goto_line = ImGui::Button("Goto"); bool goto_line = ImGui::Button("Goto");
@ -1082,8 +1084,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
// Child 2: rounded border // Child 2: rounded border
{ {
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | ImGuiWindowFlags_MenuBar); ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar));
if (ImGui::BeginMenuBar()) if (!disable_menu && ImGui::BeginMenuBar())
{ {
if (ImGui::BeginMenu("Menu")) if (ImGui::BeginMenu("Menu"))
{ {