|
@@ -3601,6 +3601,7 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
|
|
{
|
|
|
// FIXME: May need to clarify display behavior if format doesn't contain %.
|
|
|
// "%d" -> "%d" / "There are %d items" -> "%d" / "items" -> "%d" (fallback). Also see #6405
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
|
const ImGuiDataTypeInfo* type_info = DataTypeGetInfo(data_type);
|
|
|
char fmt_buf[32];
|
|
|
char data_buf[32];
|
|
@@ -3610,8 +3611,8 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
|
|
DataTypeFormatString(data_buf, IM_ARRAYSIZE(data_buf), data_type, p_data, format);
|
|
|
ImStrTrimBlanks(data_buf);
|
|
|
|
|
|
- ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | (ImGuiInputTextFlags)ImGuiInputTextFlags_NoMarkEdited | (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint;
|
|
|
-
|
|
|
+ ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint;
|
|
|
+ g.LastItemData.ItemFlags |= ImGuiItemFlags_NoMarkEdited; // Because TempInputText() uses ImGuiInputTextFlags_MergedItem it doesn't submit a new item, so we poke LastItemData.
|
|
|
bool value_changed = false;
|
|
|
if (TempInputText(bb, id, label, data_buf, IM_ARRAYSIZE(data_buf), flags))
|
|
|
{
|
|
@@ -3630,6 +3631,7 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG
|
|
|
}
|
|
|
|
|
|
// Only mark as edited if new value is different
|
|
|
+ g.LastItemData.ItemFlags &= ~ImGuiItemFlags_NoMarkEdited;
|
|
|
value_changed = memcmp(&data_backup, p_data, data_type_size) != 0;
|
|
|
if (value_changed)
|
|
|
MarkItemEdited(id);
|
|
@@ -3666,8 +3668,10 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
|
|
else
|
|
|
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
|
|
|
|
|
|
- flags |= ImGuiInputTextFlags_AutoSelectAll | (ImGuiInputTextFlags)ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
|
|
|
- flags |= (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint;
|
|
|
+ // Disable the MarkItemEdited() call in InputText but keep ImGuiItemStatusFlags_Edited.
|
|
|
+ // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.
|
|
|
+ g.NextItemData.ItemFlags |= ImGuiItemFlags_NoMarkEdited;
|
|
|
+ flags |= ImGuiInputTextFlags_AutoSelectAll | (ImGuiInputTextFlags)ImGuiInputTextFlags_LocalizeDecimalPoint;
|
|
|
|
|
|
bool value_changed = false;
|
|
|
if (p_step == NULL)
|
|
@@ -3719,6 +3723,8 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data
|
|
|
PopID();
|
|
|
EndGroup();
|
|
|
}
|
|
|
+
|
|
|
+ g.LastItemData.ItemFlags &= ~ImGuiItemFlags_NoMarkEdited;
|
|
|
if (value_changed)
|
|
|
MarkItemEdited(g.LastItemData.ID);
|
|
|
|
|
@@ -5315,7 +5321,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|
|
if (label_size.x > 0)
|
|
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
|
|
|
|
|
- if (value_changed && !(flags & ImGuiInputTextFlags_NoMarkEdited))
|
|
|
+ if (value_changed)
|
|
|
MarkItemEdited(id);
|
|
|
|
|
|
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable);
|
|
@@ -6196,8 +6202,9 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
|
|
bool allow_opt_datatype = !(flags & ImGuiColorEditFlags_DataTypeMask_);
|
|
|
if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context"))
|
|
|
return;
|
|
|
+
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- g.LockMarkEdited++;
|
|
|
+ PushItemFlag(ImGuiItemFlags_NoMarkEdited, true);
|
|
|
ImGuiColorEditFlags opts = g.ColorEditOptions;
|
|
|
if (allow_opt_inputs)
|
|
|
{
|
|
@@ -6239,8 +6246,8 @@ void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)
|
|
|
}
|
|
|
|
|
|
g.ColorEditOptions = opts;
|
|
|
+ PopItemFlag();
|
|
|
EndPopup();
|
|
|
- g.LockMarkEdited--;
|
|
|
}
|
|
|
|
|
|
void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags)
|
|
@@ -6249,8 +6256,9 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
|
|
bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);
|
|
|
if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context"))
|
|
|
return;
|
|
|
+
|
|
|
ImGuiContext& g = *GImGui;
|
|
|
- g.LockMarkEdited++;
|
|
|
+ PushItemFlag(ImGuiItemFlags_NoMarkEdited, true);
|
|
|
if (allow_opt_picker)
|
|
|
{
|
|
|
ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function
|
|
@@ -6279,8 +6287,8 @@ void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags fl
|
|
|
if (allow_opt_picker) Separator();
|
|
|
CheckboxFlags("Alpha Bar", &g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);
|
|
|
}
|
|
|
+ PopItemFlag();
|
|
|
EndPopup();
|
|
|
- g.LockMarkEdited--;
|
|
|
}
|
|
|
|
|
|
//-------------------------------------------------------------------------
|