Changeset 3088

Show
Ignore:
Timestamp:
05/28/03 20:17:20 (6 years ago)
Author:
himi
Message:

(Fmw32_get_device_capability): New function.
(syms_of_mw32term): do defsubr() for mw32-get-device-capability.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • work/cvs2svn/src/mw32term.c

    r3077 r3088  
    1070810708} 
    1070910709 
     10710DEFUN ("mw32-get-device-capability", 
     10711       Fmw32_get_device_capability, 
     10712       Smw32_get_device_capability, 
     10713       1, 2, 0,  
     10714"Retrieve system metrics. This function only calls GetSystemMetrics.") 
     10715  (item, target) 
     10716{ 
     10717  HDC hdc; 
     10718  Lisp_Object ret; 
     10719 
     10720  if (EQ (target, Qnil)) 
     10721    { 
     10722      hdc = FRAME_HDC (SELECTED_FRAME ()); 
     10723    } 
     10724  else if (FRAMEP (target)) 
     10725    { 
     10726      hdc = FRAME_HDC (XFRAME (target)); 
     10727    } 
     10728  else 
     10729    { 
     10730      Fsignal (Qwrong_type_argument, 
     10731               Fcons (build_string ("Currently, target must be frame or nil."), 
     10732                      Fcons (item, Qnil))); 
     10733    } 
     10734 
     10735  if (EQ (item, intern ("width-in-mm"))) 
     10736    { 
     10737      int val = GetDeviceCaps (hdc, HORZSIZE); 
     10738      XSETINT (ret, val); 
     10739    } 
     10740  else if (EQ (item, intern ("height-in-mm"))) 
     10741    { 
     10742      int val = GetDeviceCaps (hdc, VERTSIZE); 
     10743      XSETINT (ret, val); 
     10744    } 
     10745  else if (EQ (item, intern ("width"))) 
     10746    { 
     10747      int val = GetDeviceCaps (hdc, HORZRES); 
     10748      XSETINT (ret, val); 
     10749    } 
     10750  else if (EQ (item, intern ("height"))) 
     10751    { 
     10752      int val = GetDeviceCaps (hdc, VERTRES); 
     10753      XSETINT (ret, val); 
     10754    } 
     10755  else if (EQ (item, intern ("pixel-width-in-mm"))) 
     10756    { 
     10757      int val = GetDeviceCaps (hdc, LOGPIXELSX); 
     10758      ret = make_float (25.4 / val); 
     10759    } 
     10760  else if (EQ (item, intern ("pixel-height-in-mm"))) 
     10761    { 
     10762      int val = GetDeviceCaps (hdc, LOGPIXELSY); 
     10763      ret = make_float (25.4 / val); 
     10764    } 
     10765  else if (EQ (item, intern ("color-bits"))) 
     10766    { 
     10767      int val = (GetDeviceCaps (hdc, BITSPIXEL) 
     10768                 * GetDeviceCaps (hdc, PLANES)); 
     10769      XSETINT (ret, val); 
     10770    } 
     10771  else if (EQ (item, intern ("colors"))) 
     10772    { 
     10773      int val = GetDeviceCaps (hdc, NUMCOLORS); 
     10774      if (val == -1) 
     10775        ret = intern ("full"); 
     10776      else 
     10777        XSETINT (ret, val); 
     10778    } 
     10779  else if (EQ (item, intern ("clipping"))) 
     10780    { 
     10781      int val = GetDeviceCaps (hdc, CLIPCAPS); 
     10782      if (val) 
     10783        ret = Qt; 
     10784      else 
     10785        ret = Qnil; 
     10786    } 
     10787  else if (EQ (item, intern ("text-capabilities"))) 
     10788    { 
     10789      int val = GetDeviceCaps (hdc, TEXTCAPS); 
     10790 
     10791      ret = Qnil; 
     10792      if (val & TC_OP_CHARACTER) 
     10793        ret = Fcons(intern ("character"), ret); 
     10794      if (val & TC_OP_STROKE) 
     10795        ret = Fcons(intern ("stroke"), ret); 
     10796      if (val & TC_CP_STROKE) 
     10797        ret = Fcons(intern ("clipping"), ret); 
     10798      if (val & TC_CR_90) 
     10799        ret = Fcons(intern ("rotate-90"), ret); 
     10800      if (val & TC_CR_ANY) 
     10801        ret = Fcons(intern ("rotate"), ret); 
     10802      if (val & TC_SA_DOUBLE) 
     10803        ret = Fcons(intern ("scale"), ret); 
     10804      if (val & TC_SA_INTEGER) 
     10805        ret = Fcons(intern ("scale-in-integer"), ret); 
     10806 
     10807      if (val & TC_IA_ABLE) 
     10808        ret = Fcons(intern ("italic"), ret); 
     10809      if (val & TC_UA_ABLE) 
     10810        ret = Fcons(intern ("underline"), ret); 
     10811      if (val & TC_SO_ABLE) 
     10812        ret = Fcons(intern ("strikeout"), ret); 
     10813 
     10814      if (val & TC_RA_ABLE) 
     10815        ret = Fcons(intern ("raster"), ret); 
     10816      if (val & TC_VA_ABLE) 
     10817        ret = Fcons(intern ("vector"), ret); 
     10818    } 
     10819  else if (NUMBERP (item)) 
     10820    { 
     10821      int val = GetDeviceCaps (hdc, XINT (item)); 
     10822      XSETINT (ret, val); 
     10823    } 
     10824  else 
     10825    { 
     10826      Fsignal (Qwrong_type_argument, 
     10827               Fcons (build_string ("Invalid item."), 
     10828                      Fcons (item, Qnil))); 
     10829    } 
     10830 
     10831  return ret; 
     10832} 
     10833 
    1071010834DEFUN ("Meadow-version", 
    1071110835       FMeadow_version, 
     
    1077710901  defsubr (&Sw32_get_mouse_wheel_scroll_lines); 
    1077810902  defsubr (&Sw32_keyboard_type); 
     10903  defsubr (&Smw32_get_device_capability); 
    1077910904  defsubr (&SMeadow_version); 
    1078010905}