|
@@ -3898,20 +3898,20 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
// If we're not showing any slider there's no point in doing any HSV conversions
|
|
|
const ImGuiColorEditFlags flags_untouched = flags;
|
|
|
if (flags & ImGuiColorEditFlags_NoInputs)
|
|
|
- flags = (flags & (~ImGuiColorEditFlags__InputsMask)) | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_NoOptions;
|
|
|
+ flags = (flags & (~ImGuiColorEditFlags__ShowMask)) | ImGuiColorEditFlags_ShowRGB | ImGuiColorEditFlags_NoOptions;
|
|
|
|
|
|
// Context menu: display and modify options (before defaults are applied)
|
|
|
if (!(flags & ImGuiColorEditFlags_NoOptions))
|
|
|
ColorEditOptionsPopup(col, flags);
|
|
|
|
|
|
// Read stored options
|
|
|
- if (!(flags & ImGuiColorEditFlags__InputsMask))
|
|
|
- flags |= (g.ColorEditOptions & ImGuiColorEditFlags__InputsMask);
|
|
|
+ if (!(flags & ImGuiColorEditFlags__ShowMask))
|
|
|
+ flags |= (g.ColorEditOptions & ImGuiColorEditFlags__ShowMask);
|
|
|
if (!(flags & ImGuiColorEditFlags__DataTypeMask))
|
|
|
flags |= (g.ColorEditOptions & ImGuiColorEditFlags__DataTypeMask);
|
|
|
if (!(flags & ImGuiColorEditFlags__PickerMask))
|
|
|
flags |= (g.ColorEditOptions & ImGuiColorEditFlags__PickerMask);
|
|
|
- flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask));
|
|
|
+ flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__ShowMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask));
|
|
|
|
|
|
const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0;
|
|
|
const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0;
|
|
@@ -3919,14 +3919,14 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
|
|
|
// Convert to the formats we need
|
|
|
float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };
|
|
|
- if (flags & ImGuiColorEditFlags_HSV)
|
|
|
+ if (flags & ImGuiColorEditFlags_ShowHSV)
|
|
|
ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);
|
|
|
int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };
|
|
|
|
|
|
bool value_changed = false;
|
|
|
bool value_changed_as_float = false;
|
|
|
|
|
|
- if ((flags & (ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
|
|
|
+ if ((flags & (ImGuiColorEditFlags_ShowRGB | ImGuiColorEditFlags_ShowHSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
|
|
|
{
|
|
|
// RGB/HSV 0..255 Sliders
|
|
|
const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components-1)) / (float)components));
|
|
@@ -3946,7 +3946,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
{ "R:%0.3f", "G:%0.3f", "B:%0.3f", "A:%0.3f" }, // Long display for RGBA
|
|
|
{ "H:%0.3f", "S:%0.3f", "V:%0.3f", "A:%0.3f" } // Long display for HSVA
|
|
|
};
|
|
|
- const int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_HSV) ? 2 : 1;
|
|
|
+ const int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_ShowHSV) ? 2 : 1;
|
|
|
|
|
|
PushItemWidth(w_item_one);
|
|
|
for (int n = 0; n < components; n++)
|
|
@@ -3970,7 +3970,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
PopItemWidth();
|
|
|
PopItemWidth();
|
|
|
}
|
|
|
- else if ((flags & ImGuiColorEditFlags_HEX) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
|
|
|
+ else if ((flags & ImGuiColorEditFlags_ShowHEX) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)
|
|
|
{
|
|
|
// RGB Hexadecimal Input
|
|
|
char buf[64];
|
|
@@ -4025,7 +4025,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
Spacing();
|
|
|
}
|
|
|
ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;
|
|
|
- ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
|
|
+ ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__ShowMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;
|
|
|
PushItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?
|
|
|
value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x);
|
|
|
PopItemWidth();
|
|
@@ -4045,7 +4045,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
|
|
if (!value_changed_as_float)
|
|
|
for (int n = 0; n < 4; n++)
|
|
|
f[n] = i[n] / 255.0f;
|
|
|
- if (flags & ImGuiColorEditFlags_HSV)
|
|
|
+ if (flags & ImGuiColorEditFlags_ShowHSV)
|
|
|
ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);
|
|
|
if (value_changed)
|
|
|
{
|
|
@@ -4330,18 +4330,18 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl
|
|
|
PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x);
|
|
|
ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoSmallPreview | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf;
|
|
|
ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker;
|
|
|
- if (flags & ImGuiColorEditFlags_RGB || (flags & ImGuiColorEditFlags__InputsMask) == 0)
|
|
|
- if (ColorEdit4("##rgb", col, sub_flags | ImGuiColorEditFlags_RGB))
|
|
|
+ if (flags & ImGuiColorEditFlags_ShowRGB || (flags & ImGuiColorEditFlags__ShowMask) == 0)
|
|
|
+ if (ColorEdit4("##rgb", col, sub_flags | ImGuiColorEditFlags_ShowRGB))
|
|
|
{
|
|
|
// FIXME: Hackily differenciating using the DragInt (ActiveId != 0 && !ActiveIdAllowOverlap) vs. using the InputText or DropTarget.
|
|
|
// For the later we don't want to run the hue-wrap canceling code. If you are well versed in HSV picker please provide your input! (See #2050)
|
|
|
value_changed_fix_hue_wrap = (g.ActiveId != 0 && !g.ActiveIdAllowOverlap);
|
|
|
value_changed = true;
|
|
|
}
|
|
|
- if (flags & ImGuiColorEditFlags_HSV || (flags & ImGuiColorEditFlags__InputsMask) == 0)
|
|
|
- value_changed |= ColorEdit4("##hsv", col, sub_flags | ImGuiColorEditFlags_HSV);
|
|
|
- if (flags & ImGuiColorEditFlags_HEX || (flags & ImGuiColorEditFlags__InputsMask) == 0)
|
|
|
- value_changed |= ColorEdit4("##hex", col, sub_flags | ImGuiColorEditFlags_HEX);
|
|
|
+ if (flags & ImGuiColorEditFlags_ShowHSV || (flags & ImGuiColorEditFlags__ShowMask) == 0)
|
|
|
+ value_changed |= ColorEdit4("##hsv", col, sub_flags | ImGuiColorEditFlags_ShowHSV);
|
|
|
+ if (flags & ImGuiColorEditFlags_ShowHEX || (flags & ImGuiColorEditFlags__ShowMask) == 0)
|
|
|
+ value_changed |= ColorEdit4("##hex", col, sub_flags | ImGuiColorEditFlags_ShowHEX);
|
|
|
PopItemWidth();
|
|
|
}
|
|
|
|
|
@@ -4539,13 +4539,13 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
|
|
|
void ImGui::SetColorEditOptions(ImGuiColorEditFlags flags)
|
|
|
{
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- if ((flags & ImGuiColorEditFlags__InputsMask) == 0)
|
|
|
- flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__InputsMask;
|
|
|
+ if ((flags & ImGuiColorEditFlags__ShowMask) == 0)
|
|
|
+ flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__ShowMask;
|
|
|
if ((flags & ImGuiColorEditFlags__DataTypeMask) == 0)
|
|
|
flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__DataTypeMask;
|
|
|
if ((flags & ImGuiColorEditFlags__PickerMask) == 0)
|
|
|
flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__PickerMask;
|
|
|
- IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__InputsMask))); // Check only 1 option is selected
|
|
|
+ IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__ShowMask))); // Check only 1 option is selected
|
|
|
IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__DataTypeMask))); // Check only 1 option is selected
|
|
|
IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask))); // Check only 1 option is selected
|
|
|
g.ColorEditOptions = flags;
|
|
@@ -4578,7 +4578,7 @@ void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags
|
|
|
|
|
|
void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
|
|
{
|
|
|
- bool allow_opt_inputs = !(flags & ImGuiColorEditFlags__InputsMask);
|
|
|
+ bool allow_opt_inputs = !(flags & ImGuiColorEditFlags__ShowMask);
|
|
|
bool allow_opt_datatype = !(flags & ImGuiColorEditFlags__DataTypeMask);
|
|
|
if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context"))
|
|
|
return;
|
|
@@ -4586,9 +4586,9 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
|
|
ImGuiColorEditFlags opts = g.ColorEditOptions;
|
|
|
if (allow_opt_inputs)
|
|
|
{
|
|
|
- if (RadioButton("RGB", (opts & ImGuiColorEditFlags_RGB) != 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_RGB;
|
|
|
- if (RadioButton("HSV", (opts & ImGuiColorEditFlags_HSV) != 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HSV;
|
|
|
- if (RadioButton("HEX", (opts & ImGuiColorEditFlags_HEX) != 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HEX;
|
|
|
+ if (RadioButton("RGB", (opts & ImGuiColorEditFlags_ShowRGB) != 0)) opts = (opts & ~ImGuiColorEditFlags__ShowMask) | ImGuiColorEditFlags_ShowRGB;
|
|
|
+ if (RadioButton("HSV", (opts & ImGuiColorEditFlags_ShowHSV) != 0)) opts = (opts & ~ImGuiColorEditFlags__ShowMask) | ImGuiColorEditFlags_ShowHSV;
|
|
|
+ if (RadioButton("HEX", (opts & ImGuiColorEditFlags_ShowHEX) != 0)) opts = (opts & ~ImGuiColorEditFlags__ShowMask) | ImGuiColorEditFlags_ShowHEX;
|
|
|
}
|
|
|
if (allow_opt_datatype)
|
|
|
{
|