* maintain width of 80 chars per line
* automatic whitespace cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30533 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2031,7 +2031,8 @@ BTextView::TextHeight(int32 startLine, int32 endLine) const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTextView::GetTextRegion(int32 startOffset, int32 endOffset, BRegion *outRegion) const
|
BTextView::GetTextRegion(int32 startOffset, int32 endOffset,
|
||||||
|
BRegion *outRegion) const
|
||||||
{
|
{
|
||||||
if (!outRegion)
|
if (!outRegion)
|
||||||
return;
|
return;
|
||||||
@@ -4472,10 +4473,9 @@ BTextView::_PerformMouseMoved(BPoint where, uint32 code)
|
|||||||
if (currentOffset <= fTrackingMouse->anchor) {
|
if (currentOffset <= fTrackingMouse->anchor) {
|
||||||
fTrackingMouse->selStart
|
fTrackingMouse->selStart
|
||||||
= (*fLines)[_LineAt(currentOffset)]->offset;
|
= (*fLines)[_LineAt(currentOffset)]->offset;
|
||||||
fTrackingMouse->selEnd
|
fTrackingMouse->selEnd = fTrackingMouse->shiftDown
|
||||||
= fTrackingMouse->shiftDown
|
? fSelEnd
|
||||||
? fSelEnd
|
: (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset;
|
||||||
: (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset;
|
|
||||||
} else {
|
} else {
|
||||||
fTrackingMouse->selStart
|
fTrackingMouse->selStart
|
||||||
= fTrackingMouse->shiftDown
|
= fTrackingMouse->shiftDown
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ _BStyleRecordBuffer_::_BStyleRecordBuffer_()
|
|||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont, const rgb_color *inColor)
|
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont,
|
||||||
|
const rgb_color *inColor)
|
||||||
{
|
{
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
|
|
||||||
@@ -138,7 +139,8 @@ _BStyleRecordBuffer_::RemoveRecord(int32 index)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
_BStyleRecordBuffer_::MatchRecord(const BFont *inFont, const rgb_color *inColor, int32 *outIndex)
|
_BStyleRecordBuffer_::MatchRecord(const BFont *inFont, const rgb_color *inColor,
|
||||||
|
int32 *outIndex)
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < fItemCount; i++) {
|
for (int32 i = 0; i < fItemCount; i++) {
|
||||||
if (*inFont == fBuffer[i].style.font
|
if (*inFont == fBuffer[i].style.font
|
||||||
@@ -176,7 +178,8 @@ SetStyleFromMode(uint32 mode, const BFont *fromFont, BFont *toFont,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTextView::StyleBuffer::StyleBuffer(const BFont *inFont, const rgb_color *inColor)
|
BTextView::StyleBuffer::StyleBuffer(const BFont *inFont,
|
||||||
|
const rgb_color *inColor)
|
||||||
:
|
:
|
||||||
fValidNullStyle(true)
|
fValidNullStyle(true)
|
||||||
{
|
{
|
||||||
@@ -216,12 +219,14 @@ void
|
|||||||
BTextView::StyleBuffer::SetNullStyle(uint32 inMode, const BFont *inFont,
|
BTextView::StyleBuffer::SetNullStyle(uint32 inMode, const BFont *inFont,
|
||||||
const rgb_color *inColor, int32 offset)
|
const rgb_color *inColor, int32 offset)
|
||||||
{
|
{
|
||||||
if (fValidNullStyle || fStyleRunDesc.ItemCount() < 1)
|
if (fValidNullStyle || fStyleRunDesc.ItemCount() < 1) {
|
||||||
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, &fNullStyle.color);
|
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor,
|
||||||
else {
|
&fNullStyle.color);
|
||||||
|
} else {
|
||||||
int32 index = OffsetToRun(offset - 1);
|
int32 index = OffsetToRun(offset - 1);
|
||||||
fNullStyle = fStyleRecord[fStyleRunDesc[index]->index]->style;
|
fNullStyle = fStyleRecord[fStyleRunDesc[index]->index]->style;
|
||||||
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, &fNullStyle.color);
|
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor,
|
||||||
|
&fNullStyle.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
fValidNullStyle = true;
|
fValidNullStyle = true;
|
||||||
@@ -229,11 +234,12 @@ BTextView::StyleBuffer::SetNullStyle(uint32 inMode, const BFont *inFont,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTextView::StyleBuffer::GetNullStyle(const BFont **font, const rgb_color **color) const
|
BTextView::StyleBuffer::GetNullStyle(const BFont **font,
|
||||||
|
const rgb_color **color) const
|
||||||
{
|
{
|
||||||
if (font)
|
if (font != NULL)
|
||||||
*font = &fNullStyle.font;
|
*font = &fNullStyle.font;
|
||||||
if (color)
|
if (color != NULL)
|
||||||
*color = &fNullStyle.color;
|
*color = &fNullStyle.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,8 +247,9 @@ BTextView::StyleBuffer::GetNullStyle(const BFont **font, const rgb_color **color
|
|||||||
STEStyleRange *
|
STEStyleRange *
|
||||||
BTextView::StyleBuffer::AllocateStyleRange(const int32 numStyles) const
|
BTextView::StyleBuffer::AllocateStyleRange(const int32 numStyles) const
|
||||||
{
|
{
|
||||||
STEStyleRange* range = (STEStyleRange *)malloc(sizeof(int32) + sizeof(STEStyleRun) * numStyles);
|
STEStyleRange* range = (STEStyleRange *)malloc(sizeof(int32)
|
||||||
if (range)
|
+ sizeof(STEStyleRun) * numStyles);
|
||||||
|
if (range != NULL)
|
||||||
range->count = numStyles;
|
range->count = numStyles;
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
@@ -326,7 +333,8 @@ BTextView::StyleBuffer::SetStyleRange(int32 fromOffset, int32 toOffset,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTextView::StyleBuffer::GetStyle(int32 inOffset, BFont *outFont, rgb_color *outColor) const
|
BTextView::StyleBuffer::GetStyle(int32 inOffset, BFont *outFont,
|
||||||
|
rgb_color *outColor) const
|
||||||
{
|
{
|
||||||
if (fStyleRunDesc.ItemCount() < 1) {
|
if (fStyleRunDesc.ItemCount() < 1) {
|
||||||
if (outFont)
|
if (outFont)
|
||||||
@@ -487,7 +495,8 @@ BTextView::StyleBuffer::operator[](int32 index) const
|
|||||||
// ? CompareStyles ?
|
// ? CompareStyles ?
|
||||||
// ? FilterStyles ?
|
// ? FilterStyles ?
|
||||||
static void
|
static void
|
||||||
FixupMode(const STEStyle &firstStyle, const STEStyle &otherStyle, uint32 &mode, bool &sameColor)
|
FixupMode(const STEStyle &firstStyle, const STEStyle &otherStyle, uint32 &mode,
|
||||||
|
bool &sameColor)
|
||||||
{
|
{
|
||||||
if (mode & B_FONT_FAMILY_AND_STYLE) {
|
if (mode & B_FONT_FAMILY_AND_STYLE) {
|
||||||
if (firstStyle.font != otherStyle.font)
|
if (firstStyle.font != otherStyle.font)
|
||||||
@@ -550,7 +559,8 @@ BTextView::StyleBuffer::ContinuousGetStyle(BFont *outFont, uint32 *ioMode,
|
|||||||
|
|
||||||
for (int32 i = fromIndex; i < toIndex; i++) {
|
for (int32 i = fromIndex; i < toIndex; i++) {
|
||||||
styleIndex = fStyleRunDesc[i]->index;
|
styleIndex = fStyleRunDesc[i]->index;
|
||||||
FixupMode(fStyleRecord[styleIndex]->style, theStyle, mode, oneColor);
|
FixupMode(fStyleRecord[styleIndex]->style, theStyle, mode,
|
||||||
|
oneColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioMode)
|
if (ioMode)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ _BStyleRunDescBuffer_::operator[](int32 index) const
|
|||||||
return &fBuffer[index];
|
return &fBuffer[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// _BStyleRecordBuffer_ class --------------------------------------------------
|
// _BStyleRecordBuffer_ class --------------------------------------------------
|
||||||
class _BStyleRecordBuffer_ : public _BTextViewSupportBuffer_<STEStyleRecord> {
|
class _BStyleRecordBuffer_ : public _BTextViewSupportBuffer_<STEStyleRecord> {
|
||||||
public:
|
public:
|
||||||
@@ -77,7 +77,7 @@ class _BStyleRecordBuffer_ : public _BTextViewSupportBuffer_<STEStyleRecord> {
|
|||||||
|
|
||||||
int32 InsertRecord(const BFont *inFont, const rgb_color *inColor);
|
int32 InsertRecord(const BFont *inFont, const rgb_color *inColor);
|
||||||
void CommitRecord(int32 index);
|
void CommitRecord(int32 index);
|
||||||
void RemoveRecord(int32 index);
|
void RemoveRecord(int32 index);
|
||||||
|
|
||||||
bool MatchRecord(const BFont *inFont, const rgb_color *inColor,
|
bool MatchRecord(const BFont *inFont, const rgb_color *inColor,
|
||||||
int32 *outIndex);
|
int32 *outIndex);
|
||||||
@@ -104,34 +104,35 @@ class BTextView::StyleBuffer {
|
|||||||
|
|
||||||
void SyncNullStyle(int32 offset);
|
void SyncNullStyle(int32 offset);
|
||||||
void SetNullStyle(uint32 inMode, const BFont *inFont,
|
void SetNullStyle(uint32 inMode, const BFont *inFont,
|
||||||
const rgb_color *inColor, int32 offset = 0);
|
const rgb_color *inColor, int32 offset = 0);
|
||||||
void GetNullStyle(const BFont **font,
|
void GetNullStyle(const BFont **font,
|
||||||
const rgb_color **color) const;
|
const rgb_color **color) const;
|
||||||
|
|
||||||
void GetStyle(int32 inOffset, BFont *outFont,
|
void GetStyle(int32 inOffset, BFont *outFont,
|
||||||
rgb_color *outColor) const;
|
rgb_color *outColor) const;
|
||||||
void ContinuousGetStyle(BFont *, uint32 *, rgb_color *,
|
void ContinuousGetStyle(BFont *, uint32 *, rgb_color *,
|
||||||
bool *, int32, int32) const;
|
bool *, int32, int32) const;
|
||||||
|
|
||||||
STEStyleRange* AllocateStyleRange(const int32 numStyles) const;
|
STEStyleRange* AllocateStyleRange(const int32 numStyles) const;
|
||||||
void SetStyleRange(int32 fromOffset, int32 toOffset,
|
void SetStyleRange(int32 fromOffset, int32 toOffset,
|
||||||
int32 textLen, uint32 inMode,
|
int32 textLen, uint32 inMode,
|
||||||
const BFont *inFont, const rgb_color *inColor);
|
const BFont *inFont, const rgb_color *inColor);
|
||||||
STEStyleRange* GetStyleRange(int32 startOffset, int32 endOffset) const;
|
STEStyleRange* GetStyleRange(int32 startOffset,
|
||||||
|
int32 endOffset) const;
|
||||||
|
|
||||||
void RemoveStyleRange(int32 fromOffset, int32 toOffset);
|
void RemoveStyleRange(int32 fromOffset, int32 toOffset);
|
||||||
void RemoveStyles(int32 index, int32 count = 1);
|
void RemoveStyles(int32 index, int32 count = 1);
|
||||||
|
|
||||||
int32 Iterate(int32 fromOffset, int32 length,
|
int32 Iterate(int32 fromOffset, int32 length,
|
||||||
InlineInput* input,
|
InlineInput* input,
|
||||||
const BFont **outFont = NULL,
|
const BFont **outFont = NULL,
|
||||||
const rgb_color **outColor = NULL,
|
const rgb_color **outColor = NULL,
|
||||||
float *outAscent = NULL,
|
float *outAscent = NULL,
|
||||||
float *outDescen = NULL, uint32 * = NULL) const;
|
float *outDescen = NULL, uint32 * = NULL) const;
|
||||||
|
|
||||||
int32 OffsetToRun(int32 offset) const;
|
int32 OffsetToRun(int32 offset) const;
|
||||||
void BumpOffset(int32 delta, int32 index);
|
void BumpOffset(int32 delta, int32 index);
|
||||||
|
|
||||||
STEStyleRun operator[](int32 index) const;
|
STEStyleRun operator[](int32 index) const;
|
||||||
int32 NumRuns() const;
|
int32 NumRuns() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user