Skip to content

Commit

Permalink
update to dear imgui 1.88
Browse files Browse the repository at this point in the history
  • Loading branch information
cfillion committed Jun 22, 2022
1 parent 75da8c2 commit 457f76f
Show file tree
Hide file tree
Showing 13 changed files with 207 additions and 123 deletions.
2 changes: 0 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ stack: ruby 2.7

before_build:
- git submodule update --init --depth 1
# backport 'fix texture-based anti-aliasing with RGBA textures' from v1.88
- ps: (Invoke-WebRequest 'https://github.com/cfillion/imgui/commit/00f43be4f393ebbfb775d2ab5c0f5f5aea8c889e.patch').Content | git -C vendor/imgui apply
build_script:
- cmake -B build -DCMAKE_BUILD_TYPE=Release
-DVCPKG_TARGET_TRIPLET=$TRIPLET -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN
Expand Down
25 changes: 11 additions & 14 deletions api/indev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ DEFINE_API(int, GetKeyPressedAmount, (ImGui_Context*,ctx)
});

DEFINE_API(int, GetKeyMods, (ImGui_Context*,ctx),
"Ctrl/Shift/Alt/Super. See ImGui_KeyModFlags_*.",
"Ctrl/Shift/Alt/Super. See ImGui_ModFlags_*.",
{
FRAME_GUARD;
return ctx->IO().KeyMods;
Expand All @@ -269,23 +269,20 @@ DEFINE_API(bool, GetInputQueueCharacter, (ImGui_Context*,ctx)
return false;
});

DEFINE_API(void, CaptureKeyboardFromApp, (ImGui_Context*,ctx)
(bool*,API_RO(want_capture_keyboard_value)),
R"(Manually enable or disable capture of keyboard shortcuts in the global scope for the next frame.

Default values: want_capture_keyboard_value = true)",
DEFINE_API(void, SetNextFrameWantCaptureKeyboard, (ImGui_Context*,ctx)
(bool,want_capture_keyboard),
R"(Request capture of keyboard shortcuts in REAPER's global scope for the next frame.)",
{
FRAME_GUARD;
const bool value { valueOr(API_RO(want_capture_keyboard_value), true) };
ImGui::CaptureKeyboardFromApp(value);
ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard);
});
// ImGuiKeyModFlags
DEFINE_ENUM(ImGui, KeyModFlags_None, "");
DEFINE_ENUM(ImGui, KeyModFlags_Ctrl, "");
DEFINE_ENUM(ImGui, KeyModFlags_Shift, "");
DEFINE_ENUM(ImGui, KeyModFlags_Alt, "");
DEFINE_ENUM(ImGui, KeyModFlags_Super, "");
// ImGuiModFlags
DEFINE_ENUM(ImGui, ModFlags_None, "");
DEFINE_ENUM(ImGui, ModFlags_Ctrl, "");
DEFINE_ENUM(ImGui, ModFlags_Shift, "");
DEFINE_ENUM(ImGui, ModFlags_Alt, "Menu");
DEFINE_ENUM(ImGui, ModFlags_Super, "Cmd/Super/Windows key");
// ImGuiMouseButton
DEFINE_ENUM(ImGui, MouseButton_Left, "");
Expand Down
1 change: 1 addition & 0 deletions api/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,6 @@ DEFINE_ENUM(ImGui, HoveredFlags_AllowWhenBlockedByPopup, "Return true even
DEFINE_ENUM(ImGui, HoveredFlags_AllowWhenBlockedByActiveItem, "Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.");
DEFINE_ENUM(ImGui, HoveredFlags_AllowWhenOverlapped, "ImGui_IsItemHovered only: Return true even if the position is obstructed or overlapped by another window.");
DEFINE_ENUM(ImGui, HoveredFlags_AllowWhenDisabled, "ImGui_IsItemHovered only: Return true even if the item is disabled.");
DEFINE_ENUM(ImGui, HoveredFlags_NoNavOverride, "Disable using gamepad/keyboard navigation state when active, always query mouse.");
DEFINE_ENUM(ImGui, HoveredFlags_RectOnly, "ImGui_HoveredFlags_AllowWhenBlockedByPopup | ImGui_HoveredFlags_AllowWhenBlockedByActiveItem | ImGui_HoveredFlags_AllowWhenOverlapped");
DEFINE_ENUM(ImGui, HoveredFlags_RootAndChildWindows, "ImGui_HoveredFlags_RootWindow | ImGui_HoveredFlags_ChildWindows");
2 changes: 0 additions & 2 deletions api/listclipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ ListClipper::~ListClipper()
{
// do ~ImGuiListClipper's work to allow out-of-order destruction

m_imlc.ItemsCount = -1;

if(m_imlc.TempData && Resource::exists(m_ctx)) {
ImGuiContext *ctx { m_ctx->imgui() };
--ctx->ClipperTempDataStacked;
Expand Down
6 changes: 3 additions & 3 deletions api/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ DEFINE_ENUM(ImGui, Col_HeaderActive, "");
DEFINE_ENUM(ImGui, Col_Separator, "");
DEFINE_ENUM(ImGui, Col_SeparatorHovered, "");
DEFINE_ENUM(ImGui, Col_SeparatorActive, "");
DEFINE_ENUM(ImGui, Col_ResizeGrip, "");
DEFINE_ENUM(ImGui, Col_ResizeGrip, "Resize grip in lower-right and lower-left corners of windows.");
DEFINE_ENUM(ImGui, Col_ResizeGripHovered, "");
DEFINE_ENUM(ImGui, Col_ResizeGripActive, "");
DEFINE_ENUM(ImGui, Col_Tab, "");
DEFINE_ENUM(ImGui, Col_Tab, "TabItem in a TabBar");
DEFINE_ENUM(ImGui, Col_TabHovered, "");
DEFINE_ENUM(ImGui, Col_TabActive, "");
DEFINE_ENUM(ImGui, Col_TabUnfocused, "");
Expand All @@ -250,7 +250,7 @@ DEFINE_ENUM(ImGui, Col_TableBorderLight, "Table inner borders (prefer using
DEFINE_ENUM(ImGui, Col_TableRowBg, "Table row background (even rows).");
DEFINE_ENUM(ImGui, Col_TableRowBgAlt, "Table row background (odd rows).");
DEFINE_ENUM(ImGui, Col_TextSelectedBg, "");
DEFINE_ENUM(ImGui, Col_DragDropTarget, "");
DEFINE_ENUM(ImGui, Col_DragDropTarget, "Rectangle highlighting a drop target");
DEFINE_ENUM(ImGui, Col_NavHighlight, "Gamepad/keyboard: current highlighted item.");
DEFINE_ENUM(ImGui, Col_NavWindowingHighlight, "Highlight window when using CTRL+TAB.");
DEFINE_ENUM(ImGui, Col_NavWindowingDimBg, "Darken/colorize entire screen behind the CTRL+TAB window list, when active.");
Expand Down
8 changes: 8 additions & 0 deletions api/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,11 @@ DEFINE_API(void, CalcTextSize, (ImGui_Context*,ctx)
if(API_W(w)) *API_W(w) = size.x;
if(API_W(h)) *API_W(h) = size.y;
});

DEFINE_API(void, DebugTextEncoding, (ImGui_Context*,ctx)
(const char*,text),
"Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct.",
{
FRAME_GUARD;
ImGui::DebugTextEncoding(text);
});
3 changes: 3 additions & 0 deletions api/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@

DEFINE_API(void, GetVersion,
(char*,API_W(imgui_version))(int,API_W_SZ(imgui_version))
(int*,API_W(imgui_version_num))
(char*,API_W(reaimgui_version))(int,API_W_SZ(reaimgui_version)),
"",
{
if(API_W(imgui_version))
snprintf(API_W(imgui_version), API_W_SZ(imgui_version), "%s", IMGUI_VERSION);
if(API_W(imgui_version_num))
*API_W(imgui_version_num) = IMGUI_VERSION_NUM;
if(API_W(reaimgui_version))
snprintf(API_W(reaimgui_version), API_W_SZ(reaimgui_version), "%s", REAIMGUI_VERSION);
});
Expand Down
17 changes: 17 additions & 0 deletions api/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,23 @@ Default values: p_open = nil)",
ImGui::ShowMetricsWindow();
});

DEFINE_API(void, ShowDebugLogWindow, (ImGui_Context*,ctx)
(bool*,API_RWO(p_open)),
R"(Create Debug Log window. display a simplified log of important dear imgui events.

Default values: p_open = nil)",
{
FRAME_GUARD;

ImGuiWindowFlags flags {};
DecorationBehavior dec { ctx, &flags };
ImGui::Begin("Dear ImGui Debug Log", openPtrBehavior(API_RWO(p_open)), flags);
ImGui::GetCurrentWindow()->BeginCount = 0;
ImGui::End();

ImGui::ShowDebugLogWindow();
});

DEFINE_API(void, ShowStackToolWindow, (ImGui_Context*,ctx)
(bool*,API_RWO(p_open)),
R"(Create Stack Tool window. Hover items with mouse to query information about the source of their unique ID.
Expand Down
Loading

0 comments on commit 457f76f

Please sign in to comment.