home *** CD-ROM | disk | FTP | other *** search
- /*
- winsave.c
-
- % sf_reqsave, sfile_SaveComment, strnewlclip
-
- OWL 1.2
- Copyright (c) 1988, 1989 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 9/01/89 jdc added win_IsCharSize
-
- 10/24/89 jmd added static to function
- 12/10/89 jmd made win_GetBorder macro
- 12/11/89 jmd removed os-list headers
- 12/17/89 jdc fixed attrs
- 12/20/89 ted added bord_GetFeature macro
- 3/28/90 jmd ansi-fied
- 5/10/90 jdc added win_GoFunc
- 6/22/90 ted added "void" to no-parameter function per ansii.
- 7/06/90 pmcm added fsym_NullCheck to win go func name arg for sprintf
- 8/08/90 jdc moved aux function down to window level
- 8/13/90 jdc preened
- 9/24/90 jdc removed gofunc code
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
-
- #include "winod.h"
- #include "bordobj.h"
- #include "winsfile.h"
- #include "winspriv.h"
-
- OSTATIC objreq_func (winreq_save);
-
- void win_SaveInit(void)
- {
- winreq_savefptr = winreq_save;
- }
-
- static int winreq_save(VOID *objdata, int msg, VOID *indata, VOID *outdata)
- {
- char *s[5];
- unsigned feature;
- sfile_type sfile;
- win_type win;
- opbox box;
- int shadx, shady;
-
- oak_notused(msg);
- oak_notused(outdata);
-
- sfile = (sfile_type)indata;
- win = winod_GetSelf((win_od *)objdata);
-
- /* win info:
- new for 3.2! (go func not used now), aux func
- ymin, xmin, ymax, xmax, clip,
- shadow x, shadow y, shadow attr, border attr, border features,
- attr,
- font, border, border title, mouse, explode
- */
- s[1] = (win_GetAuxHandle(win) == OSLIST_BADNAME) ?
- ((obj_GetAux(win) == FNULL) ? "" : sfile_FindAuxName(sfile, obj_GetAux(win)))
- : win_GetAuxName(win, sfile);
-
- feature = bord_GetFeature(win);
- box.xmin = win_GetXmin(win);
- box.xmax = win_GetXmax(win);
- box.ymin = win_GetYmin(win);
- box.ymax = win_GetYmax(win);
- shadx = win_GetShadowX(win);
- shady = win_GetShadowY(win);
-
- if (win_IsCharSize(win)) {
- box.xmin = win_GetLeftCol(win);
- box.ymin = win_GetTopRow(win);
- box.xmax = win_GetRightCol(win);
- box.ymax = win_GetBotRow(win);
- shadx /= win_GetFontWidth(win);
- shady /= win_GetFontHeight(win);
- }
-
- sprintf(sfile->buf, "%s\n%s%s\n%d %d %d %d %d %d %d %d %d %d %d\n",
- V32, V32, fsym_NullCheck(s[1]),
- box.ymin, box.xmin, box.ymax, box.xmax,
- win_IsParentClip(win), shadx, shady,
- (int)win_GetShadowAttr(win), (int)bord_GetAttr(win), feature,
- win_GetAttr(win));
-
- if (!bfile_Write(sfile->bfile, sfile->buf, strlen(sfile->buf))) {
- return(FALSE);
- }
-
- s[0] = (win_GetFontHandle(win) == OSLIST_BADNAME) ?
- ((win_GetFont(win) == NULL) ? "" : sfile_FindFontName(sfile, win_GetFont(win)))
- : win_GetFontName(win, sfile);
-
- s[1] = (win_GetBorderHandle(win) == OSLIST_BADNAME) ?
- ((win_GetBorder(win) == NULL) ? "" : sfile_FindBorderName(sfile, win_GetBorderFunc(win)))
- : win_GetBorderName(win, sfile);
-
- s[2] = (win_GetMouseHandle(win) == OSLIST_BADNAME) ?
- ((win_GetMouhandler(win) == FNULL) ? "" : sfile_FindMouseName(sfile, win_GetMouhandler(win)))
- : win_GetMouseName(win, sfile);
-
- s[3] = (win_GetExplodeHandle(win) == OSLIST_BADNAME) ?
- ((win_GetExplodeFptr(win) == FNULL) ? "" : sfile_FindExplodeName(sfile, win_GetExplodeFptr(win)))
- : win_GetExplodeName(win, sfile);
-
- s[4] = NULL;
- bord_Do(win, BDM_GETTITLE, NULL, &(s[4]));
- if (s[4] != NULL) strnewlclip(s[4]);
-
- sprintf(sfile->buf, "%s\n%s\n%s\n%s\n%s\n",
- fsym_NullCheck(s[0]), fsym_NullCheck(s[1]), fsym_NullCheck(s[4]),
- fsym_NullCheck(s[2]), fsym_NullCheck(s[3]));
-
- return(bfile_Write(sfile->bfile, sfile->buf, strlen(sfile->buf)));
- }
-
- boolean sfile_SaveComment(sfile_type sfile, char *comment)
- {
- sprintf(sfile->buf, "%s\n", comment);
-
- return(bfile_Write(sfile->bfile, sfile->buf, strlen(sfile->buf)));
- }
-
- char *strnewlclip(char *s)
- {
- char *p;
-
- for (p = s; ; p++) {
- if (*p != '\n' && *p != '\r' && *p != '\t') {
- *s++ = *p;
- }
- if (*p == '\0') {
- break;
- }
- }
-
- return(s);
- }
-
-