From f70204f2f4149c8b32e2824cc4cc846376c63078 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 19 Dec 2019 15:02:55 +0100 Subject: [PATCH 1/3] Minor bits, placeholder aimed at facilitating merging of Tables branch into Docking --- imgui.cpp | 82 +++++++++++++++++++++++++++++++++++++++++--------- imgui_draw.cpp | 2 +- 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index c81ff318c..5d58f2fa9 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3875,6 +3875,21 @@ void ImGui::Initialize(ImGuiContext* context) ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll; g.SettingsHandlers.push_back(ini_handler); } + +#if 0 // FIXME-WIP: This is a placeholder to facilitate merging of Tables branch into multiple branches. + + // Add .ini handle for ImGuiTable type + { + ImGuiSettingsHandler ini_handler; + ini_handler.TypeName = "Table"; + ini_handler.TypeHash = ImHashStr("Table"); + ini_handler.ReadOpenFn = TableSettingsHandler_ReadOpen; + ini_handler.ReadLineFn = TableSettingsHandler_ReadLine; + ini_handler.WriteAllFn = TableSettingsHandler_WriteAll; + g.SettingsHandlers.push_back(ini_handler); + } + +#endif g.Initialized = true; } @@ -9806,12 +9821,18 @@ void ImGui::ShowMetricsWindow(bool* p_open) return; } - // State + // Debugging enums enum { WRT_OuterRect, WRT_OuterRectClipped, WRT_InnerRect, WRT_InnerClipRect, WRT_WorkRect, WRT_Content, WRT_ContentRegionRect, WRT_Count }; // Windows Rect Type const char* wrt_rects_names[WRT_Count] = { "OuterRect", "OuterRectClipped", "InnerRect", "InnerClipRect", "WorkRect", "Content", "ContentRegionRect" }; + enum { TRT_OuterRect, TRT_WorkRect, TRT_HostClipRect, TRT_InnerClipRect, TRT_BackgroundClipRect, TRT_ColumnsRect, TRT_ColumnsClipRect, TRT_ColumnsContentHeadersUsed, TRT_ColumnsContentHeadersDesired, TRT_ColumnsContentRowsFrozen, TRT_ColumnsContentRowsUnfrozen, TRT_Count }; // Tables Rect Type + const char* trt_rects_names[TRT_Count] = { "OuterRect", "WorkRect", "HostClipRect", "InnerClipRect", "BackgroundClipRect", "ColumnsRect", "ColumnsClipRect", "ColumnsContentHeadersUsed", "ColumnsContentHeadersDesired", "ColumnsContentRowsFrozen", "ColumnsContentRowsUnfrozen" }; + + // State static bool show_windows_rects = false; static int show_windows_rect_type = WRT_WorkRect; static bool show_windows_begin_order = false; + static bool show_tables_rects = false; + static int show_tables_rect_type = TRT_WorkRect; static bool show_drawcmd_details = true; // Basic info @@ -9825,11 +9846,12 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::Separator(); // Helper functions to display common structures: - // - NodeDrawList - // - NodeColumns - // - NodeWindow - // - NodeWindows - // - NodeTabBar + // - NodeDrawList() + // - NodeColumns() + // - NodeWindow() + // - NodeWindows() + // - NodeTabBar() + // - NodeStorage() struct Funcs { static ImRect GetWindowRect(ImGuiWindow* window, int rect_type) @@ -10057,6 +10079,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::TreePop(); } + // Details for Popups if (ImGui::TreeNode("Popups", "Popups (%d)", g.OpenPopupStack.Size)) { for (int i = 0; i < g.OpenPopupStack.Size; i++) @@ -10067,6 +10090,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::TreePop(); } + // Details for TabBars if (ImGui::TreeNode("TabBars", "Tab Bars (%d)", g.TabBars.GetSize())) { for (int n = 0; n < g.TabBars.GetSize(); n++) @@ -10074,13 +10098,10 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::TreePop(); } -#if 0 - if (ImGui::TreeNode("Docking")) - { - ImGui::TreePop(); - } -#endif - + // Details for Tables + IM_UNUSED(trt_rects_names); + IM_UNUSED(show_tables_rects); + IM_UNUSED(show_tables_rect_type); #if 0 if (ImGui::TreeNode("Tables", "Tables (%d)", g.Tables.GetSize())) { @@ -10088,6 +10109,15 @@ void ImGui::ShowMetricsWindow(bool* p_open) } #endif + // Details for Docking +#if 0 + if (ImGui::TreeNode("Docking")) + { + ImGui::TreePop(); + } +#endif + + // Misc Details if (ImGui::TreeNode("Internal state")) { const char* input_source_names[] = { "None", "Mouse", "Nav", "NavKeyboard", "NavGamepad" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT); @@ -10108,6 +10138,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::TreePop(); } + // Tools if (ImGui::TreeNode("Tools")) { // The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted. @@ -10120,7 +10151,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::Checkbox("Show windows rectangles", &show_windows_rects); ImGui::SameLine(); ImGui::SetNextItemWidth(ImGui::GetFontSize() * 12); - show_windows_rects |= ImGui::Combo("##show_windows_rect_type", &show_windows_rect_type, wrt_rects_names, WRT_Count); + show_windows_rects |= ImGui::Combo("##show_windows_rect_type", &show_windows_rect_type, wrt_rects_names, WRT_Count, WRT_Count); if (show_windows_rects && g.NavWindow) { ImGui::BulletText("'%s':", g.NavWindow->Name); @@ -10136,7 +10167,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::TreePop(); } - // Tool: Display windows Rectangles and Begin Order + // Overlay: Display windows Rectangles and Begin Order if (show_windows_rects || show_windows_begin_order) { for (int n = 0; n < g.Windows.Size; n++) @@ -10160,6 +10191,27 @@ void ImGui::ShowMetricsWindow(bool* p_open) } } } + + // FIXME-WIP: This is a placeholder to facilitate merging of Tables branch into multiple branches. +#if 0 + // Overlay: Display Tables Rectangles + if (show_tables_rects) + { + for (int table_n = 0; table_n < g.Tables.GetSize(); table_n++) + { + ImGuiTable* table = g.Tables.GetByIndex(table_n); + } + } +#endif + + // FIXME-WIP: This is a placeholder to facilitate merging of Docking branch into multiple branches. +#if 0 + // Overlay: Display Docking info + if (show_docking_nodes && g.IO.KeyCtrl) + { + } +#endif + ImGui::End(); } diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 58acacf5f..5a8477fc9 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1315,7 +1315,7 @@ void ImDrawListSplitter::Merge(ImDrawList* draw_list) // Merge previous channel last draw command with current channel first draw command if matching. last_cmd->ElemCount += ch._CmdBuffer[0].ElemCount; idx_offset += ch._CmdBuffer[0].ElemCount; - ch._CmdBuffer.erase(ch._CmdBuffer.Data); + ch._CmdBuffer.erase(ch._CmdBuffer.Data); // FIXME-OPT: Improve for multiple merges. } if (ch._CmdBuffer.Size > 0) last_cmd = &ch._CmdBuffer.back(); From 061650bd2ae21bfb085628fde781fe11df528b59 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 19 Dec 2019 22:14:28 +0100 Subject: [PATCH 2/3] Update Readme --- docs/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 8d44b5d83..e84bd7684 100644 --- a/docs/README.md +++ b/docs/README.md @@ -118,7 +118,7 @@ Officially maintained bindings (in repository): - Frameworks: Emscripten, Allegro5, Marmalade. Third-party bindings (see [Bindings](https://github.com/ocornut/imgui/wiki/Bindings/) page): -- Languages: C, C#/.Net, ChaiScript, D, Go, Haxe/hxcpp, Java, JavaScript, Julia, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift... +- Languages: C, C#/.Net, ChaiScript, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift... - Frameworks: Amethyst, bsf, Cinder, Cocos2d-x, Diligent Engine, Flexium, GML/GameMakerStudio2, Irrlicht, Ogre, OpenFrameworks, OpenSceneGraph/OSG, ORX, px_render, LÖVE+Lua, Magnum, NanoRT, Qt, QtDirect3D, SFML, Software Rasterizers, Unreal Engine 4... - Note that C bindings ([cimgui](https://github.com/cimgui/cimgui)) are auto-generated, you can use its json/lua output to generate bindings for other languages. @@ -201,9 +201,10 @@ Ongoing Dear ImGui development is financially supported by users and private spo *Platinum-chocolate sponsors* - Blizzard Entertainment - Google +- Ubisoft *Double-chocolate sponsors* -- Media Molecule, Mobigame, Aras Pranckevičius, Greggman, DotEmu, Nadeo, Supercell, Runner, Aiden Koss, Kylotonn. +- Media Molecule, Mobigame, Aras Pranckevičius, Greggman, DotEmu, Nadeo, Supercell, Aiden Koss, Kylotonn. *Salty caramel supporters* - Remedy Entertainment, Next Level Games, Recognition Robotics, ikrima, Geoffrey Evans, Mercury Labs, Singularity Demo Group, Lionel Landwerlin, Ron Gilbert, Brandon Townsend, G3DVu, Cort Stratton, drudru, Harfang 3D, Jeff Roberts, Rainway inc, Ondra Voves, Mesh Consultants, Unit 2 Games, Neil Bickford, Bill Six, Graham Manders. From 854fc081949b0a373f039a5b092d7065c5c36cdb Mon Sep 17 00:00:00 2001 From: omar Date: Fri, 20 Dec 2019 16:19:34 +0100 Subject: [PATCH 3/3] Amend f70204f2 to facilitate merges. --- imgui.cpp | 31 +++++++++++++++---------------- imgui_internal.h | 1 + 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 5d58f2fa9..144fdd259 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -880,8 +880,6 @@ static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y); namespace ImGui { -static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags); - // Navigation static void NavUpdate(); static void NavUpdateWindowing(); @@ -3876,8 +3874,7 @@ void ImGui::Initialize(ImGuiContext* context) g.SettingsHandlers.push_back(ini_handler); } -#if 0 // FIXME-WIP: This is a placeholder to facilitate merging of Tables branch into multiple branches. - +#ifdef IMGUI_HAS_TABLE // Add .ini handle for ImGuiTable type { ImGuiSettingsHandler ini_handler; @@ -3888,8 +3885,10 @@ void ImGui::Initialize(ImGuiContext* context) ini_handler.WriteAllFn = TableSettingsHandler_WriteAll; g.SettingsHandlers.push_back(ini_handler); } +#endif // #ifdef IMGUI_HAS_TABLE -#endif +#ifdef IMGUI_HAS_DOCK +#endif // #ifdef IMGUI_HAS_DOCK g.Initialized = true; } @@ -4654,7 +4653,7 @@ static ImRect GetViewportRect() return ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y); } -static bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags) +bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags) { ImGuiContext& g = *GImGui; ImGuiWindow* parent_window = g.CurrentWindow; @@ -10102,20 +10101,22 @@ void ImGui::ShowMetricsWindow(bool* p_open) IM_UNUSED(trt_rects_names); IM_UNUSED(show_tables_rects); IM_UNUSED(show_tables_rect_type); -#if 0 +#ifdef IMGUI_HAS_TABLE if (ImGui::TreeNode("Tables", "Tables (%d)", g.Tables.GetSize())) { + for (int n = 0; n < g.Tables.GetSize(); n++) + Funcs::NodeTable(g.Tables.GetByIndex(n)); ImGui::TreePop(); } -#endif +#endif // #define IMGUI_HAS_TABLE // Details for Docking -#if 0 +#ifdef IMGUI_HAS_DOCK if (ImGui::TreeNode("Docking")) { ImGui::TreePop(); } -#endif +#endif // #define IMGUI_HAS_DOCK // Misc Details if (ImGui::TreeNode("Internal state")) @@ -10192,8 +10193,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) } } - // FIXME-WIP: This is a placeholder to facilitate merging of Tables branch into multiple branches. -#if 0 +#ifdef IMGUI_HAS_TABLE // Overlay: Display Tables Rectangles if (show_tables_rects) { @@ -10202,15 +10202,14 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGuiTable* table = g.Tables.GetByIndex(table_n); } } -#endif +#endif // #define IMGUI_HAS_TABLE - // FIXME-WIP: This is a placeholder to facilitate merging of Docking branch into multiple branches. -#if 0 +#ifdef IMGUI_HAS_DOCK // Overlay: Display Docking info if (show_docking_nodes && g.IO.KeyCtrl) { } -#endif +#endif // #define IMGUI_HAS_DOCK ImGui::End(); } diff --git a/imgui_internal.h b/imgui_internal.h index ea58b65cb..cf55e53c3 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1668,6 +1668,7 @@ namespace ImGui IMGUI_API void LogToBuffer(int auto_open_depth = -1); // Start logging/capturing to internal buffer // Popups, Modals, Tooltips + IMGUI_API bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags); IMGUI_API void OpenPopupEx(ImGuiID id); IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup); IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);