Revert "TermViewStates: Check if fView is NULL before using it."

This reverts commit b84955c738.
This commit is contained in:
John Scipione 2014-06-05 18:02:44 -04:00
parent 4bf5fb9252
commit 7a214200ed

View File

@ -1,16 +1,13 @@
/*
* Copyright 2004-2014, Haiku, Inc.
* Copyright 2001-2013, Haiku, Inc.
* Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net
* Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai.
* All rights reserved.
*
* Distributed under the terms of the MIT license.
* All rights reserved. Distributed under the terms of the MIT license.
*
* Authors:
* Stefano Ceccherini, stefano.ceccherini@gmail.com
* Kian Duffy, myob@users.sourceforge.net
* Y.Hayakawa, hida@sawada.riec.tohoku.ac.jp
* John Scipione, jscipione@gmail.com
* Ingo Weinhold, ingo_weinhold@gmx.de
* Clemens Zeidler, haiku@Clemens-Zeidler.de
* Siarzhuk Zharski, zharik@gmx.li
@ -155,9 +152,6 @@ TermView::StandardBaseState::StandardBaseState(TermView* view)
bool
TermView::StandardBaseState::_StandardMouseMoved(BPoint where, int32 modifiers)
{
if (fView == NULL)
return false;
if (!fView->fReportAnyMouseEvent && !fView->fReportButtonMouseEvent)
return false;
@ -199,9 +193,6 @@ TermView::DefaultState::ModifiersChanged(int32 oldModifiers, int32 modifiers)
void
TermView::DefaultState::KeyDown(const char* bytes, int32 numBytes)
{
if (fView == NULL || fView->Looper() == NULL)
return;
int32 key;
int32 mod;
int32 rawChar;
@ -375,9 +366,6 @@ TermView::DefaultState::KeyDown(const char* bytes, int32 numBytes)
void
TermView::DefaultState::MouseDown(BPoint where, int32 buttons, int32 modifiers)
{
if (fView == NULL)
return;
if (fView->fReportAnyMouseEvent || fView->fReportButtonMouseEvent
|| fView->fReportNormalMouseEvent || fView->fReportX10MouseEvent) {
TermPos clickPos = fView->_ConvertToTerminal(where);
@ -414,7 +402,7 @@ TermView::DefaultState::MouseMoved(BPoint where, uint32 transit,
void
TermView::DefaultState::WindowActivated(bool active)
{
if (active && fView != NULL)
if (active)
_CheckEnterHyperLinkState(fView->fModifiers);
}
@ -422,8 +410,7 @@ TermView::DefaultState::WindowActivated(bool active)
bool
TermView::DefaultState::_CheckEnterHyperLinkState(int32 modifiers)
{
if ((modifiers & B_COMMAND_KEY) != 0 && fView != NULL
&& fView->Window() != NULL && fView->Window()->IsActive()) {
if ((modifiers & B_COMMAND_KEY) != 0 && fView->Window()->IsActive()) {
fView->_NextState(fView->fHyperLinkState);
return true;
}
@ -448,9 +435,6 @@ TermView::SelectState::SelectState(TermView* view)
void
TermView::SelectState::Prepare(BPoint where, int32 modifiers)
{
if (fView == NULL || fView->Window() == NULL)
return;
int32 clicks;
fView->Window()->CurrentMessage()->FindInt32("clicks", &clicks);
@ -608,9 +592,6 @@ TermView::SelectState::MouseUp(BPoint where, int32 buttons)
fCheckMouseTracking = false;
fMouseTracking = false;
if (fView == NULL)
return;
if (fView->fAutoScrollRunner != NULL) {
delete fView->fAutoScrollRunner;
fView->fAutoScrollRunner = NULL;
@ -635,9 +616,6 @@ TermView::SelectState::MouseUp(BPoint where, int32 buttons)
void
TermView::SelectState::_AutoScrollUpdate()
{
if (fView == NULL)
return;
if (fMouseTracking && fView->fAutoScrollRunner != NULL
&& fView->fScrollBar != NULL) {
float value = fView->fScrollBar->Value();
@ -674,9 +652,6 @@ TermView::HyperLinkState::HyperLinkState(TermView* view)
void
TermView::HyperLinkState::Entered()
{
if (fView == NULL)
return;
ActiveProcessInfo activeProcessInfo;
if (fView->GetActiveProcessInfo(activeProcessInfo))
fCurrentDirectory = activeProcessInfo.CurrentDirectory();
@ -697,9 +672,6 @@ TermView::HyperLinkState::Exited()
void
TermView::HyperLinkState::ModifiersChanged(int32 oldModifiers, int32 modifiers)
{
if (fView == NULL)
return;
if ((modifiers & B_COMMAND_KEY) == 0)
fView->_NextState(fView->fDefaultState);
else
@ -722,10 +694,8 @@ TermView::HyperLinkState::MouseDown(BPoint where, int32 buttons,
if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0) {
link.Open();
} else if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
if (fView != NULL) {
fView->fHyperLinkMenuState->Prepare(where, link);
fView->_NextState(fView->fHyperLinkMenuState);
}
fView->fHyperLinkMenuState->Prepare(where, link);
fView->_NextState(fView->fHyperLinkMenuState);
}
}
@ -741,7 +711,7 @@ TermView::HyperLinkState::MouseMoved(BPoint where, uint32 transit,
void
TermView::HyperLinkState::WindowActivated(bool active)
{
if (!active && fView != NULL)
if (!active)
fView->_NextState(fView->fDefaultState);
}
@ -763,10 +733,7 @@ TermView::HyperLinkState::ForegroundColor()
rgb_color
TermView::HyperLinkState::BackgroundColor()
{
if (fView != NULL)
return fView->fTextBackColor;
return make_color(255, 255, 255);
return fView->fTextBackColor;
}
@ -1000,9 +967,6 @@ TermView::HyperLinkState::_ActivateHighlight(const TermPos& start,
}
fHighlight.SetRange(start, end);
if (fView == NULL)
return;
fView->_AddHighlight(&fHighlight);
BCursor cursor(B_CURSOR_ID_FOLLOW_LINK);
fView->SetViewCursor(&cursor);
@ -1013,7 +977,7 @@ TermView::HyperLinkState::_ActivateHighlight(const TermPos& start,
void
TermView::HyperLinkState::_DeactivateHighlight()
{
if (fHighlightActive && fView != NULL) {
if (fHighlightActive) {
fView->_RemoveHighlight(&fHighlight);
BCursor cursor(B_CURSOR_ID_SYSTEM_DEFAULT);
fView->SetViewCursor(&cursor);
@ -1124,8 +1088,7 @@ TermView::HyperLinkMenuState::MessageReceived(BMessage* message)
}
case kMessageMenuClosed:
if (fView != NULL)
fView->_NextState(fView->fDefaultState);
fView->_NextState(fView->fDefaultState);
return true;
}