home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Resources / System / BoingBag1 / Contributions / Workbench / RexxArpLib3p6 / src / syswbscr.c < prev    next >
C/C++ Source or Header  |  1998-06-21  |  2KB  |  108 lines

  1. /** Syswbscr.c
  2.   *
  3.   *   Find out the size of the Workbench
  4.   *
  5.   *   AUTHOR/DATE:  W.G.J. Langeveld, November 1987.
  6.   *   ============
  7.   *
  8.   *    CURRENT VERSION:
  9.   *
  10.   *    This version has been converted to SAS C 6.5 format. It has been modified
  11.   *    for modern definition sequences for ANSI compilation. This no longer works
  12.   *    with OS versions prior to 2.04.
  13.   *
  14.   *   AUTHOR/DATE:  Joanne Dow, jdow@bix.com, June 1998.
  15.   *   ============
  16.   *
  17.   **/
  18.  
  19. #include <functions.h>
  20. #include "ralprotos.h"
  21. #include <exec/types.h>
  22. #include <exec/exec.h>
  23. #include <libraries/dos.h>
  24. #include <graphics/gfx.h>
  25. #include <graphics/gfxbase.h>
  26. #include <intuition/intuition.h>
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30. #include <ctype.h>
  31.  
  32. extern struct GfxBase *GfxBase;
  33. extern struct IntuitionBase *IntuitionBase;
  34.  
  35. #define PSIZE ((long) sizeof(struct Preferences))
  36.     
  37. /**
  38.  *
  39.  *   GetWBRows() returns the number of rows of the Workbench screen, not corrected
  40.  *   for interlace (i.e. the real number is twice as large if the Workbench is
  41.  *   interlaced). If an error is encountered, 0 is returned.
  42.  *
  43. **/
  44. int GetWBRows( void )
  45. {
  46.     int scr_rows = 0;
  47.     
  48.     scr_rows = GfxBase->NormalDisplayRows;
  49.     
  50.     return(scr_rows);
  51. }
  52.  
  53.  
  54. /**
  55.  *
  56.  *   GetWBCols() returns the number of columns of the Workbench screen, or
  57.  *   0 on error.
  58.  *
  59. **/
  60. int GetWBCols( void )
  61. {
  62.     int scr_cols = 0;
  63.     
  64.     scr_cols = GfxBase->NormalDisplayColumns;
  65.     
  66.     return(scr_cols);
  67. }
  68.  
  69. /**
  70.  *
  71.  *   GetWBLace() returns 0 if the Workbench is not interlaced
  72.  *   and 1 if the Workbench is interlaced, and -1 on error.
  73.  *
  74. **/
  75. int GetWBLace( void )
  76. {
  77.     int lace = 0, retcode = 0;
  78.     struct Preferences *prefs = NULL, *nprefs = NULL;
  79.     
  80.     /*
  81.      *   Check preferences for interlace:
  82.      *   Allocate a Preferences structure
  83.      */
  84.     prefs = (struct Preferences *) AllocMem(PSIZE, NULL);
  85.     if (!prefs)
  86.         goto cleanup;
  87.     /*
  88.      *   Get Preferences and read WB interlace mode from it.
  89.      */
  90.     nprefs = GetPrefs(prefs, PSIZE);
  91.     if (!nprefs)
  92.         goto cleanup;
  93.     
  94.     if (nprefs->LaceWB & LACEWB)
  95.         lace = 1;
  96.     
  97.     retcode = 1;
  98.     
  99.     cleanup:
  100.     if (prefs)
  101.         FreeMem(prefs, PSIZE);
  102.     
  103.     if (retcode)
  104.         return(lace);
  105.     else
  106.         return(-1);
  107. }
  108.