TermViewStates: Style fixes

This commit is contained in:
John Scipione 2014-06-05 16:03:10 -04:00
parent 16b8886a59
commit da80e3d9e2
2 changed files with 17 additions and 15 deletions

View File

@ -193,7 +193,9 @@ TermView::DefaultState::ModifiersChanged(int32 oldModifiers, int32 modifiers)
void void
TermView::DefaultState::KeyDown(const char* bytes, int32 numBytes) TermView::DefaultState::KeyDown(const char* bytes, int32 numBytes)
{ {
int32 key, mod, rawChar; int32 key;
int32 mod;
int32 rawChar;
BMessage* currentMessage = fView->Looper()->CurrentMessage(); BMessage* currentMessage = fView->Looper()->CurrentMessage();
if (currentMessage == NULL) if (currentMessage == NULL)
return; return;
@ -378,7 +380,7 @@ TermView::DefaultState::MouseDown(BPoint where, int32 buttons, int32 modifiers)
return; return;
} }
// Select Region // select region
if (buttons == B_PRIMARY_MOUSE_BUTTON) { if (buttons == B_PRIMARY_MOUSE_BUTTON) {
fView->fSelectState->Prepare(where, modifiers); fView->fSelectState->Prepare(where, modifiers);
fView->_NextState(fView->fSelectState); fView->_NextState(fView->fSelectState);
@ -388,7 +390,7 @@ TermView::DefaultState::MouseDown(BPoint where, int32 buttons, int32 modifiers)
void void
TermView::DefaultState::MouseMoved(BPoint where, uint32 transit, TermView::DefaultState::MouseMoved(BPoint where, uint32 transit,
const BMessage* message, int32 modifiers) const BMessage* dragMessage, int32 modifiers)
{ {
if (_CheckEnterHyperLinkState(modifiers)) if (_CheckEnterHyperLinkState(modifiers))
return; return;
@ -602,14 +604,11 @@ TermView::SelectState::MouseUp(BPoint where, int32 buttons)
|| fView->fReportNormalMouseEvent) { || fView->fReportNormalMouseEvent) {
TermPos clickPos = fView->_ConvertToTerminal(where); TermPos clickPos = fView->_ConvertToTerminal(where);
fView->_SendMouseEvent(0, 0, clickPos.x, clickPos.y, false); fView->_SendMouseEvent(0, 0, clickPos.x, clickPos.y, false);
} else { } else if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0
if ((buttons & B_PRIMARY_MOUSE_BUTTON) == 0
&& (fView->fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) { && (fView->fMouseButtons & B_PRIMARY_MOUSE_BUTTON) != 0) {
fView->Copy(fView->fMouseClipboard); fView->Copy(fView->fMouseClipboard);
} }
}
fView->_NextState(fView->fDefaultState); fView->_NextState(fView->fDefaultState);
} }
@ -687,6 +686,7 @@ TermView::HyperLinkState::MouseDown(BPoint where, int32 buttons,
TermPos start; TermPos start;
TermPos end; TermPos end;
HyperLink link; HyperLink link;
bool pathPrefixOnly = (modifiers & B_SHIFT_KEY) != 0; bool pathPrefixOnly = (modifiers & B_SHIFT_KEY) != 0;
if (!_GetHyperLinkAt(where, pathPrefixOnly, link, start, end)) if (!_GetHyperLinkAt(where, pathPrefixOnly, link, start, end))
return; return;
@ -939,12 +939,14 @@ TermView::HyperLinkState::_UpdateHighlight()
_UpdateHighlight(where, fView->fModifiers); _UpdateHighlight(where, fView->fModifiers);
} }
void void
TermView::HyperLinkState::_UpdateHighlight(BPoint where, int32 modifiers) TermView::HyperLinkState::_UpdateHighlight(BPoint where, int32 modifiers)
{ {
TermPos start; TermPos start;
TermPos end; TermPos end;
HyperLink link; HyperLink link;
bool pathPrefixOnly = (modifiers & B_SHIFT_KEY) != 0; bool pathPrefixOnly = (modifiers & B_SHIFT_KEY) != 0;
if (_GetHyperLinkAt(where, pathPrefixOnly, link, start, end)) if (_GetHyperLinkAt(where, pathPrefixOnly, link, start, end))
_ActivateHighlight(start, end); _ActivateHighlight(start, end);
@ -960,6 +962,7 @@ TermView::HyperLinkState::_ActivateHighlight(const TermPos& start,
if (fHighlightActive) { if (fHighlightActive) {
if (fHighlight.Start() == start && fHighlight.End() == end) if (fHighlight.Start() == start && fHighlight.End() == end)
return; return;
_DeactivateHighlight(); _DeactivateHighlight();
} }
@ -1091,4 +1094,3 @@ TermView::HyperLinkMenuState::MessageReceived(BMessage* message)
return false; return false;
} }

View File

@ -37,7 +37,7 @@ public:
virtual void MouseDown(BPoint where, int32 buttons, virtual void MouseDown(BPoint where, int32 buttons,
int32 modifiers); int32 modifiers);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* message, int32 modifiers); const BMessage* dragMessage, int32 modifiers);
virtual void MouseUp(BPoint where, int32 buttons); virtual void MouseUp(BPoint where, int32 buttons);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
@ -71,7 +71,7 @@ public:
virtual void MouseDown(BPoint where, int32 buttons, virtual void MouseDown(BPoint where, int32 buttons,
int32 modifiers); int32 modifiers);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* message, int32 modifiers); const BMessage* dragMessage, int32 modifiers);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);
@ -89,7 +89,7 @@ public:
virtual bool MessageReceived(BMessage* message); virtual bool MessageReceived(BMessage* message);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* message, int32 modifiers); const BMessage* dragMessage, int32 modifiers);
virtual void MouseUp(BPoint where, int32 buttons); virtual void MouseUp(BPoint where, int32 buttons);
private: private:
@ -116,7 +116,7 @@ public:
virtual void MouseDown(BPoint where, int32 buttons, virtual void MouseDown(BPoint where, int32 buttons,
int32 modifiers); int32 modifiers);
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* message, int32 modifiers); const BMessage* dragMessage, int32 modifiers);
virtual void WindowActivated(bool active); virtual void WindowActivated(bool active);