Style fixes in librunview, solved a regression, solved some warnings.
This commit is contained in:
parent
fdd6eb021b
commit
9cb0ef099e
|
@ -67,11 +67,11 @@
|
||||||
// cursor data for hovering over URLs
|
// cursor data for hovering over URLs
|
||||||
|
|
||||||
static unsigned char URLCursorData[] = {16, 1, 2, 2,
|
static unsigned char URLCursorData[] = {16, 1, 2, 2,
|
||||||
0, 0, 0, 0, 56, 0, 36, 0, 36, 0, 19, 224, 18, 92, 9, 42,
|
0, 0, 0, 0, 56, 0, 36, 0, 36, 0, 19, 224, 18, 92, 9, 42,
|
||||||
8, 1, 60, 33, 76, 49, 66, 121, 48, 125, 12, 253, 2, 0, 1, 0,
|
8, 1, 60, 33, 76, 49, 66, 121, 48, 125, 12, 253, 2, 0, 1, 0,
|
||||||
0, 0, 0, 0, 56, 0, 60, 0, 60, 0, 31, 224, 31, 252, 15, 254,
|
0, 0, 0, 0, 56, 0, 60, 0, 60, 0, 31, 224, 31, 252, 15, 254,
|
||||||
15, 255, 63, 255, 127, 255, 127, 255, 63, 255, 15, 255, 3, 254, 1, 248
|
15, 255, 63, 255, 127, 255, 127, 255, 63, 255, 15, 255, 3, 254, 1, 248
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SoftBreak {
|
struct SoftBreak {
|
||||||
int fOffset;
|
int fOffset;
|
||||||
|
@ -102,72 +102,69 @@ struct SoftBreakEnd {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FontColor {
|
struct FontColor {
|
||||||
int fOffset;
|
int fOffset;
|
||||||
// G++ is stupid. We only need 2 bits
|
int fWhich;
|
||||||
// for fWhich, but the compiler has a bug
|
int fIndex;
|
||||||
// and warns us against fWhich == 2
|
|
||||||
int fWhich;
|
|
||||||
int fIndex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Line {
|
struct Line {
|
||||||
char* fText;
|
char* fText;
|
||||||
time_t fStamp;
|
time_t fStamp;
|
||||||
urllist* fUrls;
|
urllist* fUrls;
|
||||||
int16* fSpaces;
|
float* fSpaces;
|
||||||
int16* fEdges;
|
float* fEdges;
|
||||||
FontColor* fFcs;
|
FontColor* fFcs;
|
||||||
SoftBreak* fSofties;
|
SoftBreak* fSofties;
|
||||||
float fTop;
|
float fTop;
|
||||||
float fBottom;
|
float fBottom;
|
||||||
|
|
||||||
int fLength;
|
int fLength;
|
||||||
int fSpace_count;
|
int fSpace_count;
|
||||||
int fEdge_count;
|
int fEdge_count;
|
||||||
int fFc_count;
|
int fFc_count;
|
||||||
int fSoftie_size;
|
int fSoftie_size;
|
||||||
int fSoftie_used;
|
int fSoftie_used;
|
||||||
|
|
||||||
Line (
|
Line (
|
||||||
const char* buffer,
|
const char* buffer,
|
||||||
int fLength,
|
int fLength,
|
||||||
float top,
|
float top,
|
||||||
float width,
|
float width,
|
||||||
Theme* fTheme,
|
Theme* fTheme,
|
||||||
const char* fStamp_format,
|
const char* fStamp_format,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font);
|
int font);
|
||||||
|
|
||||||
~Line (void);
|
~Line (void);
|
||||||
|
|
||||||
void Append (
|
void Append (
|
||||||
const char* buffer,
|
const char* buffer,
|
||||||
int len,
|
int len,
|
||||||
float width,
|
float width,
|
||||||
Theme* fTheme,
|
Theme* fTheme,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font);
|
int font);
|
||||||
|
|
||||||
void FigureSpaces (void);
|
void FigureSpaces (void);
|
||||||
|
|
||||||
void FigureFontColors (
|
void FigureFontColors (
|
||||||
int pos,
|
int pos,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font);
|
int font);
|
||||||
|
|
||||||
void FigureEdges (
|
void FigureEdges (
|
||||||
Theme* fTheme,
|
Theme* fTheme,
|
||||||
float width);
|
float width);
|
||||||
|
|
||||||
void SoftBreaks (
|
void SoftBreaks (
|
||||||
Theme* fTheme,
|
Theme* fTheme,
|
||||||
float width);
|
float width);
|
||||||
|
|
||||||
void AddSoftBreak (SoftBreakEnd , float&,
|
void AddSoftBreak (SoftBreakEnd , float&,
|
||||||
uint16&, int16&, float&, float&, Theme*);
|
int&, int16&, float&, float&, Theme*);
|
||||||
|
|
||||||
int16 CountChars (int pos, int len);
|
int16 CountChars (int pos, int len);
|
||||||
size_t SetStamp (const char*, bool);
|
size_t SetStamp (const char*, bool);
|
||||||
|
@ -315,10 +312,10 @@ RunView::Draw (BRect frame)
|
||||||
remains = frame;
|
remains = frame;
|
||||||
else if (frame.bottom >= fLines[fLine_count - 1]->fBottom + 1.0)
|
else if (frame.bottom >= fLines[fLine_count - 1]->fBottom + 1.0)
|
||||||
remains.Set (
|
remains.Set (
|
||||||
frame.left,
|
frame.left,
|
||||||
fLines[fLine_count - 1]->fBottom + 1,
|
fLines[fLine_count - 1]->fBottom + 1,
|
||||||
frame.right,
|
frame.right,
|
||||||
frame.bottom);
|
frame.bottom);
|
||||||
|
|
||||||
if (remains.IsValid()) {
|
if (remains.IsValid()) {
|
||||||
SetLowColor (view_color);
|
SetLowColor (view_color);
|
||||||
|
@ -407,15 +404,15 @@ RunView::Draw (BRect frame)
|
||||||
int fLength (line->fSofties[sit].fOffset - place + last_len);
|
int fLength (line->fSofties[sit].fOffset - place + last_len);
|
||||||
|
|
||||||
if (fore < line->fFc_count
|
if (fore < line->fFc_count
|
||||||
&& line->fFcs[fore].fOffset - place < fLength)
|
&& line->fFcs[fore].fOffset - place < fLength)
|
||||||
fLength = line->fFcs[fore].fOffset - place;
|
fLength = line->fFcs[fore].fOffset - place;
|
||||||
|
|
||||||
if (back < line->fFc_count
|
if (back < line->fFc_count
|
||||||
&& line->fFcs[back].fOffset - place < fLength)
|
&& line->fFcs[back].fOffset - place < fLength)
|
||||||
fLength = line->fFcs[back].fOffset - place;
|
fLength = line->fFcs[back].fOffset - place;
|
||||||
|
|
||||||
if (font < line->fFc_count
|
if (font < line->fFc_count
|
||||||
&& line->fFcs[font].fOffset - place < fLength)
|
&& line->fFcs[font].fOffset - place < fLength)
|
||||||
fLength = line->fFcs[font].fOffset - place;
|
fLength = line->fFcs[font].fOffset - place;
|
||||||
|
|
||||||
if (checkSelection) {
|
if (checkSelection) {
|
||||||
|
@ -466,10 +463,10 @@ RunView::Draw (BRect frame)
|
||||||
--k;
|
--k;
|
||||||
|
|
||||||
r.Set (
|
r.Set (
|
||||||
left,
|
left,
|
||||||
height,
|
height,
|
||||||
line->fEdges[k] + indent - start,
|
line->fEdges[k] + indent - start,
|
||||||
height + line->fSofties[sit].fHeight - 1);
|
height + line->fSofties[sit].fHeight - 1);
|
||||||
|
|
||||||
SetDrawingMode (B_OP_COPY);
|
SetDrawingMode (B_OP_COPY);
|
||||||
if (drawSelection)
|
if (drawSelection)
|
||||||
|
@ -489,9 +486,9 @@ RunView::Draw (BRect frame)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
tr->Render(this,
|
tr->Render(this,
|
||||||
line->fText + place,
|
line->fText + place,
|
||||||
min_c (fLength, line->fLength - place - 1),
|
min_c (fLength, line->fLength - place - 1),
|
||||||
BPoint (left, height + line->fSofties[sit].fAscent));
|
BPoint (left, height + line->fSofties[sit].fAscent));
|
||||||
}
|
}
|
||||||
|
|
||||||
left = line->fEdges[k] + indent - start;
|
left = line->fEdges[k] + indent - start;
|
||||||
|
@ -505,12 +502,12 @@ RunView::Draw (BRect frame)
|
||||||
SetDrawingMode (B_OP_COPY);
|
SetDrawingMode (B_OP_COPY);
|
||||||
SetLowColor (view_color);
|
SetLowColor (view_color);
|
||||||
FillRect (
|
FillRect (
|
||||||
BRect (
|
BRect (
|
||||||
left + 1,
|
left + 1,
|
||||||
height,
|
height,
|
||||||
bounds.right,
|
bounds.right,
|
||||||
height + line->fSofties[sit].fHeight - 1),
|
height + line->fSofties[sit].fHeight - 1),
|
||||||
B_SOLID_LOW);
|
B_SOLID_LOW);
|
||||||
|
|
||||||
height += line->fSofties[sit].fHeight;
|
height += line->fSofties[sit].fHeight;
|
||||||
|
|
||||||
|
@ -540,8 +537,8 @@ RunView::BuildPopUp (void)
|
||||||
// to enable and disable
|
// to enable and disable
|
||||||
|
|
||||||
bool enablecopy (true),
|
bool enablecopy (true),
|
||||||
enableselectall (true),
|
enableselectall (true),
|
||||||
enablelookup (false);
|
enablelookup (false);
|
||||||
BString querystring ("");
|
BString querystring ("");
|
||||||
|
|
||||||
if (fSp_start == fSp_end)
|
if (fSp_start == fSp_end)
|
||||||
|
@ -606,7 +603,7 @@ bool
|
||||||
RunView::CheckClickBounds (const SelectPos& s, const BPoint& point) const
|
RunView::CheckClickBounds (const SelectPos& s, const BPoint& point) const
|
||||||
{
|
{
|
||||||
return ((point.x <= fLines[s.fLine]->fEdges[fLines[s.fLine]->fLength - 1])
|
return ((point.x <= fLines[s.fLine]->fEdges[fLines[s.fLine]->fLength - 1])
|
||||||
&& (point.y <= fLines[s.fLine]->fBottom));
|
&& (point.y <= fLines[s.fLine]->fBottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -628,13 +625,13 @@ RunView::MouseDown (BPoint point)
|
||||||
bool inBounds (CheckClickBounds (s, point));
|
bool inBounds (CheckClickBounds (s, point));
|
||||||
|
|
||||||
if (buttons == B_SECONDARY_MOUSE_BUTTON
|
if (buttons == B_SECONDARY_MOUSE_BUTTON
|
||||||
&& (mouseModifiers & B_SHIFT_KEY) == 0
|
&& (mouseModifiers & B_SHIFT_KEY) == 0
|
||||||
&& (mouseModifiers & B_COMMAND_KEY) == 0
|
&& (mouseModifiers & B_COMMAND_KEY) == 0
|
||||||
&& (mouseModifiers & B_CONTROL_KEY) == 0
|
&& (mouseModifiers & B_CONTROL_KEY) == 0
|
||||||
&& (mouseModifiers & B_OPTION_KEY) == 0
|
&& (mouseModifiers & B_OPTION_KEY) == 0
|
||||||
&& (mouseModifiers & B_MENU_KEY) == 0) {
|
&& (mouseModifiers & B_MENU_KEY) == 0) {
|
||||||
SelectPos start (s),
|
SelectPos start (s),
|
||||||
end (s);
|
end (s);
|
||||||
|
|
||||||
// select word
|
// select word
|
||||||
if (inBounds && !IntersectSelection (s, s)) {
|
if (inBounds && !IntersectSelection (s, s)) {
|
||||||
|
@ -645,9 +642,9 @@ RunView::MouseDown (BPoint point)
|
||||||
|
|
||||||
BuildPopUp();
|
BuildPopUp();
|
||||||
fMyPopUp->Go (
|
fMyPopUp->Go (
|
||||||
ConvertToScreen (point),
|
ConvertToScreen (point),
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
delete fMyPopUp;
|
delete fMyPopUp;
|
||||||
fMyPopUp = 0;
|
fMyPopUp = 0;
|
||||||
|
@ -655,13 +652,13 @@ RunView::MouseDown (BPoint point)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttons == B_PRIMARY_MOUSE_BUTTON
|
if (buttons == B_PRIMARY_MOUSE_BUTTON
|
||||||
&& (mouseModifiers & B_SHIFT_KEY) == 0
|
&& (mouseModifiers & B_SHIFT_KEY) == 0
|
||||||
&& (mouseModifiers & B_COMMAND_KEY) == 0
|
&& (mouseModifiers & B_COMMAND_KEY) == 0
|
||||||
&& (mouseModifiers & B_CONTROL_KEY) == 0
|
&& (mouseModifiers & B_CONTROL_KEY) == 0
|
||||||
&& (mouseModifiers & B_OPTION_KEY) == 0
|
&& (mouseModifiers & B_OPTION_KEY) == 0
|
||||||
&& (mouseModifiers & B_MENU_KEY) == 0) {
|
&& (mouseModifiers & B_MENU_KEY) == 0) {
|
||||||
SelectPos start (s),
|
SelectPos start (s),
|
||||||
end (s);
|
end (s);
|
||||||
|
|
||||||
switch (clicks) {
|
switch (clicks) {
|
||||||
case 2: {
|
case 2: {
|
||||||
|
@ -695,11 +692,11 @@ RunView::MouseDown (BPoint point)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (buttons == B_PRIMARY_MOUSE_BUTTON
|
} else if (buttons == B_PRIMARY_MOUSE_BUTTON
|
||||||
&& (mouseModifiers & B_SHIFT_KEY) != 0
|
&& (mouseModifiers & B_SHIFT_KEY) != 0
|
||||||
&& (mouseModifiers & B_COMMAND_KEY) == 0
|
&& (mouseModifiers & B_COMMAND_KEY) == 0
|
||||||
&& (mouseModifiers & B_CONTROL_KEY) == 0
|
&& (mouseModifiers & B_CONTROL_KEY) == 0
|
||||||
&& (mouseModifiers & B_OPTION_KEY) == 0
|
&& (mouseModifiers & B_OPTION_KEY) == 0
|
||||||
&& (mouseModifiers & B_MENU_KEY) == 0) {
|
&& (mouseModifiers & B_MENU_KEY) == 0) {
|
||||||
if (s.fLine < fSp_start.fLine || s.fOffset < fSp_start.fOffset) {
|
if (s.fLine < fSp_start.fLine || s.fOffset < fSp_start.fOffset) {
|
||||||
Select (s, fSp_end);
|
Select (s, fSp_end);
|
||||||
fTrack_offset = SelectPos (fSp_end.fLine, (fSp_end.fOffset > 0) ? fSp_end.fOffset - 1 : fSp_end.fOffset);
|
fTrack_offset = SelectPos (fSp_end.fLine, (fSp_end.fOffset > 0) ? fSp_end.fOffset - 1 : fSp_end.fOffset);
|
||||||
|
@ -731,7 +728,7 @@ RunView::CheckURLCursor (BPoint point)
|
||||||
for (int32 i = 0; i < curline->fUrls->CountItems(); i++) {
|
for (int32 i = 0; i < curline->fUrls->CountItems(); i++) {
|
||||||
URL* current = curline->fUrls->ItemAt(i);
|
URL* current = curline->fUrls->ItemAt(i);
|
||||||
if ((s.fOffset >= current->fOffset)
|
if ((s.fOffset >= current->fOffset)
|
||||||
&& (s.fOffset <= current->fOffset + current->fLength)) {
|
&& (s.fOffset <= current->fOffset + current->fLength)) {
|
||||||
SetViewCursor (fURLCursor);
|
SetViewCursor (fURLCursor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -745,9 +742,9 @@ void
|
||||||
RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
{
|
{
|
||||||
if (fTracking == 0
|
if (fTracking == 0
|
||||||
&& fLine_count
|
&& fLine_count
|
||||||
&& (transit == B_ENTERED_VIEW
|
&& (transit == B_ENTERED_VIEW
|
||||||
|| transit == B_INSIDE_VIEW))
|
|| transit == B_INSIDE_VIEW))
|
||||||
CheckURLCursor (point);
|
CheckURLCursor (point);
|
||||||
|
|
||||||
|
|
||||||
|
@ -779,9 +776,9 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
bigtime_t now (system_time());
|
bigtime_t now (system_time());
|
||||||
|
|
||||||
ShiftTrackingSelect (
|
ShiftTrackingSelect (
|
||||||
point,
|
point,
|
||||||
false,
|
false,
|
||||||
max_c (0LL, min_c (OFFVIEW_TIMER, OFFVIEW_TIMER - (now - fOff_view_time))));
|
max_c (0LL, min_c (OFFVIEW_TIMER, OFFVIEW_TIMER - (now - fOff_view_time))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -793,10 +790,10 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
|
|
||||||
GetSelectionText (fText);
|
GetSelectionText (fText);
|
||||||
msg.AddData (
|
msg.AddData (
|
||||||
"text/plain",
|
"text/plain",
|
||||||
B_MIME_TYPE,
|
B_MIME_TYPE,
|
||||||
fText.String(),
|
fText.String(),
|
||||||
fText.Length() + 1);
|
fText.Length() + 1);
|
||||||
|
|
||||||
BString clip_name (" Clipping");
|
BString clip_name (" Clipping");
|
||||||
|
|
||||||
|
@ -809,10 +806,10 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
msg.AddInt32 ("be:actions", B_COPY_TARGET);
|
msg.AddInt32 ("be:actions", B_COPY_TARGET);
|
||||||
|
|
||||||
BRect frame (
|
BRect frame (
|
||||||
fLines[fSp_start.fLine]->fEdges[fSp_start.fOffset],
|
fLines[fSp_start.fLine]->fEdges[fSp_start.fOffset],
|
||||||
fLines[fSp_start.fLine]->fTop,
|
fLines[fSp_start.fLine]->fTop,
|
||||||
fLines[fSp_end.fLine]->fEdges[fSp_end.fOffset],
|
fLines[fSp_end.fLine]->fEdges[fSp_end.fOffset],
|
||||||
fLines[fSp_end.fLine]->fBottom);
|
fLines[fSp_end.fLine]->fBottom);
|
||||||
|
|
||||||
if (fSp_start.fLine != fSp_end.fLine) {
|
if (fSp_start.fLine != fSp_end.fLine) {
|
||||||
frame.left = 0.0;
|
frame.left = 0.0;
|
||||||
|
@ -824,9 +821,9 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
else {
|
else {
|
||||||
Line* line (fLines[fSp_start.fLine]);
|
Line* line (fLines[fSp_start.fLine]);
|
||||||
float left (line->fEdges[fSp_start.fOffset]),
|
float left (line->fEdges[fSp_start.fOffset]),
|
||||||
top (line->fTop),
|
top (line->fTop),
|
||||||
right (line->fEdges[fSp_end.fOffset]),
|
right (line->fEdges[fSp_end.fOffset]),
|
||||||
bottom (line->fBottom);
|
bottom (line->fBottom);
|
||||||
int top_softie (0), bottom_softie (0);
|
int top_softie (0), bottom_softie (0);
|
||||||
bool start_found (false);
|
bool start_found (false);
|
||||||
bool end_found (false);
|
bool end_found (false);
|
||||||
|
@ -843,7 +840,7 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
for (int16 sit = 1; sit < line->fSoftie_used; ++sit) {
|
for (int16 sit = 1; sit < line->fSoftie_used; ++sit) {
|
||||||
if (!start_found && fSp_start.fOffset < line->fSofties[sit].fOffset) {
|
if (!start_found && fSp_start.fOffset < line->fSofties[sit].fOffset) {
|
||||||
left = (float)(line->fEdges[fSp_start.fOffset] -
|
left = (float)(line->fEdges[fSp_start.fOffset] -
|
||||||
line->fEdges[line->fSofties[sit-1].fOffset]);
|
line->fEdges[line->fSofties[sit-1].fOffset]);
|
||||||
|
|
||||||
top += (sit) * line->fSofties[sit].fHeight;
|
top += (sit) * line->fSofties[sit].fHeight;
|
||||||
top_softie = sit;
|
top_softie = sit;
|
||||||
|
@ -852,7 +849,7 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
|
|
||||||
if (fSp_end.fOffset < line->fSofties[sit].fOffset) {
|
if (fSp_end.fOffset < line->fSofties[sit].fOffset) {
|
||||||
right = (float) line->fEdges[fSp_end.fOffset] -
|
right = (float) line->fEdges[fSp_end.fOffset] -
|
||||||
(float) line->fEdges[line->fSofties[sit-1].fOffset];
|
(float) line->fEdges[line->fSofties[sit-1].fOffset];
|
||||||
|
|
||||||
bottom = top + (sit - (float) top_softie + 1) * line->fSofties[sit].fHeight;
|
bottom = top + (sit - (float) top_softie + 1) * line->fSofties[sit].fHeight;
|
||||||
bottom_softie = sit;
|
bottom_softie = sit;
|
||||||
|
@ -862,9 +859,9 @@ RunView::MouseMoved (BPoint point, uint32 transit, const BMessage* msg)
|
||||||
}
|
}
|
||||||
if (!end_found) {
|
if (!end_found) {
|
||||||
int32 soft_count = (line->fSoftie_used >= 2) ?
|
int32 soft_count = (line->fSoftie_used >= 2) ?
|
||||||
line->fSoftie_used - 2 : 0;
|
line->fSoftie_used - 2 : 0;
|
||||||
right = (float) line->fEdges[line->fLength - 1] -
|
right = (float) line->fEdges[line->fLength - 1] -
|
||||||
(float) line->fEdges[line->fSofties[soft_count].fOffset];
|
(float) line->fEdges[line->fSofties[soft_count].fOffset];
|
||||||
bottom_softie = soft_count - 2;
|
bottom_softie = soft_count - 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -906,7 +903,7 @@ RunView::MouseUp (BPoint point)
|
||||||
for (int32 i = 0; i < curline->fUrls->CountItems(); i++) {
|
for (int32 i = 0; i < curline->fUrls->CountItems(); i++) {
|
||||||
URL* current = curline->fUrls->ItemAt(i);
|
URL* current = curline->fUrls->ItemAt(i);
|
||||||
if ((s.fOffset >= current->fOffset)
|
if ((s.fOffset >= current->fOffset)
|
||||||
&& (s.fOffset <= current->fOffset + current->fLength)) {
|
&& (s.fOffset <= current->fOffset + current->fLength)) {
|
||||||
|
|
||||||
LoadURL (current->fUrl.String());
|
LoadURL (current->fUrl.String());
|
||||||
url_handle = true;
|
url_handle = true;
|
||||||
|
@ -963,9 +960,9 @@ RunView::ShiftTrackingSelect (BPoint point, bool move, bigtime_t timer)
|
||||||
msg->AddPoint ("point", point);
|
msg->AddPoint ("point", point);
|
||||||
|
|
||||||
fOff_view_runner = new BMessageRunner (
|
fOff_view_runner = new BMessageRunner (
|
||||||
BMessenger (this),
|
BMessenger (this),
|
||||||
msg,
|
msg,
|
||||||
timer == 0LL ? OFFVIEW_TIMER : timer);
|
timer == 0LL ? OFFVIEW_TIMER : timer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +986,7 @@ RunView::ShiftTrackingSelect (BPoint point, bool move, bigtime_t timer)
|
||||||
if (point.y > bounds.bottom) {
|
if (point.y > bounds.bottom) {
|
||||||
Line* line (fLines[fLine_count-1]);
|
Line* line (fLines[fLine_count-1]);
|
||||||
if (line
|
if (line
|
||||||
&& line->fBottom > bounds.bottom) {
|
&& line->fBottom > bounds.bottom) {
|
||||||
float delta (point.y - bounds.bottom);
|
float delta (point.y - bounds.bottom);
|
||||||
|
|
||||||
if (fOff_view_runner == 0) {
|
if (fOff_view_runner == 0) {
|
||||||
|
@ -1000,9 +997,9 @@ RunView::ShiftTrackingSelect (BPoint point, bool move, bigtime_t timer)
|
||||||
msg->AddPoint ("point", point);
|
msg->AddPoint ("point", point);
|
||||||
|
|
||||||
fOff_view_runner = new BMessageRunner (
|
fOff_view_runner = new BMessageRunner (
|
||||||
BMessenger (this),
|
BMessenger (this),
|
||||||
msg,
|
msg,
|
||||||
timer == 0LL ? OFFVIEW_TIMER : timer);
|
timer == 0LL ? OFFVIEW_TIMER : timer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1050,7 +1047,7 @@ RunView::MessageReceived (BMessage* msg)
|
||||||
|
|
||||||
case B_COPY:
|
case B_COPY:
|
||||||
if (fSp_start != fSp_end
|
if (fSp_start != fSp_end
|
||||||
&& be_clipboard->Lock()) {
|
&& be_clipboard->Lock()) {
|
||||||
BString fText;
|
BString fText;
|
||||||
GetSelectionText (fText);
|
GetSelectionText (fText);
|
||||||
|
|
||||||
|
@ -1148,10 +1145,10 @@ RunView::ResizeRecalc (void)
|
||||||
BRect r (0.0, fLines[i]->fTop, bounds.right, fLines[i]->fBottom);
|
BRect r (0.0, fLines[i]->fTop, bounds.right, fLines[i]->fBottom);
|
||||||
|
|
||||||
if (bounds.Intersects (r)
|
if (bounds.Intersects (r)
|
||||||
&& (old_top != fLines[i]->fTop
|
&& (old_top != fLines[i]->fTop
|
||||||
|| old_bottom != fLines[i]->fBottom
|
|| old_bottom != fLines[i]->fBottom
|
||||||
|| fSoftie_used != fLines[i]->fSoftie_used
|
|| fSoftie_used != fLines[i]->fSoftie_used
|
||||||
|| memcmp (fSofties, fLines[i]->fSofties, fSoftie_used * sizeof (SoftBreak))))
|
|| memcmp (fSofties, fLines[i]->fSofties, fSoftie_used * sizeof (SoftBreak))))
|
||||||
region.Include (r);
|
region.Include (r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,7 +1208,7 @@ RunView::RecalcScrollBar (bool constrain)
|
||||||
BScrollBar* bar;
|
BScrollBar* bar;
|
||||||
|
|
||||||
if (fScroller == NULL
|
if (fScroller == NULL
|
||||||
|| (bar = fScroller->ScrollBar (B_VERTICAL)) == NULL)
|
|| (bar = fScroller->ScrollBar (B_VERTICAL)) == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float value (bar->Value());
|
float value (bar->Value());
|
||||||
|
@ -1223,8 +1220,8 @@ RunView::RecalcScrollBar (bool constrain)
|
||||||
bar->GetRange (&scrollMin, &scrollMax);
|
bar->GetRange (&scrollMin, &scrollMax);
|
||||||
|
|
||||||
if (fLine_count
|
if (fLine_count
|
||||||
&& (bounds.Contains (BPoint (0.0, 0.0)) == false
|
&& (bounds.Contains (BPoint (0.0, 0.0)) == false
|
||||||
|| bounds.Contains (BPoint (0.0, fLines[fLine_count - 1]->fBottom)) == false)) {
|
|| bounds.Contains (BPoint (0.0, fLines[fLine_count - 1]->fBottom)) == false)) {
|
||||||
bottom = fLines[fLine_count - 1]->fBottom + 5;
|
bottom = fLines[fLine_count - 1]->fBottom + 5;
|
||||||
bar->SetProportion (bounds.Height() / bottom);
|
bar->SetProportion (bounds.Height() / bottom);
|
||||||
bar->SetSteps (10.0, bounds.Height());
|
bar->SetSteps (10.0, bounds.Height());
|
||||||
|
@ -1257,21 +1254,21 @@ RunView::RecalcScrollBar (bool constrain)
|
||||||
|
|
||||||
void
|
void
|
||||||
RunView::Append (
|
RunView::Append (
|
||||||
const char* buffer,
|
const char* buffer,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font)
|
int font)
|
||||||
{
|
{
|
||||||
Append (buffer, strlen (buffer), fore, back, font);
|
Append (buffer, strlen (buffer), fore, back, font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RunView::Append (
|
RunView::Append (
|
||||||
const char* buffer,
|
const char* buffer,
|
||||||
int32 len,
|
int32 len,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font)
|
int font)
|
||||||
{
|
{
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -1301,25 +1298,25 @@ RunView::Append (
|
||||||
URLCrunch crunch (buffer + place, end - place);
|
URLCrunch crunch (buffer + place, end - place);
|
||||||
BString temp;
|
BString temp;
|
||||||
int32 url_offset (0),
|
int32 url_offset (0),
|
||||||
last_offset (0);
|
last_offset (0);
|
||||||
|
|
||||||
|
|
||||||
while ((url_offset = crunch.Crunch (&temp)) != B_ERROR) {
|
while ((url_offset = crunch.Crunch (&temp)) != B_ERROR) {
|
||||||
fWorking->Append (buffer + place,
|
fWorking->Append (buffer + place,
|
||||||
(url_offset - last_offset),
|
(url_offset - last_offset),
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
fore,
|
fore,
|
||||||
back,
|
back,
|
||||||
font);
|
font);
|
||||||
|
|
||||||
fWorking->Append (temp.String(),
|
fWorking->Append (temp.String(),
|
||||||
temp.Length(),
|
temp.Length(),
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
C_URL,
|
C_URL,
|
||||||
back,
|
back,
|
||||||
F_URL);
|
F_URL);
|
||||||
|
|
||||||
place += (url_offset - last_offset) + temp.Length();
|
place += (url_offset - last_offset) + temp.Length();
|
||||||
last_offset = url_offset + temp.Length();
|
last_offset = url_offset + temp.Length();
|
||||||
|
@ -1327,13 +1324,13 @@ RunView::Append (
|
||||||
|
|
||||||
if (place < end)
|
if (place < end)
|
||||||
fWorking->Append (
|
fWorking->Append (
|
||||||
buffer + place,
|
buffer + place,
|
||||||
end - place,
|
end - place,
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
fore,
|
fore,
|
||||||
back,
|
back,
|
||||||
font);
|
font);
|
||||||
} else {
|
} else {
|
||||||
float top (0.0);
|
float top (0.0);
|
||||||
|
|
||||||
|
@ -1342,36 +1339,36 @@ RunView::Append (
|
||||||
|
|
||||||
//HERE
|
//HERE
|
||||||
fWorking = new Line (
|
fWorking = new Line (
|
||||||
buffer + place,
|
buffer + place,
|
||||||
0,
|
0,
|
||||||
top,
|
top,
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
fStamp_format,
|
fStamp_format,
|
||||||
fore,
|
fore,
|
||||||
back,
|
back,
|
||||||
font);
|
font);
|
||||||
|
|
||||||
URLCrunch crunch (buffer + place, end - place);
|
URLCrunch crunch (buffer + place, end - place);
|
||||||
BString temp;
|
BString temp;
|
||||||
int32 url_offset (0),
|
int32 url_offset (0),
|
||||||
last_offset (0);
|
last_offset (0);
|
||||||
|
|
||||||
while ((url_offset = crunch.Crunch (&temp)) != B_ERROR) {
|
while ((url_offset = crunch.Crunch (&temp)) != B_ERROR) {
|
||||||
fWorking->Append (buffer + place,
|
fWorking->Append (buffer + place,
|
||||||
(url_offset - last_offset),
|
(url_offset - last_offset),
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
fore,
|
fore,
|
||||||
back,
|
back,
|
||||||
font);
|
font);
|
||||||
fWorking->Append (temp.String(),
|
fWorking->Append (temp.String(),
|
||||||
temp.Length(),
|
temp.Length(),
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
C_URL,
|
C_URL,
|
||||||
back,
|
back,
|
||||||
F_URL);
|
F_URL);
|
||||||
|
|
||||||
place += (url_offset - last_offset) + temp.Length();
|
place += (url_offset - last_offset) + temp.Length();
|
||||||
last_offset = url_offset + temp.Length();
|
last_offset = url_offset + temp.Length();
|
||||||
|
@ -1379,16 +1376,16 @@ RunView::Append (
|
||||||
|
|
||||||
if (place < end)
|
if (place < end)
|
||||||
fWorking->Append (buffer + place,
|
fWorking->Append (buffer + place,
|
||||||
end - place,
|
end - place,
|
||||||
width,
|
width,
|
||||||
fTheme,
|
fTheme,
|
||||||
fore,
|
fore,
|
||||||
back,
|
back,
|
||||||
font);
|
font);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fWorking->fLength
|
if (fWorking->fLength
|
||||||
&& fWorking->fText[fWorking->fLength - 1] == '\n') {
|
&& fWorking->fText[fWorking->fLength - 1] == '\n') {
|
||||||
bool chopped;
|
bool chopped;
|
||||||
|
|
||||||
if (Window()) Window()->DisableUpdates();
|
if (Window()) Window()->DisableUpdates();
|
||||||
|
@ -1481,10 +1478,10 @@ void
|
||||||
RunView::SetTimeStampFormat (const char* format)
|
RunView::SetTimeStampFormat (const char* format)
|
||||||
{
|
{
|
||||||
if ((format == NULL
|
if ((format == NULL
|
||||||
&& fStamp_format == NULL)
|
&& fStamp_format == NULL)
|
||||||
|| (format != NULL
|
|| (format != NULL
|
||||||
&& fStamp_format != NULL
|
&& fStamp_format != NULL
|
||||||
&& strcmp (format, fStamp_format) == 0))
|
&& strcmp (format, fStamp_format) == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool was_on (false);
|
bool was_on (false);
|
||||||
|
@ -1655,7 +1652,7 @@ BRect
|
||||||
RunView::GetTextFrame(const SelectPos& start, const SelectPos& end) const
|
RunView::GetTextFrame(const SelectPos& start, const SelectPos& end) const
|
||||||
{
|
{
|
||||||
return BRect (0.0, fLines[(start.fLine > 0) ? (start.fLine - 1) : 0]->fTop,
|
return BRect (0.0, fLines[(start.fLine > 0) ? (start.fLine - 1) : 0]->fTop,
|
||||||
Bounds().Width(), fLines[end.fLine]->fBottom);
|
Bounds().Width(), fLines[end.fLine]->fBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1731,15 +1728,15 @@ RunView::SetClippingName (const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
Line::Line (
|
Line::Line (
|
||||||
const char* buffer,
|
const char* buffer,
|
||||||
int len,
|
int len,
|
||||||
float top,
|
float top,
|
||||||
float width,
|
float width,
|
||||||
Theme* theme,
|
Theme* theme,
|
||||||
const char* stamp_format,
|
const char* stamp_format,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font)
|
int font)
|
||||||
: fText (NULL),
|
: fText (NULL),
|
||||||
fStamp (time(NULL)),
|
fStamp (time(NULL)),
|
||||||
fUrls (NULL),
|
fUrls (NULL),
|
||||||
|
@ -1779,13 +1776,13 @@ Line::~Line (void)
|
||||||
|
|
||||||
void
|
void
|
||||||
Line::Append (
|
Line::Append (
|
||||||
const char* buffer,
|
const char* buffer,
|
||||||
int len,
|
int len,
|
||||||
float width,
|
float width,
|
||||||
Theme* theme,
|
Theme* theme,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font)
|
int font)
|
||||||
{
|
{
|
||||||
int save (fLength);
|
int save (fLength);
|
||||||
char* new_fText;
|
char* new_fText;
|
||||||
|
@ -1841,7 +1838,7 @@ Line::FigureSpaces (void)
|
||||||
offset += n + 1;
|
offset += n + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fSpaces = new int16 [count];
|
fSpaces = new float [count];
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
while ((n = strcspn (buffer + offset, spacers)) < fLength - offset) {
|
while ((n = strcspn (buffer + offset, spacers)) < fLength - offset) {
|
||||||
|
@ -1852,10 +1849,10 @@ Line::FigureSpaces (void)
|
||||||
|
|
||||||
void
|
void
|
||||||
Line::FigureFontColors (
|
Line::FigureFontColors (
|
||||||
int pos,
|
int pos,
|
||||||
int fore,
|
int fore,
|
||||||
int back,
|
int back,
|
||||||
int font)
|
int font)
|
||||||
{
|
{
|
||||||
if (fFc_count) {
|
if (fFc_count) {
|
||||||
int last_fore = -1;
|
int last_fore = -1;
|
||||||
|
@ -1866,18 +1863,18 @@ Line::FigureFontColors (
|
||||||
// we have fFcs, so we backtrack for last of each fWhich
|
// we have fFcs, so we backtrack for last of each fWhich
|
||||||
for (i = fFc_count - 1; i >= 0; --i) {
|
for (i = fFc_count - 1; i >= 0; --i) {
|
||||||
if (last_fore < 0
|
if (last_fore < 0
|
||||||
&& fFcs[i].fWhich == FORE_WHICH)
|
&& fFcs[i].fWhich == FORE_WHICH)
|
||||||
last_fore = i;
|
last_fore = i;
|
||||||
else if (last_back < 0
|
else if (last_back < 0
|
||||||
&& fFcs[i].fWhich == BACK_WHICH)
|
&& fFcs[i].fWhich == BACK_WHICH)
|
||||||
last_back = i;
|
last_back = i;
|
||||||
else if (last_font < 0
|
else if (last_font < 0
|
||||||
&& fFcs[i].fWhich == FONT_WHICH)
|
&& fFcs[i].fWhich == FONT_WHICH)
|
||||||
last_font = i;
|
last_font = i;
|
||||||
|
|
||||||
if (last_fore >= 0
|
if (last_fore >= 0
|
||||||
&& last_back >= 0
|
&& last_back >= 0
|
||||||
&& last_font >= 0)
|
&& last_font >= 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1934,11 +1931,11 @@ Line::FigureFontColors (
|
||||||
|
|
||||||
void
|
void
|
||||||
Line::FigureEdges (
|
Line::FigureEdges (
|
||||||
Theme* theme,
|
Theme* theme,
|
||||||
float width)
|
float width)
|
||||||
{
|
{
|
||||||
delete [] fEdges;
|
delete [] fEdges;
|
||||||
fEdges = new int16 [fLength];
|
fEdges = new float [fLength];
|
||||||
|
|
||||||
int cur_fFcs (0), next_fFcs (0), cur_font (0);
|
int cur_fFcs (0), next_fFcs (0), cur_font (0);
|
||||||
|
|
||||||
|
@ -1961,9 +1958,9 @@ Line::FigureEdges (
|
||||||
// but, we want to break on a font if available
|
// but, we want to break on a font if available
|
||||||
if (fFcs[next_fFcs].fOffset > last_offset) {
|
if (fFcs[next_fFcs].fOffset > last_offset) {
|
||||||
while (next_fFcs < fFc_count
|
while (next_fFcs < fFc_count
|
||||||
&& fFcs[next_fFcs].fWhich != FONT_WHICH
|
&& fFcs[next_fFcs].fWhich != FONT_WHICH
|
||||||
&& next_fFcs + 1 < fFc_count
|
&& next_fFcs + 1 < fFc_count
|
||||||
&& fFcs[next_fFcs + 1].fOffset == fFcs[next_fFcs].fOffset)
|
&& fFcs[next_fFcs + 1].fOffset == fFcs[next_fFcs].fOffset)
|
||||||
++next_fFcs;
|
++next_fFcs;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1982,8 +1979,8 @@ Line::FigureEdges (
|
||||||
seglen = fLength - fFcs[cur_fFcs].fOffset;
|
seglen = fLength - fFcs[cur_fFcs].fOffset;
|
||||||
} else {
|
} else {
|
||||||
ccount = CountChars (
|
ccount = CountChars (
|
||||||
fFcs[cur_fFcs].fOffset,
|
fFcs[cur_fFcs].fOffset,
|
||||||
fFcs[next_fFcs].fOffset - fFcs[cur_fFcs].fOffset);
|
fFcs[next_fFcs].fOffset - fFcs[cur_fFcs].fOffset);
|
||||||
seglen = fFcs[next_fFcs].fOffset - fFcs[cur_fFcs].fOffset;
|
seglen = fFcs[next_fFcs].fOffset - fFcs[cur_fFcs].fOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2003,26 +2000,26 @@ Line::FigureEdges (
|
||||||
|
|
||||||
// if(tr)
|
// if(tr)
|
||||||
tr->GetEscapements (
|
tr->GetEscapements (
|
||||||
fText + fFcs[cur_fFcs].fOffset,
|
fText + fFcs[cur_fFcs].fOffset,
|
||||||
ccount,
|
ccount,
|
||||||
eshift);
|
eshift);
|
||||||
|
|
||||||
// This is not perfect, because we are including the left edge,
|
// This is not perfect, because we are including the left edge,
|
||||||
// but BFont::GetEdges doesn't seem to work as we'd like
|
// but BFont::GetEdges doesn't seem to work as we'd like
|
||||||
|
|
||||||
int16 i;
|
int i;
|
||||||
int size = 0;
|
float size = 0;
|
||||||
|
|
||||||
// if(tr)
|
// if(tr)
|
||||||
size = tr->Size();
|
size = tr->Size();
|
||||||
|
|
||||||
|
|
||||||
int incrementor = (fEdge_count > 0) ? fEdges[fEdge_count - 1] : 0;
|
float incrementor = (fEdge_count > 0) ? fEdges[fEdge_count - 1] : 0;
|
||||||
|
|
||||||
for (i = 0; i < ccount; ++i) {
|
for (i = 0; i < ccount; ++i) {
|
||||||
incrementor += eshift[i] * size;
|
incrementor += (float)eshift[i] * size;
|
||||||
|
|
||||||
fEdges[fEdge_count+i] = (int16) incrementor;
|
fEdges[fEdge_count+i] = incrementor;
|
||||||
|
|
||||||
// this little backfTracking routine is necessary in the case where an fFcs change
|
// this little backfTracking routine is necessary in the case where an fFcs change
|
||||||
// comes immediately after a UTF8-char, since all but the first edge will be 0
|
// comes immediately after a UTF8-char, since all but the first edge will be 0
|
||||||
|
@ -2036,10 +2033,10 @@ Line::FigureEdges (
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = fFcs[cur_fFcs].fOffset; i < fFcs[cur_fFcs].fOffset + seglen;) {
|
for (i = fFcs[cur_fFcs].fOffset; i < fFcs[cur_fFcs].fOffset + seglen;) {
|
||||||
int32 len (UTF8_CHAR_LEN (fText[i]) - 1);
|
int len (UTF8_CHAR_LEN (fText[i]) - 1);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
int16 k;
|
int k;
|
||||||
for (k = fEdge_count + ccount - 1; k > i; --k)
|
for (k = fEdge_count + ccount - 1; k > i; --k)
|
||||||
fEdges[k + len] = fEdges[k];
|
fEdges[k + len] = fEdges[k];
|
||||||
|
|
||||||
|
@ -2064,8 +2061,8 @@ Line::FigureEdges (
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
|
Line::AddSoftBreak (SoftBreakEnd sbe, float& start, int& fText_place,
|
||||||
int16& font, float& width, float& start_width, Theme* theme)
|
int16& font, float& width, float& start_width, Theme* theme)
|
||||||
{
|
{
|
||||||
fText_place = sbe.fOffset;
|
fText_place = sbe.fOffset;
|
||||||
|
|
||||||
|
@ -2084,7 +2081,7 @@ Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
|
||||||
|
|
||||||
// consume whitespace
|
// consume whitespace
|
||||||
while (fText_place + 1 < fLength
|
while (fText_place + 1 < fLength
|
||||||
&& isspace (fText[fText_place + 1]))
|
&& isspace (fText[fText_place + 1]))
|
||||||
++fText_place;
|
++fText_place;
|
||||||
|
|
||||||
fSofties[fSoftie_used].fOffset = fText_place;
|
fSofties[fSoftie_used].fOffset = fText_place;
|
||||||
|
@ -2100,7 +2097,7 @@ Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
|
||||||
|
|
||||||
tr->GetHeight (&fh);
|
tr->GetHeight (&fh);
|
||||||
|
|
||||||
height = ceil (fh.ascent + fh.descent + fh.leading);
|
height = (float)ceil (fh.ascent + fh.descent + fh.leading);
|
||||||
if (fSofties[fSoftie_used].fHeight < height)
|
if (fSofties[fSoftie_used].fHeight < height)
|
||||||
fSofties[fSoftie_used].fHeight = height;
|
fSofties[fSoftie_used].fHeight = height;
|
||||||
if (fSofties[fSoftie_used].fAscent < fh.ascent)
|
if (fSofties[fSoftie_used].fAscent < fh.ascent)
|
||||||
|
@ -2112,7 +2109,7 @@ Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (font == fFc_count
|
if (font == fFc_count
|
||||||
|| fFcs[font].fOffset > fText_place) {
|
|| fFcs[font].fOffset > fText_place) {
|
||||||
font = last;
|
font = last;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2131,11 +2128,11 @@ Line::AddSoftBreak (SoftBreakEnd sbe, float& start, uint16& fText_place,
|
||||||
void
|
void
|
||||||
Line::SoftBreaks (Theme* theme, float start_width)
|
Line::SoftBreaks (Theme* theme, float start_width)
|
||||||
{
|
{
|
||||||
float margin (theme->TextMargin());
|
float margin = theme->TextMargin();
|
||||||
float width (start_width);
|
float width = start_width;
|
||||||
float start (0.0);
|
float start = 0.0;
|
||||||
uint16 fText_place (0);
|
int fText_place = 0;
|
||||||
int16 space_place (0);
|
int space_place = 0;
|
||||||
int16 font (0);
|
int16 font (0);
|
||||||
|
|
||||||
fSoftie_used = 0;
|
fSoftie_used = 0;
|
||||||
|
@ -2147,7 +2144,7 @@ Line::SoftBreaks (Theme* theme, float start_width)
|
||||||
|
|
||||||
while (fText_place < fLength) {
|
while (fText_place < fLength) {
|
||||||
while (space_place < fSpace_count) {
|
while (space_place < fSpace_count) {
|
||||||
if (fEdges[fSpaces[space_place]] - start > width)
|
if (fEdges[(int)fSpaces[space_place]] - start > width)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++space_place;
|
++space_place;
|
||||||
|
@ -2156,8 +2153,8 @@ Line::SoftBreaks (Theme* theme, float start_width)
|
||||||
// we've reached the end of the line (but it might not all fit)
|
// we've reached the end of the line (but it might not all fit)
|
||||||
// or we only have one space, so we check if we need to split the word
|
// or we only have one space, so we check if we need to split the word
|
||||||
if (space_place == fSpace_count
|
if (space_place == fSpace_count
|
||||||
|| space_place == 0
|
|| space_place == 0
|
||||||
|| fSpaces[space_place - 1] < fText_place) {
|
|| fSpaces[space_place - 1] < fText_place) {
|
||||||
// everything fits.. how wonderful (but we want at least one softbreak)
|
// everything fits.. how wonderful (but we want at least one softbreak)
|
||||||
if (fEdge_count == 0) {
|
if (fEdge_count == 0) {
|
||||||
AddSoftBreak (SoftBreakEnd(fLength - 1), start, fText_place, font, width, start_width, theme);
|
AddSoftBreak (SoftBreakEnd(fLength - 1), start, fText_place, font, width, start_width, theme);
|
||||||
|
@ -2183,7 +2180,8 @@ Line::SoftBreaks (Theme* theme, float start_width)
|
||||||
|
|
||||||
fText_place += UTF8_CHAR_LEN (fText[fText_place]);
|
fText_place += UTF8_CHAR_LEN (fText[fText_place]);
|
||||||
}
|
}
|
||||||
AddSoftBreak (SoftBreakEnd(fText_place), start, fText_place, font, width, start_width, theme);
|
AddSoftBreak (SoftBreakEnd(fText_place), start,
|
||||||
|
fText_place, font, width, start_width, theme);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2200,7 +2198,8 @@ Line::SoftBreaks (Theme* theme, float start_width)
|
||||||
--i;
|
--i;
|
||||||
|
|
||||||
if (fEdges[ccount1 + ccount2] - fEdges[i] < width - margin) {
|
if (fEdges[ccount1 + ccount2] - fEdges[i] < width - margin) {
|
||||||
AddSoftBreak (SoftBreakEnd(fSpaces[space_place]), start, fText_place, font, width, start_width, theme);
|
AddSoftBreak (SoftBreakEnd(fSpaces[space_place]), start,
|
||||||
|
fText_place, font, width, start_width, theme);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2292,9 +2291,9 @@ Line::SetStamp (const char* format, bool was_on)
|
||||||
|
|
||||||
if (fFcs) {
|
if (fFcs) {
|
||||||
memcpy (
|
memcpy (
|
||||||
new_fFcs + 6,
|
new_fFcs + 6,
|
||||||
fFcs,
|
fFcs,
|
||||||
fFc_count * sizeof (FontColor));
|
fFc_count * sizeof (FontColor));
|
||||||
delete [] fFcs;
|
delete [] fFcs;
|
||||||
}
|
}
|
||||||
fFcs = new_fFcs;
|
fFcs = new_fFcs;
|
||||||
|
@ -2354,7 +2353,7 @@ RunView::FindText(const char* text)
|
||||||
char* offset (NULL);
|
char* offset (NULL);
|
||||||
if ((offset = strstr((const char*)fLines[i], text)) != NULL) {
|
if ((offset = strstr((const char*)fLines[i], text)) != NULL) {
|
||||||
SelectPos start (i, offset - text),
|
SelectPos start (i, offset - text),
|
||||||
end (i, (offset - text) + strlen(text));
|
end (i, (offset - text) + strlen(text));
|
||||||
Select(start, end);
|
Select(start, end);
|
||||||
ScrollTo(0.0, fLines[i]->fTop);
|
ScrollTo(0.0, fLines[i]->fTop);
|
||||||
result = true;
|
result = true;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue