Commit ecea5833 authored by Jack Andersen's avatar Jack Andersen

Add True and False tests for bitwise enums

parent 6d00c400
......@@ -405,7 +405,7 @@ void FileBrowser::touchMove(const boo::STouchCoord& coord, uintptr_t tid) {}
void FileBrowser::charKeyDown(unsigned long charcode, boo::EModifierKey mod, bool isRepeat) {
if (skipBuildInAnimation() || closed())
return;
if ((mod & boo::EModifierKey::CtrlCommand) != boo::EModifierKey::None && !isRepeat) {
if (True(mod & boo::EModifierKey::CtrlCommand) && !isRepeat) {
if (charcode == 'h' || charcode == 'H')
setShowingHidden(!showingHidden());
else if (charcode == 'r' || charcode == 'R')
......
......@@ -446,7 +446,7 @@ void RootView::touchMove(const boo::STouchCoord& coord, uintptr_t tid) {
void RootView::charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat) {
for (View* v : m_views)
v->charKeyDown(charCode, mods, isRepeat);
if (m_activeTextView && (mods & (boo::EModifierKey::Ctrl | boo::EModifierKey::Command)) != boo::EModifierKey::None) {
if (m_activeTextView && True(mods & (boo::EModifierKey::Ctrl | boo::EModifierKey::Command))) {
if (charCode == 'c' || charCode == 'C')
m_activeTextView->clipboardCopy();
else if (charCode == 'x' || charCode == 'X')
......@@ -462,7 +462,7 @@ void RootView::charKeyUp(unsigned long charCode, boo::EModifierKey mods) {
}
void RootView::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat) {
if (key == boo::ESpecialKey::Enter && (mods & boo::EModifierKey::Alt) != boo::EModifierKey::None) {
if (key == boo::ESpecialKey::Enter && True(mods & boo::EModifierKey::Alt)) {
m_window->setFullscreen(!m_window->isFullscreen());
return;
}
......
......@@ -320,7 +320,7 @@ void TextField::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, boo
return;
if (key == boo::ESpecialKey::Left) {
if ((mods & boo::EModifierKey::Shift) != boo::EModifierKey::None) {
if (True(mods & boo::EModifierKey::Shift)) {
if (m_cursorPos) {
size_t origPos = m_cursorPos;
if (m_selectionCount) {
......@@ -338,7 +338,7 @@ void TextField::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, boo
setCursorPos(m_cursorPos == 0 ? 0 : (m_cursorPos - 1));
}
} else if (key == boo::ESpecialKey::Right) {
if ((mods & boo::EModifierKey::Shift) != boo::EModifierKey::None) {
if (True(mods & boo::EModifierKey::Shift)) {
std::string_view textStr(m_textStr);
size_t len = UTF8Iterator(textStr.cbegin()).countTo(textStr.cend());
if (m_cursorPos < len) {
......
Subproject commit 2edc75f7935573e6022be739b4058f56ae8665d2
Subproject commit 617875531acd375e77f142fdb04fd219162c1237
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment