mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 09:30:56 +01:00
Merge branch 'ocornut:master' into master
This commit is contained in:
commit
d4b9ce1678
@ -65,11 +65,18 @@ Other changes:
|
|||||||
- Nav: pressing any keyboard key while holding Alt disable toggling nav layer on Alt release. (#4439)
|
- Nav: pressing any keyboard key while holding Alt disable toggling nav layer on Alt release. (#4439)
|
||||||
- MultiSelect+Tables: fixed an issue where box-select would skip items while drag-scrolling
|
- MultiSelect+Tables: fixed an issue where box-select would skip items while drag-scrolling
|
||||||
in a table with outer borders. (#7970, #7821).
|
in a table with outer borders. (#7970, #7821).
|
||||||
|
- Inputs: SetNextItemShortcut() with ImGuiInputFlags_Tooltip doesn't show tooltip when item is active.
|
||||||
- InputText: internal refactoring to simplify and optimize the code. The ImWchar buffer has been
|
- InputText: internal refactoring to simplify and optimize the code. The ImWchar buffer has been
|
||||||
removed. Simplifications allowed to implement new optimizations for handling very large text buffers
|
removed. Simplifications allowed to implement new optimizations for handling very large text buffers
|
||||||
(e.g. in our testing, handling of a 1 MB text buffer is now 3 times faster in VS2022 Debug build).
|
(e.g. in our testing, handling of a 1 MB text buffer is now 3 times faster in VS2022 Debug build).
|
||||||
This is the first step toward more refactoring. (#7925) [@alektron, @ocornut]
|
This is the first step toward more refactoring. (#7925) [@alektron, @ocornut]
|
||||||
- InputText: added CJK double-width punctuation to list of separators considered for CTRL+Arrow.
|
- InputText: added CJK double-width punctuation to list of separators considered for CTRL+Arrow.
|
||||||
|
- Tables: fixed auto-width columns when using synced-instances of same table. The previous fix
|
||||||
|
done in v1.90.5 was incomplete. (#7218)
|
||||||
|
- Tables: fixed assertion related to inconsistent outer clipping when sizes are not rounded. (#7957) [@eclbtownsend]
|
||||||
|
- Tables: fixed assertion with tables with borders when clipped by parent. (#6765, #3752, #7428)
|
||||||
|
- Windows: fixed an issue where double-click to collapse could be triggered even while another
|
||||||
|
item is active, if the item didn't use the left mouse button. (#7841)
|
||||||
- Misc: Made it accepted to call SetMouseCursor() with any out-of-bound value, as a way to allow
|
- Misc: Made it accepted to call SetMouseCursor() with any out-of-bound value, as a way to allow
|
||||||
hacking in custom cursors if desirable.
|
hacking in custom cursors if desirable.
|
||||||
- Fonts: fixed ellipsis "..." rendering width miscalculation bug introduced in 1.91.0. (#7976) [@DDeimos]
|
- Fonts: fixed ellipsis "..." rendering width miscalculation bug introduced in 1.91.0. (#7976) [@DDeimos]
|
||||||
|
@ -4343,7 +4343,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
|
|||||||
|
|
||||||
// Display shortcut (only works with mouse)
|
// Display shortcut (only works with mouse)
|
||||||
// (ImGuiItemStatusFlags_HasShortcut in LastItemData denotes we want a tooltip)
|
// (ImGuiItemStatusFlags_HasShortcut in LastItemData denotes we want a tooltip)
|
||||||
if (id == g.LastItemData.ID && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasShortcut))
|
if (id == g.LastItemData.ID && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasShortcut) && g.ActiveId != id)
|
||||||
if (IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_DelayNormal))
|
if (IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_DelayNormal))
|
||||||
SetTooltip("%s", GetKeyChordName(g.LastItemData.Shortcut));
|
SetTooltip("%s", GetKeyChordName(g.LastItemData.Shortcut));
|
||||||
}
|
}
|
||||||
@ -6948,9 +6948,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing
|
// At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing
|
||||||
if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse))
|
if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse))
|
||||||
{
|
{
|
||||||
// We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar.
|
// We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed),
|
||||||
|
// so verify that we don't have items over the title bar.
|
||||||
ImRect title_bar_rect = window->TitleBarRect();
|
ImRect title_bar_rect = window->TitleBarRect();
|
||||||
if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max))
|
if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && g.ActiveId == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max))
|
||||||
if (g.IO.MouseClickedCount[0] == 2 && GetKeyOwner(ImGuiKey_MouseLeft) == ImGuiKeyOwner_NoOwner)
|
if (g.IO.MouseClickedCount[0] == 2 && GetKeyOwner(ImGuiKey_MouseLeft) == ImGuiKeyOwner_NoOwner)
|
||||||
window->WantCollapseToggle = true;
|
window->WantCollapseToggle = true;
|
||||||
if (window->WantCollapseToggle)
|
if (window->WantCollapseToggle)
|
||||||
|
2
imgui.h
2
imgui.h
@ -29,7 +29,7 @@
|
|||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||||
#define IMGUI_VERSION "1.91.2 WIP"
|
#define IMGUI_VERSION "1.91.2 WIP"
|
||||||
#define IMGUI_VERSION_NUM 19114
|
#define IMGUI_VERSION_NUM 19115
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2499,13 +2499,14 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
|
|||||||
{
|
{
|
||||||
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!");
|
IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!");
|
||||||
IM_ASSERT(font_cfg->FontData != NULL && font_cfg->FontDataSize > 0);
|
IM_ASSERT(font_cfg->FontData != NULL && font_cfg->FontDataSize > 0);
|
||||||
IM_ASSERT(font_cfg->SizePixels > 0.0f);
|
IM_ASSERT(font_cfg->SizePixels > 0.0f && "Is ImFontConfig struct correctly initialized?");
|
||||||
|
IM_ASSERT(font_cfg->OversampleH > 0 && font_cfg->OversampleV > 0 && "Is ImFontConfig struct correctly initialized?");
|
||||||
|
|
||||||
// Create new font
|
// Create new font
|
||||||
if (!font_cfg->MergeMode)
|
if (!font_cfg->MergeMode)
|
||||||
Fonts.push_back(IM_NEW(ImFont));
|
Fonts.push_back(IM_NEW(ImFont));
|
||||||
else
|
else
|
||||||
IM_ASSERT(!Fonts.empty() && "Cannot use MergeMode for the first font"); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font.
|
IM_ASSERT(Fonts.Size > 0 && "Cannot use MergeMode for the first font"); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font.
|
||||||
|
|
||||||
ConfigData.push_back(*font_cfg);
|
ConfigData.push_back(*font_cfg);
|
||||||
ImFontConfig& new_font_cfg = ConfigData.back();
|
ImFontConfig& new_font_cfg = ConfigData.back();
|
||||||
|
@ -328,7 +328,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
// - always performing the GetOrAddByKey() O(log N) query in g.Tables.Map[].
|
// - always performing the GetOrAddByKey() O(log N) query in g.Tables.Map[].
|
||||||
const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;
|
const bool use_child_window = (flags & (ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY)) != 0;
|
||||||
const ImVec2 avail_size = GetContentRegionAvail();
|
const ImVec2 avail_size = GetContentRegionAvail();
|
||||||
const ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
const ImVec2 actual_outer_size = ImTrunc(CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f));
|
||||||
const ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
const ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
||||||
const bool outer_window_is_measuring_size = (outer_window->AutoFitFramesX > 0) || (outer_window->AutoFitFramesY > 0); // Doesn't apply to AlwaysAutoResize windows!
|
const bool outer_window_is_measuring_size = (outer_window->AutoFitFramesX > 0) || (outer_window->AutoFitFramesY > 0); // Doesn't apply to AlwaysAutoResize windows!
|
||||||
if (use_child_window && IsClippedEx(outer_rect, 0) && !outer_window_is_measuring_size)
|
if (use_child_window && IsClippedEx(outer_rect, 0) && !outer_window_is_measuring_size)
|
||||||
@ -866,7 +866,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
|
|
||||||
// Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping)
|
// Calculate ideal/auto column width (that's the width required for all contents to be visible without clipping)
|
||||||
// Combine width from regular rows + width from headers unless requested not to.
|
// Combine width from regular rows + width from headers unless requested not to.
|
||||||
if (!column->IsPreserveWidthAuto)
|
if (!column->IsPreserveWidthAuto && table->InstanceCurrent == 0)
|
||||||
column->WidthAuto = TableGetColumnWidthAuto(table, column);
|
column->WidthAuto = TableGetColumnWidthAuto(table, column);
|
||||||
|
|
||||||
// Non-resizable columns keep their requested width (apply user value regardless of IsPreserveWidthAuto)
|
// Non-resizable columns keep their requested width (apply user value regardless of IsPreserveWidthAuto)
|
||||||
@ -1261,7 +1261,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table)
|
|||||||
if (table->Flags & ImGuiTableFlags_NoClip)
|
if (table->Flags & ImGuiTableFlags_NoClip)
|
||||||
table->DrawSplitter->SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
table->DrawSplitter->SetCurrentChannel(inner_window->DrawList, TABLE_DRAW_CHANNEL_NOCLIP);
|
||||||
else
|
else
|
||||||
inner_window->DrawList->PushClipRect(inner_window->InnerClipRect.Min, inner_window->InnerClipRect.Max, false);
|
inner_window->DrawList->PushClipRect(inner_window->InnerClipRect.Min, inner_window->InnerClipRect.Max, false); // FIXME: use table->InnerClipRect?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process hit-testing on resizing borders. Actual size change will be applied in EndTable()
|
// Process hit-testing on resizing borders. Actual size change will be applied in EndTable()
|
||||||
@ -2011,7 +2011,7 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||||||
{
|
{
|
||||||
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
for (int column_n = 0; column_n < table->ColumnsCount; column_n++)
|
||||||
table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main;
|
table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main;
|
||||||
const float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y);
|
const float y0 = ImMax(table->RowPosY2 + 1, table->InnerClipRect.Min.y);
|
||||||
table_instance->LastFrozenHeight = y0 - table->OuterRect.Min.y;
|
table_instance->LastFrozenHeight = y0 - table->OuterRect.Min.y;
|
||||||
|
|
||||||
if (unfreeze_rows_actual)
|
if (unfreeze_rows_actual)
|
||||||
@ -2020,8 +2020,8 @@ void ImGui::TableEndRow(ImGuiTable* table)
|
|||||||
table->IsUnfrozenRows = true;
|
table->IsUnfrozenRows = true;
|
||||||
|
|
||||||
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
|
// BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect
|
||||||
table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y);
|
table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, table->InnerClipRect.Max.y);
|
||||||
table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y;
|
table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = table->InnerClipRect.Max.y;
|
||||||
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
|
table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen;
|
||||||
IM_ASSERT(table->Bg2ClipRectForDrawCmd.Min.y <= table->Bg2ClipRectForDrawCmd.Max.y);
|
IM_ASSERT(table->Bg2ClipRectForDrawCmd.Min.y <= table->Bg2ClipRectForDrawCmd.Max.y);
|
||||||
|
|
||||||
|
@ -4977,7 +4977,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
const int utf8_cursor_pos = callback_data.CursorPos = state->Stb->cursor;
|
const int utf8_cursor_pos = callback_data.CursorPos = state->Stb->cursor;
|
||||||
const int utf8_selection_start = callback_data.SelectionStart = state->Stb->select_start;
|
const int utf8_selection_start = callback_data.SelectionStart = state->Stb->select_start;
|
||||||
const int utf8_selection_end = state->Stb->select_end;
|
const int utf8_selection_end = callback_data.SelectionEnd = state->Stb->select_end;
|
||||||
|
|
||||||
// Call user code
|
// Call user code
|
||||||
callback(&callback_data);
|
callback(&callback_data);
|
||||||
|
Loading…
Reference in New Issue
Block a user