Merge pull request #11 from MatthiasWM/master

Fixing STR #2901, Fl_Browser formatting char
This commit is contained in:
Matthias Melcher 2018-12-28 17:25:28 -08:00 committed by GitHub
commit bf9dfa2afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View File

@ -212,7 +212,8 @@ public:
and used to modify how the rest of the line is printed:
\li <tt>'\@.'</tt> Print rest of line, don't look for more '\@' signs
\li <tt>'\@\@'</tt> Print rest of line starting with '\@'
\li <tt>'\@\@'</tt> Doubling the format character prints the format
character once, followed by the rest of line
\li <tt>'\@l'</tt> Use a LARGE (24 point) font
\li <tt>'\@m'</tt> Use a medium large (18 point) font
\li <tt>'\@s'</tt> Use a <SMALL>small</SMALL> (11 point) font
@ -222,8 +223,9 @@ public:
font (sets font to FL_COURIER)
\li <tt>'\@c'</tt> Center the line horizontally
\li <tt>'\@r'</tt> Right-justify the text
\li <tt>'\@N'</tt> Use fl_inactive_color() to draw the text
\li <tt>'\@B0', '\@B1', ... '\@B255'</tt> Fill the backgound with
fl_color(n)
fl_color(n)
\li <tt>'\@C0', '\@C1', ... '\@C255'</tt> Use fl_color(n) to draw the text
\li <tt>'\@F0', '\@F1', ...</tt> Use fl_font(n) to draw the text
\li <tt>'\@S1', '\@S2', ...</tt> Use point size n to draw the text

View File

@ -378,8 +378,7 @@ int Fl_Browser::item_height(void *item) const {
Fl_Font font = textfont(); // default font
int tsize = textsize(); // default size
if ( format_char() ) { // can be NULL
while (*str==format_char()) {
str++;
while (*str==format_char() && *str++ && *str!=format_char()) {
switch (*str++) {
case 'l': case 'L': tsize = 24; break;
case 'm': case 'M': tsize = 18; break;
@ -391,7 +390,6 @@ int Fl_Browser::item_height(void *item) const {
case 'C': while (isdigit(*str & 255)) str++; break; // skip a color number
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
case 'S': tsize = strtol(str,&str,10); break;
case 0: case '@': str--;
case '.': goto END_FORMAT;
}
}
@ -458,9 +456,6 @@ int Fl_Browser::item_width(void *item) const {
case '.':
done = 1;
break;
case '@':
str--;
done = 1;
}
if (done)
@ -578,8 +573,6 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
break;
case '.':
goto BREAK;
case '@':
str--; goto BREAK;
}
}
}

View File

@ -44,6 +44,14 @@ That was a blank line above this.
@C1RED
@C2Green
@C4Blue
@N@.Inactive
@@ start line with '@'
@.@ alternative start line with '@'
@l@@ start tall line with '@'
@s@@ start small line with '@'
#s## start line with '#'
#s#.# alternative start line with '#'
You should try different browser types:
Fl_Browser
@ -164,6 +172,7 @@ int main(int argc, char **argv) {
browser->callback(b_cb);
// browser->scrollbar_right();
//browser->has_scrollbar(Fl_Browser::BOTH_ALWAYS);
//browser->format_char('#');
if (!browser->load(fname)) {
int done = 0;
#ifdef _MSC_VER