Merge branch 'master' into docking

This commit is contained in:
omar 2019-03-07 18:40:55 +01:00
commit d77d3416d3
4 changed files with 33 additions and 14 deletions

View File

@ -132,6 +132,8 @@ Other Changes:
- TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371) - TabBar: Fixed a crash when using BeginTabBar() recursively (didn't affect docking). (#2371)
- TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to - TabBar: Added extra mis-usage error recovery. Past the assert, common mis-usage don't lead to
hard crashes any more, facilitating integration with scripting languages. (#1651) hard crashes any more, facilitating integration with scripting languages. (#1651)
- TabBar: Fixed ImGuiTabItemFlags_SetSelected being ignored if the tab is not visible (with
scrolling policy enabled) or if is currently appearing.
- Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the - Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the
lower point of the current clipping rectangle. Somehow this bug has been there since v1.0! lower point of the current clipping rectangle. Somehow this bug has been there since v1.0!
It was hardly noticeable but would affect the scrolling range, which in turn would affect It was hardly noticeable but would affect the scrolling range, which in turn would affect

View File

@ -8850,10 +8850,18 @@ void ImGui::NextColumn()
return; return;
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiColumnsSet* columns = window->DC.ColumnsSet;
if (columns->Count == 1)
{
window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x);
IM_ASSERT(columns->Current == 0);
return;
}
PopItemWidth(); PopItemWidth();
PopClipRect(); PopClipRect();
ImGuiColumnsSet* columns = window->DC.ColumnsSet;
columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y); columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
if (++columns->Current < columns->Count) if (++columns->Current < columns->Count)
{ {
@ -8863,6 +8871,7 @@ void ImGui::NextColumn()
} }
else else
{ {
// New line
window->DC.ColumnsOffset.x = 0.0f; window->DC.ColumnsOffset.x = 0.0f;
window->DrawList->ChannelsSetCurrent(0); window->DrawList->ChannelsSetCurrent(0);
columns->Current = 0; columns->Current = 0;
@ -9017,7 +9026,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
ImGuiContext& g = *GImGui; ImGuiContext& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
IM_ASSERT(columns_count > 1); IM_ASSERT(columns_count >= 1);
IM_ASSERT(window->DC.ColumnsSet == NULL); // Nested columns are currently not supported IM_ASSERT(window->DC.ColumnsSet == NULL); // Nested columns are currently not supported
// Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget. // Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget.
@ -9071,8 +9080,11 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
column->ClipRect.ClipWith(window->ClipRect); column->ClipRect.ClipWith(window->ClipRect);
} }
window->DrawList->ChannelsSplit(columns->Count); if (columns->Count > 1)
PushColumnClipRect(); {
window->DrawList->ChannelsSplit(columns->Count);
PushColumnClipRect();
}
PushItemWidth(GetColumnWidth() * 0.65f); PushItemWidth(GetColumnWidth() * 0.65f);
} }
@ -9084,8 +9096,11 @@ void ImGui::EndColumns()
IM_ASSERT(columns != NULL); IM_ASSERT(columns != NULL);
PopItemWidth(); PopItemWidth();
PopClipRect(); if (columns->Count > 1)
window->DrawList->ChannelsMerge(); {
PopClipRect();
window->DrawList->ChannelsMerge();
}
columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y); columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y);
window->DC.CursorPos.y = columns->LineMaxY; window->DC.CursorPos.y = columns->LineMaxY;

View File

@ -159,9 +159,9 @@ typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data);
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);
// Scalar data types // Scalar data types
typedef char ImS8; // 8-bit signed integer == char typedef signed char ImS8; // 8-bit signed integer == char
typedef unsigned char ImU8; // 8-bit unsigned integer typedef unsigned char ImU8; // 8-bit unsigned integer
typedef short ImS16; // 16-bit signed integer typedef signed short ImS16; // 16-bit signed integer
typedef unsigned short ImU16; // 16-bit unsigned integer typedef unsigned short ImU16; // 16-bit unsigned integer
typedef signed int ImS32; // 32-bit signed integer == int typedef signed int ImS32; // 32-bit signed integer == int
typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors) typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors)

View File

@ -74,12 +74,12 @@ Index of this file:
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Those MIN/MAX values are not define because we need to point to them // Those MIN/MAX values are not define because we need to point to them
static const char IM_S8_MIN = -128; static const signed char IM_S8_MIN = -128;
static const char IM_S8_MAX = 127; static const signed char IM_S8_MAX = 127;
static const unsigned char IM_U8_MIN = 0; static const unsigned char IM_U8_MIN = 0;
static const unsigned char IM_U8_MAX = 0xFF; static const unsigned char IM_U8_MAX = 0xFF;
static const short IM_S16_MIN = -32768; static const signed short IM_S16_MIN = -32768;
static const short IM_S16_MAX = 32767; static const signed short IM_S16_MAX = 32767;
static const unsigned short IM_U16_MIN = 0; static const unsigned short IM_U16_MIN = 0;
static const unsigned short IM_U16_MAX = 0xFFFF; static const unsigned short IM_U16_MAX = 0xFFFF;
static const ImS32 IM_S32_MIN = INT_MIN; // (-2147483647 - 1), (0x80000000); static const ImS32 IM_S32_MIN = INT_MIN; // (-2147483647 - 1), (0x80000000);
@ -6667,6 +6667,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0) if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0)
if (!tab_bar_appearing || tab_bar->SelectedTabId == 0) if (!tab_bar_appearing || tab_bar->SelectedTabId == 0)
tab_bar->NextSelectedTabId = id; // New tabs gets activated tab_bar->NextSelectedTabId = id; // New tabs gets activated
if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // SetSelected can only be passed on explicit tab bar
tab_bar->NextSelectedTabId = id;
// Lock visibility // Lock visibility
bool tab_contents_visible = (tab_bar->VisibleTabId == id); bool tab_contents_visible = (tab_bar->VisibleTabId == id);
@ -6718,9 +6720,9 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold; button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
bool hovered, held; bool hovered, held;
bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags); bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
hovered |= (g.HoveredId == id); if (pressed)
if (pressed || ((flags & ImGuiTabItemFlags_SetSelected) && !tab_contents_visible)) // SetSelected can only be passed on explicit tab bar
tab_bar->NextSelectedTabId = id; tab_bar->NextSelectedTabId = id;
hovered |= (g.HoveredId == id);
// Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered) // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)
if (!held) if (!held)