Merge remote-tracking branch 'origin' into 2015-05-menus

Conflicts:
	imgui.h
docking
ocornut 10 years ago
commit 5082182790

@ -571,7 +571,8 @@ ImGuiStyle::ImGuiStyle()
IndentSpacing = 22.0f; // Horizontal spacing when e.g. entering a tree node
ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns
ScrollbarWidth = 16.0f; // Width of the vertical scrollbar
GrabMinSize = 10.0f; // Minimum width/height of a slider or scrollbar grab
ScrollbarRounding = 0.0f; // Radius of grab corners rounding for scrollbar
GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar
DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
@ -2186,6 +2187,7 @@ void ImGui::Shutdown()
ImGui::MemFree(g.LogClipboard);
}
if (g.IO.Fonts) // Testing for NULL to allow user to NULLify in case of running Shutdown() on multiple contexts. Bit hacky.
g.IO.Fonts->Clear();
g.Initialized = false;
@ -3812,7 +3814,7 @@ static void Scrollbar(ImGuiWindow* window)
// Render
const ImU32 grab_col = window->Color(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
window->DrawList->AddRectFilled(ImVec2(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_y_norm)), ImVec2(bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_y_norm) + grab_h_pixels), grab_col);
window->DrawList->AddRectFilled(ImVec2(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_y_norm)), ImVec2(bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_y_norm) + grab_h_pixels), grab_col, style.ScrollbarRounding);
}
// Moving window to front of display (which happens to be back of our sorted list)
@ -6639,6 +6641,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
const bool is_ctrl_down = io.KeyCtrl;
const bool is_shift_down = io.KeyShift;
const bool is_alt_down = io.KeyAlt;
const bool focus_requested = window->FocusItemRegister(g.ActiveId == id, (flags & ImGuiInputTextFlags_CallbackCompletion) == 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;
@ -6760,6 +6763,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
}
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); }
else if (IsKeyPressedMap(ImGuiKey_Home)) { edit_state.OnKeyPressed(is_ctrl_down ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }
@ -6768,10 +6772,10 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
else if (IsKeyPressedMap(ImGuiKey_Backspace)) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask); }
else if (IsKeyPressedMap(ImGuiKey_Enter)) { SetActiveId(0); enter_pressed = true; }
else if (IsKeyPressedMap(ImGuiKey_Escape)) { SetActiveId(0); cancel_edit = true; }
else if (is_ctrl_down && IsKeyPressedMap(ImGuiKey_Z)) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); }
else if (is_ctrl_down && IsKeyPressedMap(ImGuiKey_Y)) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); }
else if (is_ctrl_down && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); }
else if (is_ctrl_down && (IsKeyPressedMap(ImGuiKey_X) || IsKeyPressedMap(ImGuiKey_C)))
else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_Z)) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); }
else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_Y)) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); }
else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); }
else if (is_ctrl_only && (IsKeyPressedMap(ImGuiKey_X) || IsKeyPressedMap(ImGuiKey_C)))
{
// Cut, Copy
const bool cut = IsKeyPressedMap(ImGuiKey_X);
@ -6789,7 +6793,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
if (cut)
stb_textedit_cut(&edit_state, &edit_state.StbState);
}
else if (is_ctrl_down && IsKeyPressedMap(ImGuiKey_V))
else if (is_ctrl_only && IsKeyPressedMap(ImGuiKey_V))
{
// Paste
if (g.IO.GetClipboardTextFn)
@ -6950,7 +6954,7 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
return value_changed;
}
static bool InputFloatN(const char* label, float* v, int components, int decimal_precision)
static bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags)
{
ImGuiState& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
@ -6974,7 +6978,7 @@ static bool InputFloatN(const char* label, float* v, int components, int decimal
ImGui::PopItemWidth();
ImGui::PushItemWidth(w_item_last);
}
value_changed |= ImGui::InputFloat("##v", &v[i], 0, 0, decimal_precision);
value_changed |= ImGui::InputFloat("##v", &v[i], 0, 0, decimal_precision, extra_flags);
ImGui::SameLine(0, (int)style.ItemInnerSpacing.x);
ImGui::PopID();
}
@ -6988,22 +6992,22 @@ static bool InputFloatN(const char* label, float* v, int components, int decimal
return value_changed;
}
bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision)
bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags)
{
return InputFloatN(label, v, 2, decimal_precision);
return InputFloatN(label, v, 2, decimal_precision, extra_flags);
}
bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision)
bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags)
{
return InputFloatN(label, v, 3, decimal_precision);
return InputFloatN(label, v, 3, decimal_precision, extra_flags);
}
bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision)
bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags)
{
return InputFloatN(label, v, 4, decimal_precision);
return InputFloatN(label, v, 4, decimal_precision, extra_flags);
}
static bool InputIntN(const char* label, int* v, int components)
static bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags)
{
ImGuiState& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow();
@ -7027,7 +7031,7 @@ static bool InputIntN(const char* label, int* v, int components)
ImGui::PopItemWidth();
ImGui::PushItemWidth(w_item_last);
}
value_changed |= ImGui::InputInt("##v", &v[i], 0, 0);
value_changed |= ImGui::InputInt("##v", &v[i], 0, 0, extra_flags);
ImGui::SameLine(0, (int)style.ItemInnerSpacing.x);
ImGui::PopID();
}
@ -7041,19 +7045,19 @@ static bool InputIntN(const char* label, int* v, int components)
return value_changed;
}
bool ImGui::InputInt2(const char* label, int v[2])
bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags)
{
return InputIntN(label, v, 2);
return InputIntN(label, v, 2, extra_flags);
}
bool ImGui::InputInt3(const char* label, int v[3])
bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags)
{
return InputIntN(label, v, 3);
return InputIntN(label, v, 3, extra_flags);
}
bool ImGui::InputInt4(const char* label, int v[4])
bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags)
{
return InputIntN(label, v, 4);
return InputIntN(label, v, 4, extra_flags);
}
static bool Items_ArrayGetter(void* data, int idx, const char** out_text)
@ -9878,7 +9882,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 20.0f, "%.0f");
ImGui::SliderFloat("ScrollBarWidth", &style.ScrollbarWidth, 1.0f, 20.0f, "%.0f");
ImGui::SliderFloat("ScrollbarWidth", &style.ScrollbarWidth, 1.0f, 20.0f, "%.0f");
ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 16.0f, "%.0f");
ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f");
ImGui::TreePop();
}
@ -10546,6 +10551,7 @@ void ImGui::ShowTestWindow(bool* opened)
ImGui::PopID();
}
ImGui::PopID();
ImGui::PopStyleVar();
ImGui::Indent();
ImGui::TreePop();

@ -331,13 +331,13 @@ namespace ImGui
// Widgets: Input
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1);
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1);
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputInt2(const char* label, int v[2]);
IMGUI_API bool InputInt3(const char* label, int v[3]);
IMGUI_API bool InputInt4(const char* label, int v[4]);
IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);
IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);
// Widgets: Trees
IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop
@ -363,7 +363,7 @@ namespace ImGui
// FIXME-WIP: v1.39 in development, API *WILL* change
IMGUI_API bool BeginMenu(const char* label);
IMGUI_API void EndMenu();
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = NULL); // bool enabled = true
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false); // bool enabled = true
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected); // bool enabled = true
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
@ -615,7 +615,8 @@ struct ImGuiStyle
float IndentSpacing; // Horizontal indentation when e.g. entering a tree node
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
float ScrollbarWidth; // Width of the vertical scrollbar
float GrabMinSize; // Minimum width/height of a slider or scrollbar grab
float ScrollbarRounding; // Radius of grab corners for scrollbar
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar
ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
ImVec4 Colors[ImGuiCol_COUNT];

Loading…
Cancel
Save