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