|
@@ -162,7 +162,6 @@
|
162
|
162
|
- text edit: flag to disable live update of the user buffer.
|
163
|
163
|
- text edit: field resize behaviour - field could stretch when being edited? hover tooltip shows more text?
|
164
|
164
|
- text edit: pasting text into a number box should filter the characters the same way direct input does
|
165
|
|
- - text edit: allow code to catch user pressing Return (perhaps through disable live edit? so only Return apply the final value, also allow catching Return if value didn't changed)
|
166
|
165
|
- settings: write more decent code to allow saving/loading new fields
|
167
|
166
|
- settings: api for per-tool simple persistant data (bool,int,float) in .ini file
|
168
|
167
|
- log: be able to right-click and log a window or tree-node into tty/file/clipboard?
|
|
@@ -3280,7 +3279,7 @@ bool SliderFloat(const char* label, float* v, float v_min, float v_max, const ch
|
3280
|
3279
|
g.ActiveId = g.SliderAsInputTextId;
|
3281
|
3280
|
g.HoveredId = 0;
|
3282
|
3281
|
window->FocusItemUnregister(); // Our replacement slider will override the focus ID (that we needed to declare previously to allow for a TAB focus to happen before we got selected)
|
3283
|
|
- value_changed = ImGui::InputText(label, text_buf, IM_ARRAYSIZE(text_buf), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_AlignCenter);
|
|
3282
|
+ value_changed = ImGui::InputText(label, text_buf, IM_ARRAYSIZE(text_buf), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);
|
3284
|
3283
|
if (g.SliderAsInputTextId == 0)
|
3285
|
3284
|
{
|
3286
|
3285
|
// First frame
|
|
@@ -3835,7 +3834,7 @@ void ImGuiTextEditState::RenderTextScrolledClipped(ImFont font, float font_size,
|
3835
|
3834
|
namespace ImGui
|
3836
|
3835
|
{
|
3837
|
3836
|
|
3838
|
|
-bool InputFloat(const char* label, float *v, float step, float step_fast, int decimal_precision)
|
|
3837
|
+bool InputFloat(const char* label, float *v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags)
|
3839
|
3838
|
{
|
3840
|
3839
|
ImGuiState& g = GImGui;
|
3841
|
3840
|
ImGuiWindow* window = GetCurrentWindow();
|
|
@@ -3858,7 +3857,8 @@ bool InputFloat(const char* label, float *v, float step, float step_fast, int de
|
3858
|
3857
|
else
|
3859
|
3858
|
ImFormatString(buf, IM_ARRAYSIZE(buf), "%.*f", decimal_precision, *v);
|
3860
|
3859
|
bool value_changed = false;
|
3861
|
|
- if (ImGui::InputText("", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsDecimal|ImGuiInputTextFlags_AlignCenter|ImGuiInputTextFlags_AutoSelectAll))
|
|
3860
|
+ const ImGuiInputTextFlags flags = extra_flags | (ImGuiInputTextFlags_CharsDecimal|ImGuiInputTextFlags_AutoSelectAll);
|
|
3861
|
+ if (ImGui::InputText("", buf, IM_ARRAYSIZE(buf), flags))
|
3862
|
3862
|
{
|
3863
|
3863
|
ApplyNumericalTextInput(buf, v);
|
3864
|
3864
|
value_changed = true;
|
|
@@ -3892,19 +3892,16 @@ bool InputFloat(const char* label, float *v, float step, float step_fast, int de
|
3892
|
3892
|
return value_changed;
|
3893
|
3893
|
}
|
3894
|
3894
|
|
3895
|
|
-bool InputInt(const char* label, int *v, int step, int step_fast)
|
|
3895
|
+bool InputInt(const char* label, int *v, int step, int step_fast, ImGuiInputTextFlags extra_flags)
|
3896
|
3896
|
{
|
3897
|
3897
|
float f = (float)*v;
|
3898
|
|
- const bool value_changed = ImGui::InputFloat(label, &f, (float)step, (float)step_fast, 0);
|
|
3898
|
+ const bool value_changed = ImGui::InputFloat(label, &f, (float)step, (float)step_fast, 0, extra_flags);
|
3899
|
3899
|
*v = (int)f;
|
3900
|
3900
|
return value_changed;
|
3901
|
3901
|
}
|
3902
|
3902
|
|
3903
|
|
-bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, bool *enter)
|
|
3903
|
+bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags)
|
3904
|
3904
|
{
|
3905
|
|
- if (enter != NULL)
|
3906
|
|
- *enter = false;
|
3907
|
|
-
|
3908
|
3905
|
ImGuiState& g = GImGui;
|
3909
|
3906
|
ImGuiWindow* window = GetCurrentWindow();
|
3910
|
3907
|
if (window->SkipItems)
|
|
@@ -3965,6 +3962,7 @@ bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlag
|
3965
|
3962
|
|
3966
|
3963
|
bool value_changed = false;
|
3967
|
3964
|
bool cancel_edit = false;
|
|
3965
|
+ bool enter_pressed = false;
|
3968
|
3966
|
if (g.ActiveId == id)
|
3969
|
3967
|
{
|
3970
|
3968
|
// Edit in progress
|
|
@@ -4004,7 +4002,7 @@ bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlag
|
4004
|
4002
|
else if (IsKeyPressedMap(ImGuiKey_End)) edit_state.OnKeyboardPressed(is_ctrl_down ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask);
|
4005
|
4003
|
else if (IsKeyPressedMap(ImGuiKey_Delete)) edit_state.OnKeyboardPressed(STB_TEXTEDIT_K_DELETE | k_mask);
|
4006
|
4004
|
else if (IsKeyPressedMap(ImGuiKey_Backspace)) edit_state.OnKeyboardPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);
|
4007
|
|
- else if (IsKeyPressedMap(ImGuiKey_Enter)) { g.ActiveId = 0; if (enter != NULL) *enter = true; }
|
|
4005
|
+ else if (IsKeyPressedMap(ImGuiKey_Enter)) { g.ActiveId = 0; enter_pressed = true; }
|
4008
|
4006
|
else if (IsKeyPressedMap(ImGuiKey_Escape)) { g.ActiveId = 0; cancel_edit = true; }
|
4009
|
4007
|
else if (is_ctrl_down && IsKeyPressedMap(ImGuiKey_Z)) edit_state.OnKeyboardPressed(STB_TEXTEDIT_K_UNDO); // I don't want to use shortcuts but we should probably have an Input-catch stack
|
4010
|
4008
|
else if (is_ctrl_down && IsKeyPressedMap(ImGuiKey_Y)) edit_state.OnKeyboardPressed(STB_TEXTEDIT_K_REDO);
|
|
@@ -4125,7 +4123,10 @@ bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlag
|
4125
|
4123
|
|
4126
|
4124
|
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
4127
|
4125
|
|
4128
|
|
- return value_changed;
|
|
4126
|
+ if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
|
|
4127
|
+ return enter_pressed;
|
|
4128
|
+ else
|
|
4129
|
+ return value_changed;
|
4129
|
4130
|
}
|
4130
|
4131
|
|
4131
|
4132
|
static bool InputFloatN(const char* label, float* v, int components, int decimal_precision)
|
|
@@ -5871,7 +5872,7 @@ void ShowTestWindow(bool* open)
|
5871
|
5872
|
bool goto_line = ImGui::Button("Goto");
|
5872
|
5873
|
ImGui::SameLine();
|
5873
|
5874
|
ImGui::PushItemWidth(100);
|
5874
|
|
- ImGui::InputInt("##Line", &line, 0);
|
|
5875
|
+ goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
|
5875
|
5876
|
ImGui::PopItemWidth();
|
5876
|
5877
|
ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowWidth()*0.5f,300));
|
5877
|
5878
|
for (int i = 0; i < 100; i++)
|