16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 03:29:19 +02:00

reformat: parameters can be made pointer to const

This commit is contained in:
jerrrrycho
2026-07-04 07:14:02 +02:00
parent 220689a5e3
commit 96a099acdf
51 changed files with 304 additions and 304 deletions

View File

@@ -1038,7 +1038,7 @@ static void SetCurrentWindow(ImGuiWindow* window);
static void FindHoveredWindow();
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags);
static void CheckStacksSize(ImGuiWindow* window, bool write);
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges);
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(const ImGuiWindow * window, bool snap_on_edges);
static void AddDrawListToDrawData(ImVector<ImDrawList*>* out_list, ImDrawList* draw_list);
static void AddWindowToSortBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window);
@@ -1048,7 +1048,7 @@ static ImRect GetViewportRect();
// Settings
static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name);
static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line);
static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf);
static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, const ImGuiSettingsHandler * handler, ImGuiTextBuffer* buf);
// Platform Dependents default implementation for IO functions
static const char* GetClipboardTextFn_DefaultImpl(void* user_data);
@@ -1071,7 +1071,7 @@ static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb
static ImVec2 NavCalcPreferredRefPos();
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
static int FindWindowFocusIndex(ImGuiWindow* window);
static int FindWindowFocusIndex(const ImGuiWindow * window);
// Misc
static void UpdateMouseInputs();
@@ -1110,8 +1110,8 @@ ImGuiContext* GImGui = NULL;
// If you use DLL hotreloading you might need to call SetAllocatorFunctions() after reloading code from this file.
// Otherwise, you probably don't want to modify them mid-program, and if you use global/static e.g. ImVector<> instances you may need to keep them accessible during program destruction.
#ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS
static void* MallocWrapper(const size_t size, void* user_data) { IM_UNUSED(user_data); return malloc(size); }
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); free(ptr); }
static void* MallocWrapper(const size_t size, const void * user_data) { IM_UNUSED(user_data); return malloc(size); }
static void FreeWrapper(void* ptr, const void * user_data) { IM_UNUSED(user_data); free(ptr); }
#else
static void* MallocWrapper(size_t size, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(size); IM_ASSERT(0); return NULL; }
static void FreeWrapper(void* ptr, void* user_data) { IM_UNUSED(user_data); IM_UNUSED(ptr); IM_ASSERT(0); }
@@ -1915,7 +1915,7 @@ ImU32 ImGui::GetColorU32(const ImU32 col)
//-----------------------------------------------------------------------------
// std::lower_bound but without the bullshit
static ImGuiStorage::ImGuiStoragePair* LowerBound(ImVector<ImGuiStorage::ImGuiStoragePair>& data, const ImGuiID key)
static ImGuiStorage::ImGuiStoragePair* LowerBound(const ImVector<ImGuiStorage::ImGuiStoragePair>& data, const ImGuiID key)
{
ImGuiStorage::ImGuiStoragePair* first = data.Data;
const ImGuiStorage::ImGuiStoragePair* last = data.Data + data.Size;
@@ -2669,7 +2669,7 @@ void ImGui::RenderNavHighlight(const ImRect& bb, const ImGuiID id, const ImGuiNa
//-----------------------------------------------------------------------------
// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods
ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)
ImGuiWindow::ImGuiWindow(const ImGuiContext * context, const char* name)
: DrawListInst(&context->DrawListSharedData)
{
Name = ImStrdup(name);
@@ -2942,7 +2942,7 @@ void ImGui::MarkItemEdited(const ImGuiID id)
g.CurrentWindow->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_Edited;
}
static inline bool IsWindowContentHoverable(ImGuiWindow* window, const ImGuiHoveredFlags flags)
static inline bool IsWindowContentHoverable(const ImGuiWindow * window, const ImGuiHoveredFlags flags)
{
// An active popup disable hovering on other windows (apart from its own children)
// FIXME-OPT: This could be cached/stored within the window.
@@ -3449,7 +3449,7 @@ void ImGui::UpdateMouseMovingWindowEndFrame()
}
}
static bool IsWindowActiveAndVisible(ImGuiWindow* window)
static bool IsWindowActiveAndVisible(const ImGuiWindow * window)
{
return (window->Active) && (!window->Hidden);
}
@@ -4119,7 +4119,7 @@ void ImDrawDataBuilder::FlattenIntoSingleLayer()
}
}
static void SetupDrawData(ImVector<ImDrawList*>* draw_lists, ImDrawData* draw_data)
static void SetupDrawData(const ImVector<ImDrawList*>* draw_lists, ImDrawData* draw_data)
{
const ImGuiIO & io = ImGui::GetIO();
draw_data->Valid = true;
@@ -4909,7 +4909,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, const ImGuiWi
return window;
}
static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size)
static ImVec2 CalcWindowSizeAfterConstraint(const ImGuiWindow * window, ImVec2 new_size)
{
const ImGuiContext & g = *GImGui;
if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint)
@@ -4941,7 +4941,7 @@ static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size
return new_size;
}
static ImVec2 CalcWindowContentSize(ImGuiWindow* window)
static ImVec2 CalcWindowContentSize(const ImGuiWindow * window)
{
if (window->Collapsed)
if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
@@ -5036,7 +5036,7 @@ static const ImGuiResizeGripDef resize_grip_def[4] =
{ ImVec2(1,0), ImVec2(-1,+1), 9,12 }, // Upper right
};
static ImRect GetResizeBorderRect(ImGuiWindow* window, const int border_n, const float perp_padding, const float thickness)
static ImRect GetResizeBorderRect(const ImGuiWindow * window, const int border_n, const float perp_padding, const float thickness)
{
ImRect rect = window->Rect();
if (thickness == 0.0f) rect.Max -= ImVec2(1,1);
@@ -6129,7 +6129,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
BringWindowToDisplayFront(window);
}
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window)
void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, const ImGuiWindow * ignore_window)
{
ImGuiContext& g = *GImGui;
@@ -6499,7 +6499,7 @@ const char* ImGui::GetStyleColorName(const ImGuiCol idx)
return "Unknown";
}
bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent)
bool ImGui::IsWindowChildOf(const ImGuiWindow * window, const ImGuiWindow * potential_parent)
{
if (window->RootWindow == potential_parent)
return true;
@@ -6577,7 +6577,7 @@ bool ImGui::IsWindowFocused(const ImGuiFocusedFlags flags)
// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext)
// Note that NoNavFocus makes the window not reachable with CTRL+TAB but it can still be focused with mouse or programmaticaly.
// If you want a window to never be focused, you may use the e.g. NoInputs flag.
bool ImGui::IsWindowNavFocusable(ImGuiWindow* window)
bool ImGui::IsWindowNavFocusable(const ImGuiWindow * window)
{
return window->Active && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus);
}
@@ -7193,7 +7193,7 @@ void ImGui::Unindent(const float indent_w)
// [SECTION] SCROLLING
//-----------------------------------------------------------------------------
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, const bool snap_on_edges)
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(const ImGuiWindow * window, const bool snap_on_edges)
{
const ImGuiContext & g = *GImGui;
ImVec2 scroll = window->Scroll;
@@ -7521,7 +7521,7 @@ bool ImGui::OpenPopupOnItemClick(const char* str_id, const int mouse_button)
return false;
}
void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, const bool restore_focus_to_window_under_popup)
void ImGui::ClosePopupsOverWindow(const ImGuiWindow * ref_window, const bool restore_focus_to_window_under_popup)
{
ImGuiContext& g = *GImGui;
if (g.OpenPopupStack.empty())
@@ -7781,7 +7781,7 @@ ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& s
return pos;
}
ImRect ImGui::GetWindowAllowedExtentRect(ImGuiWindow* window)
ImRect ImGui::GetWindowAllowedExtentRect(const ImGuiWindow * window)
{
IM_UNUSED(window);
const ImVec2 padding = GImGui->Style.DisplaySafeAreaPadding;
@@ -8096,7 +8096,7 @@ void ImGui::NavMoveRequestForward(const ImGuiDir move_dir, const ImGuiDir clip_d
g.NavWindow->NavRectRel[g.NavLayer] = bb_rel;
}
void ImGui::NavMoveRequestTryWrapping(ImGuiWindow* window, const ImGuiNavMoveFlags move_flags)
void ImGui::NavMoveRequestTryWrapping(const ImGuiWindow * window, const ImGuiNavMoveFlags move_flags)
{
const ImGuiContext & g = *GImGui;
if (g.NavWindow != window || !NavMoveRequestButNoResultYet() || g.NavMoveRequestForward != ImGuiNavForward_None || g.NavLayer != 0)
@@ -8170,7 +8170,7 @@ static inline void ImGui::NavUpdateAnyRequestFlag()
}
// This needs to be called before we submit any widget (aka in or before Begin)
void ImGui::NavInitWindow(ImGuiWindow* window, const bool force_reinit)
void ImGui::NavInitWindow(const ImGuiWindow * window, const bool force_reinit)
{
ImGuiContext& g = *GImGui;
IM_ASSERT(window == g.NavWindow);
@@ -8662,7 +8662,7 @@ static float ImGui::NavUpdatePageUpPageDown(const int allowed_dir_flags)
return 0.0f;
}
static int ImGui::FindWindowFocusIndex(ImGuiWindow* window) // FIXME-OPT O(N)
static int ImGui::FindWindowFocusIndex(const ImGuiWindow * window) // FIXME-OPT O(N)
{
ImGuiContext& g = *GImGui;
for (int i = g.WindowsFocusOrder.Size-1; i >= 0; i--)
@@ -8841,7 +8841,7 @@ static void ImGui::NavUpdateWindowing()
}
// Window has already passed the IsWindowNavFocusable()
static const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window)
static const char* GetFallbackWindowNameForWindowingList(const ImGuiWindow * window)
{
if (window->Flags & ImGuiWindowFlags_Popup)
return "(Popup)";
@@ -9384,7 +9384,7 @@ void ImGui::MarkIniSettingsDirty()
g.SettingsDirtyTimer = g.IO.IniSavingRate;
}
void ImGui::MarkIniSettingsDirty(ImGuiWindow* window)
void ImGui::MarkIniSettingsDirty(const ImGuiWindow * window)
{
ImGuiContext& g = *GImGui;
if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings))
@@ -9557,7 +9557,7 @@ static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*,
else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0);
}
static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)
static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, const ImGuiSettingsHandler * handler, ImGuiTextBuffer* buf)
{
// Gather data from windows that were active during this session
// (if a window wasn't opened in this session we preserve its settings)
@@ -9817,7 +9817,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
// - NodeTabBar
struct Funcs
{
static ImRect GetWindowRect(ImGuiWindow* window, const int rect_type)
static ImRect GetWindowRect(const ImGuiWindow * window, const int rect_type)
{
if (rect_type == WRT_OuterRect) { return window->Rect(); }
else

View File

@@ -980,7 +980,7 @@ static void ShowDemoWindowWidgets()
static char buf3[64] = ""; ImGui::InputText("hexadecimal", buf3, 64, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase);
static char buf4[64] = ""; ImGui::InputText("uppercase", buf4, 64, ImGuiInputTextFlags_CharsUppercase);
static char buf5[64] = ""; ImGui::InputText("no blank", buf5, 64, ImGuiInputTextFlags_CharsNoBlank);
struct TextFilters { static int FilterImGuiLetters(ImGuiInputTextCallbackData* data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) return 0; return 1; } };
struct TextFilters { static int FilterImGuiLetters(const ImGuiInputTextCallbackData * data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) return 0; return 1; } };
static char buf6[64] = ""; ImGui::InputText("\"imgui\" letters", buf6, 64, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters);
ImGui::Text("Password input");

View File

@@ -1247,7 +1247,7 @@ void ImDrawListSplitter::Split(ImDrawList* draw_list, const int channels_count)
}
}
static inline bool CanMergeDrawCommands(ImDrawCmd* a, ImDrawCmd* b)
static inline bool CanMergeDrawCommands(const ImDrawCmd * a, const ImDrawCmd * b)
{
return memcmp(&a->ClipRect, &b->ClipRect, sizeof(a->ClipRect)) == 0 && a->TextureId == b->TextureId && a->VtxOffset == b->VtxOffset && !a->UserCallback && !b->UserCallback;
}
@@ -1365,7 +1365,7 @@ void ImDrawData::ScaleClipRects(const ImVec2& fb_scale)
//-----------------------------------------------------------------------------
// Generic linear color gradient, write to RGB fields, leave A untouched.
void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2 gradient_p0, const ImVec2 gradient_p1, const ImU32 col0,
void ImGui::ShadeVertsLinearColorGradientKeepAlpha(const ImDrawList * draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2 gradient_p0, const ImVec2 gradient_p1, const ImU32 col0,
const ImU32 col1)
{
const ImVec2 gradient_extent = gradient_p1 - gradient_p0;
@@ -1384,7 +1384,7 @@ void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, const
}
// Distribute UV over (a, b) rectangle
void ImGui::ShadeVertsLinearUV(ImDrawList* draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, const bool clamp)
void ImGui::ShadeVertsLinearUV(const ImDrawList * draw_list, const int vert_start_idx, const int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, const bool clamp)
{
const ImVec2 size = b - a;
const ImVec2 uv_size = uv_b - uv_a;
@@ -2111,7 +2111,7 @@ void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas)
atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, 2, 2);
}
void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, const float ascent, const float descent)
void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, const ImFontConfig * font_config, const float ascent, const float descent)
{
if (!font_config->MergeMode)
{
@@ -3201,7 +3201,7 @@ static const unsigned char *stb_decompress_token(const unsigned char *i)
return i;
}
static unsigned int stb_adler32(const unsigned int adler32, unsigned char *buffer, unsigned int buflen)
static unsigned int stb_adler32(const unsigned int adler32, const unsigned char *buffer, unsigned int buflen)
{
constexpr unsigned long ADLER_MOD = 65521;
unsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;

View File

@@ -57,7 +57,7 @@ void ImGui_ImplOpenGL2_NewFrame()
ImGui_ImplOpenGL2_CreateDeviceObjects();
}
static void ImGui_ImplOpenGL2_SetupRenderState(ImDrawData* draw_data, const int fb_width, const int fb_height)
static void ImGui_ImplOpenGL2_SetupRenderState(const ImDrawData * draw_data, const int fb_width, const int fb_height)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill.
glEnable(GL_BLEND);

View File

@@ -132,7 +132,7 @@ void ImGui_ImplOpenGL3_NewFrame()
ImGui_ImplOpenGL3_CreateDeviceObjects();
}
static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, const int fb_width, const int fb_height, const GLuint vertex_array_object)
static void ImGui_ImplOpenGL3_SetupRenderState(const ImDrawData * draw_data, const int fb_width, const int fb_height, const GLuint vertex_array_object)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
glEnable(GL_BLEND);

View File

@@ -1367,7 +1367,7 @@ struct IMGUI_API ImGuiWindow
int MemoryDrawListVtxCapacity;
public:
ImGuiWindow(ImGuiContext* context, const char* name);
ImGuiWindow(const ImGuiContext * context, const char* name);
~ImGuiWindow();
ImGuiID GetID(const char* str, const char* str_end = NULL);
@@ -1493,15 +1493,15 @@ namespace ImGui
IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id);
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
IMGUI_API void FocusWindow(ImGuiWindow* window);
IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window);
IMGUI_API void FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, const ImGuiWindow * ignore_window);
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window);
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow* window);
IMGUI_API bool IsWindowChildOf(const ImGuiWindow * window, const ImGuiWindow * potential_parent);
IMGUI_API bool IsWindowNavFocusable(const ImGuiWindow * window);
IMGUI_API ImRect GetWindowAllowedExtentRect(const ImGuiWindow * window);
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);
IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);
@@ -1525,7 +1525,7 @@ namespace ImGui
// Settings
IMGUI_API void MarkIniSettingsDirty();
IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window);
IMGUI_API void MarkIniSettingsDirty(const ImGuiWindow * window);
IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name);
IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id);
IMGUI_API ImGuiWindowSettings* FindOrCreateWindowSettings(const char* name);
@@ -1578,7 +1578,7 @@ namespace ImGui
// Popups, Modals, Tooltips
IMGUI_API void OpenPopupEx(ImGuiID id);
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
IMGUI_API void ClosePopupsOverWindow(const ImGuiWindow * ref_window, bool restore_focus_to_window_under_popup);
IMGUI_API bool IsPopupOpen(ImGuiID id); // Test for id within current popup stack level (currently begin-ed into); this doesn't scan the whole popup stack!
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
@@ -1587,11 +1587,11 @@ namespace ImGui
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy = ImGuiPopupPositionPolicy_Default);
// Navigation
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
IMGUI_API void NavInitWindow(const ImGuiWindow * window, bool force_reinit);
IMGUI_API bool NavMoveRequestButNoResultYet();
IMGUI_API void NavMoveRequestCancel();
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags);
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
IMGUI_API void NavMoveRequestTryWrapping(const ImGuiWindow * window, ImGuiNavMoveFlags move_flags);
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
@@ -1695,7 +1695,7 @@ namespace ImGui
// Data type helpers
IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type);
IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* format);
IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, void* arg_1, const void* arg_2);
IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void * arg_1, const void* arg_2);
IMGUI_API bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* format);
// InputText
@@ -1713,8 +1713,8 @@ namespace ImGui
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size);
// Shade functions (write over already created vertices)
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);
IMGUI_API void ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(const ImDrawList * draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);
IMGUI_API void ShadeVertsLinearUV(const ImDrawList * draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);
// Debug Tools
inline void DebugStartItemPicker() { GImGui->DebugItemPickerActive = true; }
@@ -1724,7 +1724,7 @@ namespace ImGui
// ImFontAtlas internals
IMGUI_API bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas);
IMGUI_API void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas);
IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent);
IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, const ImFontConfig * font_config, float ascent, float descent);
IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque);
IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas);
IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor);

View File

@@ -1533,7 +1533,7 @@ void ImGui::EndCombo()
}
// Getter for the old Combo() API: const char*[]
static bool Items_ArrayGetter(void* data, const int idx, const char** out_text)
static bool Items_ArrayGetter(const void * data, const int idx, const char** out_text)
{
const auto items = (const char* const*)data;
if (out_text)
@@ -1542,7 +1542,7 @@ static bool Items_ArrayGetter(void* data, const int idx, const char** out_text)
}
// Getter for the old Combo() API: "item1\0item2\0item3\0"
static bool Items_SingleStringGetter(void* data, const int idx, const char** out_text)
static bool Items_SingleStringGetter(const void * data, const int idx, const char** out_text)
{
// FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited.
const auto items_separated_by_zeros = (const char*)data;
@@ -1709,7 +1709,7 @@ int ImGui::DataTypeFormatString(char* buf, const int buf_size, const ImGuiDataTy
return 0;
}
void ImGui::DataTypeApplyOp(const ImGuiDataType data_type, const int op, void* output, void* arg1, const void* arg2)
void ImGui::DataTypeApplyOp(const ImGuiDataType data_type, const int op, void* output, const void * arg1, const void* arg2)
{
IM_ASSERT(op == '+' || op == '-');
switch (data_type)
@@ -6349,10 +6349,10 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected,
namespace ImGui
{
static void TabBarLayout(ImGuiTabBar* tab_bar);
static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label);
static ImU32 TabBarCalcTabID(const ImGuiTabBar * tab_bar, const char* label);
static float TabBarCalcMaxTabWidth();
static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling);
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab);
static float TabBarScrollClamp(const ImGuiTabBar * tab_bar, float scrolling);
static void TabBarScrollToTab(ImGuiTabBar* tab_bar, const ImGuiTabItem * tab);
static ImGuiTabItem* TabBarScrollingButtons(ImGuiTabBar* tab_bar);
static ImGuiTabItem* TabBarTabListPopupButton(ImGuiTabBar* tab_bar);
}
@@ -6661,7 +6661,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
}
// Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack.
static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label)
static ImU32 ImGui::TabBarCalcTabID(const ImGuiTabBar * tab_bar, const char* label)
{
if (tab_bar->Flags & ImGuiTabBarFlags_DockNode)
{
@@ -6718,13 +6718,13 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
}
}
static float ImGui::TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling)
static float ImGui::TabBarScrollClamp(const ImGuiTabBar * tab_bar, float scrolling)
{
scrolling = ImMin(scrolling, tab_bar->OffsetMax - tab_bar->BarRect.GetWidth());
return ImMax(scrolling, 0.0f);
}
static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, const ImGuiTabItem * tab)
{
const ImGuiContext & g = *GImGui;
const float margin = g.FontSize * 1.0f; // When to scroll to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar)
@@ -7244,7 +7244,7 @@ float ImGui::GetColumnNormFromOffset(const ImGuiColumns* columns, const float of
static constexpr float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f;
static float GetDraggedColumnOffset(ImGuiColumns* columns, const int column_index)
static float GetDraggedColumnOffset(const ImGuiColumns * columns, const int column_index)
{
// Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing
// window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.

View File

@@ -292,7 +292,7 @@ STBRP_DEF void stbrp_init_target(stbrp_context *context, const int width, const
}
// find minimum y position if it starts at x1
static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, const int x0, const int width, int *pwaste)
static int stbrp__skyline_find_min_y(const stbrp_context *c, const stbrp_node *first, const int x0, const int width, int *pwaste)
{
const stbrp_node *node = first;
const int x1 = x0 + width;

View File

@@ -549,7 +549,7 @@ typedef struct
STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int pw, int ph, // same data as above
int char_index, // character to display
float *xpos, float *ypos, // pointers to current position in screen pixel space
float *xpos, const float *ypos, // pointers to current position in screen pixel space
stbtt_aligned_quad *q, // output: quad to draw
int opengl_fillrule); // true if opengl fill rule; false if DX9 or earlier
// Call GetBakedQuad with char_index = 'character - first_char', and it
@@ -597,7 +597,7 @@ STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, i
//
// Returns 0 on failure, 1 on success.
STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc);
STBTT_DEF void stbtt_PackEnd (const stbtt_pack_context *spc);
// Cleans up the packing context and frees all memory.
#define STBTT_POINT_SIZE(x) (-(x))
@@ -657,13 +657,13 @@ STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *spc, int s
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int ph, // same data as above
int char_index, // character to display
float *xpos, float *ypos, // pointers to current position in screen pixel space
float *xpos, const float *ypos, // pointers to current position in screen pixel space
stbtt_aligned_quad *q, // output: quad to draw
int align_to_integer);
STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);
STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects);
STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);
STBTT_DEF int stbtt_PackFontRangesGatherRects(const stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);
STBTT_DEF void stbtt_PackFontRangesPackRects(const stbtt_pack_context *spc, stbrp_rect *rects, int num_rects);
STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, const stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);
// Calling these functions in sequence is roughly equivalent to calling
// stbtt_PackFontRanges(). If you more control over the packing of multiple
// fonts, or if you want to pack custom data into a font texture, take a look
@@ -851,7 +851,7 @@ STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertice
// BITMAP RENDERING
//
STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata);
STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, const void *userdata);
// frees the bitmap allocated below
STBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff);
@@ -925,7 +925,7 @@ STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, // 1-channel bitmap
//
// Signed Distance Function (or Field) rendering
STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata);
STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, const void *userdata);
// frees the SDF bitmap allocated below
STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff);
@@ -1120,7 +1120,7 @@ static stbtt_uint8 stbtt__buf_get8(stbtt__buf *b)
return b->data[b->cursor++];
}
static stbtt_uint8 stbtt__buf_peek8(stbtt__buf *b)
static stbtt_uint8 stbtt__buf_peek8(const stbtt__buf *b)
{
if (b->cursor >= b->size)
return 0;
@@ -1276,15 +1276,15 @@ static stbtt__buf stbtt__cff_index_get(stbtt__buf b, const int i)
#define ttCHAR(p) (* (stbtt_int8 *) (p))
#define ttFixed(p) ttLONG(p)
static stbtt_uint16 ttUSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; }
static stbtt_int16 ttSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; }
static stbtt_uint32 ttULONG(stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }
static stbtt_int32 ttLONG(stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }
static stbtt_uint16 ttUSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; }
static stbtt_int16 ttSHORT(const stbtt_uint8 *p) { return p[0]*256 + p[1]; }
static stbtt_uint32 ttULONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }
static stbtt_int32 ttLONG(const stbtt_uint8 *p) { return (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3]; }
#define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3))
#define stbtt_tag(p,str) stbtt_tag4(p,str[0],str[1],str[2],str[3])
static int stbtt__isfont(stbtt_uint8 *font)
static int stbtt__isfont(const stbtt_uint8 *font)
{
// check the version number
if (stbtt_tag4(font, '1',0,0,0)) return 1; // TrueType 1
@@ -2702,7 +2702,7 @@ typedef struct stbtt__hheap
int num_remaining_in_head_chunk;
} stbtt__hheap;
static void *stbtt__hheap_alloc(stbtt__hheap *hh, const size_t size, void *userdata)
static void *stbtt__hheap_alloc(stbtt__hheap *hh, const size_t size, const void *userdata)
{
if (hh->first_free) {
void *p = hh->first_free;
@@ -2729,7 +2729,7 @@ static void stbtt__hheap_free(stbtt__hheap *hh, void *p)
hh->first_free = p;
}
static void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata)
static void stbtt__hheap_cleanup(const stbtt__hheap *hh, const void *userdata)
{
stbtt__hheap_chunk *c = hh->head;
while (c) {
@@ -2960,7 +2960,7 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e,
// the edge passed in here does not cross the vertical line at x or the vertical line at x+1
// (i.e. it has already been clipped to those)
static void stbtt__handle_clipped_edge(float *scanline, const int x, stbtt__active_edge *e, float x0, float y0, float x1, float y1)
static void stbtt__handle_clipped_edge(float *scanline, const int x, const stbtt__active_edge *e, float x0, float y0, float x1, float y1)
{
if (y0 == y1) return;
STBTT_assert(y0 < y1);
@@ -3161,7 +3161,7 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill,
}
// directly AA rasterize edges w/o supersampling
static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, const int n, const int vsubsample, const int off_x, const int off_y, void *userdata)
static void stbtt__rasterize_sorted_edges(const stbtt__bitmap *result, stbtt__edge *e, const int n, const int vsubsample, const int off_x, const int off_y, void *userdata)
{
stbtt__hheap hh = { 0, 0, 0 };
stbtt__active_edge *active = NULL;
@@ -3354,7 +3354,7 @@ typedef struct
float x,y;
} stbtt__point;
static void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, const int windings, const float scale_x, const float scale_y, const float shift_x, const float shift_y,
static void stbtt__rasterize(stbtt__bitmap *result, const stbtt__point *pts, const int *wcount, const int windings, const float scale_x, const float scale_y, const float shift_x, const float shift_y,
const int off_x, const int off_y, const int invert, void *userdata)
{
const float y_scale_inv = invert ? -scale_y : scale_y;
@@ -3485,7 +3485,7 @@ static void stbtt__tesselate_cubic(stbtt__point *points, int *num_points, const
}
// returns number of contours
static stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, const int num_verts, const float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata)
static stbtt__point *stbtt_FlattenCurves(const stbtt_vertex *vertices, const int num_verts, const float objspace_flatness, int **contour_lengths, int *num_contours, const void *userdata)
{
stbtt__point *points=0;
int num_points=0;
@@ -3576,7 +3576,7 @@ STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, const float flatness_in_pi
}
}
STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)
STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, const void *userdata)
{
STBTT_free(bitmap, userdata);
}
@@ -3687,7 +3687,7 @@ STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned ch
//
// This is SUPER-CRAPPY packing to keep source code small
static int stbtt_BakeFontBitmap_internal(unsigned char *data, const int offset, // font location (use offset=0 for plain .ttf)
static int stbtt_BakeFontBitmap_internal(const unsigned char *data, const int offset, // font location (use offset=0 for plain .ttf)
const float pixel_height, // height of font in pixels
unsigned char *pixels, const int pw, const int ph, // bitmap to be filled in
const int first_char, const int num_chars, // characters to bake
@@ -3733,7 +3733,7 @@ static int stbtt_BakeFontBitmap_internal(unsigned char *data, const int offset,
return bottom_y;
}
STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, const int opengl_fillrule)
STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, const float *ypos, stbtt_aligned_quad *q, const int opengl_fillrule)
{
const float d3d_bias = opengl_fillrule ? 0 : -0.5f;
float ipw = 1.0f / pw, iph = 1.0f / ph;
@@ -3863,7 +3863,7 @@ STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, co
return 1;
}
STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc)
STBTT_DEF void stbtt_PackEnd (const stbtt_pack_context *spc)
{
STBTT_free(spc->nodes , spc->user_allocator_context);
STBTT_free(spc->pack_info, spc->user_allocator_context);
@@ -4023,7 +4023,7 @@ static float stbtt__oversample_shift(const int oversample)
}
// rects array must be big enough to accommodate all characters in the given ranges
STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects)
STBTT_DEF int stbtt_PackFontRangesGatherRects(const stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects)
{
int i,j,k;
@@ -4081,7 +4081,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info
}
// rects array must be big enough to accommodate all characters in the given ranges
STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects)
STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, const stbtt_pack_range *ranges, const int num_ranges, stbrp_rect *rects)
{
int i,j,k, return_value = 1;
@@ -4163,7 +4163,7 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const
return return_value;
}
STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, const int num_rects)
STBTT_DEF void stbtt_PackFontRangesPackRects(const stbtt_pack_context *spc, stbrp_rect *rects, const int num_rects)
{
stbrp_pack_rects((stbrp_context *) spc->pack_info, rects, num_rects);
}
@@ -4229,7 +4229,7 @@ STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata, const
*lineGap = (float) i_lineGap * scale;
}
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, const int align_to_integer)
STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, const int pw, const int ph, const int char_index, float *xpos, const float *ypos, stbtt_aligned_quad *q, const int align_to_integer)
{
float ipw = 1.0f / pw, iph = 1.0f / ph;
const stbtt_packedchar *b = chardata + char_index;
@@ -4328,12 +4328,12 @@ static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2],
}
}
static int equal(float *a, float *b)
static int equal(const float *a, const float *b)
{
return (a[0] == b[0] && a[1] == b[1]);
}
static int stbtt__compute_crossings_x(const float x, float y, const int nverts, stbtt_vertex *verts)
static int stbtt__compute_crossings_x(const float x, float y, const int nverts, const stbtt_vertex *verts)
{
int i;
float orig[2], ray[2] = { 1, 0 };
@@ -4633,7 +4633,7 @@ STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, cons
return stbtt_GetGlyphSDF(info, scale, stbtt_FindGlyphIndex(info, codepoint), padding, onedge_value, pixel_dist_scale, width, height, xoff, yoff);
}
STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)
STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, const void *userdata)
{
STBTT_free(bitmap, userdata);
}
@@ -4644,7 +4644,7 @@ STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)
//
// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string
static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, const stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2)
static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(const stbtt_uint8 *s1, const stbtt_int32 len1, const stbtt_uint8 *s2, stbtt_int32 len2)
{
stbtt_int32 i=0;