mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 01:20:55 +01:00
Fix zealous warnings + Internals: Renamed members from XxxxID to XxxxxId to be more consistent with rest of the codebase (still some inconsistency left that are harder to fix)
This commit is contained in:
parent
f6d6880a61
commit
9ad4c5da7e
14
imgui.cpp
14
imgui.cpp
@ -2753,7 +2753,7 @@ void ImGui::GcAwakeTransientWindowBuffers(ImGuiWindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME-NAV: Refactor those functions into a single, more explicit one.
|
// FIXME-NAV: Refactor those functions into a single, more explicit one.
|
||||||
void ImGui::SetNavID(ImGuiID id, int nav_layer, int focus_scope_id)
|
void ImGui::SetNavID(ImGuiID id, int nav_layer, ImGuiID focus_scope_id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(g.NavWindow);
|
IM_ASSERT(g.NavWindow);
|
||||||
@ -2763,7 +2763,7 @@ void ImGui::SetNavID(ImGuiID id, int nav_layer, int focus_scope_id)
|
|||||||
g.NavWindow->NavLastIds[nav_layer] = id;
|
g.NavWindow->NavLastIds[nav_layer] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SetNavIDWithRectRel(ImGuiID id, int nav_layer, int focus_scope_id, const ImRect& rect_rel)
|
void ImGui::SetNavIDWithRectRel(ImGuiID id, int nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
SetNavID(id, nav_layer, focus_scope_id);
|
SetNavID(id, nav_layer, focus_scope_id);
|
||||||
@ -2958,10 +2958,10 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg)
|
|||||||
|
|
||||||
// [DEBUG] Item Picker tool, when enabling the "extended" version we perform the check in ItemAdd()
|
// [DEBUG] Item Picker tool, when enabling the "extended" version we perform the check in ItemAdd()
|
||||||
#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
|
#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
|
||||||
if (id == g.DebugItemPickerBreakID)
|
if (id == g.DebugItemPickerBreakId)
|
||||||
{
|
{
|
||||||
IM_DEBUG_BREAK();
|
IM_DEBUG_BREAK();
|
||||||
g.DebugItemPickerBreakID = 0;
|
g.DebugItemPickerBreakId = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -3060,7 +3060,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
|
|||||||
// #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd().
|
// #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd().
|
||||||
if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id)
|
if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id)
|
||||||
GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255));
|
GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255));
|
||||||
if (g.DebugItemPickerBreakID == id)
|
if (g.DebugItemPickerBreakId == id)
|
||||||
IM_DEBUG_BREAK();
|
IM_DEBUG_BREAK();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -3840,7 +3840,7 @@ void ImGui::NewFrame()
|
|||||||
void ImGui::UpdateDebugToolItemPicker()
|
void ImGui::UpdateDebugToolItemPicker()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.DebugItemPickerBreakID = 0;
|
g.DebugItemPickerBreakId = 0;
|
||||||
if (g.DebugItemPickerActive)
|
if (g.DebugItemPickerActive)
|
||||||
{
|
{
|
||||||
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
||||||
@ -3849,7 +3849,7 @@ void ImGui::UpdateDebugToolItemPicker()
|
|||||||
g.DebugItemPickerActive = false;
|
g.DebugItemPickerActive = false;
|
||||||
if (ImGui::IsMouseClicked(0) && hovered_id)
|
if (ImGui::IsMouseClicked(0) && hovered_id)
|
||||||
{
|
{
|
||||||
g.DebugItemPickerBreakID = hovered_id;
|
g.DebugItemPickerBreakId = hovered_id;
|
||||||
g.DebugItemPickerActive = false;
|
g.DebugItemPickerActive = false;
|
||||||
}
|
}
|
||||||
ImGui::SetNextWindowBgAlpha(0.60f);
|
ImGui::SetNextWindowBgAlpha(0.60f);
|
||||||
|
2
imgui.h
2
imgui.h
@ -2228,10 +2228,10 @@ struct ImFont
|
|||||||
short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.
|
||||||
ImWchar FallbackChar; // 2 // in // = '?' // Replacement character if a glyph isn't found. Only set via SetFallbackChar()
|
ImWchar FallbackChar; // 2 // in // = '?' // Replacement character if a glyph isn't found. Only set via SetFallbackChar()
|
||||||
ImWchar EllipsisChar; // 2 // out // = -1 // Character used for ellipsis rendering.
|
ImWchar EllipsisChar; // 2 // out // = -1 // Character used for ellipsis rendering.
|
||||||
|
bool DirtyLookupTables; // 1 // out //
|
||||||
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale()
|
||||||
float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
|
||||||
int MetricsTotalSurface;// 4 // out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
int MetricsTotalSurface;// 4 // out // // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)
|
||||||
bool DirtyLookupTables; // 1 // out //
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
IMGUI_API ImFont();
|
IMGUI_API ImFont();
|
||||||
|
@ -3431,8 +3431,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
const float surface_sqrt = sqrtf((float)font->MetricsTotalSurface);
|
const float surface_sqrt = sqrtf((float)font->MetricsTotalSurface);
|
||||||
ImGui::Text("Texture Area: about %d px ~%dx%d px", font->MetricsTotalSurface, (int)surface_sqrt, (int)surface_sqrt);
|
ImGui::Text("Texture Area: about %d px ~%dx%d px", font->MetricsTotalSurface, (int)surface_sqrt, (int)surface_sqrt);
|
||||||
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
||||||
if (const ImFontConfig* cfg = &font->ConfigData[config_i])
|
if (font->ConfigData)
|
||||||
ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH);
|
if (const ImFontConfig* cfg = &font->ConfigData[config_i])
|
||||||
|
ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH);
|
||||||
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
||||||
{
|
{
|
||||||
// Display all glyphs of the fonts in separate pages of 256 characters
|
// Display all glyphs of the fonts in separate pages of 256 characters
|
||||||
|
@ -430,7 +430,7 @@ enum ImGuiButtonFlags_
|
|||||||
ImGuiButtonFlags_Disabled = 1 << 10, // disable interactions
|
ImGuiButtonFlags_Disabled = 1 << 10, // disable interactions
|
||||||
ImGuiButtonFlags_AlignTextBaseLine = 1 << 11, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
ImGuiButtonFlags_AlignTextBaseLine = 1 << 11, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
||||||
ImGuiButtonFlags_NoKeyModifiers = 1 << 12, // disable mouse interaction if a key modifier is held
|
ImGuiButtonFlags_NoKeyModifiers = 1 << 12, // disable mouse interaction if a key modifier is held
|
||||||
ImGuiButtonFlags_NoHoldingActiveID = 1 << 13, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
ImGuiButtonFlags_NoHoldingActiveId = 1 << 13, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
||||||
ImGuiButtonFlags_NoNavFocus = 1 << 14, // don't override navigation focus when activated
|
ImGuiButtonFlags_NoNavFocus = 1 << 14, // don't override navigation focus when activated
|
||||||
ImGuiButtonFlags_NoHoveredOnNav = 1 << 15, // don't report as hovered when navigated on
|
ImGuiButtonFlags_NoHoveredOnNav = 1 << 15, // don't report as hovered when navigated on
|
||||||
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold
|
ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold
|
||||||
@ -1160,7 +1160,7 @@ struct ImGuiContext
|
|||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
bool DebugItemPickerActive;
|
bool DebugItemPickerActive;
|
||||||
ImGuiID DebugItemPickerBreakID; // Will call IM_DEBUG_BREAK() when encountering this id
|
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this id
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
||||||
@ -1289,7 +1289,7 @@ struct ImGuiContext
|
|||||||
LogDepthToExpand = LogDepthToExpandDefault = 2;
|
LogDepthToExpand = LogDepthToExpandDefault = 2;
|
||||||
|
|
||||||
DebugItemPickerActive = false;
|
DebugItemPickerActive = false;
|
||||||
DebugItemPickerBreakID = 0;
|
DebugItemPickerBreakId = 0;
|
||||||
|
|
||||||
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));
|
||||||
FramerateSecPerFrameIdx = 0;
|
FramerateSecPerFrameIdx = 0;
|
||||||
@ -1700,8 +1700,8 @@ namespace ImGui
|
|||||||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
||||||
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate);
|
||||||
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
|
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
|
||||||
IMGUI_API void SetNavID(ImGuiID id, int nav_layer, int focus_scope_id);
|
IMGUI_API void SetNavID(ImGuiID id, int nav_layer, ImGuiID focus_scope_id);
|
||||||
IMGUI_API void SetNavIDWithRectRel(ImGuiID id, int nav_layer, int focus_scope_id, const ImRect& rect_rel);
|
IMGUI_API void SetNavIDWithRectRel(ImGuiID id, int nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel);
|
||||||
|
|
||||||
// Focus scope (WIP)
|
// Focus scope (WIP)
|
||||||
IMGUI_API void PushFocusScope(ImGuiID id); // Note: this is storing in same stack as IDStack, so Push/Pop mismatch will be reported there.
|
IMGUI_API void PushFocusScope(ImGuiID id); // Note: this is storing in same stack as IDStack, so Push/Pop mismatch will be reported there.
|
||||||
|
@ -517,7 +517,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
if (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0]))
|
if (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0]))
|
||||||
{
|
{
|
||||||
pressed = true;
|
pressed = true;
|
||||||
if (flags & ImGuiButtonFlags_NoHoldingActiveID)
|
if (flags & ImGuiButtonFlags_NoHoldingActiveId)
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
else
|
else
|
||||||
SetActiveID(id, window); // Hold on ID
|
SetActiveID(id, window); // Hold on ID
|
||||||
@ -5580,7 +5580,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||||||
|
|
||||||
// We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries
|
// We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries
|
||||||
ImGuiButtonFlags button_flags = 0;
|
ImGuiButtonFlags button_flags = 0;
|
||||||
if (flags & ImGuiSelectableFlags_NoHoldingActiveID) { button_flags |= ImGuiButtonFlags_NoHoldingActiveID; }
|
if (flags & ImGuiSelectableFlags_NoHoldingActiveID) { button_flags |= ImGuiButtonFlags_NoHoldingActiveId; }
|
||||||
if (flags & ImGuiSelectableFlags_PressedOnClick) { button_flags |= ImGuiButtonFlags_PressedOnClick; }
|
if (flags & ImGuiSelectableFlags_PressedOnClick) { button_flags |= ImGuiButtonFlags_PressedOnClick; }
|
||||||
if (flags & ImGuiSelectableFlags_PressedOnRelease) { button_flags |= ImGuiButtonFlags_PressedOnRelease; }
|
if (flags & ImGuiSelectableFlags_PressedOnRelease) { button_flags |= ImGuiButtonFlags_PressedOnRelease; }
|
||||||
if (flags & ImGuiSelectableFlags_Disabled) { button_flags |= ImGuiButtonFlags_Disabled; }
|
if (flags & ImGuiSelectableFlags_Disabled) { button_flags |= ImGuiButtonFlags_Disabled; }
|
||||||
|
Loading…
Reference in New Issue
Block a user