* 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:
Oliver Tappe 2009-05-01 14:27:52 +00:00
parent 5cc8dc2fe3
commit 73af36d459
3 changed files with 44 additions and 33 deletions

View File

@ -2031,7 +2031,8 @@ BTextView::TextHeight(int32 startLine, int32 endLine) const
void
BTextView::GetTextRegion(int32 startOffset, int32 endOffset, BRegion *outRegion) const
BTextView::GetTextRegion(int32 startOffset, int32 endOffset,
BRegion *outRegion) const
{
if (!outRegion)
return;
@ -4472,10 +4473,9 @@ BTextView::_PerformMouseMoved(BPoint where, uint32 code)
if (currentOffset <= fTrackingMouse->anchor) {
fTrackingMouse->selStart
= (*fLines)[_LineAt(currentOffset)]->offset;
fTrackingMouse->selEnd
= fTrackingMouse->shiftDown
? fSelEnd
: (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset;
fTrackingMouse->selEnd = fTrackingMouse->shiftDown
? fSelEnd
: (*fLines)[_LineAt(fTrackingMouse->anchor) + 1]->offset;
} else {
fTrackingMouse->selStart
= fTrackingMouse->shiftDown

View File

@ -85,7 +85,8 @@ _BStyleRecordBuffer_::_BStyleRecordBuffer_()
int32
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont, const rgb_color *inColor)
_BStyleRecordBuffer_::InsertRecord(const BFont *inFont,
const rgb_color *inColor)
{
int32 index = 0;
@ -138,7 +139,8 @@ _BStyleRecordBuffer_::RemoveRecord(int32 index)
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++) {
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)
{
@ -216,12 +219,14 @@ void
BTextView::StyleBuffer::SetNullStyle(uint32 inMode, const BFont *inFont,
const rgb_color *inColor, int32 offset)
{
if (fValidNullStyle || fStyleRunDesc.ItemCount() < 1)
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, &fNullStyle.color);
else {
if (fValidNullStyle || fStyleRunDesc.ItemCount() < 1) {
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor,
&fNullStyle.color);
} else {
int32 index = OffsetToRun(offset - 1);
fNullStyle = fStyleRecord[fStyleRunDesc[index]->index]->style;
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor, &fNullStyle.color);
SetStyleFromMode(inMode, inFont, &fNullStyle.font, inColor,
&fNullStyle.color);
}
fValidNullStyle = true;
@ -229,11 +234,12 @@ BTextView::StyleBuffer::SetNullStyle(uint32 inMode, const BFont *inFont,
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;
if (color)
if (color != NULL)
*color = &fNullStyle.color;
}
@ -241,8 +247,9 @@ BTextView::StyleBuffer::GetNullStyle(const BFont **font, const rgb_color **color
STEStyleRange *
BTextView::StyleBuffer::AllocateStyleRange(const int32 numStyles) const
{
STEStyleRange* range = (STEStyleRange *)malloc(sizeof(int32) + sizeof(STEStyleRun) * numStyles);
if (range)
STEStyleRange* range = (STEStyleRange *)malloc(sizeof(int32)
+ sizeof(STEStyleRun) * numStyles);
if (range != NULL)
range->count = numStyles;
return range;
}
@ -326,7 +333,8 @@ BTextView::StyleBuffer::SetStyleRange(int32 fromOffset, int32 toOffset,
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 (outFont)
@ -487,7 +495,8 @@ BTextView::StyleBuffer::operator[](int32 index) const
// ? CompareStyles ?
// ? FilterStyles ?
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 (firstStyle.font != otherStyle.font)
@ -550,7 +559,8 @@ BTextView::StyleBuffer::ContinuousGetStyle(BFont *outFont, uint32 *ioMode,
for (int32 i = fromIndex; i < toIndex; i++) {
styleIndex = fStyleRunDesc[i]->index;
FixupMode(fStyleRecord[styleIndex]->style, theStyle, mode, oneColor);
FixupMode(fStyleRecord[styleIndex]->style, theStyle, mode,
oneColor);
}
if (ioMode)

View File

@ -69,7 +69,7 @@ _BStyleRunDescBuffer_::operator[](int32 index) const
return &fBuffer[index];
}
// _BStyleRecordBuffer_ class --------------------------------------------------
class _BStyleRecordBuffer_ : public _BTextViewSupportBuffer_<STEStyleRecord> {
public:
@ -77,7 +77,7 @@ class _BStyleRecordBuffer_ : public _BTextViewSupportBuffer_<STEStyleRecord> {
int32 InsertRecord(const BFont *inFont, const rgb_color *inColor);
void CommitRecord(int32 index);
void RemoveRecord(int32 index);
void RemoveRecord(int32 index);
bool MatchRecord(const BFont *inFont, const rgb_color *inColor,
int32 *outIndex);
@ -104,34 +104,35 @@ class BTextView::StyleBuffer {
void SyncNullStyle(int32 offset);
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,
const rgb_color **color) const;
const rgb_color **color) const;
void GetStyle(int32 inOffset, BFont *outFont,
rgb_color *outColor) const;
void ContinuousGetStyle(BFont *, uint32 *, rgb_color *,
bool *, int32, int32) const;
STEStyleRange* AllocateStyleRange(const int32 numStyles) const;
STEStyleRange* AllocateStyleRange(const int32 numStyles) const;
void SetStyleRange(int32 fromOffset, int32 toOffset,
int32 textLen, uint32 inMode,
int32 textLen, uint32 inMode,
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 RemoveStyles(int32 index, int32 count = 1);
int32 Iterate(int32 fromOffset, int32 length,
InlineInput* input,
const BFont **outFont = NULL,
const rgb_color **outColor = NULL,
float *outAscent = NULL,
float *outDescen = NULL, uint32 * = NULL) const;
float *outDescen = NULL, uint32 * = NULL) const;
int32 OffsetToRun(int32 offset) const;
void BumpOffset(int32 delta, int32 index);
STEStyleRun operator[](int32 index) const;
int32 NumRuns() const;