Mercurial > hg > xemacs-beta
comparison src/device-msw.c @ 5125:b5df3737028a ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 24 Feb 2010 01:58:04 -0600 |
parents | 623d57b7fbe8 3c3c1d139863 |
children | a9c41067dd88 |
comparison
equal
deleted
inserted
replaced
5124:623d57b7fbe8 | 5125:b5df3737028a |
---|---|
298 # endif | 298 # endif |
299 #endif | 299 #endif |
300 | 300 |
301 DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); | 301 DeleteDC (DEVICE_MSWINDOWS_HCDC (d)); |
302 #ifndef NEW_GC | 302 #ifndef NEW_GC |
303 xfree (d->device_data, void *); | 303 xfree (d->device_data); |
304 #endif /* not NEW_GC */ | 304 #endif /* not NEW_GC */ |
305 } | 305 } |
306 | 306 |
307 void | 307 void |
308 mswindows_get_workspace_coords (RECT *rc) | 308 mswindows_get_workspace_coords (RECT *rc) |
439 Extbyte *printer_ext; | 439 Extbyte *printer_ext; |
440 HDC hdc; | 440 HDC hdc; |
441 | 441 |
442 DEVICE_MSPRINTER_NAME (d) = printer_name; | 442 DEVICE_MSPRINTER_NAME (d) = printer_name; |
443 | 443 |
444 LISP_STRING_TO_TSTR (printer_name, printer_ext); | 444 printer_ext = LISP_STRING_TO_TSTR (printer_name); |
445 | 445 |
446 if (!qxeOpenPrinter (printer_ext, &DEVICE_MSPRINTER_HPRINTER (d), NULL)) | 446 if (!qxeOpenPrinter (printer_ext, &DEVICE_MSPRINTER_HPRINTER (d), NULL)) |
447 { | 447 { |
448 DEVICE_MSPRINTER_HPRINTER (d) = NULL; | 448 DEVICE_MSPRINTER_HPRINTER (d) = NULL; |
449 return 0; | 449 return 0; |
491 Ibyte *nameint; | 491 Ibyte *nameint; |
492 | 492 |
493 if (qxeGetProfileString (XETEXT ("windows"), XETEXT ("device"), NULL, name, | 493 if (qxeGetProfileString (XETEXT ("windows"), XETEXT ("device"), NULL, name, |
494 sizeof (name) / XETCHAR_SIZE) <= 0) | 494 sizeof (name) / XETCHAR_SIZE) <= 0) |
495 return Qnil; | 495 return Qnil; |
496 TSTR_TO_C_STRING (name, nameint); | 496 nameint = TSTR_TO_ITEXT (name); |
497 | 497 |
498 if (nameint[0] == '\0') | 498 if (nameint[0] == '\0') |
499 return Qnil; | 499 return Qnil; |
500 | 500 |
501 /* this is destructive, but that's ok because the string is either in | 501 /* this is destructive, but that's ok because the string is either in |
502 name[] or ALLOCA ()ed */ | 502 name[] or ALLOCA ()ed */ |
503 qxestrtok (nameint, ","); | 503 qxestrtok (nameint, ","); |
504 | 504 |
505 return build_intstring (nameint); | 505 return build_istring (nameint); |
506 } | 506 } |
507 | 507 |
508 | 508 |
509 /************************************************************************/ | 509 /************************************************************************/ |
510 /* printer methods */ | 510 /* printer methods */ |
537 CHECK_STRING (DEVICE_CONNECTION (d)); | 537 CHECK_STRING (DEVICE_CONNECTION (d)); |
538 | 538 |
539 if (!msprinter_init_device_internal (d, DEVICE_CONNECTION (d))) | 539 if (!msprinter_init_device_internal (d, DEVICE_CONNECTION (d))) |
540 signal_open_printer_error (d); | 540 signal_open_printer_error (d); |
541 | 541 |
542 LISP_STRING_TO_TSTR (DEVICE_CONNECTION (d), printer_name); | 542 printer_name = LISP_STRING_TO_TSTR (DEVICE_CONNECTION (d)); |
543 /* Determine DEVMODE size and store the default DEVMODE */ | 543 /* Determine DEVMODE size and store the default DEVMODE */ |
544 dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), | 544 dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), |
545 printer_name, NULL, NULL, 0); | 545 printer_name, NULL, NULL, 0); |
546 if (dm_size <= 0) | 546 if (dm_size <= 0) |
547 signal_open_printer_error (d); | 547 signal_open_printer_error (d); |
571 XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil; | 571 XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil; |
572 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; | 572 DEVICE_MSPRINTER_DEVMODE (d) = Qnil; |
573 } | 573 } |
574 | 574 |
575 #ifndef NEW_GC | 575 #ifndef NEW_GC |
576 xfree (d->device_data, void *); | 576 xfree (d->device_data); |
577 #endif /* not NEW_GC */ | 577 #endif /* not NEW_GC */ |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 static Lisp_Object | 581 static Lisp_Object |
650 sync_printer_with_devmode (struct device* d, DEVMODEW* devmode_in, | 650 sync_printer_with_devmode (struct device* d, DEVMODEW* devmode_in, |
651 DEVMODEW* devmode_out, Lisp_Object devname) | 651 DEVMODEW* devmode_out, Lisp_Object devname) |
652 { | 652 { |
653 /* Change connection if the device changed */ | 653 /* Change connection if the device changed */ |
654 if (!NILP (devname) | 654 if (!NILP (devname) |
655 && lisp_strcasecmp (devname, DEVICE_MSPRINTER_NAME (d)) != 0) | 655 && lisp_strcasecmp_i18n (devname, DEVICE_MSPRINTER_NAME (d)) != 0) |
656 { | 656 { |
657 Lisp_Object new_connection = devname; | 657 Lisp_Object new_connection = devname; |
658 | 658 |
659 DEVICE_CONNECTION (d) = Qnil; | 659 DEVICE_CONNECTION (d) = Qnil; |
660 if (!NILP (Ffind_device (new_connection, Qmsprinter))) | 660 if (!NILP (Ffind_device (new_connection, Qmsprinter))) |
664 connection name. Use the memory address of d as a unique | 664 connection name. Use the memory address of d as a unique |
665 suffix. */ | 665 suffix. */ |
666 Ibyte new_connext[20]; | 666 Ibyte new_connext[20]; |
667 | 667 |
668 qxesprintf (new_connext, ":%X", d->header.uid); | 668 qxesprintf (new_connext, ":%X", d->header.uid); |
669 new_connection = concat2 (devname, build_intstring (new_connext)); | 669 new_connection = concat2 (devname, build_istring (new_connext)); |
670 } | 670 } |
671 DEVICE_CONNECTION (d) = new_connection; | 671 DEVICE_CONNECTION (d) = new_connection; |
672 | 672 |
673 /* Reinitialize printer. The device can pop off in process */ | 673 /* Reinitialize printer. The device can pop off in process */ |
674 if (!msprinter_reinit_device (d, devname)) | 674 if (!msprinter_reinit_device (d, devname)) |
679 } | 679 } |
680 } | 680 } |
681 { | 681 { |
682 Extbyte *nameext; | 682 Extbyte *nameext; |
683 | 683 |
684 LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d), nameext); | 684 nameext = LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d)); |
685 | 685 |
686 /* Apply the new devmode to the printer */ | 686 /* Apply the new devmode to the printer */ |
687 qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), | 687 qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), |
688 nameext, devmode_out, devmode_in, | 688 nameext, devmode_out, devmode_in, |
689 DM_IN_BUFFER | DM_OUT_BUFFER); | 689 DM_IN_BUFFER | DM_OUT_BUFFER); |
1035 if (NILP (ldm->printer_name)) | 1035 if (NILP (ldm->printer_name)) |
1036 { | 1036 { |
1037 Extbyte *nameext; | 1037 Extbyte *nameext; |
1038 LONG dm_size; | 1038 LONG dm_size; |
1039 | 1039 |
1040 LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d), nameext); | 1040 nameext = LISP_STRING_TO_TSTR (DEVICE_MSPRINTER_NAME (d)); |
1041 dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), | 1041 dm_size = qxeDocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER (d), |
1042 nameext, NULL, NULL, 0); | 1042 nameext, NULL, NULL, 0); |
1043 if (dm_size <= 0) | 1043 if (dm_size <= 0) |
1044 signal_error (Qio_error, | 1044 signal_error (Qio_error, |
1045 "Unable to specialize settings, printer error", | 1045 "Unable to specialize settings, printer error", |
1146 print_devmode (Lisp_Object obj, Lisp_Object printcharfun, | 1146 print_devmode (Lisp_Object obj, Lisp_Object printcharfun, |
1147 int UNUSED (escapeflag)) | 1147 int UNUSED (escapeflag)) |
1148 { | 1148 { |
1149 Lisp_Devmode *dm = XDEVMODE (obj); | 1149 Lisp_Devmode *dm = XDEVMODE (obj); |
1150 if (print_readably) | 1150 if (print_readably) |
1151 printing_unreadable_object ("#<msprinter-settings 0x%x>", | 1151 printing_unreadable_lcrecord (obj, 0); |
1152 dm->header.uid); | 1152 write_ascstring (printcharfun, "#<msprinter-settings"); |
1153 write_c_string (printcharfun, "#<msprinter-settings"); | |
1154 if (!NILP (dm->printer_name)) | 1153 if (!NILP (dm->printer_name)) |
1155 write_fmt_string_lisp (printcharfun, " for %S", 1, dm->printer_name); | 1154 write_fmt_string_lisp (printcharfun, " for %S", 1, dm->printer_name); |
1156 if (!NILP (dm->device)) | 1155 if (!NILP (dm->device)) |
1157 write_fmt_string_lisp (printcharfun, " (currently on %s)", 1, dm->device); | 1156 write_fmt_string_lisp (printcharfun, " (currently on %s)", 1, dm->device); |
1158 write_fmt_string (printcharfun, " 0x%x>", dm->header.uid); | 1157 write_fmt_string (printcharfun, " 0x%x>", dm->header.uid); |
1165 | 1164 |
1166 assert (NILP (dm->device)); | 1165 assert (NILP (dm->device)); |
1167 } | 1166 } |
1168 | 1167 |
1169 static int | 1168 static int |
1170 equal_devmode (Lisp_Object obj1, Lisp_Object obj2, int UNUSED (depth)) | 1169 equal_devmode (Lisp_Object obj1, Lisp_Object obj2, int UNUSED (depth), |
1170 int UNUSED (foldcase)) | |
1171 { | 1171 { |
1172 Lisp_Devmode *dm1 = XDEVMODE (obj1); | 1172 Lisp_Devmode *dm1 = XDEVMODE (obj1); |
1173 Lisp_Devmode *dm2 = XDEVMODE (obj2); | 1173 Lisp_Devmode *dm2 = XDEVMODE (obj2); |
1174 | 1174 |
1175 if ((dm1->devmode != NULL) != (dm1->devmode != NULL)) | 1175 if ((dm1->devmode != NULL) != (dm1->devmode != NULL)) |
1178 return 1; | 1178 return 1; |
1179 if (memcmp (dm1->devmode, dm2->devmode, XDEVMODE_SIZE (dm1)) != 0) | 1179 if (memcmp (dm1->devmode, dm2->devmode, XDEVMODE_SIZE (dm1)) != 0) |
1180 return 0; | 1180 return 0; |
1181 if (NILP (dm1->printer_name) || NILP (dm2->printer_name)) | 1181 if (NILP (dm1->printer_name) || NILP (dm2->printer_name)) |
1182 return 1; | 1182 return 1; |
1183 return lisp_strcasecmp (dm1->printer_name, dm2->printer_name) == 0; | 1183 return lisp_strcasecmp_i18n (dm1->printer_name, dm2->printer_name) == 0; |
1184 } | 1184 } |
1185 | 1185 |
1186 static Hashcode | 1186 static Hashcode |
1187 hash_devmode (Lisp_Object obj, int depth) | 1187 hash_devmode (Lisp_Object obj, int depth) |
1188 { | 1188 { |