Style fixes in librunview, solved a regression, solved some warnings.
This commit is contained in:
parent
fdd6eb021b
commit
9cb0ef099e
|
@ -103,9 +103,6 @@ struct SoftBreakEnd {
|
||||||
|
|
||||||
struct FontColor {
|
struct FontColor {
|
||||||
int fOffset;
|
int fOffset;
|
||||||
// G++ is stupid. We only need 2 bits
|
|
||||||
// for fWhich, but the compiler has a bug
|
|
||||||
// and warns us against fWhich == 2
|
|
||||||
int fWhich;
|
int fWhich;
|
||||||
int fIndex;
|
int fIndex;
|
||||||
};
|
};
|
||||||
|
@ -114,8 +111,8 @@ 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;
|
||||||
|
@ -167,7 +164,7 @@ struct Line {
|
||||||
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);
|
||||||
|
@ -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) {
|
||||||
|
@ -1938,7 +1935,7 @@ Line::FigureEdges (
|
||||||
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);
|
||||||
|
|
||||||
|
@ -2010,19 +2007,19 @@ Line::FigureEdges (
|
||||||
// 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,7 +2061,7 @@ 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;
|
||||||
|
@ -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)
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue