Implemented BTextView::SetText(BFile *.... etc.)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8038 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2004-06-18 09:51:10 +00:00
parent e3a2e77198
commit 895207da06
3 changed files with 72 additions and 3 deletions
+33 -2
View File
@@ -951,11 +951,42 @@ BTextView::SetText(const char *inText, int32 inLength,
}
//------------------------------------------------------------------------------
void
BTextView::SetText(BFile *inFile, int32 startOffset, int32 inLength,
BTextView::SetText(BFile *inFile, int32 inOffset, int32 inLength,
const text_run_array *inRuns)
{
CALLED();
// TODO:
// TODO: Should probably call _DoDeleteText() here
if (fText->Length() > 0)
DeleteText(0, fText->Length());
fText->InsertText(inFile, inOffset, inLength, 0);
// update the start offsets of each line below offset
fLines->BumpOffset(inLength, LineAt(inOffset) + 1);
// update the style runs
fStyles->BumpOffset(inLength, fStyles->OffsetToRun(inOffset - 1) + 1);
if (inRuns != NULL)
//SetStyleRange(inOffset, inOffset + inLength, inStyles, false);
SetRunArray(inOffset, inOffset + inLength, inRuns);
else {
// apply nullStyle to inserted text
fStyles->SyncNullStyle(inOffset);
fStyles->SetStyleRange(inOffset, inOffset + inLength,
fText->Length(), doAll, NULL, NULL);
}
fSelStart = fSelEnd = 0;
// recalc line breaks and draw the text
Refresh(0, inLength, true, true);
// draw the caret
if (fActive) {
if (!fCaretVisible)
InvertCaret();
}
}
//------------------------------------------------------------------------------
void