1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-14 19:17:48 +01:00
Commit Graph

3506 Commits

Author SHA1 Message Date
Ben Carter
051ce0765e AddCircle, AddCircleFilled: Add auto-calculation of circle segment counts 2020-01-23 14:52:48 +01:00
omar
2eda3585e7 Fixed hoverable/focus bug introduced in 3fe6ae97 (#2997)
+ ArrowButtonEx() internal bits.
2020-01-22 15:20:49 +01:00
omar
3fe6ae9732 Internals: Move some Nav functions and members around (no functional change) + Misc comments 2020-01-20 18:19:03 +01:00
omar
2478dbfdb7 Disable warning C5054 introduced in VS 2019 16.2 (#2983) 2020-01-17 14:18:16 +01:00
Loïc Molinari
6c00d1916e Disable format checks when using stb_sprintf.h
STB sprintf allows extra formats like %b or %$d. If ImGui is configured
to use STB sprintf, it generates warnings with GCC and clang when using
such formats because it keeps applying default printf-style warnings.
This commit disables printf-style warnings when using STB sprintf.

Since the printf-style warnings are defined in imgui.h based on the
compiler, IMGUI_USE_STB_SPRINTF can't just be defined in the cpp file
anymore and it's been moved as a proper config in imconfig.h.
2020-01-17 13:27:51 +01:00
omar
9ad4c5da7e 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) 2020-01-16 23:44:05 +01:00
omar
f6d6880a61 Internals: Nav: PushFocusScope, PopFocusScope, GetFocusScopeID() helpers 2020-01-14 20:34:26 +01:00
omar
2ebe08be40 Focus, Nav: Merged bits from RangeSelect features to enable early manipulation of focus scope for styling purpose.
FocusScopeId is tracked by nav scoring/request and stored in result.
It's all rather WIP and we should reorganize the SetNavIDXXX functions fiasco at some point (soon?).
Didn't separate FocusScope from SelectionScope for now, will re-investigate this later, this is the minimum commit to be able to do some styling.
2020-01-14 19:25:20 +01:00
omar
e2eb0b4bc4 Internals: Begin tries to setup WindowTemp/DC members in same order as their declaration. Readme: remove Coverity banner (PVS is better) 2020-01-13 16:50:56 +01:00
omar
02c2d18aa3 Internals: Renaming and marking of legacy focus/tabbing system 2020-01-13 15:21:37 +01:00
omar
52334ad8df Internals: Minor ordering/comments of ImGuiWindowTempData. 2020-01-13 15:04:28 +01:00
omar
ff5299e0e0 Docs: FAQ, Comments. 2020-01-12 22:09:18 +01:00
Rokas Kupstys
97a8dc6514 CI: Added PVS-Studio static analysis on the continuous-integration server. 2020-01-10 16:58:39 +01:00
Rokas Kupstys
ae1e3619f6 Disable some PVS studio warnings.
V1048: While they are technically correct we want to emphasize assigned values must remain same.
2020-01-10 15:20:08 +01:00
omar
f9630e60c5 Metrics: Fix not being able to expand "ParentWindow" when parent window is same as root window. 2020-01-07 21:32:00 +01:00
omar
d581939387 Removed trailing spaces. 2020-01-06 15:24:16 +01:00
omar
22d7f26e06 Tweak wording
Remove Patreon
2020-01-06 12:55:01 +01:00
omar
854fc08194 Amend f70204f2 to facilitate merges. 2019-12-20 16:34:07 +01:00
omar
f70204f2f4 Minor bits, placeholder aimed at facilitating merging of Tables branch into Docking 2019-12-19 16:53:44 +01:00
omar
a610f1da52 Bezier Tweaks, fixed parameter order of 3831d50 2019-12-17 16:43:05 +01:00
Rokas Kupstys
3831d50ab9 Add ImBezierClosestPoint() function which returns a point on bezier curve which is closed to a specified point. 2019-12-17 16:22:02 +01:00
omar
9d444062f9 Limiting Columns()/BeginColumns() api to 64 columns (#125)
While the current code technically supports it, future code may not so we're putting the restriction ahead.
2019-12-17 13:25:46 +01:00
omar
10fdc03a46 Clarification about Im helpers + moving GetColorXXX functions outside of that block. 2019-12-17 13:19:36 +01:00
omar
43bd80a40d Internals: Breaking: ImRect() default constructor initializes all fields with 0.0f
Instead of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). Previous behavior was designed for adding into a bounding box but rarely relied on and not worth it.
2019-12-13 11:56:00 +01:00
omar
6fdde67be2 Documentation, FAQ, todo tweaks 2019-12-10 13:37:29 +01:00
omar
f9c26d23de Removed redirecting functions/enums that were marked obsolete in 1.53 (December 2017).
Comments
2019-12-08 16:38:27 +01:00
Ben Carter
697f15e339 Added PrimUnreserve() API. Obsoleted calling ImDrawList::PrimReserve() with a negative count. 2019-12-08 16:06:32 +01:00
omar
f656e7775e Inputs: Added ImGuiMouseButton enum for convenience (e.g. ImGuiMouseButton_Right=1).
We forever guarantee that the existing value will not changes so existing code is free to use 0/1/2.
2019-12-06 16:29:36 +01:00
omar
6cbed03d4a Comments, clarified mouse button ordering. 2019-12-06 16:29:32 +01:00
omar
b521cd357d Removed implicit default parameter to IsMouseDragging(int button = 0) to be consistent with other mouse functions.
(none of the other functions have it).
2019-12-05 18:33:36 +01:00
omar
8342e5b91a Amend previous commits (added ImGuiMouseCursor_NotAllowed enum + new cursors in GLFW 3.4)
Amend b5cad20d79, 945a509773
+ unrelated minor typos
2019-12-05 15:45:30 +01:00
omar
abaf0256b8 Version 1.75 WIP
Added message to font file loading assert.
2019-11-28 20:58:16 +01:00
omar
bdce833636 Version 1.74 2019-11-25 18:38:53 +01:00
omar
26d177bc03 Docs: Moved misc/fonts/README.txt to docs/FONTS.txt. + tweaks 2019-11-25 18:29:28 +01:00
omar
bbe0409942 Metrics: Show wire-frame mesh and approximate surface area when hovering ImDrawCmd. Amend aeb5795.
Internals: Added ImTriangleArea()
2019-11-25 12:01:04 +01:00
Ben Carter
aeb57952d6 Added area calculation for draw lists in metrics
Added ability to hover over a draw list's summary stats and see all the contents in wireframe

(cherry picked from commit fd808347bd68a07ad318af6c151028bc9f7b82e7)
2019-11-25 11:10:00 +01:00
omar
51e2e9b239 ImVector: Added shrink() helper. ImFont::RenderText minor optimisation for debug build. Misc: Metrics shows tab names because we now have them. 2019-11-22 14:06:51 +01:00
omar
51a02b319c Added IM_UNICODE_CODEPOINT_MAX. Changed specs of ImFontAtlas::AddCustomRectRegular() (breaking change). 2019-11-21 14:13:17 +01:00
omar
ca63349eb4 Renamed XX-bits -> XX-bit in comments to match what the world appears to be using. 2019-11-20 11:58:25 +01:00
omar
a899c1e570 Internals: Using ImU64 for internal ImFile api so we can later wrap them to fseeko/ftello//_fseeki64/_ftelli64 (#2734) 2019-11-20 10:40:14 +01:00
omar
ecbedc8c26 Tweaks, ammend 93efa54, rename to IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS (#1038) 2019-11-19 21:29:12 +01:00
omar
4e90906b04 Added IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS / IMGUI_DISABLE_FILE_FUNCTIONS #2734)
Using in Emscripten example.
2019-11-19 21:14:44 +01:00
omar
93efa5415f Renamed IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS to IMGUI_DISABLE_DEFAULT_FORMAT_STRING_FUNCTIONS. (#1038)
Renamed IMGUI_DISABLE_MATH_FUNCTIONS to IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS.
2019-11-19 20:53:17 +01:00
omar
9efaf2828b Doc comments. Removed .ini parsing code from 1.53 that parsed entries without the [Window] tag (which enabled importing an old .ini file) 2019-11-19 19:39:46 +01:00
omar
7e232092a6 Internals: Added GetWindowResizeID(), renamed GetScrollbarID() to GetWindowScrollbarID(). Using integer for resize ID so they matches regardless of the pointer size.
Internals: Renamed IMGUI_USER_ERROR to IM_ASSERT_USER_ERROR().
2019-11-15 16:59:43 +01:00
Tracy Ma
8f40020ca6 Disable Win32 clipboard and IME functions when build target UWP (#2892, #2895) 2019-11-15 12:19:44 +01:00
omar
b23dcab6e1 Fix 25eee91 incorrect assert when ending a child-popup (rarely used but used by sub-nenus) 2019-11-14 16:06:39 +01:00
omar
be436e2b0b Fix HelpMarker() symbol collision for unity builds (#2893) 2019-11-13 22:04:16 +01:00
omar
03852470de Internals: Routing recoverable user errors via IMGUI_USER_ERROR() macro. (#1651) 2019-11-13 21:58:18 +01:00
omar
25eee91542 Error handling: Assert if user mistakenly calls End() instead of EndChild() on a child window. (#1651)
Internals: Moved some error handling code.
2019-11-13 21:51:38 +01:00
omar
b138f8cbcd Internal: Nav rename preparing for nav inputs ownership changes. IsNavInputPressed() -> IsNavInputTest() 2019-11-13 21:02:25 +01:00
omar
7c441e37fa CI: Update jobs to MacOS latest (Catalina)
Metrics: Added description to Item Picker.
2019-11-13 20:34:55 +01:00
omar
6e8e2c0fa9 Scrollbar: Fixed an issue where scrollbars wouldn't display on the frame following a frame where all child window contents would be culled.
Demo: Fixed a small bug with scrolling demo.
Metrics: Tweaks.
2019-11-08 19:01:54 +01:00
omar
57dc34f4e8 TreeNode: Added IsItemToggledOpen() to explicitly query if item was just open/closed, facilitating interactions with custom multi-selections patterns. (#1896, #1861) 2019-11-08 15:30:15 +01:00
omar
d003674f2c Internals: Added ImChunkStream, used by window settings. (more generic followup to 4c13807, the class will be used more extensively by Tables) 2019-11-07 16:05:03 +01:00
omar
a337e219b6 Internals: ImPool: Renaming. 2019-11-07 16:04:51 +01:00
omar
28f1d60de1 Internals: Renaming + added ImStrSkipBlank() from docking branch.
(cherry picked from commit a573943fa0ce323ffb4080e57f5e8fe1bc777c36)
2019-11-06 23:37:35 +01:00
omar
4c13807b7d Misc: Optimized storage of window settings data (reducing allocation count). 2019-11-05 22:43:53 +01:00
omar
792a8631aa Metrics: Expose basic details of each window key/value state storage. 2019-10-31 14:01:35 +01:00
omar
8fee5a4349 Internals: Renaming for consistency. 2019-10-31 11:15:40 +01:00
omar
d62a413476 Misc: Windows: Do not use _wfopen() if IMGUI_DISABLE_WIN32_FUNCTIONS is defined. (#2815) 2019-10-29 21:47:43 +01:00
Rokas Kupstys
c863c1f6a1 Clean up number rounding. Now it is more obvious what code is doing. (#2862)
Add IM_ROUND() macro
Replace IM_FLOOR(n + 0.5f) and ImFloor(n + 0.5f) with IM_ROUND(n)
2019-10-29 17:05:25 +01:00
omar
4e56de757c Doc: Promote Discord over Discourse. Obsoleting Discourse server. 2019-10-25 15:36:37 +02:00
omar
ec0e953cca Fixed a couple of subtle bounding box vertical positioning issues relating to text baseline alignment.
The issue would generally manifest when laying out multiple items on a same line, with varying heights and text baseline offsets. (#2833)
Some specific examples, e.g. a button with regular frame padding followed by another item with a multi-line label and no frame padding, such as: multi-line text, small button, tree node item, etc. The second item was correctly offset to match text baseline, and would interact/display correctly,but it wouldn't push the contents area boundary low enough.
Note: previously the second parameter to ItemSize() was 0.0f was default, now -1.0f to signify "no text baseline offset request". If you have code using ItemSize() with an hardcoded zero you may need to change it. (+1 squashed commits)
2019-10-23 18:05:44 +02:00
omar
23c1ff4907 Removed redirecting functions/enums names that were marked obsolete in 1.52 (October 2017).
- Begin() [old 5 args version]     -> use Begin() [3 args], use SetNextWindowSize() SetNextWindowBgAlpha() if needed
- IsRootWindowOrAnyChildHovered()  -> use IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows)
- AlignFirstTextHeightToWidgets()  -> use AlignTextToFramePadding();
- SetNextWindowPosCenter()         -> use SetNextWindowPos() with a pivot of (0.5f, 0.5f)
- ImFont::Glyph                    -> use ImFontGlyph
If you were still using the old names, read "API Breaking Changes" section of imgui.cpp to find out the new names or equivalent features, or see how they were implemented until 1.73.
2019-10-22 14:45:11 +02:00
Rokas Kupstys
714fe29d1a Replace manual flooring with IM_FLOOR() macro. (#2850)
Macro is used to ensure that flooring operation is always inlined even in debug builds. __forceinline does not force inlining in /Od builds with MSVC.

(cherry picked from commit bc165df6fd)
2019-10-18 16:18:38 +02:00
omar
53278be61f FAQ, Readme. Use = {} instead of = { 0 }, wasn't problematic because they were all static variables or one stack array not read. But hey. 2019-10-18 16:18:05 +02:00
omar
5fc427a49e Improved and moved FAQ to docs/FAQ.md so it can be readable on the web. (#2848) 2019-10-16 11:04:00 +02:00
Rokas Kupstys
6892b81578 Remove trailing spaces from bunch of files.
(cherry picked from commit 50e0f8d4ddf4c426f62f346c8260a927f6b7c779)
2019-10-15 16:04:02 +02:00
omar
c21fdabb43 Doc: Readme: moving contents to FAQ. 2019-10-15 14:21:44 +02:00
omar
a41f0b2df4 Inputs: Fixed a miscalculation in the keyboard/mouse "typematic" repeat delay/rate calculation, used by keys and e.g. repeating mouse buttons as well as the GetKeyPressedAmount() function.
IMPORTANT: Renamed internal CalcTypematicPressedRepeatAmount to CalcTypematicRepeatAmount and reordered the t1, t0 arguments to t0, t1 !!
If you were using a non-default value for io.KeyRepeatRate (previous default was 0.250), you can add +io.KeyRepeatDelay to it to compensate for the fix.  The function was triggering on: 0.0 and (delay+rate*N) where (N>=1). Fixed formula responds to (N>=0).
Effectively it made io.KeyRepeatRate behave like it was set to (io.KeyRepeatRate + io.KeyRepeatDelay).
Fixed the code and altered default io.KeyRepeatRate,Delay from 0.250,0.050 to 0.300,0.050 to compensate.
If you never altered io.KeyRepeatRate nor used GetKeyPressedAmount() this won't affect you.
2019-10-14 23:07:06 +02:00
omar
67e4cd5cc6 Comments, some logging for NavInitRequest debugging Moved OpenPopupOnItemClick() next to BeginPopupContextItem() 2019-10-14 15:54:11 +02:00
omar
73fa6509a5 Internal: InputTextEx: tweaked a bit of code (should be a no-op) 2019-10-05 16:57:12 +02:00
omar
a6c3be4bda Internals: Tweaks to ItemSize() should be harmless. Added DebugDrawItemRect() helper. 2019-10-03 18:30:41 +02:00
omar
892dfb1dea InputText, Nav: Fixed Home/End key broken when activating Keyboard Navigation. (#787)
Small refactor of ActiveIdUsingXXX inputs flags toward a little more consistent system. (#2637)
2019-10-02 15:57:36 +02:00
omar
0dad3f436b Fix harmless float calculation overflow. (#2813) 2019-09-30 15:16:30 +02:00
omar
c262276988 Version 1.74 WIP 2019-09-30 14:27:56 +02:00
omar
d5efe16157 Version 1.73 2019-09-24 17:02:26 +02:00
omar
ca858c084b Demo tweaks. Comments. Compacting the rarely used AutoFitXXX fields in ImGuiWindowTempData. 2019-09-23 20:15:25 +02:00
omar
52deb415e0 Internal: Refactored internal RenderMouseCursor so colors can be specified. (#2614) 2019-09-23 14:53:49 +02:00
omar
25849234f6 Internal: Tree: tweaks (initially tried to implement auto-scrolling, stashed) 2019-09-23 13:11:38 +02:00
omar
a45e3b5bb3 Readme, Wiki: Image loading examples. 2019-09-20 19:04:19 +02:00
omar
74e01e62ce Fixed unused static function warning for some compilers. (#2793) 2019-09-18 13:21:12 +02:00
omar
b48dc067ae Style: Allow style.WindowMenuButtonPosition to be set to ImGuiDir_None to hide the collapse button. (#2634, #2639)
+ Fix #2775
2019-09-17 16:33:15 +02:00
omar
3b014d0c31 Merge branch 'features/ellipsis_rendering'
# Conflicts:
#	imgui.cpp
2019-09-17 12:07:30 +02:00
omar
7d5a17e5e4 Remove trailing spaces (grep for ' \r?$' in visual studio) 2019-09-17 11:33:18 +02:00
omar
1c951dca97 Font: Narrow ellipsis: once we know an ellipsis is going to be drawn, we can claim the space between pos_max.x and ellipsis_max.x which gives us enough extra space to not requires the further (and otherwise valid) optimizations. Gets us vastly simplified code, yay. (#2775) 2019-09-17 11:14:46 +02:00
omar
57623c15dd Font: Narrow ellipsis: various minor stylistic tweaks (#2775) 2019-09-17 11:13:34 +02:00
Rokas Kupstys
45405f0dc9 Font: implement a way to draw narrow ellipsis without relying on hardcoded 1 pixel dots. (#2775)
This changeset implements several pieces of the puzzle that add up to a narrow ellipsis rendering.

## EllipsisCodePoint

`ImFontConfig` and `ImFont` received `ImWchar EllipsisCodePoint = -1;` field. User may configure `ImFontConfig::EllipsisCodePoint` a unicode codepoint that will be used for rendering narrow ellipsis. Not setting this field will automatically detect a suitable character or fall back to rendering 3 dots with minimal spacing between them. Autodetection prefers codepoint 0x2026 (narrow ellipsis) and falls back to 0x0085 (NEXT LINE) when missing. Wikipedia indicates that codepoint 0x0085 was used as ellipsis in some older windows fonts. So does default Dear ImGui font. When user is merging fonts - first configured and present ellipsis codepoint will be used, ellipsis characters from subsequently merged fonts will be ignored.

## Narrow ellipsis

Rendering a narrow ellipsis is surprisingly not straightforward task. There are cases when ellipsis is bigger than the last visible character therefore `RenderTextEllipsis()` has to hide last two characters. In a subset of those cases ellipsis is as big as last visible character + space before it. `RenderTextEllipsis()` tries to work around this case by taking free space between glyph edges into account. Code responsible for this functionality is within `if (text_end_ellipsis != text_end_full) { ... }`.

## Fallback (manually rendered dots)

There are cases when font does not have ellipsis character defined. In this case RenderTextEllipsis() falls back to rendering ellipsis as 3 dots, but with reduced spacing between them. 1 pixel space is used in all cases. This results in a somewhat wider ellipsis, but avoids issues where spaces between dots are uneven (visible in larger/monospace fonts) or squish dots way too much (visible in default font where dot is essentially a pixel). This fallback method obsoleted `RenderPixelEllipsis()` and this function was removed. Note that fallback ellipsis will always be somewhat wider than it could be, however it will fit in visually into every font used unlike what `RenderPixelEllipsis()` produced.
2019-09-17 11:13:07 +02:00
Qix
561e7dd490 Fix signed types warning in pasteboard handler (#2786) 2019-09-17 16:21:09 +09:00
omar
b05f6f6f50 Nav, Scrolling: Added support for Home/End key. (#787) 2019-09-16 19:01:40 +02:00
omar
bfcdaeb610 Disable with ConfigWindowsMemoryCompactTimer < 0.0f (#2636) 2019-08-28 20:30:36 +02:00
omar
62f75c7fb1 Added a mechanism to compact/free the larger allocations of unused windows (buffers are compacted when a window is unused for 60 seconds, as per io.ConfigWindowsMemoryCompactTimer = 60.0f). Note that memory usage has never been reported as a problem, so this is merely a touch of overzealous luxury. (#2636) 2019-08-28 20:28:36 +02:00
omar
cb538fadfe Internals: Storing settings using ImVec2ih to match what we are doing with dock node. + removed ImMax from reading Size value (done in Begin) + removed seemingly unnecessary FLT_MAX compare in SettingsHandlerWindow_WriteAll.
About: Added backquote to text copied into clipboard so it doesn't mess up with github formatting when pasted.
2019-08-23 12:02:52 +02:00
omar
3fb5cf3541 Using offsetof() when available in C++11. Avoids Clang sanitizer complaining about old-style macros. (#94) 2019-08-22 16:55:42 +02:00
omar
c4b0bf718a More typos in comments (#2738) 2019-08-22 11:40:37 +02:00
omar
a856c670c1 TabBar: fixed single-tab not shrinking their width down.
+ minor typo fixes (#2738)
2019-08-22 11:38:58 +02:00
omar
a33cedda14 Internals: Renaming window size calc functions. 2019-08-19 21:48:52 +02:00
omar
9fce278918 ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
Note that some elements won't accurately fade down with the same intensity, and the color wheel when enabled will have small overlap glitches with (style.Alpha < 1.0).
2019-08-16 11:46:11 +02:00
omar
f624455d7b Version 1.73 WIP 2019-08-01 10:57:13 -07:00