mirror of
https://github.com/ocornut/imgui.git
synced 2026-07-10 11:29:41 +00:00
(Breaking) ColorEdit: obsoleted SetColorEditOptions() function in favor of poking to io.ConfigColorEditFlags. (Amend 0e479b9, 9f7d808)
Apologies, 9f7d808 was extremely flaky.
This commit is contained in:
@@ -44,7 +44,7 @@ Breaking Changes:
|
||||
- TreeNode: commented out legacy name `ImGuiTreeNodeFlags_SpanTextWidth` which
|
||||
was obsoleted in 1.90.7 (May 2024). Use `ImGuiTreeNodeFlags_SpanLabelWidth`.
|
||||
- ColorEdit: obsoleted SetColorEditOptions() function added in 1.51 (June 2017) in
|
||||
of directly poking to style.ColorEditFlags. More consistent and easier to discover
|
||||
of directly poking to io.ConfigColorEditFlags. More consistent and easier to discover.
|
||||
|
||||
|
||||
Other Changes:
|
||||
@@ -113,6 +113,9 @@ Other Changes:
|
||||
- Added io.MouseSingleClickDelay to configure default delayed single click delay when
|
||||
using GetItemClickedCountWithSingleClickDelay() or IsMouseReleasedWithDelay(). (#8337)
|
||||
Note that io.MouseSingleClickDelay is always > io.MouseDoubleClickTime.
|
||||
- ColorEdit:
|
||||
- Added `io.ConfigColorEditFlags` to read/modify current color edit/picker settings.
|
||||
- ColorButton: small rendering tweak/optimization for the alpha checkerboard.
|
||||
- Style:
|
||||
- Added style.MenuItemRounding, ImGuiStyleVar_MenuItemRounding. (#7589, #9375, #9453)
|
||||
- Added style.SelectableRounding, ImGuiStyleVar_SelectableRounding. (#7589, #9375, #9453)
|
||||
@@ -134,8 +137,6 @@ Other Changes:
|
||||
- Minor optimization to `AddLine()`, `AddLineH()`, `AddLineV()` functions. (#4091)
|
||||
- Added `ImDrawListFlags_TextNoPixelSnap` to disable snapping of AddText()
|
||||
coordinates for a given scope. (#3437, #9417, #2291)
|
||||
- ColorButton:
|
||||
- Small rendering tweak/optimization for the alpha checkerboard.
|
||||
- Demo:
|
||||
- Extract 'Widgets->Tree Nodes->Selectable Nodes' out of the 'Advanced'
|
||||
demo for clarity (manual reimplementation of basic selection).
|
||||
@@ -154,7 +155,7 @@ Other Changes:
|
||||
- Uses `SetProcessDpiAwarenessContext()` instead of `SetThreadDpiAwarenessContext()`
|
||||
when available, fixing OpenGL DPI scaling issues as e.g. NVIDIA drivers tends
|
||||
to spawn multiple-thread to manage OpenGL. (#9403)
|
||||
- Examples:
|
||||
- Examples:
|
||||
- Android: update to AGP 9.2.0 to support Gradle 9.6.0.
|
||||
- OpenGL3+GLFW/SDL2/SDL3: allow Wine compatibility by passing empty GLSL version
|
||||
string to ImGui_ImplOpenGL3_Init() to let backend decide of a GLSL version based
|
||||
|
||||
12
imgui.cpp
12
imgui.cpp
@@ -395,7 +395,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||
|
||||
- 2026/07/06 (1.92.9) - ColorEdit: obsoleted SetColorEditOptions() function added in 1.51 (June 2017) in favor of directly poking to style.ColorEditFlags. More consistent and easier to discover.
|
||||
- 2026/07/06 (1.92.9) - ColorEdit: obsoleted SetColorEditOptions() function added in 1.51 (June 2017) in favor of directly poking to io.ConfigColorEditFlags. More consistent and easier to discover.
|
||||
- 2026/06/02 (1.92.9) - TreeNode: commented out legacy name ImGuiTreeNodeFlags_SpanTextWidth which was obsoleted in 1.90.7 (May 2024). Use ImGuiTreeNodeFlags_SpanLabelWidth instead.
|
||||
- 2026/05/07 (1.92.8) - DrawList: swapped the last two arguments of AddRect(), AddPolyline(), PathStroke().
|
||||
- Before: void ImDrawList::AddRect(ImVec2 p_min, ImVec2 p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f);
|
||||
@@ -1681,7 +1681,7 @@ ImGuiIO::ImGuiIO()
|
||||
ConfigInputTextCursorBlink = true;
|
||||
ConfigInputTextEnterKeepActive = false;
|
||||
ConfigDragClickToInputText = false;
|
||||
ColorEditFlags = ImGuiColorEditFlags_DefaultOptions_; // Current settings for ColorEdit/ColorPicker widgets. May be further edited by users, unless you also set ImGuiColorEditFlags_NoOptions.
|
||||
ConfigColorEditFlags = ImGuiColorEditFlags_DefaultOptions_; // Current settings for ColorEdit/ColorPicker widgets. May be further edited by users, unless you also set ImGuiColorEditFlags_NoOptions.
|
||||
ConfigWindowsResizeFromEdges = true;
|
||||
ConfigWindowsMoveFromTitleBarOnly = false;
|
||||
ConfigWindowsCopyContentsWithCtrlC = false;
|
||||
@@ -11081,10 +11081,10 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
|
||||
IM_ASSERT(g.Style.WindowBorderHoverPadding > 0.0f && "Invalid style setting!"); // Required otherwise cannot resize from borders.
|
||||
IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_None || g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right);
|
||||
IM_ASSERT(g.Style.ColorButtonPosition == ImGuiDir_Left || g.Style.ColorButtonPosition == ImGuiDir_Right);
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ColorEditFlags & ImGuiColorEditFlags_DisplayMask_)); // Check only 1 option is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ColorEditFlags & ImGuiColorEditFlags_DataTypeMask_)); // Check only 1 option is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ColorEditFlags & ImGuiColorEditFlags_PickerMask_)); // Check only 1 option is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ColorEditFlags & ImGuiColorEditFlags_InputMask_)); // Check only 1 option is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_DisplayMask_)); // Check only 1 option is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_DataTypeMask_)); // "
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_PickerMask_)); // "
|
||||
IM_ASSERT(ImIsPowerOfTwo(g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_InputMask_)); // "
|
||||
|
||||
IM_ASSERT(g.Style.TreeLinesFlags == ImGuiTreeNodeFlags_DrawLinesNone || g.Style.TreeLinesFlags == ImGuiTreeNodeFlags_DrawLinesFull || g.Style.TreeLinesFlags == ImGuiTreeNodeFlags_DrawLinesToNodes);
|
||||
IM_ASSERT(g.IO.MouseSingleClickDelay > g.IO.MouseDoubleClickTime);
|
||||
|
||||
6
imgui.h
6
imgui.h
@@ -1917,9 +1917,9 @@ enum ImGuiColorEditFlags_
|
||||
ImGuiColorEditFlags_InputRGB = 1 << 27, // [Input] // ColorEdit, ColorPicker: input and output data in RGB format.
|
||||
ImGuiColorEditFlags_InputHSV = 1 << 28, // [Input] // ColorEdit, ColorPicker: input and output data in HSV format.
|
||||
|
||||
// Defaults Options copied to style.ColorEditFlags during initialization.
|
||||
// Defaults Options copied to io.ConfigColorEditFlags during initialization.
|
||||
// The intent is that you probably don't want to override them in most of your calls.
|
||||
// Let the user choose via the option menu and/or modify style.ColorEditFlags directly during startup if you want.
|
||||
// Let the user choose via the option menu and/or modify io.ConfigColorEditFlags directly during startup if you want.
|
||||
ImGuiColorEditFlags_DefaultOptions_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_PickerHueBar,
|
||||
|
||||
// [Internal] Masks
|
||||
@@ -2441,7 +2441,7 @@ struct ImGuiIO
|
||||
bool ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
|
||||
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
||||
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will reactivate item and select all text (single-line only).
|
||||
ImGuiColorEditFlags ColorEditFlags; // // Current settings for ColorEdit/ColorPicker widgets. Must have one bit of ImGuiColorEditFlags_DisplayMask_, one bit of ImGuiColorEditFlags_DataTypeMask_, one bit of ImGuiColorEditFlags_PickerMask_, one bit of ImGuiColorEditFlags_InputMask_. Defaults to ImGuiColorEditFlags_DefaultOptions_. May be further edited by users, unless you also set ImGuiColorEditFlags_NoOptions.
|
||||
ImGuiColorEditFlags ConfigColorEditFlags; // // Current settings for ColorEdit/ColorPicker widgets. Must have one bit of ImGuiColorEditFlags_DisplayMask_, one bit of ImGuiColorEditFlags_DataTypeMask_, one bit of ImGuiColorEditFlags_PickerMask_, one bit of ImGuiColorEditFlags_InputMask_. Defaults to ImGuiColorEditFlags_DefaultOptions_. May be further edited by users, unless you also set ImGuiColorEditFlags_NoOptions.
|
||||
bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.
|
||||
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires ImGuiBackendFlags_HasMouseCursors for better mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
|
||||
|
||||
@@ -1334,7 +1334,7 @@ static void DemoWindowWidgetsColorAndPickers()
|
||||
ImGui::SameLine(); HelpMarker(
|
||||
"ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, "
|
||||
"but the user can change it with a right-click on those inputs.\n\nColorPicker defaults to displaying RGB+HSV+Hex "
|
||||
"if you don't specify a display mode.\n\nYou can change the defaults using style.ColorEditFlags.");
|
||||
"if you don't specify a display mode.\n\nYou can change the defaults using io.ConfigColorEditFlags.");
|
||||
|
||||
ImGuiColorEditFlags flags = base_flags | color_picker_flags;
|
||||
if (picker_mode == 1) flags |= ImGuiColorEditFlags_PickerHueBar;
|
||||
@@ -1347,14 +1347,14 @@ static void DemoWindowWidgetsColorAndPickers()
|
||||
|
||||
ImGui::Text("Set defaults in code:");
|
||||
ImGui::SameLine(); HelpMarker(
|
||||
"io.ColorEditFlags is designed to allow you to set boot-time default.\n"
|
||||
"io.ConfigColorEditFlags is designed to allow you to set boot-time default.\n"
|
||||
"We don't have Push/Pop functions because you can force options on a per-widget basis if needed, "
|
||||
"and the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid "
|
||||
"encouraging you to persistently save values that aren't forward-compatible.");
|
||||
if (ImGui::Button("Overwrite default: Uint8 + HSV + Hue Bar"))
|
||||
ImGui::GetIO().ColorEditFlags = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_PickerHueBar;
|
||||
ImGui::GetIO().ConfigColorEditFlags = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_PickerHueBar;
|
||||
if (ImGui::Button("Overwrite default: Float + HDR + Hue Wheel"))
|
||||
ImGui::GetIO().ColorEditFlags = ImGuiColorEditFlags_Float | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_PickerHueWheel;
|
||||
ImGui::GetIO().ConfigColorEditFlags = ImGuiColorEditFlags_Float | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_PickerHueWheel;
|
||||
|
||||
// Always display a small version of both types of pickers
|
||||
// (that's in order to make it more visible in the demo to people who are skimming quickly through it)
|
||||
|
||||
@@ -5822,14 +5822,14 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
|
||||
// Read stored options
|
||||
if (!(flags & ImGuiColorEditFlags_DisplayMask_))
|
||||
flags |= (g.IO.ColorEditFlags & ImGuiColorEditFlags_DisplayMask_);
|
||||
flags |= (g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_DisplayMask_);
|
||||
if (!(flags & ImGuiColorEditFlags_DataTypeMask_))
|
||||
flags |= (g.IO.ColorEditFlags & ImGuiColorEditFlags_DataTypeMask_);
|
||||
flags |= (g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_DataTypeMask_);
|
||||
if (!(flags & ImGuiColorEditFlags_PickerMask_))
|
||||
flags |= (g.IO.ColorEditFlags & ImGuiColorEditFlags_PickerMask_);
|
||||
flags |= (g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_PickerMask_);
|
||||
if (!(flags & ImGuiColorEditFlags_InputMask_))
|
||||
flags |= (g.IO.ColorEditFlags & ImGuiColorEditFlags_InputMask_);
|
||||
flags |= (g.IO.ColorEditFlags & ~(ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_PickerMask_ | ImGuiColorEditFlags_InputMask_));
|
||||
flags |= (g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_InputMask_);
|
||||
flags |= (g.IO.ConfigColorEditFlags & ~(ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_PickerMask_ | ImGuiColorEditFlags_InputMask_));
|
||||
IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_DisplayMask_)); // Check that only 1 is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_InputMask_)); // Check that only 1 is selected
|
||||
|
||||
@@ -6098,13 +6098,13 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
||||
|
||||
// Read stored options
|
||||
if (!(flags & ImGuiColorEditFlags_PickerMask_))
|
||||
flags |= ((g.IO.ColorEditFlags & ImGuiColorEditFlags_PickerMask_) ? g.IO.ColorEditFlags : ImGuiColorEditFlags_DefaultOptions_) & ImGuiColorEditFlags_PickerMask_;
|
||||
flags |= ((g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_PickerMask_) ? g.IO.ConfigColorEditFlags : ImGuiColorEditFlags_DefaultOptions_) & ImGuiColorEditFlags_PickerMask_;
|
||||
if (!(flags & ImGuiColorEditFlags_InputMask_))
|
||||
flags |= ((g.IO.ColorEditFlags & ImGuiColorEditFlags_InputMask_) ? g.IO.ColorEditFlags : ImGuiColorEditFlags_DefaultOptions_) & ImGuiColorEditFlags_InputMask_;
|
||||
flags |= ((g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_InputMask_) ? g.IO.ConfigColorEditFlags : ImGuiColorEditFlags_DefaultOptions_) & ImGuiColorEditFlags_InputMask_;
|
||||
IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_PickerMask_)); // Check that only 1 is selected
|
||||
IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiColorEditFlags_InputMask_)); // Check that only 1 is selected
|
||||
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
||||
flags |= (g.IO.ColorEditFlags & ImGuiColorEditFlags_AlphaBar);
|
||||
flags |= (g.IO.ConfigColorEditFlags & ImGuiColorEditFlags_AlphaBar);
|
||||
|
||||
// Setup
|
||||
int components = (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4;
|
||||
@@ -6533,7 +6533,7 @@ void ImGui::SetColorEditOptions(ImGuiColorEditFlags flags)
|
||||
if ((flags & ImGuiColorEditFlags_DataTypeMask_) == 0) { flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_DataTypeMask_; }
|
||||
if ((flags & ImGuiColorEditFlags_PickerMask_) == 0) { flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_PickerMask_; }
|
||||
if ((flags & ImGuiColorEditFlags_InputMask_) == 0) { flags |= ImGuiColorEditFlags_DefaultOptions_ & ImGuiColorEditFlags_InputMask_; }
|
||||
g.IO.ColorEditFlags = flags;
|
||||
g.IO.ConfigColorEditFlags = flags;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -6583,7 +6583,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
PushItemFlag(ImGuiItemFlags_NoMarkEdited, true);
|
||||
ImGuiColorEditFlags opts = g.IO.ColorEditFlags;
|
||||
ImGuiColorEditFlags opts = g.IO.ConfigColorEditFlags;
|
||||
if (allow_opt_inputs)
|
||||
{
|
||||
if (RadioButton("RGB", (opts & ImGuiColorEditFlags_DisplayRGB) != 0)) opts = (opts & ~ImGuiColorEditFlags_DisplayMask_) | ImGuiColorEditFlags_DisplayRGB;
|
||||
@@ -6623,7 +6623,7 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
||||
EndPopup();
|
||||
}
|
||||
|
||||
g.IO.ColorEditFlags = opts;
|
||||
g.IO.ConfigColorEditFlags = opts;
|
||||
PopItemFlag();
|
||||
EndPopup();
|
||||
}
|
||||
@@ -6651,7 +6651,7 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
||||
if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;
|
||||
ImVec2 backup_pos = GetCursorScreenPos();
|
||||
if (Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup
|
||||
g.IO.ColorEditFlags = (g.IO.ColorEditFlags & ~ImGuiColorEditFlags_PickerMask_) | (picker_flags & ImGuiColorEditFlags_PickerMask_);
|
||||
g.IO.ConfigColorEditFlags = (g.IO.ConfigColorEditFlags & ~ImGuiColorEditFlags_PickerMask_) | (picker_flags & ImGuiColorEditFlags_PickerMask_);
|
||||
SetCursorScreenPos(backup_pos);
|
||||
ImVec4 previewing_ref_col;
|
||||
memcpy(&previewing_ref_col, ref_col, sizeof(float) * ((picker_flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4));
|
||||
@@ -6663,7 +6663,7 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
||||
if (allow_opt_alpha_bar)
|
||||
{
|
||||
if (allow_opt_picker) Separator();
|
||||
CheckboxFlags("Alpha Bar", &g.IO.ColorEditFlags, ImGuiColorEditFlags_AlphaBar);
|
||||
CheckboxFlags("Alpha Bar", &g.IO.ConfigColorEditFlags, ImGuiColorEditFlags_AlphaBar);
|
||||
}
|
||||
PopItemFlag();
|
||||
EndPopup();
|
||||
|
||||
Reference in New Issue
Block a user