some changes, fixed a rendering bug
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3574,18 +3574,18 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era
|
|||||||
BRegion inputRegion;
|
BRegion inputRegion;
|
||||||
if (fInline != NULL && fInline->IsActive())
|
if (fInline != NULL && fInline->IsActive())
|
||||||
GetTextRegion(fInline->Offset(), fInline->Offset() + fInline->Length(), &inputRegion);
|
GetTextRegion(fInline->Offset(), fInline->Offset() + fInline->Length(), &inputRegion);
|
||||||
|
|
||||||
float startLeft = fTextRect.left;
|
|
||||||
if (startOffset != -1) {
|
|
||||||
startLeft = PointAt(startOffset).x;
|
|
||||||
if (ByteAt(startOffset) == B_ENTER) {
|
|
||||||
// StartOffset is a newline
|
|
||||||
startLeft = PointAt((*fLines)[startLine]->offset).x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BPoint leftTop(startLeft, line->origin);
|
//BPoint leftTop(startLeft, line->origin);
|
||||||
for (long i = startLine; i <= endLine; i++) {
|
for (long i = startLine; i <= endLine; i++) {
|
||||||
|
float startLeft = fTextRect.left;
|
||||||
|
if (startOffset != -1) {
|
||||||
|
startLeft = PointAt(startOffset).x;
|
||||||
|
if (ByteAt(startOffset) == B_ENTER) {
|
||||||
|
// StartOffset is a newline
|
||||||
|
startLeft = PointAt((*fLines)[i]->offset).x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
long length = (line + 1)->offset;
|
long length = (line + 1)->offset;
|
||||||
if (startOffset != -1)
|
if (startOffset != -1)
|
||||||
length -= startOffset;
|
length -= startOffset;
|
||||||
@@ -3665,9 +3665,8 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era
|
|||||||
view->PopState();
|
view->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 returnedBytes = 0;
|
int32 returnedBytes = tabChars;
|
||||||
const char *string = fText->GetString(offset, tabChars, &returnedBytes);
|
view->DrawString(fText->GetString(offset, &returnedBytes), returnedBytes);
|
||||||
view->DrawString(string, returnedBytes);
|
|
||||||
|
|
||||||
if (foundTab) {
|
if (foundTab) {
|
||||||
float penPos = PenLocation().x - fTextRect.left;
|
float penPos = PenLocation().x - fTextRect.left;
|
||||||
@@ -3705,9 +3704,9 @@ BTextView::DrawLines(int32 startLine, int32 endLine, int32 startOffset, bool era
|
|||||||
|
|
||||||
if (fOffscreen != NULL) {
|
if (fOffscreen != NULL) {
|
||||||
view->Sync();
|
view->Sync();
|
||||||
BPoint penLocation = view->PenLocation();
|
/*BPoint penLocation = view->PenLocation();
|
||||||
BRect drawRect(leftTop.x, leftTop.y, penLocation.x, penLocation.y);
|
BRect drawRect(leftTop.x, leftTop.y, penLocation.x, penLocation.y);
|
||||||
DrawBitmap(fOffscreen, drawRect, drawRect);
|
DrawBitmap(fOffscreen, drawRect, drawRect);*/
|
||||||
fOffscreen->Unlock();
|
fOffscreen->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ _BTextGapBuffer_::~_BTextGapBuffer_()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_BTextGapBuffer_::InsertText(const char *inText, int32 inNumItems,
|
_BTextGapBuffer_::InsertText(const char *inText, int32 inNumItems, int32 inAtIndex)
|
||||||
int32 inAtIndex)
|
|
||||||
{
|
{
|
||||||
if (inNumItems < 1)
|
if (inNumItems < 1)
|
||||||
return;
|
return;
|
||||||
@@ -169,15 +168,15 @@ _BTextGapBuffer_::SizeGapTo(long inCount)
|
|||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
_BTextGapBuffer_::GetString(int32 fromOffset, int32 numBytes, int32 *returnedBytes)
|
_BTextGapBuffer_::GetString(int32 fromOffset, int32 *_numBytes)
|
||||||
{
|
{
|
||||||
char *result = "";
|
char *result = "";
|
||||||
|
if (_numBytes == NULL)
|
||||||
if (numBytes < 1) {
|
return result;
|
||||||
if (returnedBytes != NULL)
|
|
||||||
*returnedBytes = 0;
|
int32 numBytes = *_numBytes;
|
||||||
|
if (numBytes < 1)
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
|
|
||||||
bool isStartBeforeGap = (fromOffset < fGapIndex);
|
bool isStartBeforeGap = (fromOffset < fGapIndex);
|
||||||
bool isEndBeforeGap = ((fromOffset + numBytes - 1) < fGapIndex);
|
bool isEndBeforeGap = ((fromOffset + numBytes - 1) < fGapIndex);
|
||||||
@@ -199,9 +198,6 @@ _BTextGapBuffer_::GetString(int32 fromOffset, int32 numBytes, int32 *returnedByt
|
|||||||
result = fScratchBuffer;
|
result = fScratchBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnedBytes != NULL)
|
|
||||||
*returnedBytes = numBytes;
|
|
||||||
|
|
||||||
// TODO: this could be improved. We are overwriting what we did some lines ago,
|
// TODO: this could be improved. We are overwriting what we did some lines ago,
|
||||||
// we could just avoid to do that.
|
// we could just avoid to do that.
|
||||||
if (fPasswordMode) {
|
if (fPasswordMode) {
|
||||||
@@ -220,8 +216,7 @@ _BTextGapBuffer_::GetString(int32 fromOffset, int32 numBytes, int32 *returnedByt
|
|||||||
scratchPtr += charLen;
|
scratchPtr += charLen;
|
||||||
}
|
}
|
||||||
scratchPtr = '\0';
|
scratchPtr = '\0';
|
||||||
if (returnedBytes != NULL)
|
*_numBytes = newSize - 1;
|
||||||
*returnedBytes = newSize - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ virtual ~_BTextGapBuffer_();
|
|||||||
|
|
||||||
|
|
||||||
// char *RealText();
|
// char *RealText();
|
||||||
const char *GetString(int32 fromOffset, int32 numBytes, int32 *returnedBytes);
|
const char *GetString(int32 fromOffset, int32 *numBytes);
|
||||||
void GetString(int32 offset, int32 length, char *buffer);
|
void GetString(int32 offset, int32 length, char *buffer);
|
||||||
|
|
||||||
char RealCharAt(int32 offset) const;
|
char RealCharAt(int32 offset) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user