home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / WINLOAD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  3.5 KB  |  152 lines

  1. /*
  2.     winload.c
  3.  
  4.     % winreq_load
  5.  
  6.     OWL 1.1
  7.     Copyright (c) 1988, 1989 by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.     09/01/89 jdc    added win_IsCharSize
  13. */
  14.  
  15. #include "oakhead.h"
  16. #include "disppriv.h"
  17. #include "jadecl.h"
  18. #include "symldecl.h"
  19.  
  20. #include "bordobj.h"
  21. #include "winod.h"
  22. #include "winsfile.h"
  23. #include "winspriv.h"
  24.  
  25. OSTATIC objreq_func (winreq_load);
  26.  
  27. void win_LoadInit()
  28. {
  29.     winreq_loadfptr = winreq_load;
  30. }
  31.  
  32. static VOID_FPTR null_funcptr = FNULL;
  33.  
  34. int winreq_load(objdata, msg, indata, outdata)
  35.     VOID *objdata;
  36.     int msg;                /* message */
  37.     VOID *indata;            /* message input data */
  38.     VOID *outdata;            /* message output data */
  39. {
  40.     ocbox box;
  41.     opbox pbox;
  42.     int shadow_x, shadow_y, shadow_attr, clip;
  43.     int bd_attr, handle;
  44.     unsigned bd_feature;
  45.     bd_fptr border;
  46.     char *sbuf;
  47.     bfile_type bfile;
  48.     sfile_type sfile;
  49.     win_type win;
  50.  
  51.     oak_notused(msg);
  52.     oak_notused(outdata);
  53.  
  54.     win = winod_GetSelf((win_od *)objdata);
  55.     sfile = (sfile_type)indata;
  56.  
  57.     bfile = sfile->bfile;
  58.     sbuf = sfile->buf;
  59.  
  60. /* win info:
  61.         ymin, xmin, ymax, xmax, parent clip,
  62.         shadow x, shadow y, shadow attr, border attr, border features,
  63.         font, border, border title, mouse, explode
  64. */
  65.     if (_bfile_gets(bfile, sbuf, SFILE_BUFLEN, '\0') == 0) {
  66.         return(FALSE);
  67.     }
  68.     sscanf(sbuf, "%d %d %d %d %d %d %d %d %d %d", 
  69.         &box.toprow, &box.leftcol, &box.botrow, &box.rightcol, &clip, 
  70.         &shadow_x, &shadow_y, &shadow_attr, 
  71.         &bd_attr, &bd_feature);
  72.  
  73. /* ignore font for now */
  74.     if (_bfile_gets(bfile, sbuf, SFILE_BUFLEN, '\0') == 0) {
  75.         return(FALSE);
  76.     }
  77.     win_SetFont(win, disp_GetDefFont());
  78.  
  79.     win_SetParentClip(win, clip);
  80.     win_SetShadowAttr(win, (byte)shadow_attr);
  81.  
  82. /* border */
  83.     if (_bfile_gets(bfile, sbuf, SFILE_BUFLEN, '\0') == 0) {
  84.         return(FALSE);
  85.     }
  86.     if (*sbuf == '\0') {
  87.         border = FNULL;
  88.         handle = -1;
  89.     }
  90.     else if ((border = sfile_FindBorderFunc(sfile, sbuf, &handle)) == FNULL) {
  91.         border = bd_prompt;
  92.     }
  93.     win_SetBorder(win, border);
  94.     if (handle == -1) {
  95.         handle = sfile_PutBorderFunc(sfile, sbuf, border);
  96.     }
  97.     win_SetBorderHandle(win, handle);
  98.  
  99. /* win init */
  100.     if (win_IsCharSize(win)) {
  101.         ocbox_pixcoords(&box, win_GetFont(win), &pbox);
  102.         shadow_x *= win_GetFontWidth(win);
  103.         shadow_y *= win_GetFontHeight(win);
  104.     }
  105.     else {
  106.         pbox.ymin = box.toprow;
  107.         pbox.xmin = box.leftcol;
  108.         pbox.ymax = box.botrow;
  109.         pbox.xmax = box.rightcol;
  110.     }
  111.     win_ReallySetPixPosition(win, pbox.xmin, pbox.ymin);
  112.     win_ReallySetPixSize(win, opbox_GetWidth(&pbox), opbox_GetHeight(&pbox));
  113.  
  114.     win_SetPixShadow(win, shadow_x, shadow_y);
  115.  
  116.     bord_SetAttr(win, (byte)bd_attr);
  117.     bord_SetFeature(win, bd_feature);
  118.  
  119. /* border title */
  120.     if (_bfile_gets(bfile, sbuf, SFILE_BUFLEN, '\0') == 0) {
  121.         return(FALSE);
  122.     }
  123.     if (strcmp(sbuf, FSYM_NULLSTR) != 0) {
  124.         bord_Do(win, BDM_SETTITLE, sbuf, NULL);
  125.     }
  126.  
  127. /* mouse */
  128.     if (_bfile_gets(bfile, sbuf, SFILE_BUFLEN, '\0') == 0) {
  129.         return(FALSE);
  130.     }
  131.     win_SetMouse(win, sfile_FindMouseFunc(sfile, sbuf, &handle));
  132.     if (handle == -1) {
  133.         handle = sfile_PutMouseFunc(sfile, sbuf, null_funcptr);
  134.     }
  135.     win_SetMouseHandle(win, handle);
  136.  
  137. /* explode */
  138.     if (_bfile_gets(bfile, sbuf, SFILE_BUFLEN, '\0') == 0) {
  139.         return(FALSE);
  140.     }
  141.     win_SetExplode(win, sfile_FindExplodeFunc(sfile, sbuf, &handle));
  142.     if (handle == -1) {
  143.         handle = sfile_PutExplodeFunc(sfile, sbuf, null_funcptr);
  144.     }
  145.     win_SetExplodeHandle(win, handle);
  146.  
  147. /* Put window into unemployed list (at the top) */
  148.     win_ListAdd(curr_wmgr->unemployedhead, win);
  149.  
  150.     return(TRUE);
  151. }
  152.