Internals: Renaming of non-user facing parts from ValueChanged to Edited terminology. (#2034, #820, #956, #1875)
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index e6445e4..d8977fc 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -145,8 +145,9 @@
- Some frameworks (such as the Allegro, Marmalade) handle both the "platform" and "rendering" part, and your custom engine may as well.
- Read examples/README.txt for details.
- Added IsItemDeactivated() to query if the last item was active previously and isn't anymore. Useful for Undo/Redo patterns. (#820, #956, #1875)
- - Added IsItemDeactivatedAfterChange() if the last item was active previously, isn't anymore, and during its active state modified a value.
- Note that you may still get false positive (e.g. drag value and while holding return on the same value). (#820, #956, #1875)
+ - Added IsItemDeactivatedAfterChange() [*EDIT* renamed to IsItemDeactivatedAfterEdit() in 1.63) if the last item was active previously,
+ is not anymore, and during its active state modified a value. Note that you may still get false positive (e.g. drag value and while
+ holding return on the same value). (#820, #956, #1875)
- Nav: Added support for PageUp/PageDown (explorer-style: first aim at bottom/top most item, when scroll a page worth of contents). (#787)
- Nav: To keep the navigated item in view we also attempt to scroll the parent window as well as the current window. (#787)
- ColorEdit3, ColorEdit4, ColorButton: Added ImGuiColorEditFlags_NoDragDrop flag to disable ColorEditX as drag target and ColorButton as drag source. (#1826)
diff --git a/imgui.cpp b/imgui.cpp
index 5f5bc44..0619264 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -2269,7 +2269,7 @@
if (g.ActiveIdIsJustActivated)
{
g.ActiveIdTimer = 0.0f;
- g.ActiveIdValueChanged = false;
+ g.ActiveIdHasBeenEdited = false;
if (id != 0)
{
g.LastActiveId = id;
@@ -2338,7 +2338,7 @@
g.ActiveIdPreviousFrameIsAlive = true;
}
-void ImGui::MarkItemValueChanged(ImGuiID id)
+void ImGui::MarkItemEdited(ImGuiID id)
{
// This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit().
// ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data.
@@ -2346,8 +2346,8 @@
ImGuiContext& g = *GImGui;
IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive);
//IM_ASSERT(g.CurrentWindow->DC.LastItemId == id);
- g.ActiveIdValueChanged = true;
- g.CurrentWindow->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_ValueChanged;
+ g.ActiveIdHasBeenEdited = true;
+ g.CurrentWindow->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_Edited;
}
static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags)
@@ -3954,7 +3954,7 @@
g.LastActiveIdTimer += g.IO.DeltaTime;
g.ActiveIdPreviousFrame = g.ActiveId;
g.ActiveIdPreviousFrameWindow = g.ActiveIdWindow;
- g.ActiveIdPreviousFrameValueChanged = g.ActiveIdValueChanged;
+ g.ActiveIdPreviousFrameHasBeenEdited = g.ActiveIdHasBeenEdited;
g.ActiveIdIsAlive = 0;
g.ActiveIdPreviousFrameIsAlive = false;
g.ActiveIdIsJustActivated = false;
@@ -5209,7 +5209,7 @@
bool ImGui::IsItemDeactivatedAfterEdit()
{
ImGuiContext& g = *GImGui;
- return IsItemDeactivated() && (g.ActiveIdPreviousFrameValueChanged || (g.ActiveId == 0 && g.ActiveIdValueChanged));
+ return IsItemDeactivated() && (g.ActiveIdPreviousFrameHasBeenEdited || (g.ActiveId == 0 && g.ActiveIdHasBeenEdited));
}
bool ImGui::IsItemFocused()
@@ -5250,7 +5250,7 @@
bool ImGui::IsItemEdited()
{
ImGuiWindow* window = GetCurrentWindowRead();
- return (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_ValueChanged) != 0;
+ return (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Edited) != 0;
}
// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.
@@ -8294,7 +8294,7 @@
bool hovered, held;
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
if (pressed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
// Render
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
@@ -9635,7 +9635,7 @@
ImRect grab_bb;
const bool value_changed = SliderBehavior(frame_bb, id, data_type, v, v_min, v_max, format, power, ImGuiSliderFlags_None, &grab_bb);
if (value_changed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
// Render grab
window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);
@@ -9701,7 +9701,7 @@
ImRect grab_bb;
const bool value_changed = SliderBehavior(frame_bb, id, data_type, v, v_min, v_max, format, power, ImGuiSliderFlags_Vertical, &grab_bb);
if (value_changed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
// Render grab
window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);
@@ -9982,7 +9982,7 @@
ItemSize(total_bb, style.FramePadding.y);
const bool value_changed = DragBehavior(id, data_type, v, v_speed, v_min, v_max, format, power);
if (value_changed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
// Draw frame
const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
@@ -10333,7 +10333,7 @@
if (pressed)
{
*v = !(*v);
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
}
RenderNavHighlight(total_bb, id);
@@ -10403,7 +10403,7 @@
bool hovered, held;
bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
if (pressed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
RenderNavHighlight(total_bb, id);
window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16);
@@ -11384,7 +11384,7 @@
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
if (value_changed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
return enter_pressed;
@@ -11851,7 +11851,7 @@
SetNavID(id, window->DC.NavLayerCurrent);
}
if (pressed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
// Render
if (hovered || selected)
@@ -11984,7 +11984,7 @@
}
ListBoxFooter();
if (value_changed)
- MarkItemValueChanged(g.CurrentWindow->DC.LastItemId);
+ MarkItemEdited(g.CurrentWindow->DC.LastItemId);
return value_changed;
}
@@ -12451,7 +12451,7 @@
ColorTooltip(desc_id, &col.x, flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf));
if (pressed)
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
return pressed;
}
@@ -12748,7 +12748,7 @@
window->DC.LastItemId = g.ActiveId;
if (value_changed)
- MarkItemValueChanged(window->DC.LastItemId);
+ MarkItemEdited(window->DC.LastItemId);
return value_changed;
}
@@ -13064,7 +13064,7 @@
if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0)
value_changed = false;
if (value_changed)
- MarkItemValueChanged(window->DC.LastItemId);
+ MarkItemEdited(window->DC.LastItemId);
PopID();
@@ -13184,7 +13184,7 @@
*size1 += mouse_delta;
*size2 -= mouse_delta;
bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta));
- MarkItemValueChanged(id);
+ MarkItemEdited(id);
}
}
diff --git a/imgui_internal.h b/imgui_internal.h
index 07b6890..ebb12c9 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -269,7 +269,7 @@
ImGuiItemStatusFlags_None = 0,
ImGuiItemStatusFlags_HoveredRect = 1 << 0,
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,
- ImGuiItemStatusFlags_ValueChanged = 1 << 2 // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
+ ImGuiItemStatusFlags_Edited = 1 << 2 // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
};
// FIXME: this is in development, not exposed/functional as a generic feature yet.
@@ -649,9 +649,9 @@
float ActiveIdTimer;
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
- bool ActiveIdValueChanged; // Was the value associated to the widget changed over the course of the Active state.
+ bool ActiveIdHasBeenEdited; // Was the value associated to the widget Edited over the course of the Active state.
bool ActiveIdPreviousFrameIsAlive;
- bool ActiveIdPreviousFrameValueChanged;
+ bool ActiveIdPreviousFrameHasBeenEdited;
int ActiveIdAllowNavDirFlags; // Active widget allows using directional navigation (e.g. can activate a button and move away from it)
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
ImGuiWindow* ActiveIdWindow;
@@ -796,9 +796,9 @@
ActiveIdTimer = 0.0f;
ActiveIdIsJustActivated = false;
ActiveIdAllowOverlap = false;
- ActiveIdValueChanged = false;
+ ActiveIdHasBeenEdited = false;
ActiveIdPreviousFrameIsAlive = false;
- ActiveIdPreviousFrameValueChanged = false;
+ ActiveIdPreviousFrameHasBeenEdited = false;
ActiveIdAllowNavDirFlags = 0;
ActiveIdClickOffset = ImVec2(-1,-1);
ActiveIdWindow = ActiveIdPreviousFrameWindow = NULL;
@@ -1128,7 +1128,7 @@
IMGUI_API ImGuiID GetHoveredID();
IMGUI_API void SetHoveredID(ImGuiID id);
IMGUI_API void KeepAliveID(ImGuiID id);
- IMGUI_API void MarkItemValueChanged(ImGuiID id);
+ IMGUI_API void MarkItemEdited(ImGuiID id);
// Basic Helpers for widget code
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);