|
|
@@ -152,6 +152,8 @@
|
|
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
|
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
|
|
|
|
|
+ - 2016/04/03 (1.48) - removed style.WindowFillAlphaDefault setting which was redundant. Bake default BG alpha inside style.Colors[ImGuiCol_WindowBg] and all other Bg color values. (ref github issue #337).
|
|
|
+ - 2016/04/03 (1.48) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg, used by popups/menus and tooltips. popups/menus were previously using ImGuiCol_WindowBg. (ref github issue #337)
|
|
|
- 2016/03/21 (1.48) - renamed GetWindowFont() to GetFont(), GetWindowFontSize() to GetFontSize(). Kept inline redirection function (will obsolete).
|
|
|
- 2016/03/02 (1.48) - InputText() completion/history/always callbacks: if you modify the text buffer manually (without using DeleteChars()/InsertChars() helper) you need to maintain the BufTextLen field. added an assert.
|
|
|
- 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you.
|
|
|
@@ -439,6 +441,7 @@
|
|
|
!- window: begin with *p_opened == false should return false.
|
|
|
- window: get size/pos helpers given names (see discussion in #249)
|
|
|
- window: a collapsed window can be stuck behind the main menu bar?
|
|
|
+ - window: when window is small, prioritize resize button over close button.
|
|
|
- window: detect extra End() call that pop the "Debug" window out and assert at call site instead of later.
|
|
|
- window/tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
|
|
|
- window: increase minimum size of a window with menus or fix the menu rendering so that it doesn't look odd.
|
|
|
@@ -448,15 +451,19 @@
|
|
|
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc.
|
|
|
- widgets: clean up widgets internal toward exposing everything.
|
|
|
- widgets: add disabled and read-only modes (#211)
|
|
|
- - main: considering adding EndFrame()/Init(). some constructs are awkward in the implementation because of the lack of them.
|
|
|
- - main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows).
|
|
|
+ - main: considering adding an Init() function? some constructs are awkward in the implementation because of the lack of them.
|
|
|
+!- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows).
|
|
|
- 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
|
|
|
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
|
|
- - input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
|
|
|
+ - input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
|
|
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
|
|
|
+ - input text: flag to disable live update of the user buffer (also applies to float/int text input)
|
|
|
+ - input text: resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
|
|
+ - input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
|
|
|
- input text multi-line: don't directly call AddText() which does an unnecessary vertex reserve for character count prior to clipping. and/or more line-based clipping to AddText(). and/or reorganize TextUnformatted/RenderText for more efficiency for large text (e.g TextUnformatted could clip and log separately, etc).
|
|
|
- input text multi-line: way to dynamically grow the buffer without forcing the user to initially allocate for worse case (follow up on #200)
|
|
|
- input text multi-line: line numbers? status bar? (follow up on #200)
|
|
|
+ - input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
|
|
|
- input number: optional range min/max for Input*() functions
|
|
|
- input number: holding [-]/[+] buttons could increase the step speed non-linearly (or user-controlled)
|
|
|
- input number: use mouse wheel to step up/down
|
|
|
@@ -495,10 +502,11 @@
|
|
|
- statusbar: add a per-window status bar helper similar to what menubar does.
|
|
|
- tabs (#261, #351)
|
|
|
- separator: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y)
|
|
|
- - color: the color helpers/typing is a mess and needs sorting out.
|
|
|
+!- color: the color helpers/typing is a mess and needs sorting out.
|
|
|
- color: add a better color picker (#346)
|
|
|
- node/graph editor (#306)
|
|
|
- pie menus patterns (#434)
|
|
|
+ - drag'n drop, dragging helpers (carry dragging info, visualize drag source before clicking, drop target, etc.) (#143, #479)
|
|
|
- plot: PlotLines() should use the polygon-stroke facilities (currently issues with averaging normals)
|
|
|
- plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots)
|
|
|
- plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value)
|
|
|
@@ -510,14 +518,11 @@
|
|
|
- slider & drag: int data passing through a float
|
|
|
- drag float: up/down axis
|
|
|
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
|
|
- - text edit: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
|
|
- - text edit: centered text for slider as input text so it matches typical positioning.
|
|
|
- - text edit: flag to disable live update of the user buffer.
|
|
|
- - text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
|
|
- tree node / optimization: avoid formatting when clipped.
|
|
|
- tree node: clarify spacing, perhaps provide API to query exact spacing. provide API to draw the primitive. same with Bullet().
|
|
|
- tree node: tree-node/header right-most side doesn't take account of horizontal scrolling.
|
|
|
- tree node: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings
|
|
|
+ - tree node: try to apply scrolling at time of TreePop() if node was just opened and end of node is past scrolling limits?
|
|
|
- tree node / selectable render mismatch which is visible if you use them both next to each other (e.g. cf. property viewer)
|
|
|
- textwrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (git issue #249)
|
|
|
- settings: write more decent code to allow saving/loading new fields
|
|
|
@@ -527,6 +532,7 @@
|
|
|
- style: color-box not always square?
|
|
|
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
|
|
|
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
|
|
|
+ - style/opt: PopStyleVar could be optimized by having GetStyleVar returns the type, using a table mapping stylevar enum to data type.
|
|
|
- style: global scale setting.
|
|
|
- text: simple markup language for color change?
|
|
|
- font: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
|
|
|
@@ -550,7 +556,8 @@
|
|
|
- style editor: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? (#438)
|
|
|
- style editor: color child window height expressed in multiple of line height.
|
|
|
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
|
|
- - drawlist: user probably can't call Clear() because we expect a texture to be pushed in the stack.
|
|
|
+!- demo: custom render demo pushes a clipping rectangle past parent window bounds. expose ImGui::PushClipRect() from imgui_internal.h?
|
|
|
+ - drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack.
|
|
|
- examples: directx9/directx11: save/restore device state more thoroughly.
|
|
|
- optimization: use another hash function than crc32, e.g. FNV1a
|
|
|
- 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)?
|
|
|
@@ -689,13 +696,12 @@ ImGuiStyle::ImGuiStyle()
|
|
|
WindowMinSize = ImVec2(32,32); // Minimum window size
|
|
|
WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
|
|
WindowTitleAlign = ImGuiAlign_Left; // Alignment for title bar text
|
|
|
- ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
|
|
|
+ ChildWindowRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows
|
|
|
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
|
|
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
|
|
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
|
|
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
|
|
TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
|
|
- WindowFillAlphaDefault = 0.70f; // Default alpha of window background, if not specified in ImGui::Begin()
|
|
|
IndentSpacing = 22.0f; // Horizontal spacing when e.g. entering a tree node
|
|
|
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns
|
|
|
ScrollbarSize = 16.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar
|
|
|
@@ -710,8 +716,9 @@ ImGuiStyle::ImGuiStyle()
|
|
|
|
|
|
Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
|
|
|
Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
|
|
- Colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
|
|
+ Colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.70f);
|
|
|
Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
|
|
+ Colors[ImGuiCol_PopupBg] = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
|
|
|
Colors[ImGuiCol_Border] = ImVec4(0.70f, 0.70f, 0.70f, 0.65f);
|
|
|
Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
|
|
Colors[ImGuiCol_FrameBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.30f); // Background of checkbox, radio button, plot, slider, text input
|
|
|
@@ -749,7 +756,6 @@ ImGuiStyle::ImGuiStyle()
|
|
|
Colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
|
|
Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
|
|
Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
|
|
|
- Colors[ImGuiCol_TooltipBg] = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
|
|
|
Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
|
|
}
|
|
|
|
|
|
@@ -788,6 +794,14 @@ ImGuiIO::ImGuiIO()
|
|
|
GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations
|
|
|
SetClipboardTextFn = SetClipboardTextFn_DefaultImpl;
|
|
|
ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl;
|
|
|
+
|
|
|
+ // Set OS X style defaults based on __APPLE__ compile time flag
|
|
|
+#ifdef __APPLE__
|
|
|
+ WordMovementUsesAltKey = true; // OS X style: Text editing cursor movement using Alt instead of Ctrl
|
|
|
+ ShortcutsUseSuperKey = true; // OS X style: Shortcuts using Cmd/Super instead of Ctrl
|
|
|
+ DoubleClickSelectsWord = true; // OS X style: Double click selects by word instead of selecting whole text
|
|
|
+ MultiSelectUsesSuperKey = true; // OS X style: Multi-selection in lists uses Cmd/Super instead of Ctrl
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
// Pass in translated ASCII characters for text input.
|
|
|
@@ -3126,9 +3140,8 @@ static ImRect GetVisibleRect()
|
|
|
|
|
|
void ImGui::BeginTooltip()
|
|
|
{
|
|
|
- ImGuiState& g = *GImGui;
|
|
|
ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize;
|
|
|
- ImGui::Begin("##Tooltip", NULL, ImVec2(0,0), g.Style.Colors[ImGuiCol_TooltipBg].w, flags);
|
|
|
+ ImGui::Begin("##Tooltip", NULL, flags);
|
|
|
}
|
|
|
|
|
|
void ImGui::EndTooltip()
|
|
|
@@ -3266,9 +3279,8 @@ static bool BeginPopupEx(const char* str_id, ImGuiWindowFlags extra_flags)
|
|
|
ImFormatString(name, 20, "##menu_%d", g.CurrentPopupStack.Size); // Recycle windows based on depth
|
|
|
else
|
|
|
ImFormatString(name, 20, "##popup_%08x", id); // Not recycling, so we can close/open during the same frame
|
|
|
- float alpha = 1.0f;
|
|
|
|
|
|
- bool opened = ImGui::Begin(name, NULL, ImVec2(0.0f, 0.0f), alpha, flags);
|
|
|
+ bool opened = ImGui::Begin(name, NULL, flags);
|
|
|
if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
g.CurrentWindow->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
|
|
if (!opened) // opened can be 'false' when the popup is completely clipped (e.g. zero size display)
|
|
|
@@ -3299,7 +3311,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_opened, ImGuiWindowFlags e
|
|
|
}
|
|
|
|
|
|
ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_Modal|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoSavedSettings;
|
|
|
- bool opened = ImGui::Begin(name, p_opened, ImVec2(0.0f, 0.0f), -1.0f, flags);
|
|
|
+ bool opened = ImGui::Begin(name, p_opened, flags);
|
|
|
if (!opened || (p_opened && !*p_opened)) // Opened can be 'false' when the popup is completely clipped (e.g. zero size display)
|
|
|
{
|
|
|
ImGui::EndPopup();
|
|
|
@@ -3379,8 +3391,7 @@ bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border,
|
|
|
char title[256];
|
|
|
ImFormatString(title, IM_ARRAYSIZE(title), "%s.%s", window->Name, str_id);
|
|
|
|
|
|
- const float alpha = 1.0f;
|
|
|
- bool ret = ImGui::Begin(title, NULL, size, alpha, flags);
|
|
|
+ bool ret = ImGui::Begin(title, NULL, size, -1.0f, flags);
|
|
|
|
|
|
if (!(window->Flags & ImGuiWindowFlags_ShowBorders))
|
|
|
GetCurrentWindow()->Flags &= ~ImGuiWindowFlags_ShowBorders;
|
|
|
@@ -3430,13 +3441,14 @@ bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags ext
|
|
|
const ImGuiStyle& style = g.Style;
|
|
|
ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, style.Colors[ImGuiCol_FrameBg]);
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ChildWindowRounding, style.FrameRounding);
|
|
|
- return ImGui::BeginChild(id, size, false, ImGuiWindowFlags_NoMove | extra_flags);
|
|
|
+ ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
|
|
+ return ImGui::BeginChild(id, size, (g.CurrentWindow->Flags & ImGuiWindowFlags_ShowBorders) ? true : false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);
|
|
|
}
|
|
|
|
|
|
void ImGui::EndChildFrame()
|
|
|
{
|
|
|
ImGui::EndChild();
|
|
|
- ImGui::PopStyleVar();
|
|
|
+ ImGui::PopStyleVar(2);
|
|
|
ImGui::PopStyleColor();
|
|
|
}
|
|
|
|
|
|
@@ -3679,10 +3691,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
window->RootWindow = g.CurrentWindowStack[root_idx];
|
|
|
window->RootNonPopupWindow = g.CurrentWindowStack[root_non_popup_idx]; // This is merely for displaying the TitleBgActive color.
|
|
|
|
|
|
- // Default alpha
|
|
|
- if (bg_alpha < 0.0f)
|
|
|
- bg_alpha = style.WindowFillAlphaDefault;
|
|
|
-
|
|
|
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
|
|
if (first_begin_of_the_frame)
|
|
|
{
|
|
|
@@ -3754,7 +3762,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
}
|
|
|
|
|
|
// Lock window padding so that altering the ShowBorders flag for children doesn't have side-effects.
|
|
|
- window->WindowPadding = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup))) ? ImVec2(0,0) : style.WindowPadding;
|
|
|
+ window->WindowPadding = ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ShowBorders | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup))) ? ImVec2(0,0) : style.WindowPadding;
|
|
|
|
|
|
// Calculate auto-fit size
|
|
|
ImVec2 size_auto_fit;
|
|
|
@@ -3968,27 +3976,26 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
|
|
}
|
|
|
|
|
|
// Scrollbars
|
|
|
- window->ScrollbarY = (flags & ImGuiWindowFlags_ForceVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
|
- window->ScrollbarX = (flags & ImGuiWindowFlags_ForceHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
|
+ window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > window->Size.y + style.ItemSpacing.y) && !(flags & ImGuiWindowFlags_NoScrollbar));
|
|
|
+ window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > window->Size.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));
|
|
|
window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);
|
|
|
window->BorderSize = (flags & ImGuiWindowFlags_ShowBorders) ? 1.0f : 0.0f;
|
|
|
|
|
|
// Window background
|
|
|
- if (bg_alpha > 0.0f)
|
|
|
- {
|
|
|
- ImGuiCol col_idx;
|
|
|
- if ((flags & ImGuiWindowFlags_ComboBox) != 0)
|
|
|
- col_idx = ImGuiCol_ComboBg;
|
|
|
- else if ((flags & ImGuiWindowFlags_Tooltip) != 0)
|
|
|
- col_idx = ImGuiCol_TooltipBg;
|
|
|
- else if ((flags & ImGuiWindowFlags_Popup) != 0)
|
|
|
- col_idx = ImGuiCol_WindowBg;
|
|
|
- else if ((flags & ImGuiWindowFlags_ChildWindow) != 0)
|
|
|
- col_idx = ImGuiCol_ChildWindowBg;
|
|
|
- else
|
|
|
- col_idx = ImGuiCol_WindowBg;
|
|
|
- window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, GetColorU32(col_idx, bg_alpha), window_rounding);
|
|
|
- }
|
|
|
+ // Default alpha
|
|
|
+ ImGuiCol bg_color_idx = ImGuiCol_WindowBg;
|
|
|
+ if ((flags & ImGuiWindowFlags_ComboBox) != 0)
|
|
|
+ bg_color_idx = ImGuiCol_ComboBg;
|
|
|
+ else if ((flags & ImGuiWindowFlags_Tooltip) != 0 || (flags & ImGuiWindowFlags_Popup) != 0)
|
|
|
+ bg_color_idx = ImGuiCol_PopupBg;
|
|
|
+ else if ((flags & ImGuiWindowFlags_ChildWindow) != 0)
|
|
|
+ bg_color_idx = ImGuiCol_ChildWindowBg;
|
|
|
+ ImVec4 bg_color = style.Colors[bg_color_idx];
|
|
|
+ if (bg_alpha >= 0.0f)
|
|
|
+ bg_color.w = bg_alpha;
|
|
|
+ bg_color.w *= style.Alpha;
|
|
|
+ if (bg_color.w > 0.0f)
|
|
|
+ window->DrawList->AddRectFilled(window->Pos, window->Pos+window->Size, ColorConvertFloat4ToU32(bg_color), window_rounding);
|
|
|
|
|
|
// Title bar
|
|
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
|
|
@@ -4510,6 +4517,7 @@ const char* ImGui::GetStyleColName(ImGuiCol idx)
|
|
|
case ImGuiCol_TextDisabled: return "TextDisabled";
|
|
|
case ImGuiCol_WindowBg: return "WindowBg";
|
|
|
case ImGuiCol_ChildWindowBg: return "ChildWindowBg";
|
|
|
+ case ImGuiCol_PopupBg: return "PopupBg";
|
|
|
case ImGuiCol_Border: return "Border";
|
|
|
case ImGuiCol_BorderShadow: return "BorderShadow";
|
|
|
case ImGuiCol_FrameBg: return "FrameBg";
|
|
|
@@ -4547,7 +4555,6 @@ const char* ImGui::GetStyleColName(ImGuiCol idx)
|
|
|
case ImGuiCol_PlotHistogram: return "PlotHistogram";
|
|
|
case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered";
|
|
|
case ImGuiCol_TextSelectedBg: return "TextSelectedBg";
|
|
|
- case ImGuiCol_TooltipBg: return "TooltipBg";
|
|
|
case ImGuiCol_ModalWindowDarkening: return "ModalWindowDarkening";
|
|
|
}
|
|
|
IM_ASSERT(0);
|
|
|
@@ -7091,8 +7098,18 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* ob
|
|
|
r->num_chars = (int)(text_remaining - (text + line_start_idx));
|
|
|
}
|
|
|
|
|
|
-static bool is_separator(unsigned int c) { return c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; }
|
|
|
-#define STB_TEXTEDIT_IS_SPACE(CH) ( ImCharIsSpace((unsigned int)CH) || is_separator((unsigned int)CH) )
|
|
|
+static bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; }
|
|
|
+static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; }
|
|
|
+static int is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; }
|
|
|
+static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }
|
|
|
+#ifdef __APPLE__ // FIXME: Move setting to IO structure
|
|
|
+static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }
|
|
|
+#else
|
|
|
+static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }
|
|
|
+#endif
|
|
|
+#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h
|
|
|
+#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL
|
|
|
+
|
|
|
static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n)
|
|
|
{
|
|
|
ImWchar* dst = obj->Text.Data + pos;
|
|
|
@@ -7289,7 +7306,6 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
return false;
|
|
|
}
|
|
|
draw_window = GetCurrentWindow();
|
|
|
- draw_window->DC.CursorPos += style.FramePadding;
|
|
|
size.x -= draw_window->ScrollbarSizes.x;
|
|
|
}
|
|
|
else
|
|
|
@@ -7322,6 +7338,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
const bool is_ctrl_down = io.KeyCtrl;
|
|
|
const bool is_shift_down = io.KeyShift;
|
|
|
const bool is_alt_down = io.KeyAlt;
|
|
|
+ const bool is_super_down = io.KeySuper;
|
|
|
const bool focus_requested = FocusableItemRegister(window, g.ActiveId == id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0); // Using completion callback disable keyboard tabbing
|
|
|
const bool focus_requested_by_code = focus_requested && (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent);
|
|
|
const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
|
|
|
@@ -7409,11 +7426,17 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
const float mouse_x = (g.IO.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX;
|
|
|
const float mouse_y = (is_multiline ? (g.IO.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f));
|
|
|
|
|
|
- if (select_all || (hovered && io.MouseDoubleClicked[0]))
|
|
|
+ if (select_all || (hovered && !io.DoubleClickSelectsWord && io.MouseDoubleClicked[0]))
|
|
|
{
|
|
|
edit_state.SelectAll();
|
|
|
edit_state.SelectedAllMouseLock = true;
|
|
|
}
|
|
|
+ else if (hovered && io.DoubleClickSelectsWord && io.MouseDoubleClicked[0])
|
|
|
+ {
|
|
|
+ // Select a word only, OS X style (by simulating keystrokes)
|
|
|
+ edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT);
|
|
|
+ edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);
|
|
|
+ }
|
|
|
else if (io.MouseClicked[0] && !edit_state.SelectedAllMouseLock)
|
|
|
{
|
|
|
stb_textedit_click(&edit_state, &edit_state.StbState, mouse_x, mouse_y);
|
|
|
@@ -7451,9 +7474,11 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
// Handle various key-presses
|
|
|
bool cancel_edit = false;
|
|
|
const int k_mask = (is_shift_down ? STB_TEXTEDIT_K_SHIFT : 0);
|
|
|
- const bool is_ctrl_only = is_ctrl_down && !is_alt_down && !is_shift_down;
|
|
|
- if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed(is_ctrl_down ? STB_TEXTEDIT_K_WORDLEFT | k_mask : STB_TEXTEDIT_K_LEFT | k_mask); }
|
|
|
- else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed(is_ctrl_down ? STB_TEXTEDIT_K_WORDRIGHT | k_mask : STB_TEXTEDIT_K_RIGHT | k_mask); }
|
|
|
+ const bool is_shortcutkey_only = (io.ShortcutsUseSuperKey ? (is_super_down && !is_alt_down && !is_shift_down && !is_ctrl_down) : (is_ctrl_down && !is_alt_down && !is_shift_down && !is_super_down));
|
|
|
+ const bool is_wordmove_key_down = (io.WordMovementUsesAltKey ? io.KeyAlt : io.KeyCtrl);
|
|
|
+
|
|
|
+ if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed(is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT | k_mask : STB_TEXTEDIT_K_LEFT | k_mask); }
|
|
|
+ else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed(is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT | k_mask : STB_TEXTEDIT_K_RIGHT | k_mask); }
|
|
|
else if (is_multiline && IsKeyPressedMap(ImGuiKey_UpArrow)) { if (is_ctrl_down) SetWindowScrollY(draw_window, draw_window->Scroll.y - g.FontSize); else edit_state.OnKeyPressed(STB_TEXTEDIT_K_UP | k_mask); }
|
|
|
else if (is_multiline && IsKeyPressedMap(ImGuiKey_DownArrow)) { if (is_ctrl_down) SetWindowScrollY(draw_window, draw_window->Scroll.y + g.FontSize); else edit_state.OnKeyPressed(STB_TEXTEDIT_K_DOWN| k_mask); }
|
|
|
else if (IsKeyPressedMap(ImGuiKey_Home)) { edit_state.OnKeyPressed(is_ctrl_down ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }
|
|
|
@@ -7481,11 +7506,11 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
if (InputTextFilterCharacter(&c, flags, callback, user_data))
|
|
|
edit_state.OnKeyPressed((int)c);
|
|
|
}
|
|
|
- else if (IsKeyPressedMap(ImGuiKey_Escape)) { SetActiveID(0); cancel_edit = true; }
|
|
|
- else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_Z) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); edit_state.ClearSelection(); }
|
|
|
- else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_Y) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); edit_state.ClearSelection(); }
|
|
|
- else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); edit_state.CursorFollow = true; }
|
|
|
- else if (is_ctrl_only && !is_password && ((IsKeyPressedMap(ImGuiKey_X) && is_editable) || IsKeyPressedMap(ImGuiKey_C)) && (!is_multiline || edit_state.HasSelection()))
|
|
|
+ else if (IsKeyPressedMap(ImGuiKey_Escape)) { SetActiveID(0); cancel_edit = true; }
|
|
|
+ else if (is_shortcutkey_only && IsKeyPressedMap(ImGuiKey_Z) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); edit_state.ClearSelection(); }
|
|
|
+ else if (is_shortcutkey_only && IsKeyPressedMap(ImGuiKey_Y) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); edit_state.ClearSelection(); }
|
|
|
+ else if (is_shortcutkey_only && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); edit_state.CursorFollow = true; }
|
|
|
+ else if (is_shortcutkey_only && !is_password && ((IsKeyPressedMap(ImGuiKey_X) && is_editable) || IsKeyPressedMap(ImGuiKey_C)) && (!is_multiline || edit_state.HasSelection()))
|
|
|
{
|
|
|
// Cut, Copy
|
|
|
const bool cut = IsKeyPressedMap(ImGuiKey_X);
|
|
|
@@ -7507,7 +7532,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
|
|
stb_textedit_cut(&edit_state, &edit_state.StbState);
|
|
|
}
|
|
|
}
|
|
|
- else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_V) && is_editable)
|
|
|
+ else if (is_shortcutkey_only && IsKeyPressedMap(ImGuiKey_V) && is_editable)
|
|
|
{
|
|
|
// Paste
|
|
|
if (g.IO.GetClipboardTextFn)
|
|
|
@@ -8471,7 +8496,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
|
|
|
bool want_open = false, want_close = false;
|
|
|
if (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))
|
|
|
{
|
|
|
- // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers so menus feel more reactive.
|
|
|
+ // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.
|
|
|
bool moving_within_opened_triangle = false;
|
|
|
if (g.HoveredWindow == window && g.OpenedPopupStack.Size > g.CurrentPopupStack.Size && g.OpenedPopupStack[g.CurrentPopupStack.Size].ParentWindow == window)
|
|
|
{
|