DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2766
Version: 1.3-feature
This change allows someone to configure FLTK to use 0x0F as the symbol
prefix character instead of @. This allows the use of @ without special
handling which can be troublesome since internal widgets use @ for things
like arrows and special characters. To enable support for the new prefix
you'd run ./configure with the --enable-newprefix option (you may have to
remake the configure first, "make clean" seems to do that for you).
Link: http://www.fltk.org/str.php?L2766
Version: 1.3-feature
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 9168)
+++ CMakeLists.txt (working copy)
@@ -423,6 +423,15 @@
endif(OPTION_LARGE_FILE)
#######################################################################
+option(OPTION_USE_NEW_PREFIX_SYMBOL "use new symbol prefix character 0x0F" OFF)
+
+if (OPTION_USE_NEW_PREFIX_SYMBOL)
+ add_definitions(-DFLTK_USE_NEW_PREFIX_SYMBOL)
+ list(APPEND FLTK_CFLAGS -DFLTK_USE_NEW_PREFIX_SYMBOL
+ set(FLTK_USE_NEW_PREFIX_SYMBOL 1)
+endif(OPTION_USE_NEW_PREFIX_SYMBOL)
+
+#######################################################################
option(OPTION_USE_SYSTEM_LIBJPEG "Use's system libjpeg" ON)
if(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
Index: configh.cmake.in
===================================================================
--- configh.cmake.in (revision 9168)
+++ configh.cmake.in (working copy)
@@ -310,5 +310,14 @@
#cmakedefine HAVE_DLSYM @HAVE_DLSYM@
/*
+ * FLTK_USE_NEW_PREFIX_SYMBOL:
+ *
+ * Use 0x0F instead of @ for symbol prefix character.
+ */
+
+#cmakedefine FLTK_USE_NEW_PREFIX_SYMBOL @FLTK_USE_NEW_PREFIX_SYMBOL@
+
+
+/*
* End of "$Id$".
*/
Index: configh.in
===================================================================
--- configh.in (revision 9168)
+++ configh.in (working copy)
@@ -315,5 +315,11 @@
#undef HAVE_DLSYM
/*
+ * use new prefix symbol 0x0F instead of @
+ */
+
+#undef FLTK_USE_NEW_PREFIX_SYMBOL
+
+/*
* End of "$Id$".
*/
Index: configure.in
===================================================================
--- configure.in (revision 9168)
+++ configure.in (working copy)
@@ -358,6 +358,15 @@
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading
support (default=yes)])
+NEW_PREFIX_SYMBOL_FLAG=""
+
+AC_ARG_ENABLE(newprefix, [ --enable-newprefix enable use of new prefix
symbol 0x0F (default=no)])
+if test x$enable_newprefix = xyes; then
+ AC_DEFINE(FLTK_USE_NEW_PREFIX_SYMBOL)
+ NEW_PREFIX_SYMBOL_FLAG="-DFLTK_USE_NEW_PREFIX_SYMBOL"
+fi
+AC_SUBST(NEW_PREFIX_SYMBOL_FLAG)
+
AC_ARG_WITH(optim, [ --with-optim="flags" use custom optimization flags])
AC_ARG_WITH(archflags, [ --with-archflags="flags"
Index: FL/Enumerations.H
===================================================================
--- FL/Enumerations.H (revision 9168)
+++ FL/Enumerations.H (working copy)
@@ -947,8 +947,66 @@
# define inactive fl_inactive
# endif // FLTK_1_0_COMPAT
+
+#if defined(FLTK_USE_NEW_PREFIX_SYMBOL)
+
+ #define FL_SYMBOL_CHAR '\x0F'
+ #define FL_SYMBOL_TX "\x0F"
+
+ #define FL_UP_TRIANGLE_TX "\x0F8>"
+ #define FL_DN_TRIANGLE_TX "\x0F2>"
+
+ #define FL_UP_ARROW_TX "\x0F-42<"
+ #define FL_DN_ARROW_TX "\x0F-42>"
+ #define FL_LT_ARROW_TX "\x0F<-"
+ #define FL_RT_ARROW_TX "\x0F->"
+ #define FL_SYM_FILEOPEN_TX "\x0Ffileopen"
+ #define FL_SYM_CROSS_TX "\x0F-3refresh"
+ #define FL_SYM_SEARCH_TX "\x0Fsearch"
+
+ #define FL_FLUID_LF_ALIGN_TX "\x0F-1<-"
+ #define FL_FLUID_RT_ALIGN_TX "\x0F-1->"
+ #define FL_FLUID_TOP_ALIGN_TX "\x0F-18"
+ #define FL_FLUID_BOT_ALIGN_TX "\x0F-12"
+ #define FL_FLUID_INSIDE_ALIGN_TX "\x0F-3square"
+
+ #define FL_COUNTER_LF2_TX "\x0F-4<<"
+ #define FL_COUNTER_LF_TX "\x0F-4<"
+ #define FL_COUNTER_RT2_TX "\x0F-4>>"
+ #define FL_COUNTER_RT_TX "\x0F-4>"
+
+#else
+
+ #define FL_SYMBOL_CHAR '@'
+ #define FL_SYMBOL_TX "@"
+
+ #define FL_UP_TRIANGLE_TX "@8>"
+ #define FL_DN_TRIANGLE_TX "@2>"
+
+ #define FL_UP_ARROW_TX "@-42<"
+ #define FL_DN_ARROW_TX "@-42>"
+ #define FL_LT_ARROW_TX "@<-"
+ #define FL_RT_ARROW_TX "@->"
+ #define FL_SYM_FILEOPEN_TX "@fileopen"
+ #define FL_SYM_CROSS_TX "@-3refresh"
+ #define FL_SYM_SEARCH_TX "@search"
+
+ #define FL_FLUID_LF_ALIGN_TX "@-1<-"
+ #define FL_FLUID_RT_ALIGN_TX "@-1->"
+ #define FL_FLUID_TOP_ALIGN_TX "@-18"
+ #define FL_FLUID_BOT_ALIGN_TX "@-12"
+ #define FL_FLUID_INSIDE_ALIGN_TX "@-3square"
+
+ #define FL_COUNTER_LF2_TX "@-4<<"
+ #define FL_COUNTER_LF_TX "@-4<"
+ #define FL_COUNTER_RT2_TX "@-4>>"
+ #define FL_COUNTER_RT_TX "@-4>"
+
#endif
+
+#endif
+
//
// End of "$Id$".
//
Index: FL/Fl_Browser.H
===================================================================
--- FL/Fl_Browser.H (revision 9168)
+++ FL/Fl_Browser.H (working copy)
@@ -86,7 +86,7 @@
int lines; // Number of lines
int full_height_;
const int* column_widths_;
- char format_char_; // alternative to @-sign
+ char format_char_; // alternative to FL_SYMBOL_CHAR-sign
char column_char_; // alternative to tab
protected:
@@ -196,9 +196,10 @@
~Fl_Browser() { clear(); }
/**
- Gets the current format code prefix character, which by default is '\@'.
+ Gets the current format code prefix character, which by default is
FL_SYMBOL_CHAR.
A string of formatting codes at the start of each column are stripped off
- and used to modify how the rest of the line is printed:
+ and used to modify how the rest of the line is printed. The samples below
+ assume the FL_SYMBOL_CHAR is '@':
\li <tt>'\@.'</tt> Print rest of line, don't look for more '\@' signs
\li <tt>'\@\@'</tt> Print rest of line starting with '\@'
@@ -227,8 +228,8 @@
char format_char() const { return format_char_; }
/**
Sets the current format code prefix character to \p c.
- The default prefix is '\@'. Set the prefix to 0 to disable formatting.
- \see format_char() for list of '\@' codes
+ The default prefix is FL_SYMBOL_CHAR. Set the prefix to 0 to disable
formatting.
+ \see format_char() for list of FL_SYMBOL_CHAR codes
*/
void format_char(char c) { format_char_ = c; }
/**
Index: FL/Fl_Spinner.H
===================================================================
--- FL/Fl_Spinner.H (revision 9168)
+++ FL/Fl_Spinner.H (working copy)
@@ -117,9 +117,9 @@
Fl_Spinner(int X, int Y, int W, int H, const char *L = 0)
: Fl_Group(X, Y, W, H, L),
input_(X, Y, W - H / 2 - 2, H),
- up_button_(X + W - H / 2 - 2, Y, H / 2 + 2, H / 2, "@-42<"),
+ up_button_(X + W - H / 2 - 2, Y, H / 2 + 2, H / 2, FL_UP_ARROW_TX),
down_button_(X + W - H / 2 - 2, Y + H - H / 2,
- H / 2 + 2, H / 2, "@-42>") {
+ H / 2 + 2, H / 2, FL_DN_ARROW_TX) {
end();
value_ = 1.0;
Index: fltk-config.in
===================================================================
--- fltk-config.in (revision 9168)
+++ fltk-config.in (working copy)
@@ -42,8 +42,8 @@
# flags for C++ compiler:
ARCHFLAGS="@ARCHFLAGS@"
-CFLAGS="@CFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
-CXXFLAGS="@CXXFLAGS@ @LARGEFILE@ @PTHREAD_FLAGS@"
+CFLAGS="@CFLAGS@ @NEW_PREFIX_SYMBOL_FLAG@ @LARGEFILE@ @PTHREAD_FLAGS@"
+CXXFLAGS="@CXXFLAGS@ @NEW_PREFIX_SYMBOL_FLAG@ @LARGEFILE@ @PTHREAD_FLAGS@"
LDFLAGS="@LDFLAGS@"
LDLIBS="@LIBS@"
OPTIM="@OPTIM@"
Index: src/Fl_Browser.cxx
===================================================================
--- src/Fl_Browser.cxx (revision 9168)
+++ src/Fl_Browser.cxx (working copy)
@@ -389,7 +389,7 @@
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 0: case FL_SYMBOL_CHAR: str--;
case '.': goto END_FORMAT;
}
}
@@ -454,7 +454,7 @@
case '.':
done = 1;
break;
- case '@':
+ case FL_SYMBOL_CHAR:
str--;
done = 1;
}
@@ -573,7 +573,7 @@
break;
case '.':
goto BREAK;
- case '@':
+ case FL_SYMBOL_CHAR:
str--; goto BREAK;
}
}
@@ -605,7 +605,7 @@
lines = 0;
full_height_ = 0;
cacheline = 0;
- format_char_ = '@';
+ format_char_ = FL_SYMBOL_CHAR;
column_char_ = '\t';
first = last = cache = 0;
}
Index: src/Fl_Counter.cxx
===================================================================
--- src/Fl_Counter.cxx (revision 9168)
+++ src/Fl_Counter.cxx (working copy)
@@ -65,15 +65,15 @@
if (type() == FL_NORMAL_COUNTER) {
draw_box(boxtype[1], xx[1], y(), ww[1], h(), color());
- fl_draw_symbol("@-4<<", xx[1], y(), ww[1], h(), selcolor);
+ fl_draw_symbol(FL_COUNTER_LF2_TX, xx[1], y(), ww[1], h(), selcolor);
}
draw_box(boxtype[2], xx[2], y(), ww[2], h(), color());
- fl_draw_symbol("@-4<", xx[2], y(), ww[2], h(), selcolor);
+ fl_draw_symbol(FL_COUNTER_LF_TX, xx[2], y(), ww[2], h(), selcolor);
draw_box(boxtype[3], xx[3], y(), ww[3], h(), color());
- fl_draw_symbol("@-4>", xx[3], y(), ww[3], h(), selcolor);
+ fl_draw_symbol(FL_COUNTER_RT_TX, xx[3], y(), ww[3], h(), selcolor);
if (type() == FL_NORMAL_COUNTER) {
draw_box(boxtype[4], xx[4], y(), ww[4], h(), color());
- fl_draw_symbol("@-4>>", xx[4], y(), ww[4], h(), selcolor);
+ fl_draw_symbol(FL_COUNTER_RT2_TX, xx[4], y(), ww[4], h(), selcolor);
}
}
Index: src/fl_draw.cxx
===================================================================
--- src/fl_draw.cxx (revision 9168)
+++ src/fl_draw.cxx (working copy)
@@ -151,8 +151,8 @@
#endif
*o++ = ' ';
- } else if (c == '@' && draw_symbols) { // Symbol???
- if (p[1] && p[1] != '@') break;
+ } else if (c == FL_SYMBOL_CHAR && draw_symbols) { // Symbol???
+ if (p[1] && p[1] != FL_SYMBOL_CHAR) break;
*o++ = c;
if (p[1]) p++;
} else {
@@ -199,7 +199,7 @@
symwidth[1] = 0;
if (draw_symbols) {
- if (str && str[0] == '@' && str[1] && str[1] != '@') {
+ if (str && str[0] == FL_SYMBOL_CHAR && str[1] && str[1] != FL_SYMBOL_CHAR)
{
// Start with a symbol...
for (symptr = symbol[0];
*str && !isspace(*str) && symptr < (symbol[0] + sizeof(symbol[0]) -
1);
@@ -209,7 +209,7 @@
symwidth[0] = (w < h ? w : h);
}
- if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1) && p[-1] !=
'@') {
+ if (str && (p = strrchr(str, FL_SYMBOL_CHAR)) != NULL && p > (str + 1) &&
p[-1] != FL_SYMBOL_CHAR) {
strlcpy(symbol[1], p, sizeof(symbol[1]));
symwidth[1] = (w < h ? w : h);
}
@@ -227,7 +227,7 @@
align&FL_ALIGN_WRAP, draw_symbols);
if (strw<width) strw = (int)width;
lines++;
- if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break;
+ if (!*e || (*e == FL_SYMBOL_CHAR && e[1] != FL_SYMBOL_CHAR &&
draw_symbols)) break;
p = e;
}
} else lines = 0;
@@ -305,7 +305,7 @@
if (underline_at && underline_at >= buf && underline_at < (buf + buflen))
callthis("_",1,xpos+int(fl_width(buf,underline_at-buf)),ypos-desc);
- if (!*e || (*e == '@' && e[1] != '@')) break;
+ if (!*e || (*e == FL_SYMBOL_CHAR && e[1] != FL_SYMBOL_CHAR)) break;
p = e;
}
}
@@ -360,7 +360,7 @@
If \p img is provided and is not \p NULL, the image is drawn above or
below the text as specified by the \p align value.
The \p draw_symbols argument specifies whether or not to look for symbol
- names starting with the '\@' character'
+ names starting with the FL_SYMBOL_CHAR character'
The text length is limited to 1024 characters per line.
*/
void fl_draw(
@@ -408,7 +408,7 @@
symwidth[1] = 0;
if (draw_symbols) {
- if (str && str[0] == '@' && str[1] && str[1] != '@') {
+ if (str && str[0] == FL_SYMBOL_CHAR && str[1] && str[1] != FL_SYMBOL_CHAR)
{
// Start with a symbol...
for (symptr = symbol[0];
*str && !isspace(*str) && symptr < (symbol[0] + sizeof(symbol[0]) -
1);
@@ -418,7 +418,7 @@
symwidth[0] = h;
}
- if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1) && p[-1]!='@')
{
+ if (str && (p = strrchr(str, FL_SYMBOL_CHAR)) != NULL && p > (str + 1) &&
p[-1]!=FL_SYMBOL_CHAR) {
strlcpy(symbol[1], p, sizeof(symbol[1]));
symwidth[1] = h;
}
@@ -432,7 +432,7 @@
w != 0, draw_symbols);
if ((int)ceil(width) > W) W = (int)ceil(width);
lines++;
- if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break;
+ if (!*e || (*e == FL_SYMBOL_CHAR && e[1] != FL_SYMBOL_CHAR &&
draw_symbols)) break;
p = e;
}
Index: src/Fl_File_Chooser.cxx
===================================================================
--- src/Fl_File_Chooser.cxx (revision 9168)
+++ src/Fl_File_Chooser.cxx (working copy)
@@ -256,7 +256,7 @@
Fl_Group::current()->resizable(favList);
} // Fl_File_Browser* favList
{ Fl_Group* o = new Fl_Group(320, 10, 25, 95);
- { favUpButton = new Fl_Button(320, 10, 25, 25, "@8>");
+ { favUpButton = new Fl_Button(320, 10, 25, 25, FL_UP_TRIANGLE_TX);
favUpButton->callback((Fl_Callback*)cb_favUpButton);
} // Fl_Button* favUpButton
{ favDeleteButton = new Fl_Button(320, 45, 25, 25, "X");
@@ -264,7 +264,7 @@
favDeleteButton->callback((Fl_Callback*)cb_favDeleteButton);
Fl_Group::current()->resizable(favDeleteButton);
} // Fl_Button* favDeleteButton
- { favDownButton = new Fl_Button(320, 80, 25, 25, "@2>");
+ { favDownButton = new Fl_Button(320, 80, 25, 25, FL_DN_TRIANGLE_TX);
favDownButton->callback((Fl_Callback*)cb_favDownButton);
} // Fl_Button* favDownButton
o->end();
Index: src/Fl_File_Chooser2.cxx
===================================================================
--- src/Fl_File_Chooser2.cxx (revision 9168)
+++ src/Fl_File_Chooser2.cxx (working copy)
@@ -1301,14 +1301,14 @@
set = 1;
} else if (fl_filename_isdir(filename)) {
// filename is a directory, show a folder icon
- newlabel = "@fileopen";
+ newlabel = FL_SYM_FILEOPEN_TX;
set = 1;
} else {
struct stat s;
if (fl_stat(filename, &s)==0) {
if ((s.st_mode&S_IFMT)!=S_IFREG) {
// this is no regular file, probably some kind of device
- newlabel = "@-3refresh"; // a cross
+ newlabel = FL_SYM_CROSS_TX; // a cross
set = 1;
} else if (s.st_size==0) {
// this file is emty
@@ -1433,7 +1433,7 @@
} else if (newlabel) {
previewBox->label(newlabel);
previewBox->align(FL_ALIGN_CLIP);
- previewBox->labelsize(newlabel[0]=='@'?75:12);
+ previewBox->labelsize(newlabel[0]==FL_SYMBOL_CHAR ? 75:12);
previewBox->labelfont(FL_HELVETICA);
}
Index: src/Fl_Help_Dialog.cxx
===================================================================
--- src/Fl_Help_Dialog.cxx (revision 9168)
+++ src/Fl_Help_Dialog.cxx (working copy)
@@ -141,13 +141,13 @@
{ window_ = new Fl_Double_Window(530, 385, "Help Dialog");
window_->user_data((void*)(this));
{ Fl_Group* o = new Fl_Group(10, 10, 511, 25);
- { back_ = new Fl_Button(10, 10, 25, 25, "@<-");
+ { back_ = new Fl_Button(10, 10, 25, 25, FL_LT_ARROW_TX);
back_->tooltip("Show the previous help page.");
back_->shortcut(0xff51);
back_->labelcolor((Fl_Color)2);
back_->callback((Fl_Callback*)cb_back_);
} // Fl_Button* back_
- { forward_ = new Fl_Button(45, 10, 25, 25, "@->");
+ { forward_ = new Fl_Button(45, 10, 25, 25, FL_RT_ARROW_TX);
forward_->tooltip("Show the next help page.");
forward_->shortcut(0xff53);
forward_->labelcolor((Fl_Color)2);
@@ -168,7 +168,7 @@
{ Fl_Group* o = new Fl_Group(350, 10, 171, 25);
o->box(FL_DOWN_BOX);
o->color(FL_BACKGROUND2_COLOR);
- { find_ = new Fl_Input(375, 12, 143, 21, "@search");
+ { find_ = new Fl_Input(375, 12, 143, 21, FL_SYM_SEARCH_TX);
find_->tooltip("find text in document");
find_->box(FL_FLAT_BOX);
find_->labelsize(13);
Index: src/fl_symbols.cxx
===================================================================
--- src/fl_symbols.cxx (revision 9168)
+++ src/fl_symbols.cxx (working copy)
@@ -17,7 +17,7 @@
//
// These are small graphics drawn by the normal label-drawing
-// code when the string starts with an '@' sign.
+// code when the string starts with an FL_SYMBOL_CHAR sign.
// Adapted from original code written by:
@@ -70,7 +70,7 @@
/**
Adds a symbol to the system.
- \param[in] name name of symbol (without the "@")
+ \param[in] name name of symbol (without the FL_SYMBOL_CHAR)
\param[in] drawit function to draw symbol
\param[in] scalable set to 1 if \p drawit uses scalable vector drawing
\returns 1 on success, 0 on failure
@@ -102,7 +102,7 @@
// provided for back compatibility:
int fl_draw_symbol(const char *label,int x,int y,int w,int h,Fl_Color col) {
const char *p = label;
- if (*p++ != '@') return 0;
+ if (*p++ != FL_SYMBOL_CHAR) return 0;
fl_init_symbols();
int equalscale = 0;
if (*p == '#') {equalscale = 1; p++;}
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev