mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 05:35:29 +08:00
Merge pull request #11 from MatthiasWM/master
Fixing STR #2901, Fl_Browser formatting char
This commit is contained in:
+4
-2
@@ -212,7 +212,8 @@ public:
|
|||||||
and used to modify how the rest of the line is printed:
|
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, 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>'\@l'</tt> Use a LARGE (24 point) font
|
||||||
\li <tt>'\@m'</tt> Use a medium large (18 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
|
\li <tt>'\@s'</tt> Use a <SMALL>small</SMALL> (11 point) font
|
||||||
@@ -222,8 +223,9 @@ public:
|
|||||||
font (sets font to FL_COURIER)
|
font (sets font to FL_COURIER)
|
||||||
\li <tt>'\@c'</tt> Center the line horizontally
|
\li <tt>'\@c'</tt> Center the line horizontally
|
||||||
\li <tt>'\@r'</tt> Right-justify the text
|
\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
|
\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>'\@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>'\@F0', '\@F1', ...</tt> Use fl_font(n) to draw the text
|
||||||
\li <tt>'\@S1', '\@S2', ...</tt> Use point size n to draw the text
|
\li <tt>'\@S1', '\@S2', ...</tt> Use point size n to draw the text
|
||||||
|
|||||||
+1
-8
@@ -378,8 +378,7 @@ int Fl_Browser::item_height(void *item) const {
|
|||||||
Fl_Font font = textfont(); // default font
|
Fl_Font font = textfont(); // default font
|
||||||
int tsize = textsize(); // default size
|
int tsize = textsize(); // default size
|
||||||
if ( format_char() ) { // can be NULL
|
if ( format_char() ) { // can be NULL
|
||||||
while (*str==format_char()) {
|
while (*str==format_char() && *str++ && *str!=format_char()) {
|
||||||
str++;
|
|
||||||
switch (*str++) {
|
switch (*str++) {
|
||||||
case 'l': case 'L': tsize = 24; break;
|
case 'l': case 'L': tsize = 24; break;
|
||||||
case 'm': case 'M': tsize = 18; 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 'C': while (isdigit(*str & 255)) str++; break; // skip a color number
|
||||||
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
|
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
|
||||||
case 'S': tsize = strtol(str,&str,10); break;
|
case 'S': tsize = strtol(str,&str,10); break;
|
||||||
case 0: case '@': str--;
|
|
||||||
case '.': goto END_FORMAT;
|
case '.': goto END_FORMAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,9 +456,6 @@ int Fl_Browser::item_width(void *item) const {
|
|||||||
case '.':
|
case '.':
|
||||||
done = 1;
|
done = 1;
|
||||||
break;
|
break;
|
||||||
case '@':
|
|
||||||
str--;
|
|
||||||
done = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done)
|
if (done)
|
||||||
@@ -578,8 +573,6 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
|
|||||||
break;
|
break;
|
||||||
case '.':
|
case '.':
|
||||||
goto BREAK;
|
goto BREAK;
|
||||||
case '@':
|
|
||||||
str--; goto BREAK;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,14 @@ That was a blank line above this.
|
|||||||
@C1RED
|
@C1RED
|
||||||
@C2Green
|
@C2Green
|
||||||
@C4Blue
|
@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:
|
You should try different browser types:
|
||||||
Fl_Browser
|
Fl_Browser
|
||||||
@@ -164,6 +172,7 @@ int main(int argc, char **argv) {
|
|||||||
browser->callback(b_cb);
|
browser->callback(b_cb);
|
||||||
// browser->scrollbar_right();
|
// browser->scrollbar_right();
|
||||||
//browser->has_scrollbar(Fl_Browser::BOTH_ALWAYS);
|
//browser->has_scrollbar(Fl_Browser::BOTH_ALWAYS);
|
||||||
|
//browser->format_char('#');
|
||||||
if (!browser->load(fname)) {
|
if (!browser->load(fname)) {
|
||||||
int done = 0;
|
int done = 0;
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|||||||
Reference in New Issue
Block a user