More changes to StyleBuffer. Now BTextView::AutoResize() has a minimum
size of 3 pixels. To be verified, but seems to work better. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18657 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ffe3f107c4
commit
b12f75cfdc
@ -85,8 +85,7 @@ _BStyleRecordBuffer_::_BStyleRecordBuffer_()
|
||||
|
||||
|
||||
int32
|
||||
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont,
|
||||
const rgb_color *inColor)
|
||||
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont, const rgb_color *inColor)
|
||||
{
|
||||
int32 index = 0;
|
||||
|
||||
@ -111,14 +110,14 @@ _BStyleRecordBuffer_::InsertRecord(const BFont *inFont,
|
||||
}
|
||||
|
||||
// no unused space, expand the buffer
|
||||
index = fItemCount;
|
||||
STEStyleRecord newRecord;
|
||||
newRecord.refs = 0;
|
||||
newRecord.ascent = fh.ascent;
|
||||
newRecord.descent = fh.descent + fh.leading;
|
||||
newRecord.style.font = *inFont;
|
||||
newRecord.style.color = *inColor;
|
||||
InsertItemsAt(1, index, &newRecord);
|
||||
const STEStyle style = { *inFont, *inColor };
|
||||
const STEStyleRecord newRecord = {
|
||||
0,
|
||||
fh.ascent,
|
||||
fh.descent + fh.leading,
|
||||
style
|
||||
};
|
||||
InsertItemsAt(1, fItemCount, &newRecord);
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -176,8 +175,9 @@ SetStyleFromMode(uint32 mode, const BFont *fromFont, BFont *toFont,
|
||||
|
||||
|
||||
_BStyleBuffer_::_BStyleBuffer_(const BFont *inFont, const rgb_color *inColor)
|
||||
:
|
||||
fValidNullStyle(true)
|
||||
{
|
||||
fValidNullStyle = true;
|
||||
fNullStyle.font = *inFont;
|
||||
fNullStyle.color = *inColor;
|
||||
}
|
||||
@ -227,8 +227,7 @@ _BStyleBuffer_::SetNullStyle(uint32 inMode, const BFont *inFont,
|
||||
|
||||
|
||||
void
|
||||
_BStyleBuffer_::GetNullStyle(const BFont **font,
|
||||
const rgb_color **color) const
|
||||
_BStyleBuffer_::GetNullStyle(const BFont **font, const rgb_color **color) const
|
||||
{
|
||||
if (font)
|
||||
*font = &fNullStyle.font;
|
||||
|
@ -138,9 +138,9 @@ class _BStyleBuffer_ {
|
||||
const _BStyleRunDescBuffer_& RunBuffer() const;
|
||||
const _BStyleRecordBuffer_& RecordBuffer() const;
|
||||
|
||||
protected:
|
||||
_BStyleRunDescBuffer_ fStyleRunDesc;
|
||||
_BStyleRecordBuffer_ fStyleRecord;
|
||||
private:
|
||||
_BStyleRunDescBuffer_ fStyleRunDesc;
|
||||
_BStyleRecordBuffer_ fStyleRecord;
|
||||
bool fValidNullStyle;
|
||||
STEStyle fNullStyle;
|
||||
};
|
||||
|
@ -4020,7 +4020,9 @@ BTextView::AutoResize(bool redraw)
|
||||
float newWidth = 0;
|
||||
for (int32 i = 0; i < CountLines(); i++)
|
||||
newWidth += LineWidth(i);
|
||||
|
||||
|
||||
if (newWidth < 3)
|
||||
newWidth = 3;
|
||||
BRect newRect(0, 0, ceilf(newWidth) + 1, ceilf(TextHeight(0, 0)) + 1);
|
||||
|
||||
if (fContainerView != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user