|
@@ -148,6 +148,7 @@
|
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
|
|
|
|
+ - 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you.
|
|
|
- 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis.
|
|
- 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis.
|
|
|
- 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.
|
|
- 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.
|
|
|
- 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.
|
|
- 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.
|
|
@@ -508,6 +509,7 @@
|
|
|
- keyboard: full keyboard navigation and focus.
|
|
- keyboard: full keyboard navigation and focus.
|
|
|
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
|
|
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
|
|
|
- input: rework IO system to be able to pass actual ordered/timestamped events.
|
|
- input: rework IO system to be able to pass actual ordered/timestamped events.
|
|
|
|
|
+ - input: allow to decide and pass explicit double-clicks (e.g. for windows by the CS_DBLCLKS style).
|
|
|
- input: support track pad style scrolling & slider edit.
|
|
- input: support track pad style scrolling & slider edit.
|
|
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
|
|
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
|
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
|
@@ -610,7 +612,7 @@ static void ClosePopupToLevel(int remaining);
|
|
|
static void ClosePopup(ImGuiID id);
|
|
static void ClosePopup(ImGuiID id);
|
|
|
static bool IsPopupOpen(ImGuiID id);
|
|
static bool IsPopupOpen(ImGuiID id);
|
|
|
static ImGuiWindow* GetFrontMostModalRootWindow();
|
|
static ImGuiWindow* GetFrontMostModalRootWindow();
|
|
|
-static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiWindowFlags flags, int* last_dir, const ImRect& r_inner);
|
|
|
|
|
|
|
+static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& rect_to_avoid);
|
|
|
|
|
|
|
|
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
|
|
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
|
|
|
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
|
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
|
@@ -1534,6 +1536,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
|
|
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
|
|
ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);
|
|
|
ScrollbarX = ScrollbarY = false;
|
|
ScrollbarX = ScrollbarY = false;
|
|
|
ScrollbarSizes = ImVec2(0.0f, 0.0f);
|
|
ScrollbarSizes = ImVec2(0.0f, 0.0f);
|
|
|
|
|
+ BorderSize = 0.0f;
|
|
|
Active = WasActive = false;
|
|
Active = WasActive = false;
|
|
|
Accessed = false;
|
|
Accessed = false;
|
|
|
Collapsed = false;
|
|
Collapsed = false;
|
|
@@ -3413,7 +3416,7 @@ static void CheckStacksSize(ImGuiWindow* window, bool write)
|
|
|
IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
|
IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiWindowFlags flags, int* last_dir, const ImRect& r_inner)
|
|
|
|
|
|
|
+static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& r_inner)
|
|
|
{
|
|
{
|
|
|
const ImGuiStyle& style = GImGui->Style;
|
|
const ImGuiStyle& style = GImGui->Style;
|
|
|
|
|
|
|
@@ -3423,7 +3426,7 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size,
|
|
|
r_outer.Reduce(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x*2) ? safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y*2) ? safe_padding.y : 0.0f));
|
|
r_outer.Reduce(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x*2) ? safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y*2) ? safe_padding.y : 0.0f));
|
|
|
ImVec2 base_pos_clamped = ImClamp(base_pos, r_outer.Min, r_outer.Max - size);
|
|
ImVec2 base_pos_clamped = ImClamp(base_pos, r_outer.Min, r_outer.Max - size);
|
|
|
|
|
|
|
|
- for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Right, down, up, left. Favor last used direction.
|
|
|
|
|
|
|
+ for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Last, Right, down, up, left. (Favor last used direction).
|
|
|
{
|
|
{
|
|
|
const int dir = (n == -1) ? *last_dir : n;
|
|
const int dir = (n == -1) ? *last_dir : n;
|
|
|
ImRect rect(dir == 0 ? r_inner.Max.x : r_outer.Min.x, dir == 1 ? r_inner.Max.y : r_outer.Min.y, dir == 3 ? r_inner.Min.x : r_outer.Max.x, dir == 2 ? r_inner.Min.y : r_outer.Max.y);
|
|
ImRect rect(dir == 0 ? r_inner.Max.x : r_outer.Min.x, dir == 1 ? r_inner.Max.y : r_outer.Min.y, dir == 3 ? r_inner.Min.x : r_outer.Max.x, dir == 2 ? r_inner.Min.y : r_outer.Max.y);
|
|
@@ -3433,12 +3436,8 @@ static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size,
|
|
|
return ImVec2(dir == 0 ? r_inner.Max.x : dir == 3 ? r_inner.Min.x - size.x : base_pos_clamped.x, dir == 1 ? r_inner.Max.y : dir == 2 ? r_inner.Min.y - size.y : base_pos_clamped.y);
|
|
return ImVec2(dir == 0 ? r_inner.Max.x : dir == 3 ? r_inner.Min.x - size.x : base_pos_clamped.x, dir == 1 ? r_inner.Max.y : dir == 2 ? r_inner.Min.y - size.y : base_pos_clamped.y);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Fallback
|
|
|
|
|
|
|
+ // Fallback, try to keep within display
|
|
|
*last_dir = -1;
|
|
*last_dir = -1;
|
|
|
- if (flags & ImGuiWindowFlags_Tooltip) // For tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
|
|
|
|
|
- return base_pos + ImVec2(2,2);
|
|
|
|
|
-
|
|
|
|
|
- // Otherwise try to keep within display
|
|
|
|
|
ImVec2 pos = base_pos;
|
|
ImVec2 pos = base_pos;
|
|
|
pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x);
|
|
pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x);
|
|
|
pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y);
|
|
pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y);
|
|
@@ -3802,19 +3801,21 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight());
|
|
rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight());
|
|
|
else
|
|
else
|
|
|
rect_to_avoid = ImRect(parent_window->Pos.x + style.ItemSpacing.x, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - style.ItemSpacing.x - parent_window->ScrollbarSizes.x, FLT_MAX); // We want some overlap to convey the relative depth of each popup (here hard-coded to 4)
|
|
rect_to_avoid = ImRect(parent_window->Pos.x + style.ItemSpacing.x, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - style.ItemSpacing.x - parent_window->ScrollbarSizes.x, FLT_MAX); // We want some overlap to convey the relative depth of each popup (here hard-coded to 4)
|
|
|
- window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
|
|
|
|
+ window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
}
|
|
}
|
|
|
else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_appearing_after_being_hidden)
|
|
else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_appearing_after_being_hidden)
|
|
|
{
|
|
{
|
|
|
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
|
|
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
|
|
|
- window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
|
|
|
|
+ window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Position tooltip (always follows mouse)
|
|
// Position tooltip (always follows mouse)
|
|
|
if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api)
|
|
if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api)
|
|
|
{
|
|
{
|
|
|
ImRect rect_to_avoid(g.IO.MousePos.x - 16, g.IO.MousePos.y - 8, g.IO.MousePos.x + 24, g.IO.MousePos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead?
|
|
ImRect rect_to_avoid(g.IO.MousePos.x - 16, g.IO.MousePos.y - 8, g.IO.MousePos.x + 24, g.IO.MousePos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead?
|
|
|
- window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, flags, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
|
|
|
|
+ window->PosFloat = FindBestPopupWindowPos(g.IO.MousePos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
|
|
|
|
+ if (window->AutoPosLastDirection == -1)
|
|
|
|
|
+ window->PosFloat = g.IO.MousePos + ImVec2(2,2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// User moving window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
|
|
// User moving window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
|
|
@@ -3931,6 +3932,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
window->ScrollbarY = (flags & ImGuiWindowFlags_ForceVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
window->ScrollbarY = (flags & ImGuiWindowFlags_ForceVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
|
window->ScrollbarX = (flags & ImGuiWindowFlags_ForceHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
window->ScrollbarX = (flags & ImGuiWindowFlags_ForceHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
|
|
|
+ window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
|
|
|
// Window background
|
|
// Window background
|
|
|
if (bg_alpha > 0.0f)
|
|
if (bg_alpha > 0.0f)
|
|
@@ -3970,11 +3972,10 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
// (after the input handling so we don't have a frame of latency)
|
|
// (after the input handling so we don't have a frame of latency)
|
|
|
if (!(flags & ImGuiWindowFlags_NoResize))
|
|
if (!(flags & ImGuiWindowFlags_NoResize))
|
|
|
{
|
|
{
|
|
|
- const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
const ImVec2 br = window->Rect().GetBR();
|
|
const ImVec2 br = window->Rect().GetBR();
|
|
|
- window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -border_size));
|
|
|
|
|
- window->DrawList->PathLineTo(br + ImVec2(-border_size, -resize_corner_size));
|
|
|
|
|
- window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - border_size, br.y - window_rounding - border_size), window_rounding, 0, 3);
|
|
|
|
|
|
|
+ window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -window->BorderSize));
|
|
|
|
|
+ window->DrawList->PathLineTo(br + ImVec2(-window->BorderSize, -resize_corner_size));
|
|
|
|
|
+ window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - window->BorderSize, br.y - window_rounding - window->BorderSize), window_rounding, 0, 3);
|
|
|
window->DrawList->PathFill(resize_col);
|
|
window->DrawList->PathFill(resize_col);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4064,7 +4065,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
|
// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame
|
|
|
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
|
|
// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.
|
|
|
const ImRect title_bar_rect = window->TitleBarRect();
|
|
const ImRect title_bar_rect = window->TitleBarRect();
|
|
|
- const float border_size = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
|
|
+ const float border_size = window->BorderSize;
|
|
|
ImRect clip_rect;
|
|
ImRect clip_rect;
|
|
|
clip_rect.Min.x = title_bar_rect.Min.x + 0.5f + ImMax(border_size, window->WindowPadding.x*0.5f);
|
|
clip_rect.Min.x = title_bar_rect.Min.x + 0.5f + ImMax(border_size, window->WindowPadding.x*0.5f);
|
|
|
clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size;
|
|
clip_rect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + 0.5f + border_size;
|
|
@@ -4137,7 +4138,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|
|
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
|
|
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
|
|
|
float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
|
|
float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;
|
|
|
const ImRect window_rect = window->Rect();
|
|
const ImRect window_rect = window->Rect();
|
|
|
- const float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
|
|
+ const float border_size = window->BorderSize;
|
|
|
ImRect bb = horizontal
|
|
ImRect bb = horizontal
|
|
|
? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size)
|
|
? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size)
|
|
|
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size);
|
|
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size);
|
|
@@ -4270,8 +4271,8 @@ static void PushMultiItemsWidths(int components, float w_full)
|
|
|
const ImGuiStyle& style = GImGui->Style;
|
|
const ImGuiStyle& style = GImGui->Style;
|
|
|
if (w_full <= 0.0f)
|
|
if (w_full <= 0.0f)
|
|
|
w_full = ImGui::CalcItemWidth();
|
|
w_full = ImGui::CalcItemWidth();
|
|
|
- const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components));
|
|
|
|
|
- const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)));
|
|
|
|
|
|
|
+ const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.ItemInnerSpacing.x) * (components-1)) / (float)components));
|
|
|
|
|
+ const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components-1)));
|
|
|
window->DC.ItemWidthStack.push_back(w_item_last);
|
|
window->DC.ItemWidthStack.push_back(w_item_last);
|
|
|
for (int i = 0; i < components-1; i++)
|
|
for (int i = 0; i < components-1; i++)
|
|
|
window->DC.ItemWidthStack.push_back(w_item_one);
|
|
window->DC.ItemWidthStack.push_back(w_item_one);
|
|
@@ -4292,9 +4293,8 @@ float ImGui::CalcItemWidth()
|
|
|
if (w < 0.0f)
|
|
if (w < 0.0f)
|
|
|
{
|
|
{
|
|
|
// Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well.
|
|
// Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well.
|
|
|
- ImGuiState& g = *GImGui;
|
|
|
|
|
float width_to_right_edge = ImGui::GetContentRegionAvail().x;
|
|
float width_to_right_edge = ImGui::GetContentRegionAvail().x;
|
|
|
- w = ImMax(1.0f, width_to_right_edge + w - g.Style.FramePadding.x * 2.0f);
|
|
|
|
|
|
|
+ w = ImMax(1.0f, width_to_right_edge + w);
|
|
|
}
|
|
}
|
|
|
w = (float)(int)w;
|
|
w = (float)(int)w;
|
|
|
return w;
|
|
return w;
|
|
@@ -5155,8 +5155,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args)
|
|
|
const float w = CalcItemWidth();
|
|
const float w = CalcItemWidth();
|
|
|
|
|
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
- const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2, label_size.y + style.FramePadding.y*2));
|
|
|
|
|
- const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + style.FramePadding.x*2 + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size);
|
|
|
|
|
|
|
+ const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2));
|
|
|
|
|
+ const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size);
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
if (!ItemAdd(total_bb, NULL))
|
|
if (!ItemAdd(total_bb, NULL))
|
|
|
return;
|
|
return;
|
|
@@ -5264,7 +5264,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
const ImGuiStyle& style = g.Style;
|
|
const ImGuiStyle& style = g.Style;
|
|
|
const ImGuiID id = window->GetID(label);
|
|
const ImGuiID id = window->GetID(label);
|
|
|
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
|
if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset)
|
|
if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset)
|
|
@@ -5354,7 +5354,7 @@ static bool CloseWindowButton(bool* p_opened)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (p_opened != NULL && pressed)
|
|
if (p_opened != NULL && pressed)
|
|
|
- *p_opened = !*p_opened;
|
|
|
|
|
|
|
+ *p_opened = false;
|
|
|
|
|
|
|
|
return pressed;
|
|
return pressed;
|
|
|
}
|
|
}
|
|
@@ -5957,7 +5957,7 @@ bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label
|
|
|
|
|
|
|
|
char buf[32];
|
|
char buf[32];
|
|
|
DataTypeFormatString(data_type, data_ptr, decimal_precision, buf, IM_ARRAYSIZE(buf));
|
|
DataTypeFormatString(data_type, data_ptr, decimal_precision, buf, IM_ARRAYSIZE(buf));
|
|
|
- bool value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize() - g.Style.FramePadding*2.0f, ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);
|
|
|
|
|
|
|
+ bool value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);
|
|
|
if (g.ScalarAsInputTextId == 0)
|
|
if (g.ScalarAsInputTextId == 0)
|
|
|
{
|
|
{
|
|
|
// First frame
|
|
// First frame
|
|
@@ -6158,7 +6158,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
|
|
const float w = CalcItemWidth();
|
|
const float w = CalcItemWidth();
|
|
|
|
|
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
|
|
|
|
|
|
|
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
|
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
|
|
|
|
|
|
// NB- we don't call ItemSize() yet because we may turn into a text edit box below
|
|
// NB- we don't call ItemSize() yet because we may turn into a text edit box below
|
|
@@ -6249,7 +6249,6 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
|
|
|
char value_buf[64];
|
|
char value_buf[64];
|
|
|
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
|
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
|
|
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center);
|
|
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImGuiAlign_Center);
|
|
|
-
|
|
|
|
|
if (label_size.x > 0.0f)
|
|
if (label_size.x > 0.0f)
|
|
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
|
|
|
|
|
|
@@ -6456,7 +6455,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
|
|
|
const float w = CalcItemWidth();
|
|
const float w = CalcItemWidth();
|
|
|
|
|
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
|
|
|
|
|
|
|
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
|
|
|
const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
|
|
const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);
|
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
|
|
|
|
|
@@ -6663,7 +6662,7 @@ void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_ge
|
|
|
|
|
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
if (graph_size.x == 0.0f)
|
|
if (graph_size.x == 0.0f)
|
|
|
- graph_size.x = CalcItemWidth() + (style.FramePadding.x * 2);
|
|
|
|
|
|
|
+ graph_size.x = CalcItemWidth();
|
|
|
if (graph_size.y == 0.0f)
|
|
if (graph_size.y == 0.0f)
|
|
|
graph_size.y = label_size.y + (style.FramePadding.y * 2);
|
|
graph_size.y = label_size.y + (style.FramePadding.y * 2);
|
|
|
|
|
|
|
@@ -6804,15 +6803,16 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over
|
|
|
const ImGuiStyle& style = g.Style;
|
|
const ImGuiStyle& style = g.Style;
|
|
|
|
|
|
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
|
- const ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x*2.0f, g.FontSize + style.FramePadding.y*2.0f));
|
|
|
|
|
|
|
+ ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y*2.0f));
|
|
|
ItemSize(bb, style.FramePadding.y);
|
|
ItemSize(bb, style.FramePadding.y);
|
|
|
if (!ItemAdd(bb, NULL))
|
|
if (!ItemAdd(bb, NULL))
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
// Render
|
|
// Render
|
|
|
fraction = ImSaturate(fraction);
|
|
fraction = ImSaturate(fraction);
|
|
|
- const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
|
|
|
|
|
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
|
|
|
+ bb.Reduce(ImVec2(window->BorderSize, window->BorderSize));
|
|
|
|
|
+ const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);
|
|
|
RenderFrame(bb.Min, fill_br, GetColorU32(ImGuiCol_PlotHistogram), false, style.FrameRounding);
|
|
RenderFrame(bb.Min, fill_br, GetColorU32(ImGuiCol_PlotHistogram), false, style.FrameRounding);
|
|
|
|
|
|
|
|
// Default displaying the fraction as percentage string, but user can override it
|
|
// Default displaying the fraction as percentage string, but user can override it
|
|
@@ -7215,9 +7215,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0;
|
|
const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0;
|
|
|
const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;
|
|
const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;
|
|
|
|
|
|
|
|
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
|
|
|
- ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), is_multiline ? ImGui::GetTextLineHeight() * 8.0f : label_size.y); // Arbitrary default of 8 lines high for multi-line
|
|
|
|
|
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size + style.FramePadding*2.0f);
|
|
|
|
|
|
|
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
+ ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? ImGui::GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line
|
|
|
|
|
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);
|
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f));
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f));
|
|
|
|
|
|
|
|
ImGuiWindow* draw_window = window;
|
|
ImGuiWindow* draw_window = window;
|
|
@@ -7768,15 +7768,13 @@ bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data
|
|
|
|
|
|
|
|
ImGuiState& g = *GImGui;
|
|
ImGuiState& g = *GImGui;
|
|
|
const ImGuiStyle& style = g.Style;
|
|
const ImGuiStyle& style = g.Style;
|
|
|
- const float w = CalcItemWidth();
|
|
|
|
|
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
|
|
|
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
|
|
|
|
|
|
|
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
|
ImGui::BeginGroup();
|
|
|
ImGui::PushID(label);
|
|
ImGui::PushID(label);
|
|
|
- const ImVec2 button_sz = ImVec2(g.FontSize, g.FontSize) + style.FramePadding * 2;
|
|
|
|
|
|
|
+ const ImVec2 button_sz = ImVec2(g.FontSize, g.FontSize) + style.FramePadding*2.0f;
|
|
|
if (step_ptr)
|
|
if (step_ptr)
|
|
|
- ImGui::PushItemWidth(ImMax(1.0f, w - (button_sz.x + style.ItemInnerSpacing.x)*2));
|
|
|
|
|
|
|
+ ImGui::PushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_sz.x + style.ItemInnerSpacing.x)*2));
|
|
|
|
|
|
|
|
char buf[64];
|
|
char buf[64];
|
|
|
DataTypeFormatString(data_type, data_ptr, scalar_format, buf, IM_ARRAYSIZE(buf));
|
|
DataTypeFormatString(data_type, data_ptr, scalar_format, buf, IM_ARRAYSIZE(buf));
|
|
@@ -7986,7 +7984,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|
|
const float w = CalcItemWidth();
|
|
const float w = CalcItemWidth();
|
|
|
|
|
|
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
- const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y) + style.FramePadding*2.0f);
|
|
|
|
|
|
|
+ const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f));
|
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
ItemSize(total_bb, style.FramePadding.y);
|
|
|
if (!ItemAdd(total_bb, &id))
|
|
if (!ItemAdd(total_bb, &id))
|
|
@@ -8088,7 +8086,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|
|
PopClipRect();
|
|
PopClipRect();
|
|
|
|
|
|
|
|
ImGuiID id = window->GetID(label);
|
|
ImGuiID id = window->GetID(label);
|
|
|
- ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
+ ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);
|
|
ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);
|
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
ImVec2 pos = window->DC.CursorPos;
|
|
|
pos.y += window->DC.CurrentLineTextBaseOffset;
|
|
pos.y += window->DC.CurrentLineTextBaseOffset;
|
|
@@ -8172,10 +8170,10 @@ bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)
|
|
|
|
|
|
|
|
const ImGuiStyle& style = ImGui::GetStyle();
|
|
const ImGuiStyle& style = ImGui::GetStyle();
|
|
|
const ImGuiID id = ImGui::GetID(label);
|
|
const ImGuiID id = ImGui::GetID(label);
|
|
|
- const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
+ const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
|
|
|
|
|
|
|
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
|
|
// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
|
|
|
- ImVec2 size = CalcItemSize(size_arg, CalcItemWidth() + style.FramePadding.x * 2.0f, ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y);
|
|
|
|
|
|
|
+ ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y);
|
|
|
ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));
|
|
ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));
|
|
|
ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
|
|
ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);
|
|
|
ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
|
|
@@ -8330,8 +8328,7 @@ bool ImGui::BeginMenuBar()
|
|
|
ImGui::BeginGroup(); // Save position
|
|
ImGui::BeginGroup(); // Save position
|
|
|
ImGui::PushID("##menubar");
|
|
ImGui::PushID("##menubar");
|
|
|
ImRect rect = window->MenuBarRect();
|
|
ImRect rect = window->MenuBarRect();
|
|
|
- float border_size = (window->Flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
- PushClipRect(ImVec2(rect.Min.x+0.5f, rect.Min.y-0.5f+border_size), ImVec2(rect.Max.x+0.5f, rect.Max.y-0.5f), false);
|
|
|
|
|
|
|
+ PushClipRect(ImVec2(rect.Min.x+0.5f, rect.Min.y-0.5f+window->BorderSize), ImVec2(rect.Max.x+0.5f, rect.Max.y-0.5f), false);
|
|
|
window->DC.CursorPos = ImVec2(rect.Min.x + window->DC.MenuBarOffsetX, rect.Min.y);// + g.Style.FramePadding.y);
|
|
window->DC.CursorPos = ImVec2(rect.Min.x + window->DC.MenuBarOffsetX, rect.Min.y);// + g.Style.FramePadding.y);
|
|
|
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
|
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
|
|
window->DC.MenuBarAppending = true;
|
|
window->DC.MenuBarAppending = true;
|
|
@@ -8524,7 +8521,6 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
|
|
edit_mode = g.ColorEditModeStorage.GetInt(id, 0) % 3;
|
|
edit_mode = g.ColorEditModeStorage.GetInt(id, 0) % 3;
|
|
|
|
|
|
|
|
float f[4] = { col[0], col[1], col[2], col[3] };
|
|
float f[4] = { col[0], col[1], col[2], col[3] };
|
|
|
-
|
|
|
|
|
if (edit_mode == ImGuiColorEditMode_HSV)
|
|
if (edit_mode == ImGuiColorEditMode_HSV)
|
|
|
ImGui::ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
|
ImGui::ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
|
|
|
|
|
|
@@ -8544,8 +8540,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
|
|
{
|
|
{
|
|
|
// RGB/HSV 0..255 Sliders
|
|
// RGB/HSV 0..255 Sliders
|
|
|
const float w_items_all = w_full - (square_sz + style.ItemInnerSpacing.x);
|
|
const float w_items_all = w_full - (square_sz + style.ItemInnerSpacing.x);
|
|
|
- const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)) / (float)components));
|
|
|
|
|
- const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.FramePadding.x*2.0f + style.ItemInnerSpacing.x) * (components-1)));
|
|
|
|
|
|
|
+ const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components-1)) / (float)components));
|
|
|
|
|
+ const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.ItemInnerSpacing.x) * (components-1)));
|
|
|
|
|
|
|
|
const bool hide_prefix = (w_item_one <= CalcTextSize("M:999").x);
|
|
const bool hide_prefix = (w_item_one <= CalcTextSize("M:999").x);
|
|
|
const char* ids[4] = { "##X", "##Y", "##Z", "##W" };
|
|
const char* ids[4] = { "##X", "##Y", "##Z", "##W" };
|
|
@@ -8580,18 +8576,19 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
|
|
else
|
|
else
|
|
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", i[0], i[1], i[2]);
|
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", i[0], i[1], i[2]);
|
|
|
ImGui::PushItemWidth(w_slider_all - style.ItemInnerSpacing.x);
|
|
ImGui::PushItemWidth(w_slider_all - style.ItemInnerSpacing.x);
|
|
|
- value_changed |= ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase);
|
|
|
|
|
|
|
+ if (ImGui::InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))
|
|
|
|
|
+ {
|
|
|
|
|
+ value_changed |= true;
|
|
|
|
|
+ char* p = buf;
|
|
|
|
|
+ while (*p == '#' || ImCharIsSpace(*p))
|
|
|
|
|
+ p++;
|
|
|
|
|
+ i[0] = i[1] = i[2] = i[3] = 0;
|
|
|
|
|
+ if (alpha)
|
|
|
|
|
+ sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)
|
|
|
|
|
+ else
|
|
|
|
|
+ sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
|
|
|
|
|
+ }
|
|
|
ImGui::PopItemWidth();
|
|
ImGui::PopItemWidth();
|
|
|
- char* p = buf;
|
|
|
|
|
- while (*p == '#' || ImCharIsSpace(*p))
|
|
|
|
|
- p++;
|
|
|
|
|
-
|
|
|
|
|
- // Treat at unsigned (%X is unsigned)
|
|
|
|
|
- i[0] = i[1] = i[2] = i[3] = 0;
|
|
|
|
|
- if (alpha)
|
|
|
|
|
- sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]);
|
|
|
|
|
- else
|
|
|
|
|
- sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);
|
|
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -8612,15 +8609,15 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
|
|
const char* button_titles[3] = { "RGB", "HSV", "HEX" };
|
|
const char* button_titles[3] = { "RGB", "HSV", "HEX" };
|
|
|
if (ButtonEx(button_titles[edit_mode], ImVec2(0,0), ImGuiButtonFlags_DontClosePopups))
|
|
if (ButtonEx(button_titles[edit_mode], ImVec2(0,0), ImGuiButtonFlags_DontClosePopups))
|
|
|
g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3); // Don't set local copy of 'edit_mode' right away!
|
|
g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3); // Don't set local copy of 'edit_mode' right away!
|
|
|
- ImGui::SameLine();
|
|
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const char* label_display_end = FindTextDisplayEnd(label);
|
|
|
|
|
+ if (label != label_display_end)
|
|
|
{
|
|
{
|
|
|
- ImGui::SameLine(0, style.ItemInnerSpacing.x);
|
|
|
|
|
|
|
+ ImGui::SameLine(0, (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelectShowButton) ? -1.0f : style.ItemInnerSpacing.x);
|
|
|
|
|
+ ImGui::TextUnformatted(label, label_display_end);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ImGui::TextUnformatted(label, FindTextDisplayEnd(label));
|
|
|
|
|
-
|
|
|
|
|
// Convert back
|
|
// Convert back
|
|
|
for (int n = 0; n < 4; n++)
|
|
for (int n = 0; n < 4; n++)
|
|
|
f[n] = i[n] / 255.0f;
|
|
f[n] = i[n] / 255.0f;
|