Merge branch 'master' into docking

# Conflicts:
#	docs/CHANGELOG.txt
This commit is contained in:
omar 2020-02-10 14:03:12 +01:00
commit 8432d1bfc7
12 changed files with 93 additions and 27 deletions

View File

@ -1,16 +1,16 @@
(Click "Preview" to turn any http URL into a clickable link)
(Click "Preview" above ^ to turn URL into clickable links)
1. PLEASE CAREFULLY READ: [FAQ](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md)
2. PLEASE CAREFULLY READ: https://github.com/ocornut/imgui/issues/2261
2. PLEASE CAREFULLY READ: [Issue Submitting Guidelines](https://github.com/ocornut/imgui/issues/2261)
2. FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING/LOADING FONTS, please use the [Discord server](http://discord.dearimgui.org).
3. FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING/LOADING FONTS, please use the [Discord server](http://discord.dearimgui.org).
3. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the link provided in (1) (2).
4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the link provided in (1) (2).
4. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
5. Delete points 1-6 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue.
6. Delete points 1-6 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue.
Thank you!
@ -39,7 +39,7 @@ XXX _(you can drag files here)_
**Standalone, minimal, complete and verifiable example:** _(see https://github.com/ocornut/imgui/issues/2261)_
```
// Please do not forget this!
// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();

View File

@ -100,9 +100,11 @@ Other changes:
-----------------------------------------------------------------------
VERSION 1.75 WIP (In Progress)
VERSION 1.75 (Released 2020-02-10)
-----------------------------------------------------------------------
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.75
Breaking Changes:
- Removed redirecting functions/enums names that were marked obsolete in 1.53 (December 2017):
@ -124,14 +126,14 @@ Breaking Changes:
documented and rarely if ever used). Instead we added an explicit PrimUnreserve() API
which can be implemented faster. Also clarified pre-existing constraints which weren't
documented (can only unreserve from the last reserve call). If you suspect you ever
used that feature before, #define IMGUI_DEBUG_PARANOID in imconfig.h to catch existing
calls. [@ShironekoBen]
used that feature before (very unlikely, but grep for call to PrimReserve in your code),
you can #define IMGUI_DEBUG_PARANOID in imconfig.h to catch existing calls. [@ShironekoBen]
- ImDrawList::AddCircle()/AddCircleFilled() functions don't accept negative radius.
- Limiting Columns()/BeginColumns() api to 64 columns with an assert. While the current code
technically supports it, future code may not so we're putting the restriction ahead.
- imgui_internal.h: changed ImRect() default constructor initializes all fields to 0.0f instead
of (FLT_MAX,FLT_MAX,-FLT_MAX,-FLT_MAX). If you used ImRect::Add() to create bounding boxes by
adding multiple points into it, you may need to fix your initial value.
adding points into it without explicit initialization, you may need to fix your initial value.
Other Changes:
@ -145,6 +147,12 @@ Other Changes:
those improvements in 1.73 makes them unnecessary. (#2722, #2770). [@rokups]
- ColorEdit: "Copy As" context-menu tool shows hex values with a '#' prefix instead of '0x'.
- ColorEdit: "Copy As" content-menu tool shows hex values both with/without alpha when available.
- InputText: Fix corruption or crash when executing undo after clearing input with ESC, as a
byproduct we are allowing to later undo the revert with a CTRL+Z. (#3008).
- InputText: Fix using a combination of _CallbackResize (e.g. for std::string binding), along with the
_EnterReturnsTrue flag along with the rarely used property of using an InputText without persisting
user-side storage. Previously if you had e.g. a local unsaved std::string and reading result back
from the widget, the user string object wouldn't be resized when Enter key was pressed. (#3009)
- MenuBar: Fix minor clipping issue where occasionally a menu text can overlap the right-most border.
- Window: Fix SetNextWindowBgAlpha(1.0f) failing to override alpha component. (#3007) [@Albog]
- Window: When testing for the presence of the ImGuiWindowFlags_NoBringToFrontOnFocus flag we
@ -158,6 +166,7 @@ Other Changes:
- Columns: ImDrawList::Channels* functions now work inside columns. Added extra comments to
suggest using user-owned ImDrawListSplitter instead of ImDrawList functions. [@rokups]
- Misc: Added ImGuiMouseCursor_NotAllowed enum so it can be used by more shared widgets. [@rokups]
- Misc: Added IMGUI_DISABLE compile-time definition to make all headers and sources empty.
- Misc: Disable format checks when using stb_printf, to allow using extra formats.
Made IMGUI_USE_STB_SPRINTF a properly documented imconfig.h flag. (#2954) [@loicmolinari]
- Misc: Added misc/single_file/imgui_single_file.h, We use this to validate compiling all *.cpp

View File

@ -193,6 +193,7 @@ Ongoing Dear ImGui development is financially supported by users and private spo
- Blizzard Entertainment
- Google
- Ubisoft
- Nvidia
*Double-chocolate sponsors*
- Media Molecule, Mobigame, Aras Pranckevičius, Greggman, DotEmu, Nadeo, Supercell, Aiden Koss, Kylotonn.

View File

@ -80,6 +80,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
- input text: expose CursorPos in char filter event (#816)
- input text: try usage idiom of using InputText with data only exposed through get/set accessors, without extraneous copy/alloc. (#3009)
- input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
- input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
- input text: hover tooltip could show unclamped text

View File

@ -1,5 +1,5 @@
-----------------------------------------------------------------------
dear imgui, v1.75 WIP
dear imgui, v1.75
-----------------------------------------------------------------------
examples/README.txt
(This is the README file for the examples/ folder. See docs/ for more documentation)

View File

@ -14,6 +14,7 @@
#pragma once
//---- Define assertion handler. Defaults to calling assert().
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
@ -25,10 +26,11 @@
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
// It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
//#define IMGUI_DISABLE_DEMO_WINDOWS
//#define IMGUI_DISABLE_METRICS_WINDOW
//---- Disable all of Dear ImGui or don't implement standard windows.
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable debug/metrics window: ShowMetricsWindow() will be empty.
//---- Don't implement some functions to reduce linkage requirements.
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.

View File

@ -1,4 +1,4 @@
// dear imgui, v1.75 WIP
// dear imgui, v1.75
// (main code and documentation)
// Help:
@ -802,6 +802,8 @@ CODE
#endif
#include "imgui.h"
#ifndef IMGUI_DISABLE
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
@ -15566,3 +15568,5 @@ void ImGui::ShowMetricsWindow(bool*) { }
#endif
//-----------------------------------------------------------------------------
#endif // #ifndef IMGUI_DISABLE

10
imgui.h
View File

@ -1,4 +1,4 @@
// dear imgui, v1.75 WIP
// dear imgui, v1.75
// (headers)
// Help:
@ -46,6 +46,8 @@ Index of this file:
#include "imconfig.h"
#endif
#ifndef IMGUI_DISABLE
//-----------------------------------------------------------------------------
// Header mess
//-----------------------------------------------------------------------------
@ -58,8 +60,8 @@ Index of this file:
// Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
#define IMGUI_VERSION "1.75 WIP"
#define IMGUI_VERSION_NUM 17401
#define IMGUI_VERSION "1.75"
#define IMGUI_VERSION_NUM 17500
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_VIEWPORT 1 // Viewport WIP branch
#define IMGUI_HAS_DOCK 1 // Docking WIP branch
@ -2494,3 +2496,5 @@ struct ImGuiViewport
#ifdef IMGUI_INCLUDE_IMGUI_USER_H
#include "imgui_user.h"
#endif
#endif // #ifndef IMGUI_DISABLE

View File

@ -1,4 +1,4 @@
// dear imgui, v1.75 WIP
// dear imgui, v1.75
// (demo code)
// Help:
@ -66,6 +66,8 @@ Index of this file:
#endif
#include "imgui.h"
#ifndef IMGUI_DISABLE
#include <ctype.h> // toupper
#include <limits.h> // INT_MIN, INT_MAX
#include <math.h> // sqrtf, powf, cosf, sinf, floorf, ceilf
@ -5112,3 +5114,5 @@ void ImGui::ShowUserGuide() {}
void ImGui::ShowStyleEditor(ImGuiStyle*) {}
#endif
#endif // #ifndef IMGUI_DISABLE

View File

@ -1,4 +1,4 @@
// dear imgui, v1.75 WIP
// dear imgui, v1.75
// (drawing and font code)
/*
@ -27,6 +27,8 @@ Index of this file:
#endif
#include "imgui.h"
#ifndef IMGUI_DISABLE
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
@ -364,7 +366,7 @@ ImDrawListSharedData::ImDrawListSharedData()
const float a = ((float)i * 2 * IM_PI) / (float)IM_ARRAYSIZE(CircleVtx12);
CircleVtx12[i] = ImVec2(ImCos(a), ImSin(a));
}
memset(CircleSegmentCounts, 0, sizeof(CircleSegmentCounts)); // This will be set by
memset(CircleSegmentCounts, 0, sizeof(CircleSegmentCounts)); // This will be set by SetCircleSegmentMaxError()
}
void ImDrawListSharedData::SetCircleSegmentMaxError(float max_error)
@ -3492,3 +3494,5 @@ static const char* GetDefaultCompressedFontDataTTFBase85()
{
return proggy_clean_ttf_compressed_data_base85;
}
#endif // #ifndef IMGUI_DISABLE

View File

@ -1,4 +1,4 @@
// dear imgui, v1.75 WIP
// dear imgui, v1.75
// (internal structures/api)
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
@ -22,6 +22,7 @@ Index of this file:
*/
#pragma once
#ifndef IMGUI_DISABLE
//-----------------------------------------------------------------------------
// Header mess
@ -2166,3 +2167,5 @@ extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const cha
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#endif // #ifndef IMGUI_DISABLE

View File

@ -1,4 +1,4 @@
// dear imgui, v1.75 WIP
// dear imgui, v1.75
// (widgets code)
/*
@ -33,6 +33,8 @@ Index of this file:
#endif
#include "imgui.h"
#ifndef IMGUI_DISABLE
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
@ -3278,8 +3280,25 @@ static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const Im
#define STB_TEXTEDIT_IMPLEMENTATION
#include "imstb_textedit.h"
// stb_textedit internally allows for a single undo record to do addition and deletion, but somehow, calling
// the stb_textedit_paste() function creates two separate records, so we perform it manually. (FIXME: Report to nothings/stb?)
static void stb_textedit_replace(STB_TEXTEDIT_STRING* str, STB_TexteditState* state, const STB_TEXTEDIT_CHARTYPE* text, int text_len)
{
stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len);
ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW);
if (text_len <= 0)
return;
if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len))
{
state->cursor = text_len;
state->has_preferred_x = 0;
return;
}
IM_ASSERT(0); // Failed to insert character, normally shouldn't happen because of how we currently use stb_textedit_replace()
}
} // namespace ImStb
void ImGuiInputTextState::OnKeyPressed(int key)
{
stb_textedit_key(this, &Stb, key);
@ -3833,13 +3852,22 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
// Restore initial value. Only return true if restoring to the initial value changes the current buffer contents.
if (!is_readonly && strcmp(buf, state->InitialTextA.Data) != 0)
{
// Push records into the undo stack so we can CTRL+Z the revert operation itself
apply_new_text = state->InitialTextA.Data;
apply_new_text_length = state->InitialTextA.Size - 1;
ImVector<ImWchar> w_text;
if (apply_new_text_length > 0)
{
w_text.resize(ImTextCountCharsFromUtf8(apply_new_text, apply_new_text + apply_new_text_length) + 1);
ImTextStrFromUtf8(w_text.Data, w_text.Size, apply_new_text, apply_new_text + apply_new_text_length);
}
stb_textedit_replace(state, &state->Stb, w_text.Data, (apply_new_text_length > 0) ? (w_text.Size - 1) : 0);
}
}
// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage.
// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail.
// This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize).
bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
if (apply_edit_back_to_user_buffer)
{
@ -3933,8 +3961,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
// Copy result to user buffer
if (apply_new_text)
{
// We cannot test for 'backup_current_text_length != apply_new_text_length' here because we have no guarantee that the size
// of our owned buffer matches the size of the string object held by the user, and by design we allow InputText() to be used
// without any storage on user's side.
IM_ASSERT(apply_new_text_length >= 0);
if (backup_current_text_length != apply_new_text_length && is_resizable)
if (is_resizable)
{
ImGuiInputTextCallbackData callback_data;
callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize;
@ -3949,6 +3980,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1);
IM_ASSERT(apply_new_text_length <= buf_size);
}
//IMGUI_DEBUG_LOG("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length);
// If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size.
ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size));
@ -7793,3 +7825,5 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
}
//-------------------------------------------------------------------------
#endif // #ifndef IMGUI_DISABLE