Minor inconsequential merges from Master/Docking branches

This commit is contained in:
omar 2018-09-05 11:51:45 +02:00
parent bdb30d7145
commit a848807847
4 changed files with 12 additions and 11 deletions

View File

@ -3852,8 +3852,9 @@ void ImGui::CalcListClipping(int items_count, float items_height, int* out_items
} }
// Find window given position, search front-to-back // Find window given position, search front-to-back
// FIXME: Note that we have an inconsequential lag here: OuterRectClipped is updated in Begin(), so windows moved programatically with SetWindowPos() and not SetNextWindowPos() // FIXME: Note that we have an inconsequential lag here: OuterRectClipped is updated in Begin(), so windows moved programatically
// will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window isn't affected. // with SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is
// called, aka before the next Begin(). Moving window isn't affected.
static void FindHoveredWindow() static void FindHoveredWindow()
{ {
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
@ -8209,7 +8210,7 @@ ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInput
static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect) static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect)
{ {
ImRect window_rect(window->InnerMainRect.Min - ImVec2(1, 1), window->InnerMainRect.Max + ImVec2(1, 1)); ImRect window_rect(window->InnerMainRect.Min - ImVec2(1, 1), window->InnerMainRect.Max + ImVec2(1, 1));
//GetOverlayDrawList(window)->AddRect(window_rect_rel.Min, window_rect_rel.Max, IM_COL32_WHITE); // [DEBUG] //GetOverlayDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
if (window_rect.Contains(item_rect)) if (window_rect.Contains(item_rect))
return; return;
@ -9700,7 +9701,6 @@ void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size)
entry_handler->ReadLineFn(&g, entry_handler, entry_data, line); entry_handler->ReadLineFn(&g, entry_handler, entry_data, line);
} }
} }
ImGui::MemFree(buf); ImGui::MemFree(buf);
g.SettingsLoaded = true; g.SettingsLoaded = true;
} }

View File

@ -115,7 +115,7 @@ typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: f
typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText*() typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText*()
typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable() typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable()
typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode*(),CollapsingHeader() typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode*(),CollapsingHeader()
typedef int ImGuiViewportFlags; // -> ImGuiViewportFlags_ // Flags: for ImGuiViewport typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin*() typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin*()
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data); typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data);
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);

View File

@ -3405,7 +3405,7 @@ static void ShowExampleAppWindowTitles(bool*)
// Demonstrate using the low-level ImDrawList to draw custom shapes. // Demonstrate using the low-level ImDrawList to draw custom shapes.
static void ShowExampleAppCustomRendering(bool* p_open) static void ShowExampleAppCustomRendering(bool* p_open)
{ {
ImGui::SetNextWindowSize(ImVec2(350,560), ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize(ImVec2(350, 560), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Example: Custom rendering", p_open)) if (!ImGui::Begin("Example: Custom rendering", p_open))
{ {
ImGui::End(); ImGui::End();
@ -3422,7 +3422,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
ImGui::Text("Primitives"); ImGui::Text("Primitives");
static float sz = 36.0f; static float sz = 36.0f;
static float thickness = 4.0f; static float thickness = 4.0f;
static ImVec4 col = ImVec4(1.0f,1.0f,0.4f,1.0f); static ImVec4 col = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);
ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f"); ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f");
ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f"); ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f");
ImGui::ColorEdit3("Color", &col.x); ImGui::ColorEdit3("Color", &col.x);
@ -3472,8 +3472,8 @@ static void ShowExampleAppCustomRendering(bool* p_open)
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
if (canvas_size.x < 50.0f) canvas_size.x = 50.0f; if (canvas_size.x < 50.0f) canvas_size.x = 50.0f;
if (canvas_size.y < 50.0f) canvas_size.y = 50.0f; if (canvas_size.y < 50.0f) canvas_size.y = 50.0f;
draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(50,50,50,255), IM_COL32(50,50,60,255), IM_COL32(60,60,70,255), IM_COL32(50,50,60,255)); draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(50, 50, 50, 255), IM_COL32(50, 50, 60, 255), IM_COL32(60, 60, 70, 255), IM_COL32(50, 50, 60, 255));
draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(255,255,255,255)); draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(255, 255, 255, 255));
bool adding_preview = false; bool adding_preview = false;
ImGui::InvisibleButton("canvas", canvas_size); ImGui::InvisibleButton("canvas", canvas_size);
@ -3499,9 +3499,9 @@ static void ShowExampleAppCustomRendering(bool* p_open)
points.pop_back(); points.pop_back();
} }
} }
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.) draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.)
for (int i = 0; i < points.Size - 1; i += 2) for (int i = 0; i < points.Size - 1; i += 2)
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f); draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i + 1].x, canvas_pos.y + points[i + 1].y), IM_COL32(255, 255, 0, 255), 2.0f);
draw_list->PopClipRect(); draw_list->PopClipRect();
if (adding_preview) if (adding_preview)
points.pop_back(); points.pop_back();

View File

@ -2,6 +2,7 @@
// (drawing and font code) // (drawing and font code)
/* /*
Index of this file: Index of this file:
- Cruft for stb_truetype/stb_rectpack implementation - Cruft for stb_truetype/stb_rectpack implementation
- Style functions (default style) - Style functions (default style)