Removed debugging messages, added character lookup table for HTML enteties into Mac Roman font.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5206 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2006-06-18 15:45:49 +00:00
parent b51dd39f07
commit baeafbea45
+116 -105
View File
@@ -184,7 +184,6 @@ static int draw_mode = 0;
static int mouse_x = 0; static int mouse_x = 0;
static int mouse_y = 0; static int mouse_y = 0;
static int current_pos = 0; static int current_pos = 0;
static int clicked_link = 0;
static Fl_Help_View *current_view = 0L; static Fl_Help_View *current_view = 0L;
Fl_Color hv_selection_color; Fl_Color hv_selection_color;
Fl_Color hv_selection_text_color; Fl_Color hv_selection_text_color;
@@ -200,7 +199,7 @@ void Fl_Help_View::hv_draw(const char *t, int x, int y)
Fl_Color c = fl_color(); Fl_Color c = fl_color();
fl_color(hv_selection_color); fl_color(hv_selection_color);
int w = fl_width(t); int w = fl_width(t);
if (current_pos+strlen(t)<selection_last) if (current_pos+(int)strlen(t)<selection_last)
w += fl_width(' '); w += fl_width(' ');
fl_rectf(x, y+fl_descent()-fl_height(), w, fl_height()); fl_rectf(x, y+fl_descent()-fl_height(), w, fl_height());
fl_color(hv_selection_text_color); fl_color(hv_selection_text_color);
@@ -2630,7 +2629,7 @@ void Fl_Help_View::end_selection(int clipboard)
// convert the select part of our html text into some kind of somewhat readable ASCII // convert the select part of our html text into some kind of somewhat readable ASCII
// and store it in the selection buffer // and store it in the selection buffer
char p = 0, pre = 0;; char p = 0, pre = 0;;
int len = strlen(value_), nc; int len = strlen(value_);
char *txt = (char*)malloc(len+1), *d = txt; char *txt = (char*)malloc(len+1), *d = txt;
const char *s = value_, *cmd, *src; const char *s = value_, *cmd, *src;
for (;;) { for (;;) {
@@ -2778,10 +2777,10 @@ Fl_Help_View::handle(int event) // I - Event to handle
return 1; return 1;
case FL_RELEASE: case FL_RELEASE:
if (linkp) { if (linkp) {
fl_cursor(FL_CURSOR_DEFAULT);
if (Fl::event_is_click()) { if (Fl::event_is_click()) {
follow_link(linkp); follow_link(linkp);
} }
fl_cursor(FL_CURSOR_DEFAULT);
linkp = 0; linkp = 0;
return 1; return 1;
} }
@@ -2792,7 +2791,6 @@ Fl_Help_View::handle(int event) // I - Event to handle
return 1; return 1;
case FL_SHORTCUT: { case FL_SHORTCUT: {
char ascii = Fl::event_text()[0]; char ascii = Fl::event_text()[0];
fprintf(stderr, "%02x %c\n", ascii, ascii);
switch (ascii) { switch (ascii) {
case ctrl('A'): select_all(); redraw(); return 1; case ctrl('A'): select_all(); redraw(); return 1;
case ctrl('X'): end_selection(1); return 1; case ctrl('X'): end_selection(1); return 1;
@@ -3105,6 +3103,14 @@ Fl_Help_View::value(const char *v) // I - Text to view
leftline(0); leftline(0);
} }
#ifdef ENC
# undef ENC
#endif
#ifdef __APPLE__
# define ENC(a, b) b
#else
# define ENC(a, b) a
#endif
// //
// 'quote_char()' - Return the character code associated with a quoted char. // 'quote_char()' - Return the character code associated with a quoted char.
@@ -3119,106 +3125,111 @@ quote_char(const char *p) { // I - Quoted string
int code; int code;
} *nameptr, // Pointer into name array } *nameptr, // Pointer into name array
names[] = { // Quoting names names[] = { // Quoting names
{ "Aacute;", 7, 193 }, { "Aacute;", 7, ENC(193,231) },
{ "aacute;", 7, 225 }, { "aacute;", 7, ENC(225,135) },
{ "Acirc;", 6, 194 }, { "Acirc;", 6, ENC(194,229) },
{ "acirc;", 6, 226 }, { "acirc;", 6, ENC(226,137) },
{ "acute;", 6, 180 }, { "acute;", 6, ENC(180,171) },
{ "AElig;", 6, 198 }, { "AElig;", 6, ENC(198,174) },
{ "aelig;", 6, 230 }, { "aelig;", 6, ENC(230,190) },
{ "Agrave;", 7, 192 }, { "Agrave;", 7, ENC(192,203) },
{ "agrave;", 7, 224 }, { "agrave;", 7, ENC(224,136) },
{ "amp;", 4, '&' }, { "amp;", 4, ENC('&','&') },
{ "Aring;", 6, 197 }, { "Aring;", 6, ENC(197,129) },
{ "aring;", 6, 229 }, { "aring;", 6, ENC(229,140) },
{ "Atilde;", 7, 195 }, { "Atilde;", 7, ENC(195,204) },
{ "atilde;", 7, 227 }, { "atilde;", 7, ENC(227,139) },
{ "Auml;", 5, 196 }, { "Auml;", 5, ENC(196,128) },
{ "auml;", 5, 228 }, { "auml;", 5, ENC(228,138) },
{ "brvbar;", 7, 166 }, { "brvbar;", 7, ENC(166, -1) },
{ "Ccedil;", 7, 199 }, { "bull;", 5, ENC(149,165) },
{ "ccedil;", 7, 231 }, { "Ccedil;", 7, ENC(199,199) },
{ "cedil;", 6, 184 }, { "ccedil;", 7, ENC(231,141) },
{ "cent;", 5, 162 }, { "cedil;", 6, ENC(184,252) },
{ "copy;", 5, 169 }, { "cent;", 5, ENC(162,162) },
{ "curren;", 7, 164 }, { "copy;", 5, ENC(169,169) },
{ "deg;", 4, 176 }, { "curren;", 7, ENC(164, -1) },
{ "divide;", 7, 247 }, { "deg;", 4, ENC(176,161) },
{ "Eacute;", 7, 201 }, { "divide;", 7, ENC(247,214) },
{ "eacute;", 7, 233 }, { "Eacute;", 7, ENC(201,131) },
{ "Ecirc;", 6, 202 }, { "eacute;", 7, ENC(233,142) },
{ "ecirc;", 6, 234 }, { "Ecirc;", 6, ENC(202,230) },
{ "Egrave;", 7, 200 }, { "ecirc;", 6, ENC(234,144) },
{ "egrave;", 7, 232 }, { "Egrave;", 7, ENC(200,233) },
{ "ETH;", 4, 208 }, { "egrave;", 7, ENC(232,143) },
{ "eth;", 4, 240 }, { "ETH;", 4, ENC(208, -1) },
{ "Euml;", 5, 203 }, { "eth;", 4, ENC(240, -1) },
{ "euml;", 5, 235 }, { "Euml;", 5, ENC(203,232) },
{ "frac12;", 7, 189 }, { "euml;", 5, ENC(235,145) },
{ "frac14;", 7, 188 }, { "euro;", 5, ENC(128,219) },
{ "frac34;", 7, 190 }, { "frac12;", 7, ENC(189, -1) },
{ "gt;", 3, '>' }, { "frac14;", 7, ENC(188, -1) },
{ "Iacute;", 7, 205 }, { "frac34;", 7, ENC(190, -1) },
{ "iacute;", 7, 237 }, { "gt;", 3, ENC('>','>') },
{ "Icirc;", 6, 206 }, { "Iacute;", 7, ENC(205,234) },
{ "icirc;", 6, 238 }, { "iacute;", 7, ENC(237,146) },
{ "iexcl;", 6, 161 }, { "Icirc;", 6, ENC(206,235) },
{ "Igrave;", 7, 204 }, { "icirc;", 6, ENC(238,148) },
{ "igrave;", 7, 236 }, { "iexcl;", 6, ENC(161,193) },
{ "iquest;", 7, 191 }, { "Igrave;", 7, ENC(204,237) },
{ "Iuml;", 5, 207 }, { "igrave;", 7, ENC(236,147) },
{ "iuml;", 5, 239 }, { "iquest;", 7, ENC(191,192) },
{ "laquo;", 6, 171 }, { "Iuml;", 5, ENC(207,236) },
{ "lt;", 3, '<' }, { "iuml;", 5, ENC(239,149) },
{ "macr;", 5, 175 }, { "laquo;", 6, ENC(171,199) },
{ "micro;", 6, 181 }, { "lt;", 3, ENC('<','<') },
{ "middot;", 7, 183 }, { "macr;", 5, ENC(175,248) },
{ "nbsp;", 5, ' ' }, { "micro;", 6, ENC(181,181) },
{ "not;", 4, 172 }, { "middot;", 7, ENC(183,225) },
{ "Ntilde;", 7, 209 }, { "nbsp;", 5, ENC(' ',' ') },
{ "ntilde;", 7, 241 }, { "not;", 4, ENC(172,194) },
{ "Oacute;", 7, 211 }, { "Ntilde;", 7, ENC(209,132) },
{ "oacute;", 7, 243 }, { "ntilde;", 7, ENC(241,150) },
{ "Ocirc;", 6, 212 }, { "Oacute;", 7, ENC(211,238) },
{ "ocirc;", 6, 244 }, { "oacute;", 7, ENC(243,151) },
{ "Ograve;", 7, 210 }, { "Ocirc;", 6, ENC(212,239) },
{ "ograve;", 7, 242 }, { "ocirc;", 6, ENC(244,153) },
{ "ordf;", 5, 170 }, { "Ograve;", 7, ENC(210,241) },
{ "ordm;", 5, 186 }, { "ograve;", 7, ENC(242,152) },
{ "Oslash;", 7, 216 }, { "ordf;", 5, ENC(170,187) },
{ "oslash;", 7, 248 }, { "ordm;", 5, ENC(186,188) },
{ "Otilde;", 7, 213 }, { "Oslash;", 7, ENC(216,175) },
{ "otilde;", 7, 245 }, { "oslash;", 7, ENC(248,191) },
{ "Ouml;", 5, 214 }, { "Otilde;", 7, ENC(213,205) },
{ "ouml;", 5, 246 }, { "otilde;", 7, ENC(245,155) },
{ "para;", 5, 182 }, { "Ouml;", 5, ENC(214,133) },
{ "plusmn;", 7, 177 }, { "ouml;", 5, ENC(246,154) },
{ "pound;", 6, 163 }, { "para;", 5, ENC(182,166) },
{ "quot;", 5, '\"' }, { "premil;", 7, ENC(137,228) },
{ "raquo;", 6, 187 }, { "plusmn;", 7, ENC(177,177) },
{ "reg;", 4, 174 }, { "pound;", 6, ENC(163,163) },
{ "sect;", 5, 167 }, { "quot;", 5, ENC('\"','\"') },
{ "shy;", 4, 173 }, { "raquo;", 6, ENC(187,200) },
{ "sup1;", 5, 185 }, { "reg;", 4, ENC(174,168) },
{ "sup2;", 5, 178 }, { "sect;", 5, ENC(167,164) },
{ "sup3;", 5, 179 }, { "shy;", 4, ENC(173,'-') },
{ "szlig;", 6, 223 }, { "sup1;", 5, ENC(185, -1) },
{ "THORN;", 6, 222 }, { "sup2;", 5, ENC(178, -1) },
{ "thorn;", 6, 254 }, { "sup3;", 5, ENC(179, -1) },
{ "times;", 6, 215 }, { "szlig;", 6, ENC(223,167) },
{ "Uacute;", 7, 218 }, { "THORN;", 6, ENC(222, -1) },
{ "uacute;", 7, 250 }, { "thorn;", 6, ENC(254, -1) },
{ "Ucirc;", 6, 219 }, { "times;", 6, ENC(215,'x') },
{ "ucirc;", 6, 251 }, { "trade;", 6, ENC(153,170) },
{ "Ugrave;", 7, 217 }, { "Uacute;", 7, ENC(218,242) },
{ "ugrave;", 7, 249 }, { "uacute;", 7, ENC(250,156) },
{ "uml;", 4, 168 }, { "Ucirc;", 6, ENC(219,243) },
{ "Uuml;", 5, 220 }, { "ucirc;", 6, ENC(251,158) },
{ "uuml;", 5, 252 }, { "Ugrave;", 7, ENC(217,244) },
{ "Yacute;", 7, 221 }, { "ugrave;", 7, ENC(249,157) },
{ "yacute;", 7, 253 }, { "uml;", 4, ENC(168,172) },
{ "yen;", 4, 165 }, { "Uuml;", 5, ENC(220,134) },
{ "yuml;", 5, 255 } { "uuml;", 5, ENC(252,159) },
{ "Yacute;", 7, ENC(221, -1) },
{ "yacute;", 7, ENC(253, -1) },
{ "yen;", 4, ENC(165,180) },
{ "Yuml;", 5, ENC(159,217) },
{ "yuml;", 5, ENC(255,216) }
}; };
if (!strchr(p, ';')) return -1; if (!strchr(p, ';')) return -1;