Removed SetViewCursor() from BTextView::_Deactivate(), as suggested by
cl21. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23203 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3541,81 +3541,82 @@ BTextView::_DrawLine(BView *view, const int32 &lineNum, const int32 &startOffset
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do we have any text to draw?
|
// do we have any text to draw?
|
||||||
if (length > 0) {
|
if (length <= 0)
|
||||||
bool foundTab = false;
|
return;
|
||||||
int32 tabChars = 0;
|
|
||||||
int32 numTabs = 0;
|
|
||||||
int32 offset = startOffset != -1 ? startOffset : line->offset;
|
|
||||||
const BFont *font = NULL;
|
|
||||||
const rgb_color *color = NULL;
|
|
||||||
int32 numBytes;
|
|
||||||
// iterate through each style on this line
|
|
||||||
while ((numBytes = fStyles->Iterate(offset, length, fInline, &font,
|
|
||||||
&color)) != 0) {
|
|
||||||
view->SetFont(font);
|
|
||||||
view->SetHighColor(*color);
|
|
||||||
|
|
||||||
tabChars = numBytes;
|
bool foundTab = false;
|
||||||
do {
|
int32 tabChars = 0;
|
||||||
foundTab = fText->FindChar(B_TAB, offset, &tabChars);
|
int32 numTabs = 0;
|
||||||
if (foundTab) {
|
int32 offset = startOffset != -1 ? startOffset : line->offset;
|
||||||
do {
|
const BFont *font = NULL;
|
||||||
numTabs++;
|
const rgb_color *color = NULL;
|
||||||
if (ByteAt(offset + tabChars + numTabs) != B_TAB)
|
int32 numBytes;
|
||||||
break;
|
// iterate through each style on this line
|
||||||
} while ((tabChars + numTabs) < numBytes);
|
while ((numBytes = fStyles->Iterate(offset, length, fInline, &font,
|
||||||
}
|
&color)) != 0) {
|
||||||
|
view->SetFont(font);
|
||||||
|
view->SetHighColor(*color);
|
||||||
|
|
||||||
if (inputRegion.CountRects() > 0) {
|
tabChars = numBytes;
|
||||||
BRegion textRegion;
|
do {
|
||||||
GetTextRegion(offset, offset + length, &textRegion);
|
foundTab = fText->FindChar(B_TAB, offset, &tabChars);
|
||||||
|
if (foundTab) {
|
||||||
|
do {
|
||||||
|
numTabs++;
|
||||||
|
if (ByteAt(offset + tabChars + numTabs) != B_TAB)
|
||||||
|
break;
|
||||||
|
} while ((tabChars + numTabs) < numBytes);
|
||||||
|
}
|
||||||
|
|
||||||
textRegion.IntersectWith(&inputRegion);
|
if (inputRegion.CountRects() > 0) {
|
||||||
view->PushState();
|
BRegion textRegion;
|
||||||
|
GetTextRegion(offset, offset + length, &textRegion);
|
||||||
|
|
||||||
// Highlight in blue the inputted text
|
textRegion.IntersectWith(&inputRegion);
|
||||||
view->SetHighColor(kBlueInputColor);
|
view->PushState();
|
||||||
|
|
||||||
|
// Highlight in blue the inputted text
|
||||||
|
view->SetHighColor(kBlueInputColor);
|
||||||
|
view->FillRect(textRegion.Frame());
|
||||||
|
|
||||||
|
// Highlight in red the selected part
|
||||||
|
if (fInline->SelectionLength() > 0) {
|
||||||
|
BRegion selectedRegion;
|
||||||
|
GetTextRegion(fInline->Offset()
|
||||||
|
+ fInline->SelectionOffset(), fInline->Offset()
|
||||||
|
+ fInline->SelectionOffset()
|
||||||
|
+ fInline->SelectionLength(), &selectedRegion);
|
||||||
|
|
||||||
|
textRegion.IntersectWith(&selectedRegion);
|
||||||
|
|
||||||
|
view->SetHighColor(kRedInputColor);
|
||||||
view->FillRect(textRegion.Frame());
|
view->FillRect(textRegion.Frame());
|
||||||
|
|
||||||
// Highlight in red the selected part
|
|
||||||
if (fInline->SelectionLength() > 0) {
|
|
||||||
BRegion selectedRegion;
|
|
||||||
GetTextRegion(fInline->Offset()
|
|
||||||
+ fInline->SelectionOffset(), fInline->Offset()
|
|
||||||
+ fInline->SelectionOffset()
|
|
||||||
+ fInline->SelectionLength(), &selectedRegion);
|
|
||||||
|
|
||||||
textRegion.IntersectWith(&selectedRegion);
|
|
||||||
|
|
||||||
view->SetHighColor(kRedInputColor);
|
|
||||||
view->FillRect(textRegion.Frame());
|
|
||||||
}
|
|
||||||
|
|
||||||
view->PopState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 returnedBytes = tabChars;
|
view->PopState();
|
||||||
const char *stringToDraw = fText->GetString(offset,
|
}
|
||||||
&returnedBytes);
|
|
||||||
|
|
||||||
view->DrawString(stringToDraw, returnedBytes);
|
int32 returnedBytes = tabChars;
|
||||||
if (foundTab) {
|
const char *stringToDraw = fText->GetString(offset,
|
||||||
float penPos = PenLocation().x - fTextRect.left;
|
&returnedBytes);
|
||||||
float tabWidth = _ActualTabWidth(penPos);
|
|
||||||
if (numTabs > 1)
|
|
||||||
tabWidth += ((numTabs - 1) * fTabWidth);
|
|
||||||
|
|
||||||
view->MovePenBy(tabWidth, 0.0);
|
view->DrawString(stringToDraw, returnedBytes);
|
||||||
tabChars += numTabs;
|
if (foundTab) {
|
||||||
}
|
float penPos = PenLocation().x - fTextRect.left;
|
||||||
|
float tabWidth = _ActualTabWidth(penPos);
|
||||||
|
if (numTabs > 1)
|
||||||
|
tabWidth += ((numTabs - 1) * fTabWidth);
|
||||||
|
|
||||||
offset += tabChars;
|
view->MovePenBy(tabWidth, 0.0);
|
||||||
length -= tabChars;
|
tabChars += numTabs;
|
||||||
numBytes -= tabChars;
|
}
|
||||||
tabChars = numBytes;
|
|
||||||
numTabs = 0;
|
offset += tabChars;
|
||||||
} while (foundTab && tabChars > 0);
|
length -= tabChars;
|
||||||
}
|
numBytes -= tabChars;
|
||||||
|
tabChars = numBytes;
|
||||||
|
numTabs = 0;
|
||||||
|
} while (foundTab && tabChars > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4191,12 +4192,6 @@ BTextView::_Deactivate()
|
|||||||
Highlight(fSelStart, fSelEnd);
|
Highlight(fSelStart, fSelEnd);
|
||||||
} else
|
} else
|
||||||
_HideCaret();
|
_HideCaret();
|
||||||
|
|
||||||
BPoint where;
|
|
||||||
ulong buttons;
|
|
||||||
GetMouse(&where, &buttons);
|
|
||||||
if (Bounds().Contains(where))
|
|
||||||
SetViewCursor(B_CURSOR_SYSTEM_DEFAULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user