Comments, reworded some !(xxx && xxx) complex expression to be a little less confusing.
This commit is contained in:
parent
90c0c0c163
commit
c658cba22b
@ -2906,7 +2906,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
||||
}
|
||||
|
||||
// Allow wrapping after punctuation.
|
||||
inside_word = !(c == '.' || c == ',' || c == ';' || c == '!' || c == '?' || c == '\"');
|
||||
inside_word = (c != '.' && c != ',' && c != ';' && c != '!' && c != '?' && c != '\"');
|
||||
}
|
||||
|
||||
// We ignore blank width at the end of the line (they can be skipped)
|
||||
|
@ -557,7 +557,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
||||
if ((flags & ImGuiButtonFlags_PressedOnRelease) && mouse_button_released != -1)
|
||||
{
|
||||
// Repeat mode trumps on release behavior
|
||||
if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay))
|
||||
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
|
||||
if (!has_repeated_at_least_once)
|
||||
pressed = true;
|
||||
ClearActiveID();
|
||||
}
|
||||
@ -3469,18 +3470,22 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f
|
||||
// Generic named filters
|
||||
if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
|
||||
{
|
||||
// Allow 0-9 . - + * /
|
||||
if (flags & ImGuiInputTextFlags_CharsDecimal)
|
||||
if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/'))
|
||||
return false;
|
||||
|
||||
// Allow 0-9 . - + * / e E
|
||||
if (flags & ImGuiInputTextFlags_CharsScientific)
|
||||
if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/') && (c != 'e') && (c != 'E'))
|
||||
return false;
|
||||
|
||||
// Allow 0-9 a-F A-F
|
||||
if (flags & ImGuiInputTextFlags_CharsHexadecimal)
|
||||
if (!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F'))
|
||||
return false;
|
||||
|
||||
// Turn a-z into A-Z
|
||||
if (flags & ImGuiInputTextFlags_CharsUppercase)
|
||||
if (c >= 'a' && c <= 'z')
|
||||
*p_char = (c += (unsigned int)('A'-'a'));
|
||||
@ -4283,7 +4288,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
PopFont();
|
||||
|
||||
// Log as text
|
||||
if (g.LogEnabled && !(is_password && !is_displaying_hint))
|
||||
if (g.LogEnabled && (!is_password || is_displaying_hint))
|
||||
LogRenderedText(&draw_pos, buf_display, buf_display_end);
|
||||
|
||||
if (label_size.x > 0)
|
||||
@ -7157,7 +7162,9 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
if (tab_bar->Tabs.Size == 1 && !(tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs))
|
||||
tab_contents_visible = true;
|
||||
|
||||
if (tab_appearing && !(tab_bar_appearing && !tab_is_new))
|
||||
// Note that tab_is_new is not necessarily the same as tab_appearing! When a tab bar stops being submitted
|
||||
// and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'.
|
||||
if (tab_appearing && (!tab_bar_appearing || tab_is_new))
|
||||
{
|
||||
PushItemFlag(ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus, true);
|
||||
ItemAdd(ImRect(), id);
|
||||
@ -7275,7 +7282,9 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
}
|
||||
|
||||
// [Public] This is call is 100% optional but it allows to remove some one-frame glitches when a tab has been unexpectedly removed.
|
||||
// To use it to need to call the function SetTabItemClosed() after BeginTabBar() and before any call to BeginTabItem()
|
||||
// To use it to need to call the function SetTabItemClosed() after BeginTabBar() and before any call to BeginTabItem().
|
||||
// Tabs closed by the close button will automatically be flagged to avoid this issue.
|
||||
// FIXME: We should aim to support calling SetTabItemClosed() after the tab submission (for next frame)
|
||||
void ImGui::SetTabItemClosed(const char* label)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
Loading…
Reference in New Issue
Block a user