|
@ -146,7 +146,6 @@ |
|
|
- filters: handle wildcards (with implicit leading/trailing *), regexps |
|
|
- filters: handle wildcards (with implicit leading/trailing *), regexps |
|
|
- shortcuts: add a shortcut api, e.g. parse "&Save" and/or "Save (CTRL+S)", pass in to widgets or provide simple ways to use (button=activate, input=focus) |
|
|
- shortcuts: add a shortcut api, e.g. parse "&Save" and/or "Save (CTRL+S)", pass in to widgets or provide simple ways to use (button=activate, input=focus) |
|
|
- keyboard: full keyboard navigation and focus |
|
|
- keyboard: full keyboard navigation and focus |
|
|
- clipboard: add a default "local" implementation of clipboard functions (user will only need to override them to connect to OS clipboard) |
|
|
|
|
|
- misc: not thread-safe |
|
|
- misc: not thread-safe |
|
|
- optimisation/render: use indexed rendering |
|
|
- optimisation/render: use indexed rendering |
|
|
- optimisation/render: move clip-rect to vertex data? would allow merging all commands |
|
|
- optimisation/render: move clip-rect to vertex data? would allow merging all commands |
|
@ -154,8 +153,6 @@ |
|
|
- optimisation: turn some the various stack vectors into statically-sized arrays |
|
|
- optimisation: turn some the various stack vectors into statically-sized arrays |
|
|
- optimisation: better clipping for multi-component widgets |
|
|
- optimisation: better clipping for multi-component widgets |
|
|
- optimisation: specialize for height based clipping first (assume widgets never go up + height tests before width tests?) |
|
|
- optimisation: specialize for height based clipping first (assume widgets never go up + height tests before width tests?) |
|
|
- optimisation/portability: provide ImVector style implementation |
|
|
|
|
|
- optimisation/portability: remove dependency on <algorithm> |
|
|
|
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
#include "imgui.h" |
|
|
#include "imgui.h" |
|
@ -198,15 +195,11 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs); |
|
|
}; // namespace ImGui
|
|
|
}; // namespace ImGui
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// Platform dependant helpers
|
|
|
// Platform dependant default implementations
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER |
|
|
static const char* GetClipboardTextFn_DefaultImpl(); |
|
|
#ifndef IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS |
|
|
static void SetClipboardTextFn_DefaultImpl(const char* text, const char* text_end); |
|
|
static const char* GetClipboardTextFn_DefaultImplWindows(); |
|
|
|
|
|
static void SetClipboardTextFn_DefaultImplWindows(const char* text, const char* text_end); |
|
|
|
|
|
#endif |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// User facing structures
|
|
|
// User facing structures
|
|
@ -282,12 +275,8 @@ ImGuiIO::ImGuiIO() |
|
|
MouseDoubleClickMaxDist = 6.0f; |
|
|
MouseDoubleClickMaxDist = 6.0f; |
|
|
|
|
|
|
|
|
// Platform dependant default implementations
|
|
|
// Platform dependant default implementations
|
|
|
#ifdef _MSC_VER |
|
|
GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; |
|
|
#ifndef IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS |
|
|
SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; |
|
|
GetClipboardTextFn = GetClipboardTextFn_DefaultImplWindows; |
|
|
|
|
|
SetClipboardTextFn = SetClipboardTextFn_DefaultImplWindows; |
|
|
|
|
|
#endif |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Pass in translated ASCII characters for text input.
|
|
|
// Pass in translated ASCII characters for text input.
|
|
@ -630,6 +619,7 @@ struct ImGuiState |
|
|
ImGuiStorage ColorEditModeStorage; // for user selection
|
|
|
ImGuiStorage ColorEditModeStorage; // for user selection
|
|
|
ImGuiID ActiveComboID; |
|
|
ImGuiID ActiveComboID; |
|
|
char Tooltip[1024]; |
|
|
char Tooltip[1024]; |
|
|
|
|
|
char* PrivateClipboard; // if no custom clipboard handler is defined
|
|
|
|
|
|
|
|
|
// Logging
|
|
|
// Logging
|
|
|
bool LogEnabled; |
|
|
bool LogEnabled; |
|
@ -653,6 +643,7 @@ struct ImGuiState |
|
|
SliderAsInputTextId = 0; |
|
|
SliderAsInputTextId = 0; |
|
|
ActiveComboID = 0; |
|
|
ActiveComboID = 0; |
|
|
memset(Tooltip, 0, sizeof(Tooltip)); |
|
|
memset(Tooltip, 0, sizeof(Tooltip)); |
|
|
|
|
|
PrivateClipboard = NULL; |
|
|
LogEnabled = false; |
|
|
LogEnabled = false; |
|
|
LogFile = NULL; |
|
|
LogFile = NULL; |
|
|
LogAutoExpandMaxDepth = 2; |
|
|
LogAutoExpandMaxDepth = 2; |
|
@ -1313,6 +1304,12 @@ void Shutdown() |
|
|
g.IO.Font = NULL; |
|
|
g.IO.Font = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (g.PrivateClipboard) |
|
|
|
|
|
{ |
|
|
|
|
|
free(g.PrivateClipboard); |
|
|
|
|
|
g.PrivateClipboard = NULL; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
g.Initialized = false; |
|
|
g.Initialized = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -5201,13 +5198,13 @@ void ImBitmapFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& c |
|
|
// PLATFORM DEPENDANT HELPERS
|
|
|
// PLATFORM DEPENDANT HELPERS
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER |
|
|
#if defined(_MSC_VER) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) |
|
|
#ifndef IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS |
|
|
|
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN |
|
|
#define WIN32_LEAN_AND_MEAN |
|
|
#include <windows.h> |
|
|
#include <windows.h> |
|
|
|
|
|
|
|
|
static const char* GetClipboardTextFn_DefaultImplWindows() |
|
|
// Win32 API clipboard implementation
|
|
|
|
|
|
static const char* GetClipboardTextFn_DefaultImpl() |
|
|
{ |
|
|
{ |
|
|
static char* buf_local = NULL; |
|
|
static char* buf_local = NULL; |
|
|
if (buf_local) |
|
|
if (buf_local) |
|
@ -5215,47 +5212,62 @@ static const char* GetClipboardTextFn_DefaultImplWindows() |
|
|
free(buf_local); |
|
|
free(buf_local); |
|
|
buf_local = NULL; |
|
|
buf_local = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!OpenClipboard(NULL)) |
|
|
if (!OpenClipboard(NULL)) |
|
|
return NULL; |
|
|
return NULL; |
|
|
|
|
|
|
|
|
HANDLE buf_handle = GetClipboardData(CF_TEXT); |
|
|
HANDLE buf_handle = GetClipboardData(CF_TEXT); |
|
|
if (buf_handle == NULL) |
|
|
if (buf_handle == NULL) |
|
|
return NULL; |
|
|
return NULL; |
|
|
|
|
|
|
|
|
if (char* buf_global = (char*)GlobalLock(buf_handle)) |
|
|
if (char* buf_global = (char*)GlobalLock(buf_handle)) |
|
|
buf_local = strdup(buf_global); |
|
|
buf_local = strdup(buf_global); |
|
|
GlobalUnlock(buf_handle); |
|
|
GlobalUnlock(buf_handle); |
|
|
CloseClipboard(); |
|
|
CloseClipboard(); |
|
|
|
|
|
|
|
|
return buf_local; |
|
|
return buf_local; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static void SetClipboardTextFn_DefaultImplWindows(const char* text, const char* text_end) |
|
|
// Win32 API clipboard implementation
|
|
|
|
|
|
static void SetClipboardTextFn_DefaultImpl(const char* text, const char* text_end) |
|
|
{ |
|
|
{ |
|
|
if (!OpenClipboard(NULL)) |
|
|
if (!OpenClipboard(NULL)) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
if (!text_end) |
|
|
if (!text_end) |
|
|
text_end = text + strlen(text); |
|
|
text_end = text + strlen(text); |
|
|
|
|
|
|
|
|
const int buf_length = (text_end - text) + 1; |
|
|
const int buf_length = (text_end - text) + 1; |
|
|
HGLOBAL buf_handle = GlobalAlloc(GMEM_MOVEABLE, buf_length * sizeof(char)); |
|
|
HGLOBAL buf_handle = GlobalAlloc(GMEM_MOVEABLE, buf_length * sizeof(char)); |
|
|
if (buf_handle == NULL) |
|
|
if (buf_handle == NULL) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
char* buf_global = (char *)GlobalLock(buf_handle); |
|
|
char* buf_global = (char *)GlobalLock(buf_handle); |
|
|
memcpy(buf_global, text, text_end - text); |
|
|
memcpy(buf_global, text, text_end - text); |
|
|
buf_global[text_end - text] = 0; |
|
|
buf_global[text_end - text] = 0; |
|
|
GlobalUnlock(buf_handle); |
|
|
GlobalUnlock(buf_handle); |
|
|
|
|
|
|
|
|
EmptyClipboard(); |
|
|
EmptyClipboard(); |
|
|
SetClipboardData(CF_TEXT, buf_handle); |
|
|
SetClipboardData(CF_TEXT, buf_handle); |
|
|
CloseClipboard(); |
|
|
CloseClipboard(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // #ifndef IMGUI_DONT_IMPLEMENT_WINDOWS_CLIPBOARD_FUNCTIONS
|
|
|
#else |
|
|
#endif // #ifdef _MSC_VER
|
|
|
|
|
|
|
|
|
// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
|
|
|
|
|
|
static const char* GetClipboardTextFn_DefaultImpl() |
|
|
|
|
|
{ |
|
|
|
|
|
return GImGui.PrivateClipboard; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers
|
|
|
|
|
|
static void SetClipboardTextFn_DefaultImpl(const char* text, const char* text_end) |
|
|
|
|
|
{ |
|
|
|
|
|
if (GImGui.PrivateClipboard) |
|
|
|
|
|
{ |
|
|
|
|
|
free(GImGui.PrivateClipboard); |
|
|
|
|
|
GImGui.PrivateClipboard = NULL; |
|
|
|
|
|
} |
|
|
|
|
|
if (!text_end) |
|
|
|
|
|
text_end = text + strlen(text); |
|
|
|
|
|
GImGui.PrivateClipboard = (char*)malloc(text_end - text + 1); |
|
|
|
|
|
memcpy(GImGui.PrivateClipboard, text, text_end - text); |
|
|
|
|
|
GImGui.PrivateClipboard[text_end - text] = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
//-----------------------------------------------------------------------------
|
|
|
// HELP
|
|
|
// HELP
|
|
|