|
@@ -1,4 +1,4 @@
|
1
|
|
-// ImGui library v1.20
|
|
1
|
+// ImGui library v1.21 wip
|
2
|
2
|
// See ImGui::ShowTestWindow() for sample code.
|
3
|
3
|
// Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
|
4
|
4
|
// Get latest version at https://github.com/ocornut/imgui
|
|
@@ -197,11 +197,13 @@
|
197
|
197
|
- window: fix resize grip rendering scaling along with Rounding style setting
|
198
|
198
|
- window: autofit feedback loop when user relies on any dynamic layout (window width multiplier, column). maybe just clearly drop manual autofit?
|
199
|
199
|
- window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list.
|
|
200
|
+ - window: allow resizing of child windows (possibly given min/max for each axis?)
|
|
201
|
+ - window: resizing from any sides? + mouse cursor directives for app.
|
200
|
202
|
- widgets: switching from "widget-label" to "label-widget" would make it more convenient to integrate widgets in trees
|
201
|
203
|
- widgets: clip text? hover clipped text shows it in a tooltip or in-place overlay
|
202
|
|
- - widgets: IsItemHovered() returns true even if mouse is active on another widget (e.g. dragging outside of sliders). Maybe not a sensible default? Add parameter or alternate function?
|
203
|
|
- - main: make IsHovered() more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
204
|
|
- - main: make IsHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
|
204
|
+ - main: IsItemHovered() returns true even if mouse is active on another widget (e.g. dragging outside of sliders). Maybe not a sensible default? Add parameter or alternate function?
|
|
205
|
+ - main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
|
206
|
+ - main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
205
|
207
|
- scrollbar: use relative mouse movement when first-clicking inside of scroll grab box.
|
206
|
208
|
- scrollbar: make the grab visible and a minimum size for long scroll regions
|
207
|
209
|
!- input number: very large int not reliably supported because of int<>float conversions.
|
|
@@ -210,7 +212,7 @@
|
210
|
212
|
- input number: use mouse wheel to step up/down
|
211
|
213
|
- input number: non-decimal input.
|
212
|
214
|
- layout: horizontal layout helper (github issue #97)
|
213
|
|
- - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 horrible layout code. item width should include frame padding.
|
|
215
|
+ - layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
|
214
|
216
|
- columns: separator function or parameter that works within the column (currently Separator() bypass all columns)
|
215
|
217
|
- columns: declare column set (each column: fixed size, %, fill, distribute default size among fills)
|
216
|
218
|
- columns: columns header to act as button (~sort op) and allow resize/reorder
|
|
@@ -224,13 +226,15 @@
|
224
|
226
|
- file selection widget -> build the tool in our codebase to improve model-dialog idioms (may or not lead to ImGui changes)
|
225
|
227
|
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
226
|
228
|
- slider: initial absolute click is imprecise. change to relative movement slider? hide mouse cursor, allow more precise input using less screen-space.
|
227
|
|
- - text edit: clean up the horrible mess caused by converting UTF-8 <> wchar
|
|
229
|
+ - text edit: clean up the mess caused by converting UTF-8 <> wchar
|
228
|
230
|
- text edit: centered text for slider or input text to it matches typical positioning.
|
229
|
231
|
- text edit: flag to disable live update of the user buffer.
|
230
|
232
|
- text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
231
|
233
|
- text edit: add multi-line text edit
|
232
|
234
|
- settings: write more decent code to allow saving/loading new fields
|
233
|
235
|
- settings: api for per-tool simple persistent data (bool,int,float) in .ini file
|
|
236
|
+ - style: checkbox: padding for "active" color should be a multiplier of the
|
|
237
|
+ - style: colorbox not always square?
|
234
|
238
|
- log: LogButtons() options for specifying depth and/orhiding depth slider
|
235
|
239
|
- log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
|
236
|
240
|
- log: be able to right-click and log a window or tree-node into tty/file/clipboard / generalized context menu?
|
|
@@ -244,14 +248,13 @@
|
244
|
248
|
- tooltip: move to fit within screen (e.g. when mouse cursor is right of the screen).
|
245
|
249
|
- clipboard: automatically transform \n into \n\r or equivalent for higher compatibility on windows
|
246
|
250
|
- portability: big-endian test/support (github issue #81)
|
247
|
|
- - examples: add History support in the demo console application (pertinent to github issue #68).
|
|
251
|
+ - misc: rounded triangle fail to draw correctly on OpenGL3 example.
|
248
|
252
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
249
|
253
|
- misc: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
250
|
|
- - style editor: add a button to output C code.
|
|
254
|
+ - style editor: color child window height expressed in multiple of line height.
|
251
|
255
|
- optimization/render: use indexed rendering to reduce vertex data cost (for remote/networked imgui)
|
252
|
256
|
- optimization/render: move clip-rect to vertex data? would allow merging all commands
|
253
|
257
|
- optimization/render: merge command-lists with same clip-rect into one even if they aren't sequential? (as long as in-between clip rectangle don't overlap)?
|
254
|
|
- - optimization/render: font exported by bmfont is not tight fit on vertical axis, incur unneeded pixel-shading cost.
|
255
|
258
|
- optimization: turn some the various stack vectors into statically-sized arrays
|
256
|
259
|
- optimization: better clipping for multi-component widgets
|
257
|
260
|
- optimization: specialize for height based clipping first (assume widgets never go up + height tests before width tests?)
|
|
@@ -346,9 +349,10 @@ ImGuiStyle::ImGuiStyle()
|
346
|
349
|
{
|
347
|
350
|
Alpha = 1.0f; // Global alpha applies to everything in ImGui
|
348
|
351
|
WindowPadding = ImVec2(8,8); // Padding within a window
|
349
|
|
- WindowMinSize = ImVec2(48,48); // Minimum window size
|
|
352
|
+ WindowMinSize = ImVec2(32,32); // Minimum window size
|
350
|
353
|
WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
351
|
354
|
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
|
355
|
+ FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
352
|
356
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
353
|
357
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
354
|
358
|
TouchExtraPadding = ImVec2(0,0); // Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
|
|
@@ -1180,18 +1184,32 @@ bool ImGuiTextFilter::PassFilter(const char* val) const
|
1180
|
1184
|
|
1181
|
1185
|
//-----------------------------------------------------------------------------
|
1182
|
1186
|
|
|
1187
|
+// On some platform vsnprintf() takes va_list by reference and modifies it.
|
|
1188
|
+// va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it.
|
|
1189
|
+#ifndef va_copy
|
|
1190
|
+#define va_copy(dest, src) (dest = src)
|
|
1191
|
+#endif
|
|
1192
|
+
|
1183
|
1193
|
// Helper: Text buffer for logging/accumulating text
|
1184
|
1194
|
void ImGuiTextBuffer::appendv(const char* fmt, va_list args)
|
1185
|
1195
|
{
|
|
1196
|
+ va_list args_copy;
|
|
1197
|
+ va_copy(args_copy, args);
|
|
1198
|
+
|
1186
|
1199
|
int len = vsnprintf(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.
|
1187
|
1200
|
if (len <= 0)
|
1188
|
1201
|
return;
|
|
1202
|
+
|
1189
|
1203
|
const size_t write_off = Buf.size();
|
|
1204
|
+ const size_t needed_sz = write_off + (size_t)len;
|
1190
|
1205
|
if (write_off + (size_t)len >= Buf.capacity())
|
1191
|
|
- Buf.reserve(Buf.capacity() * 2);
|
|
1206
|
+ {
|
|
1207
|
+ const size_t double_capacity = Buf.capacity() * 2;
|
|
1208
|
+ Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity);
|
|
1209
|
+ }
|
1192
|
1210
|
|
1193
|
|
- Buf.resize(write_off + (size_t)len);
|
1194
|
|
- ImFormatStringV(&Buf[write_off] - 1, (size_t)len+1, fmt, args);
|
|
1211
|
+ Buf.resize(needed_sz);
|
|
1212
|
+ ImFormatStringV(&Buf[write_off] - 1, (size_t)len+1, fmt, args_copy);
|
1195
|
1213
|
}
|
1196
|
1214
|
|
1197
|
1215
|
void ImGuiTextBuffer::append(const char* fmt, ...)
|
|
@@ -1835,6 +1853,7 @@ static void LogText(const ImVec2& ref_pos, const char* text, const char* text_en
|
1835
|
1853
|
const int tree_depth = (window->DC.TreeDepth - g.LogStartDepth);
|
1836
|
1854
|
while (true)
|
1837
|
1855
|
{
|
|
1856
|
+ // Split the string. Each new line (after a '\n') is followed by spacing corresponding to the current depth of our log entry.
|
1838
|
1857
|
const char* line_end = text_remaining;
|
1839
|
1858
|
while (line_end < text_end)
|
1840
|
1859
|
if (*line_end == '\n')
|
|
@@ -2141,7 +2160,9 @@ int ImGui::GetFrameCount()
|
2141
|
2160
|
|
2142
|
2161
|
void ImGui::BeginTooltip()
|
2143
|
2162
|
{
|
2144
|
|
- ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), 0.9f, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_Tooltip);
|
|
2163
|
+ ImGuiState& g = GImGui;
|
|
2164
|
+ ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_Tooltip;
|
|
2165
|
+ ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), g.Style.Colors[ImGuiCol_TooltipBg].w, window_flags);
|
2145
|
2166
|
}
|
2146
|
2167
|
|
2147
|
2168
|
void ImGui::EndTooltip()
|
|
@@ -2291,11 +2312,13 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2291
|
2312
|
g.CurrentWindow = window;
|
2292
|
2313
|
|
2293
|
2314
|
// Process SetNextWindow***() calls
|
|
2315
|
+ bool window_pos_set_by_api = false;
|
2294
|
2316
|
if (g.SetNextWindowPosCond)
|
2295
|
2317
|
{
|
2296
|
2318
|
const ImVec2 backup_cursor_pos = window->DC.CursorPos;
|
2297
|
2319
|
ImGui::SetWindowPos(g.SetNextWindowPosVal, g.SetNextWindowPosCond);
|
2298
|
2320
|
window->DC.CursorPos = backup_cursor_pos;
|
|
2321
|
+ window_pos_set_by_api = true;
|
2299
|
2322
|
g.SetNextWindowPosCond = 0;
|
2300
|
2323
|
}
|
2301
|
2324
|
if (g.SetNextWindowSizeCond)
|
|
@@ -2333,16 +2356,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2333
|
2356
|
|
2334
|
2357
|
// New windows appears in front
|
2335
|
2358
|
if (window->LastFrameDrawn < current_frame - 1)
|
2336
|
|
- {
|
2337
|
2359
|
FocusWindow(window);
|
2338
|
|
- if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
2339
|
|
- {
|
2340
|
|
- // Hide for 1 frame while resizing
|
2341
|
|
- window->AutoFitFrames = 2;
|
2342
|
|
- window->AutoFitOnlyGrows = false;
|
2343
|
|
- window->Visible = false;
|
2344
|
|
- }
|
2345
|
|
- }
|
2346
|
2360
|
|
2347
|
2361
|
window->LastFrameDrawn = current_frame;
|
2348
|
2362
|
window->ClipRectStack.resize(0);
|
|
@@ -2386,26 +2400,26 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2386
|
2400
|
}
|
2387
|
2401
|
}
|
2388
|
2402
|
|
2389
|
|
- // Tooltips always follow mouse
|
2390
|
|
- if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
|
2403
|
+ // Tooltips always follows mouse
|
|
2404
|
+ if (!window_pos_set_by_api && (window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
2391
|
2405
|
{
|
2392
|
2406
|
window->PosFloat = g.IO.MousePos + ImVec2(32,16) - style.FramePadding*2;
|
2393
|
2407
|
}
|
2394
|
2408
|
|
2395
|
2409
|
// Clamp into view
|
2396
|
|
- if (!(window->Flags & ImGuiWindowFlags_ChildWindow))
|
|
2410
|
+ if (!(window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Tooltip))
|
2397
|
2411
|
{
|
2398
|
|
- const ImVec2 pad = ImVec2(window->FontSize()*2.0f, window->FontSize()*2.0f);
|
|
2412
|
+ const ImVec2 pad = ImVec2(window->FontSize()*2.0f, window->FontSize()*2.0f); // FIXME: Parametrize of clarify this behavior.
|
2399
|
2413
|
if (g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.
|
2400
|
2414
|
{
|
2401
|
2415
|
window->PosFloat = ImMax(window->PosFloat + window->Size, pad) - window->Size;
|
2402
|
2416
|
window->PosFloat = ImMin(window->PosFloat, ImVec2(g.IO.DisplaySize.x, g.IO.DisplaySize.y) - pad);
|
2403
|
2417
|
}
|
2404
|
|
- window->SizeFull = ImMax(window->SizeFull, pad);
|
|
2418
|
+ window->SizeFull = ImMax(window->SizeFull, style.WindowMinSize);
|
2405
|
2419
|
}
|
2406
|
2420
|
window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y);
|
2407
|
2421
|
|
2408
|
|
- // Default item width
|
|
2422
|
+ // Default item width. Make it proportional to window size if window manually resizes
|
2409
|
2423
|
if (window->Size.x > 0.0f && !(window->Flags & ImGuiWindowFlags_Tooltip) && !(window->Flags & ImGuiWindowFlags_AlwaysAutoResize))
|
2410
|
2424
|
window->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f);
|
2411
|
2425
|
else
|
|
@@ -2467,11 +2481,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2467
|
2481
|
ImU32 resize_col = 0;
|
2468
|
2482
|
if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
2469
|
2483
|
{
|
2470
|
|
- // Tooltip always resize
|
2471
|
|
- if (window->AutoFitFrames > 0)
|
2472
|
|
- {
|
2473
|
|
- window->SizeFull = window->SizeContentsFit + style.WindowPadding - ImVec2(0.0f, style.ItemSpacing.y);
|
2474
|
|
- }
|
|
2484
|
+ // Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.
|
|
2485
|
+ const ImVec2 size_auto_fit = window->SizeContentsFit + style.WindowPadding - ImVec2(0.0f, style.ItemSpacing.y);
|
|
2486
|
+ window->SizeFull = size_auto_fit;
|
2475
|
2487
|
}
|
2476
|
2488
|
else
|
2477
|
2489
|
{
|
|
@@ -2493,7 +2505,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2493
|
2505
|
}
|
2494
|
2506
|
else if (!(window->Flags & ImGuiWindowFlags_NoResize))
|
2495
|
2507
|
{
|
2496
|
|
- // Resize grip
|
|
2508
|
+ // Manual resize grip
|
2497
|
2509
|
const ImGuiAabb resize_aabb(window->Aabb().GetBR()-ImVec2(18,18), window->Aabb().GetBR());
|
2498
|
2510
|
const ImGuiID resize_id = window->GetID("##RESIZE");
|
2499
|
2511
|
bool hovered, held;
|
|
@@ -2502,7 +2514,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2502
|
2514
|
|
2503
|
2515
|
if (g.HoveredWindow == window && held && g.IO.MouseDoubleClicked[0])
|
2504
|
2516
|
{
|
2505
|
|
- // Manual auto-fit
|
|
2517
|
+ // Manual auto-fit when double-clicking
|
2506
|
2518
|
window->SizeFull = size_auto_fit;
|
2507
|
2519
|
window->Size = window->SizeFull;
|
2508
|
2520
|
if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings))
|
|
@@ -2518,7 +2530,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2518
|
2530
|
}
|
2519
|
2531
|
}
|
2520
|
2532
|
|
2521
|
|
- // Update aabb immediately so that the rendering below isn't one frame late
|
|
2533
|
+ // Update aabb immediately so that rendering right below us isn't one frame late
|
2522
|
2534
|
title_bar_aabb = window->TitleBarAabb();
|
2523
|
2535
|
}
|
2524
|
2536
|
|
|
@@ -2527,6 +2539,8 @@ bool ImGui::Begin(const char* name, bool* p_opened, ImVec2 size, float fill_alph
|
2527
|
2539
|
{
|
2528
|
2540
|
if ((window->Flags & ImGuiWindowFlags_ComboBox) != 0)
|
2529
|
2541
|
window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_ComboBg, fill_alpha), 0);
|
|
2542
|
+ else if ((window->Flags & ImGuiWindowFlags_Tooltip) != 0)
|
|
2543
|
+ window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_TooltipBg, fill_alpha), style.WindowRounding);
|
2530
|
2544
|
else
|
2531
|
2545
|
window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, window->Color(ImGuiCol_WindowBg, fill_alpha), style.WindowRounding);
|
2532
|
2546
|
}
|
|
@@ -2810,6 +2824,7 @@ static float* GetStyleVarFloatAddr(ImGuiStyleVar idx)
|
2810
|
2824
|
{
|
2811
|
2825
|
case ImGuiStyleVar_Alpha: return &g.Style.Alpha;
|
2812
|
2826
|
case ImGuiStyleVar_WindowRounding: return &g.Style.WindowRounding;
|
|
2827
|
+ case ImGuiStyleVar_FrameRounding: return &g.Style.FrameRounding;
|
2813
|
2828
|
case ImGuiStyleVar_TreeNodeSpacing: return &g.Style.TreeNodeSpacing;
|
2814
|
2829
|
}
|
2815
|
2830
|
return NULL;
|
|
@@ -2888,9 +2903,9 @@ const char* ImGui::GetStyleColName(ImGuiCol idx)
|
2888
|
2903
|
case ImGuiCol_ScrollbarGrabHovered: return "ScrollbarGrabHovered";
|
2889
|
2904
|
case ImGuiCol_ScrollbarGrabActive: return "ScrollbarGrabActive";
|
2890
|
2905
|
case ImGuiCol_ComboBg: return "ComboBg";
|
2891
|
|
- case ImGuiCol_CheckHovered: return "CheckBgHovered";
|
2892
|
|
- case ImGuiCol_CheckActive: return "CheckBgActive";
|
2893
|
|
- case ImGuiCol_CheckMark: return "CheckSelected";
|
|
2906
|
+ case ImGuiCol_CheckHovered: return "CheckHovered";
|
|
2907
|
+ case ImGuiCol_CheckActive: return "CheckActive";
|
|
2908
|
+ case ImGuiCol_CheckMark: return "CheckMark";
|
2894
|
2909
|
case ImGuiCol_SliderGrab: return "SliderGrab";
|
2895
|
2910
|
case ImGuiCol_SliderGrabActive: return "SliderGrabActive";
|
2896
|
2911
|
case ImGuiCol_Button: return "Button";
|
|
@@ -3088,6 +3103,8 @@ void ImGui::SetWindowFontScale(float scale)
|
3088
|
3103
|
window->FontWindowScale = scale;
|
3089
|
3104
|
}
|
3090
|
3105
|
|
|
3106
|
+// NB: internally we store CursorPos in absolute screen coordinates because it is more convenient.
|
|
3107
|
+// Conversion happens as we pass the value to user, but it makes our naming convention dodgy. May want to rename 'DC.CursorPos'.
|
3091
|
3108
|
ImVec2 ImGui::GetCursorPos()
|
3092
|
3109
|
{
|
3093
|
3110
|
ImGuiWindow* window = GetCurrentWindow();
|
|
@@ -3118,6 +3135,12 @@ ImVec2 ImGui::GetCursorScreenPos()
|
3118
|
3135
|
return window->DC.CursorPos;
|
3119
|
3136
|
}
|
3120
|
3137
|
|
|
3138
|
+void ImGui::SetCursorScreenPos(const ImVec2& screen_pos)
|
|
3139
|
+{
|
|
3140
|
+ ImGuiWindow* window = GetCurrentWindow();
|
|
3141
|
+ window->DC.CursorPos = screen_pos;
|
|
3142
|
+}
|
|
3143
|
+
|
3121
|
3144
|
void ImGui::SetScrollPosHere()
|
3122
|
3145
|
{
|
3123
|
3146
|
ImGuiWindow* window = GetCurrentWindow();
|
|
@@ -3426,7 +3449,7 @@ bool ImGui::Button(const char* label, ImVec2 size, bool repeat_when_held)
|
3426
|
3449
|
|
3427
|
3450
|
// Render
|
3428
|
3451
|
const ImU32 col = window->Color((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
|
3429
|
|
- RenderFrame(bb.Min, bb.Max, col);
|
|
3452
|
+ RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
3430
|
3453
|
|
3431
|
3454
|
if (size.x < text_size.x || size.y < text_size.y)
|
3432
|
3455
|
PushClipRect(ImVec4(bb.Min.x+style.FramePadding.x, bb.Min.y+style.FramePadding.y, bb.Max.x, bb.Max.y-style.FramePadding.y)); // Allow extra to draw over the horizontal padding to make it visible that text doesn't fit
|
|
@@ -3670,7 +3693,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool d
|
3670
|
3693
|
if (display_frame)
|
3671
|
3694
|
{
|
3672
|
3695
|
// Framed type
|
3673
|
|
- RenderFrame(bb.Min, bb.Max, col, true);
|
|
3696
|
+ RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);
|
3674
|
3697
|
RenderCollapseTriangle(bb.Min + style.FramePadding, opened, 1.0f, true);
|
3675
|
3698
|
if (g.LogEnabled)
|
3676
|
3699
|
{
|
|
@@ -4012,7 +4035,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
4012
|
4035
|
}
|
4013
|
4036
|
|
4014
|
4037
|
ItemSize(bb);
|
4015
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg));
|
|
4038
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
4016
|
4039
|
|
4017
|
4040
|
// Process clicking on the slider
|
4018
|
4041
|
if (g.ActiveId == id)
|
|
@@ -4270,7 +4293,7 @@ static void Plot(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
4270
|
4293
|
scale_max = v_max;
|
4271
|
4294
|
}
|
4272
|
4295
|
|
4273
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg));
|
|
4296
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
4274
|
4297
|
|
4275
|
4298
|
int res_w = ImMin((int)graph_size.x, values_count);
|
4276
|
4299
|
if (plot_type == ImGuiPlotType_Lines)
|
|
@@ -4396,12 +4419,12 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
4396
|
4419
|
if (pressed)
|
4397
|
4420
|
*v = !(*v);
|
4398
|
4421
|
|
4399
|
|
- RenderFrame(check_bb.Min, check_bb.Max, window->Color((held && hovered) ? ImGuiCol_CheckActive : hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg));
|
|
4422
|
+ RenderFrame(check_bb.Min, check_bb.Max, window->Color((held && hovered) ? ImGuiCol_CheckActive : hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg), true, style.FrameRounding);
|
4400
|
4423
|
if (*v)
|
4401
|
4424
|
{
|
4402
|
4425
|
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
4403
|
4426
|
const float pad = check_sz < 8.0f ? 1.0f : check_sz < 13.0f ? 2.0f : 3.0f;
|
4404
|
|
- window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), window->Color(ImGuiCol_CheckMark));
|
|
4427
|
+ window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), window->Color(ImGuiCol_CheckMark), style.FrameRounding);
|
4405
|
4428
|
}
|
4406
|
4429
|
|
4407
|
4430
|
if (g.LogEnabled)
|
|
@@ -5000,7 +5023,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
|
5000
|
5023
|
}
|
5001
|
5024
|
}
|
5002
|
5025
|
|
5003
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true);
|
|
5026
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
5004
|
5027
|
|
5005
|
5028
|
const ImVec2 font_off_up = ImVec2(0.0f,window->FontSize()+1.0f); // FIXME: those offsets are part of the style or font API
|
5006
|
5029
|
const ImVec2 font_off_dn = ImVec2(0.0f,2.0f);
|
|
@@ -5167,8 +5190,8 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
5167
|
5190
|
const bool hovered = IsHovered(frame_bb, id);
|
5168
|
5191
|
|
5169
|
5192
|
bool value_changed = false;
|
5170
|
|
- RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg));
|
5171
|
|
- RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, window->Color(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button));
|
|
5193
|
+ RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);
|
|
5194
|
+ RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, window->Color(hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING
|
5172
|
5195
|
RenderCollapseTriangle(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y) + style.FramePadding, true);
|
5173
|
5196
|
|
5174
|
5197
|
if (*current_item >= 0 && *current_item < items_count)
|
|
@@ -5275,6 +5298,7 @@ bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_borde
|
5275
|
5298
|
return false;
|
5276
|
5299
|
|
5277
|
5300
|
const ImGuiStyle& style = g.Style;
|
|
5301
|
+ const ImGuiID id = window->GetID("##colorbutton");
|
5278
|
5302
|
const float square_size = window->FontSize();
|
5279
|
5303
|
const ImGuiAabb bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(square_size + style.FramePadding.x*2, square_size + (small_height ? 0 : style.FramePadding.y*2)));
|
5280
|
5304
|
ItemSize(bb);
|
|
@@ -5282,9 +5306,9 @@ bool ImGui::ColorButton(const ImVec4& col, bool small_height, bool outline_borde
|
5282
|
5306
|
if (ClipAdvance(bb))
|
5283
|
5307
|
return false;
|
5284
|
5308
|
|
5285
|
|
- const bool hovered = IsHovered(bb, 0);
|
5286
|
|
- const bool pressed = hovered && g.IO.MouseClicked[0];
|
5287
|
|
- RenderFrame(bb.Min, bb.Max, window->Color(col), outline_border);
|
|
5309
|
+ bool hovered, held;
|
|
5310
|
+ bool pressed = ButtonBehaviour(bb, id, &hovered, &held, true);
|
|
5311
|
+ RenderFrame(bb.Min, bb.Max, window->Color(col), outline_border, style.FrameRounding);
|
5288
|
5312
|
|
5289
|
5313
|
if (hovered)
|
5290
|
5314
|
{
|
|
@@ -5327,7 +5351,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
5327
|
5351
|
const float square_sz = (window->FontSize() + style.FramePadding.x * 2.0f);
|
5328
|
5352
|
|
5329
|
5353
|
ImGuiColorEditMode edit_mode = window->DC.ColorEditMode;
|
5330
|
|
- if (edit_mode == ImGuiColorEditMode_UserSelect)
|
|
5354
|
+ if (edit_mode == ImGuiColorEditMode_UserSelect || edit_mode == ImGuiColorEditMode_UserSelectShowButton)
|
5331
|
5355
|
edit_mode = g.ColorEditModeStorage.GetInt(id, 0) % 3;
|
5332
|
5356
|
|
5333
|
5357
|
float fx = col[0];
|
|
@@ -5409,9 +5433,13 @@ bool ImGui::ColorEdit4(const char* label, float col[4], bool alpha)
|
5409
|
5433
|
}
|
5410
|
5434
|
|
5411
|
5435
|
ImGui::SameLine(0, (int)style.ItemInnerSpacing.x);
|
5412
|
|
- ImGui::ColorButton(col_display);
|
|
5436
|
+ if (ImGui::ColorButton(col_display))
|
|
5437
|
+ {
|
|
5438
|
+ // Don't set local copy of 'edit_mode' right away!
|
|
5439
|
+ g.ColorEditModeStorage.SetInt(id, (edit_mode + 1) % 3);
|
|
5440
|
+ }
|
5413
|
5441
|
|
5414
|
|
- if (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelect)
|
|
5442
|
+ if (window->DC.ColorEditMode == ImGuiColorEditMode_UserSelectShowButton)
|
5415
|
5443
|
{
|
5416
|
5444
|
ImGui::SameLine(0, (int)style.ItemInnerSpacing.x);
|
5417
|
5445
|
const char* button_titles[3] = { "RGB", "HSV", "HEX" };
|
|
@@ -6869,6 +6897,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
6869
|
6897
|
ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f");
|
6870
|
6898
|
ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 16.0f, "%.0f");
|
6871
|
6899
|
ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f");
|
|
6900
|
+ ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 16.0f, "%.0f");
|
6872
|
6901
|
ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f");
|
6873
|
6902
|
ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
|
6874
|
6903
|
ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
|
|
@@ -6906,6 +6935,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
6906
|
6935
|
ImGui::RadioButton("HSV", &edit_mode, ImGuiColorEditMode_HSV);
|
6907
|
6936
|
ImGui::SameLine();
|
6908
|
6937
|
ImGui::RadioButton("HEX", &edit_mode, ImGuiColorEditMode_HEX);
|
|
6938
|
+ //ImGui::Text("Tip: Click on colored square to change edit mode.");
|
6909
|
6939
|
|
6910
|
6940
|
static ImGuiTextFilter filter;
|
6911
|
6941
|
filter.Draw("Filter colors", 200);
|
|
@@ -7730,7 +7760,7 @@ struct ExampleAppConsole
|
7730
|
7760
|
if (data->EventKey == ImGuiKey_UpArrow)
|
7731
|
7761
|
{
|
7732
|
7762
|
if (HistoryPos == -1)
|
7733
|
|
- HistoryPos = History.size() - 1;
|
|
7763
|
+ HistoryPos = (int)(History.size() - 1);
|
7734
|
7764
|
else if (HistoryPos > 0)
|
7735
|
7765
|
HistoryPos--;
|
7736
|
7766
|
}
|
|
@@ -7746,7 +7776,7 @@ struct ExampleAppConsole
|
7746
|
7776
|
{
|
7747
|
7777
|
ImFormatString(data->Buf, data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
|
7748
|
7778
|
data->BufDirty = true;
|
7749
|
|
- data->CursorPos = data->SelectionStart = data->SelectionEnd = strlen(data->Buf);
|
|
7779
|
+ data->CursorPos = data->SelectionStart = data->SelectionEnd = (int)strlen(data->Buf);
|
7750
|
7780
|
}
|
7751
|
7781
|
}
|
7752
|
7782
|
}
|