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

View File

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