comparison src/objects-msw.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents abe6d1db359e
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
1182 { 1182 {
1183 c->data = xnew (struct mswindows_color_instance_data); 1183 c->data = xnew (struct mswindows_color_instance_data);
1184 COLOR_INSTANCE_MSWINDOWS_COLOR (c) = color; 1184 COLOR_INSTANCE_MSWINDOWS_COLOR (c) = color;
1185 return 1; 1185 return 1;
1186 } 1186 }
1187 maybe_signal_simple_error ("Unrecognized color", name, Qcolor, errb); 1187 maybe_signal_error (Qinvalid_constant,
1188 "Unrecognized color", name, Qcolor, errb);
1188 return(0); 1189 return(0);
1189 } 1190 }
1190 1191
1191 #if 0 1192 #if 0
1192 static void 1193 static void
1299 * us to use match_font() on a canonicalized font string to check the 1300 * us to use match_font() on a canonicalized font string to check the
1300 * availability of the requested font */ 1301 * availability of the requested font */
1301 1302
1302 if (fields < 0) 1303 if (fields < 0)
1303 { 1304 {
1304 maybe_signal_simple_error ("Invalid font", name, Qfont, errb); 1305 maybe_signal_error (Qinvalid_argument, "Invalid font", name, Qfont, errb);
1305 return (0); 1306 return (0);
1306 } 1307 }
1307 1308
1308 if (fields>0 && strlen(fontname)) 1309 if (fields>0 && strlen(fontname))
1309 { 1310 {
1310 strncpy (logfont.lfFaceName, fontname, LF_FACESIZE); 1311 strncpy (logfont.lfFaceName, fontname, LF_FACESIZE);
1311 logfont.lfFaceName[LF_FACESIZE-1] = 0; 1312 logfont.lfFaceName[LF_FACESIZE-1] = 0;
1312 } 1313 }
1313 else 1314 else
1314 { 1315 {
1315 maybe_signal_simple_error ("Must specify a font name", name, Qfont, errb); 1316 maybe_signal_error (Qinvalid_argument, "Must specify a font name", name, Qfont, errb);
1316 return (0); 1317 return (0);
1317 } 1318 }
1318 1319
1319 /* weight */ 1320 /* weight */
1320 if (fields < 2) 1321 if (fields < 2)
1342 logfont.lfWeight = FW_REGULAR; 1343 logfont.lfWeight = FW_REGULAR;
1343 style = weight; /* May have specified style without weight */ 1344 style = weight; /* May have specified style without weight */
1344 } 1345 }
1345 else 1346 else
1346 { 1347 {
1347 maybe_signal_simple_error ("Invalid font weight", name, Qfont, errb); 1348 maybe_signal_error (Qinvalid_constant, "Invalid font weight", name, Qfont, errb);
1348 return (0); 1349 return (0);
1349 } 1350 }
1350 } 1351 }
1351 1352
1352 if (style) 1353 if (style)
1354 /* #### what about oblique? */ 1355 /* #### what about oblique? */
1355 if (stricmp (style,"italic") == 0) 1356 if (stricmp (style,"italic") == 0)
1356 logfont.lfItalic = TRUE; 1357 logfont.lfItalic = TRUE;
1357 else 1358 else
1358 { 1359 {
1359 maybe_signal_simple_error ("Invalid font weight or style", name, Qfont, errb); 1360 maybe_signal_error (Qinvalid_constant, "Invalid font weight or style", name, Qfont, errb);
1360 return (0); 1361 return (0);
1361 } 1362 }
1362 1363
1363 /* Glue weight and style together again */ 1364 /* Glue weight and style together again */
1364 if (weight != style) 1365 if (weight != style)
1369 1370
1370 if (fields < 3) 1371 if (fields < 3)
1371 pt = 10; /* #### Should we reject strings that don't specify a size? */ 1372 pt = 10; /* #### Should we reject strings that don't specify a size? */
1372 else if ((pt=atoi(points)) == 0) 1373 else if ((pt=atoi(points)) == 0)
1373 { 1374 {
1374 maybe_signal_simple_error ("Invalid font pointsize", name, Qfont, errb); 1375 maybe_signal_error (Qinvalid_argument, "Invalid font pointsize", name, Qfont, errb);
1375 return (0); 1376 return (0);
1376 } 1377 }
1377 1378
1378 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */ 1379 /* Formula for pointsize->height from LOGFONT docs in MSVC5 Platform SDK */
1379 logfont.lfHeight = -MulDiv(pt, GetDeviceCaps (hdc, LOGPIXELSY), 72); 1380 logfont.lfHeight = -MulDiv(pt, GetDeviceCaps (hdc, LOGPIXELSY), 72);
1399 logfont.lfUnderline = TRUE; 1400 logfont.lfUnderline = TRUE;
1400 else if (stricmp (effects, "strikeout") == 0) 1401 else if (stricmp (effects, "strikeout") == 0)
1401 logfont.lfStrikeOut = TRUE; 1402 logfont.lfStrikeOut = TRUE;
1402 else 1403 else
1403 { 1404 {
1404 maybe_signal_simple_error ("Invalid font effect", name, Qfont, errb); 1405 maybe_signal_error (Qinvalid_constant, "Invalid font effect", name, Qfont, errb);
1405 return (0); 1406 return (0);
1406 } 1407 }
1407 1408
1408 if (effects2 && effects2[0] != '\0') 1409 if (effects2 && effects2[0] != '\0')
1409 { 1410 {
1411 logfont.lfUnderline = TRUE; 1412 logfont.lfUnderline = TRUE;
1412 else if (stricmp (effects2, "strikeout") == 0) 1413 else if (stricmp (effects2, "strikeout") == 0)
1413 logfont.lfStrikeOut = TRUE; 1414 logfont.lfStrikeOut = TRUE;
1414 else 1415 else
1415 { 1416 {
1416 maybe_signal_simple_error ("Invalid font effect", name, 1417 maybe_signal_error (Qinvalid_constant, "Invalid font effect", name,
1417 Qfont, errb); 1418 Qfont, errb);
1418 return (0); 1419 return (0);
1419 } 1420 }
1420 } 1421 }
1421 1422
1454 break; 1455 break;
1455 } 1456 }
1456 1457
1457 if (i == countof (charset_map)) /* No matching charset */ 1458 if (i == countof (charset_map)) /* No matching charset */
1458 { 1459 {
1459 maybe_signal_simple_error ("Invalid charset", name, Qfont, errb); 1460 maybe_signal_error (Qinvalid_argument, "Invalid charset", name, Qfont, errb);
1460 return 0; 1461 return 0;
1461 } 1462 }
1462 1463
1463 /* Misc crud */ 1464 /* Misc crud */
1464 logfont.lfEscapement = logfont.lfOrientation = 0; 1465 logfont.lfEscapement = logfont.lfOrientation = 0;
1491 if (match_font (XSTRING_DATA (XCAR (fonttail)), truename, NULL)) 1492 if (match_font (XSTRING_DATA (XCAR (fonttail)), truename, NULL))
1492 break; 1493 break;
1493 } 1494 }
1494 if (NILP (fonttail)) 1495 if (NILP (fonttail))
1495 { 1496 {
1496 maybe_signal_simple_error ("No matching font", name, Qfont, errb); 1497 maybe_signal_error (Qinvalid_argument, "No matching font", name, Qfont, errb);
1497 return 0; 1498 return 0;
1498 } 1499 }
1499 } 1500 }
1500 1501
1501 if ((hfont = CreateFontIndirect(&logfont)) == NULL) 1502 if ((hfont = CreateFontIndirect(&logfont)) == NULL)
1502 { 1503 {
1503 maybe_signal_simple_error ("Couldn't create font", name, Qfont, errb); 1504 maybe_signal_error (Qgui_error, "Couldn't create font", name, Qfont, errb);
1504 return 0; 1505 return 0;
1505 } 1506 }
1506 1507
1507 f->data = xnew_and_zero (struct mswindows_font_instance_data); 1508 f->data = xnew_and_zero (struct mswindows_font_instance_data);
1508 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f,0,0) = hfont; 1509 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f,0,0) = hfont;
1517 1518
1518 hfont2 = (HFONT) SelectObject (hdc, hfont); 1519 hfont2 = (HFONT) SelectObject (hdc, hfont);
1519 if (!hfont2) 1520 if (!hfont2)
1520 { 1521 {
1521 mswindows_finalize_font_instance (f); 1522 mswindows_finalize_font_instance (f);
1522 maybe_signal_simple_error ("Couldn't map font", name, Qfont, errb); 1523 maybe_signal_error (Qgui_error, "Couldn't map font", name, Qfont, errb);
1523 return 0; 1524 return 0;
1524 } 1525 }
1525 GetTextMetrics (hdc, &metrics); 1526 GetTextMetrics (hdc, &metrics);
1526 SelectObject(hdc, hfont2); 1527 SelectObject(hdc, hfont2);
1527 1528