Commit Graph

4080 Commits

Author SHA1 Message Date
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
3895363432 Merge branch 'master' into docking inc alter GetWindowResizeID
# Conflicts:
#	imgui.cpp
2019-11-18 13:58:50 +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
omar
a1e43c682a Merge branch 'master' into docking (with fixes)
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2019-11-15 15:32:36 +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
c3fd4ae473 Docking: comments 2019-11-12 11:06:02 +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
69b5c2f541 Merge branch 'master' into docking
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2019-11-08 15:45:12 +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
a704614b3e Merge branch 'master' into docking
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
#	imgui_widgets.cpp
2019-11-04 16:33:57 +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
omar
6024051a2f Viewport: Fixed 32380a0 (#2876) 2019-10-29 21:18:01 +01:00
omar
b3e94f5de8 Merge branch 'master' into docking
# Conflicts:
#	examples/imgui_impl_opengl3.cpp
#	imgui_widgets.cpp
2019-10-29 17:21:19 +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
32380a0112 Viewport: Store current dpi scale in context. 2019-10-29 16:43:11 +01:00
omar
4e56de757c Doc: Promote Discord over Discourse. Obsoleting Discourse server. 2019-10-25 15:36:37 +02:00
omar
664fb38e39 Docking: child windows don't use style.ChildRounding. 2019-10-25 11:13:51 +02:00
omar
0cbb96895a Merge branch 'master' into docking
# Conflicts:
#	examples/imgui_impl_dx12.cpp
#	imgui.cpp
#	imgui.h
#	imgui_widgets.cpp
2019-10-24 15:11: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
omar
7feccf9ab2 Merge branch 'master' into docking
# Conflicts:
#	examples/imgui_impl_dx10.cpp
#	examples/imgui_impl_dx10.h
#	examples/imgui_impl_dx11.cpp
#	examples/imgui_impl_dx11.h
#	examples/imgui_impl_dx9.cpp
#	examples/imgui_impl_dx9.h
#	examples/imgui_impl_glfw.cpp
#	examples/imgui_impl_opengl2.cpp
#	examples/imgui_impl_opengl2.h
#	examples/imgui_impl_opengl3.cpp
#	examples/imgui_impl_opengl3.h
#	imgui.cpp
2019-10-18 16:50:30 +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 bc165df6fd7969605bbc07b8a6d3d28f9109e8f3)
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
bf4880f6a2 Merge branch 'master' into docking 2019-10-07 19:14:37 +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
e0c0e53edf Merge branch 'master' into docking
# Conflicts:
#	docs/CHANGELOG.txt
2019-10-04 19:22:42 +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
6994bf10bc Merge branch 'master' into docking + fix for RenderMouseCursor()
# Conflicts:
#	docs/CHANGELOG.txt
#	examples/imgui_impl_opengl3.cpp
#	imgui.cpp
#	imgui_draw.cpp
#	imgui_internal.h
2019-09-24 17:14:51 +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
3233d85d2f Merge branch 'master' into docking 2019-09-22 22:16:11 +02:00
omar
13f00331da Docking: Added ImGuiDockNodeFlags_NoDocking flag. (#2109) 2019-09-21 14:50:02 +02:00
omar
a45e3b5bb3 Readme, Wiki: Image loading examples. 2019-09-20 19:04:19 +02:00
omar
af93c21cf9 Merge branch 'master' into docking
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2019-09-18 17:27:14 +02:00
omar
74e01e62ce Fixed unused static function warning for some compilers. (#2793) 2019-09-18 13:21:12 +02:00
omar
1ca6ff974c Viewport: fix to allow multiple shutdown / calls to DestroyPlatformWindows(). (#2769) 2019-09-17 18:02:58 +02:00
omar
575df6f192 Merge branch 'master' into docking
# Conflicts:
#	examples/imgui_impl_opengl3.cpp
#	imgui.cpp
#	imgui_draw.cpp
#	imgui_internal.h
2019-09-17 16:35:50 +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
0bdc145343 Merge branch 'master' into docking
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2019-08-31 19:19:00 +02:00
omar
d049a7988c Docking: comments for DockBuilder API. 2019-08-31 16:51:12 +02:00
omar
9e294be5c5 Docking: Fix for node created at the same time as windows that are still resizing (typically with io.ConfigDockingAlwaysTabBar) to not be zero/min sized. (#2109)
The fix delay their visibility by one frame, which is not ideal but not very problematic as the .ini data gets populated after that
2019-08-29 10:45:33 +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
a01d149369 Fixed context popup windows from not having the NoDocking flag. (#2763) 2019-08-28 10:52:17 +02:00
omar
483534b525 Internals: Using simpler ImVec2ih construct + fixed misnamed member. 2019-08-23 12:31:14 +02:00
omar
e1fca8d982 Merge branch 'master' into docking
# Conflicts:
#	imgui.cpp
#	imgui_internal.h
2019-08-23 12:21:49 +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
10a202422a Docking: Extracted some of BeginDocked() into a DockContextBindNodeToWindow() function.
Moved one of the undocking blurb to favor fast path.
(Commit intended to have no functional side effects)
2019-08-22 13:51:17 +02:00
omar
27431dcc6b Docking: fix BeginDocked() path that creates node so that SetNextWindowDockID() doesn't immediately discard the node..(#2109)
Amend 515ecbddc2, not sure at this point if the (auto_dock_node) flag was needed at all.
Comments. Exposed DockContextGenNodeID() in imgui_internal.h
2019-08-22 13:51:16 +02:00
omar
d8f9f6ba2a Viewport: Fixed issue where resize grip would display hovered (before of extruded hit rectangle) while mouse is still off the OS bounds so click would miss it and focus the OS window behind expected one. (#1542) 2019-08-22 13:51:16 +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
72090b646f Fixed incorrect assignment of IsFallbackWindow which would tag dock node host windows created in NewFrame() as such, messing with popup viewport inheritance. 2019-08-22 11:35:17 +02:00
omar
aedcd2fb1a Merge branch 'master' into docking
# Conflicts:
#	docs/CHANGELOG.txt
#	examples/imgui_impl_dx11.cpp
#	imgui.cpp
2019-08-19 21:49:53 +02:00
omar
a33cedda14 Internals: Renaming window size calc functions. 2019-08-19 21:48:52 +02:00
omar
76ccbb899d Viewport: Fix modal/popup window being stuck in unowned hidden viewport associated to fallback window without stealing it back. (#1542)
Viewport: Fix modal reference viewport when opened outside of another window.
+ Comments
2019-08-19 11:58:30 +02:00
omar
5d87ee8d82 Internals: Added function index for Viewport and Docking. Renamed a few functions. 2019-08-16 15:29:58 +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
451c756b01 Docking: Modals don't need to set ImGuiViewportFlags_NoFocusOnClick. This also mitigate the common described by #2445, which becomes particularly bad with unfocused modal. (#1542) 2019-08-01 16:23:54 -07:00
omar
3aa9aae0be Docking: Fix a crash that could occur with a malformed ini file (DockNode Parent value pointing to a missing node) 2019-08-01 15:50:05 -07:00
omar
f624455d7b Version 1.73 WIP 2019-08-01 10:57:13 -07:00
omar
967073ba3d Viewport: Handle case where host window gets moved and resized simultaneous (toggling maximized state). There's no perfect solution there, than using io.ConfigViewportsNoAutoMerge = false. (#1542) 2019-07-31 20:08:06 -07:00
omar
9bd7846f07 Internal: Made ScrollToBringRectIntoView() handle recursing back to scroll parent window, so the function can be called elsewhere (instead of 1 deep recursion done in NavUpdateMoveResult(). 2019-07-31 18:37:55 -07:00
omar
b8d8355f10 Merge branch 'master' into docking
# Conflicts:
#	docs/CHANGELOG.txt
#	imgui.cpp
2019-07-31 14:34:58 -07:00