home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Science⁄Math / VideoToolbox / VideoToolboxSources / MaximizeConsoleHeight.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-25  |  1.3 KB  |  43 lines  |  [TEXT/KAHL]

  1. /*
  2. MaximizeConsoleHeight.c
  3. THINK C provides a built-in console. That console is less useful than it might
  4. be because it opens to only a small size, presumably designed to fit on the tiny
  5. screen of a Mac Plus. This routine requests that the console open to the full
  6. height of your main screen. Call MaximizeConsoleHeight() BEFORE opening the
  7. console in THINK C, i.e. before your first printf().
  8.  
  9. To change the WIDTH of your THINK C console do this:
  10. #include <console.h>
  11. ...
  12. console_options.ncols=100;
  13.  
  14. HISTORY:
  15. 1/92    dgp wrote it.
  16. 8/27/92    dgp    check for 8-bit quickdraw before using GDevices.
  17. 10/10/92 dgp Reduced maximum console height by one pixel, so as not to clip 
  18.             displayed text.
  19. 2/22/93    dgp replaced GetMBarHeight() by MBarHeight.
  20. 4/16/93    dgp    enhanced to actively support 1-bit QD, rather than doing nothing.
  21. */
  22.  
  23. #include "VideoToolbox.h"
  24. #if THINK_C
  25.     #include <LoMem.h>    // MBarHeight
  26.     #include <console.h>
  27. #endif
  28.  
  29. void MaximizeConsoleHeight(void)
  30. {
  31. #if THINK_C
  32.     long qD;
  33.     Rect r;
  34.     
  35.     Gestalt(gestaltQuickdrawVersion,&qD);
  36.     console_options.top=MBarHeight+19;
  37.     console_options.left=1;
  38.     if(qD>=gestalt8BitQD) r=(**(**MainDevice).gdPMap).bounds;
  39.     else r=CrsrPin;    // Can't use qd.screenBits.bounds 'cause qd may not yet be inited.
  40.     console_options.nrows=r.bottom-4-console_options.top;
  41.     console_options.nrows/=console_options.txSize*4/3-1; /* estimate line spacing */
  42. #endif
  43. }