Category : C Source Code
Archive   : PUBWIW_C.ZIP
Filename : WINDOW.C
Output of file : WINDOW.C contained in archive : PUBWIW_C.ZIP
#include
#include
#include "GRconst.h"
#include "GRports.h" /* MetaWINDOW header files */
#include "GRextrn.h"
#include "window.h"
#include "control.h"
extern void _drawControls();
extern COUNT fntHeight, fntWidth;
extern metaPort *thePort;
extern WindowPtr _SysWindow;
extern rect deskTop;
extern COUNT _titlePen,
_titleBack,
_sysBack,
_threshold,
ControlEvent();
WindowPtr _TopWindow, /* Pointer to Front or Top Window */
_LastWindow; /* Pointer to Last or Bottom Window */
/*--------------------------------------------------------------------------*/
void InitWindows()
{
extern rect scrnRect;
_SysWindow = NewWindow(W_PLAIN, (TEXT *)0, &scrnRect, False, False);
ColorWindow(_SysWindow,-1,-1,_sysBack,-1);
DrawWindow(_SysWindow);
DupRect(&scrnRect,&deskTop);
}
/*--------------------------------------------------------------------------*/
LOCAL _drawPlain(wnp)
WindowPtr wnp;
{
metaPort *savePort;
GetPort(&savePort);
SetPort(&(wnp->port));
FillRect(&(wnp->content),wnp->port.bkPat); /* Clear the window */
_drawControls(wnp);
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
LOCAL _drawDialog(wnp)
WindowPtr wnp;
{
metaPort *savePort;
GetPort(&savePort);
SetPort(&(wnp->port));
FillRect(&(wnp->bounds),wnp->port.bkPat); /* Clear the window */
PenSize(1,1);
PenMode(Invert); /* Outline the window */
FrameRect(&(wnp->content));
PenSize(1,1);
_drawControls(wnp);
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
LOCAL _drawLine(x1,y1,x2)
COORD x1,y1,x2;
{
COUNT i;
for (i=0; i<5; i++)
{
MoveTo(x1,y1);
LineTo(x2,y1);
y1 += 3;
}
}
/*--------------------------------------------------------------------------*/
LOCAL _drawHilite(wnp, state)
WindowPtr wnp;
COUNT state;
{
metaPort *savePort;
GetPort(&savePort);
SetPort(&(wnp->port));
PenMode(Invert);
if (state == True)
{
_drawLine
(
wnp->tbRect->Xmin + 4,
wnp->tbRect->Ymin + 3,
wnp->tRect->Xmin - 4
);
_drawLine
(
wnp->tRect->Xmax + 4,
wnp->tbRect->Ymin + 3,
wnp->tbRect->Xmax - 4
);
FillRect(wnp->goAway,White);
FillRect(wnp->shrink,White);
FrameRect(wnp->goAway);
FrameRect(wnp->shrink);
}
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
LOCAL _drawTitle(wnp, state)
WindowPtr wnp;
COUNT state;
{
metaPort *savePort;
COUNT tStart;
penState ps;
GetPort(&savePort);
SetPort(&(wnp->port));
GetPenState(&ps);
FillRect(wnp->tbRect,White);
PenMode(Invert);
FrameRect(wnp->tbRect);
_drawHilite(wnp, state);
PenColor(_titlePen);
BackColor(_titleBack);
PenMode(Replace);
MoveTo(wnp->tRect->Xmin,wnp->tRect->Ymin+13);
DrawString(wnp->title);
SetPenState(&ps);
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
_drawGrowBox(wnp)
WindowPtr wnp;
{
penState ps;
rect r;
GetPenState(&ps);
PenMode(Replace);
PenColor(_titlePen);
BackColor(_titleBack);
FrameRect(wnp->growBox);
PenMode(Invert);
DupRect(wnp->growBox,&r);
InsetRect(&r,2,2);
r.Xmax = r.Xmin + 10;
r.Ymax = r.Ymin + 8;
EraseRect(&r);
InsetRect(&r,2,2);
r.Xmax += 8;
r.Ymax += 6;
EraseRect(&r);
SetPenState(&ps);
}
/*--------------------------------------------------------------------------*/
LOCAL _drawContent(wnp)
WindowPtr wnp;
{
metaPort *savePort;
rect r;
penState ps;
ControlPtr cp;
GetPort(&savePort);
SetPort(&(wnp->port));
GetPenState(&ps);
FillRect(&(wnp->content),wnp->port.bkPat); /* Clear the window */
PenMode(Invert);
FrameRect(&(wnp->content));
SetPenState(&ps);
if (wnp->shrunk == False)
{
_drawControls(wnp);
_drawGrowBox(wnp);
if ( wnp->VScroll != (UBYTE *)0 )
{
cp = wnp->VScroll;
_drawVScroll(cp->defn.sb);
}
#if 0
if ( wnp->HScroll != (UBYTE *)0 )
_drawHScroll(wnp->HScroll);
#endif
}
SetPenState(&ps);
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
LOCAL _drawDocument(wnp)
WindowPtr wnp;
{
metaPort *savePort;
GetPort(&savePort);
SetPort(&(wnp->port));
_drawTitle(wnp, True);
if (wnp->shrunk == False)
{
_drawContent(wnp);
}
else
{
InvertRect(wnp->shrink);
}
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
void _drawControls(wnp)
WindowPtr wnp;
{
ControlPtr cPtr;
if (wnp->controls == (ControlPtr)0)
return;
cPtr = (ControlPtr)(wnp->controls);
while (cPtr != (ControlPtr) 0)
{
DrawControl(cPtr);
cPtr = cPtr->next;
}
}
/*--------------------------------------------------------------------------*/
COUNT WindowEvent(X, Y, wnp)
COORD X,Y;
WindowPtr wnp;
{
point Pnt;
metaPort *savePort;
ControlPtr cp;
GetPort(&savePort);
SetPort(&(wnp->port));
Pnt.X = X;
Pnt.Y = Y;
Gbl2LclPt(&Pnt);
if ( PtInRect(&Pnt, &(wnp->bounds)) == False )
{
SetPort(savePort);
return(IN_NOTHING);
}
if ( ((wnp->type)& 0x0f == W_PLAIN) || ((wnp->type)&0x0f == W_DIALOG) )
{
if (ControlEvent(X,Y,wnp) != IN_NOTHING)
{
SetPort(savePort);
return(IN_CONTROL);
}
else
{
SetPort(savePort);
return(IN_NOTHING);
}
}
if ( PtInRect(&Pnt, wnp->shrink) == True )
{
SetPort(savePort);
return(IN_SHRINK);
}
if ( PtInRect(&Pnt, wnp->goAway) == True )
{
SetPort(savePort);
return(IN_GOAWAY);
}
if ( PtInRect(&Pnt, wnp->tRect) == True )
{
SetPort(savePort);
return(IN_DRAG); /* IN_TITLE later */
}
if ( PtInRect(&Pnt, wnp->tbRect) == True )
{
SetPort(savePort);
return(IN_DRAG);
}
if ( (PtInRect(&Pnt, &(wnp->content)) == True) && (wnp->shrunk == False) )
{
if ( PtInRect(&Pnt, wnp->growBox) == True )
{
SetPort(savePort);
return(IN_GROW);
}
cp = wnp->VScroll;
if ( PtInRect(&Pnt, &(cp->bounds)) == True )
{
VScrollAction(cp->defn, &Pnt);
SetPort(savePort);
return(IN_CONTROL);
}
if (ControlEvent(X,Y,wnp) != IN_NOTHING)
{
SetPort(savePort);
return(IN_CONTROL);
}
SetPort(savePort);
return(IN_CONTENT);
}
SetPort(savePort);
return(IN_NOTHING);
}
/*--------------------------------------------------------------------------*/
BOOL GrowRect(rp, pt)
rect *rp;
point *pt;
{
point Pnt;
rect oldR;
COORD x,y;
COUNT button, Xdelta, Ydelta;
penState ps;
GetPenState(&ps);
DupRect(rp,&oldR);
x = rp->Xmax;
y = rp->Ymax;
EventQueue(False);
HideCursor();
ReadMouse(&x,&y,&button);
PenMode(Invert);
FrameRect(&oldR);
while (button & LeftButton)
{
ReadMouse(&x,&y,&button);
if (button < 0)
continue;
Pnt.X = x;
Pnt.Y = y;
if (PtInRect(&Pnt,&deskTop) == False)
continue;
Xdelta = x - oldR.Xmax;
Ydelta = y - oldR.Ymax;
if ( (iabs(Xdelta) > _threshold) || (iabs(Ydelta) > _threshold) )
{
FrameRect(&oldR);
oldR.Xmax += Xdelta;
oldR.Ymax += Ydelta;
FrameRect(&oldR);
}
}
FrameRect(&oldR);
EventQueue(True);
SetPenState(&ps);
ShowCursor();
pt->X = oldR.Xmax;
pt->Y = oldR.Ymax;
}
/*--------------------------------------------------------------------------*/
void GrowWindow(wnp)
WindowPtr wnp;
{
metaPort *savePort;
point bottomRight;
COUNT updateCnt;
rect update1, update2;
COORD newX, newY;
ControlPtr cp;
updateCnt = 0;
GetPort(&savePort);
SetPort(&(wnp->port));
Lcl2GblRect(&(wnp->bounds));
SetPort(thePort);
GrowRect(&(wnp->bounds),&bottomRight);
SetPort(&(wnp->port));
newX = bottomRight.X;
newY = bottomRight.Y;
if (newX < ( wnp->bounds.Xmin + wnp->tLen + 80 ) )
newX = wnp->bounds.Xmin + wnp->tLen + 80;
if (newY < ( wnp->bounds.Ymin + fntHeight * 7 ) )
newY = wnp->bounds.Ymin + fntHeight * 7;
if (newX < wnp->bounds.Xmax)
{
DupRect(&(wnp->bounds),&update1);
update1.Xmin = newX;
updateCnt++;
}
if (newY < wnp->bounds.Ymax)
{
if (updateCnt)
{
DupRect(&(wnp->bounds),&update2);
update2.Ymin = newY;
updateCnt++;
}
else
{
DupRect(&(wnp->bounds),&update1);
update1.Ymin = newY;
updateCnt++;
}
}
PortSize((newX - wnp->bounds.Xmin)+2, (newY - wnp->bounds.Ymin)+2);
HideCursor();
OffsetRect(wnp->shrink, newX - wnp->bounds.Xmax, 0);
OffsetRect(wnp->tRect, ((newX - wnp->bounds.Xmax) / 2), 0);
OffsetRect(
wnp->growBox,
newX - wnp->bounds.Xmax,
newY - wnp->bounds.Ymax
);
if(wnp->VScroll != (UBYTE *)0)
{
cp = (ControlPtr)wnp->VScroll;
/* Offset all control Rect and Polygons */
OffsetRect
(
&(cp->bounds),
newX - wnp->bounds.Xmax,
0
);
cp->bounds.Ymax += newY - wnp->bounds.Ymax;
OffsetRect
(
&(cp->defn.sb->shaft),
newX - wnp->bounds.Xmax,
0
);
cp->defn.sb->shaft.Ymax += newY - wnp->bounds.Ymax;
if (cp->defn.sb->shaft.Ymax < cp->defn.sb->thumb.Ymax)
{
OffsetRect
(
&(cp->defn.sb->thumb),
newX - wnp->bounds.Xmax,
cp->defn.sb->shaft.Ymax - cp->defn.sb->thumb.Ymax
);
}
else
{
OffsetRect
(
&(cp->defn.sb->thumb),
newX - wnp->bounds.Xmax,
0
);
}
OffsetRect
(
&(cp->defn.sb->downArrow->pHdr.polyRect),
newX - wnp->bounds.Xmax,
0
);
OffsetRect
(
&(cp->defn.sb->upArrow->pHdr.polyRect),
newX - wnp->bounds.Xmax,
newY - wnp->bounds.Ymax
);
OffsetPoly
(
1,
&(cp->defn.sb->downArrow->pHdr),
cp->defn.sb->downArrow->pnts,
newX - wnp->bounds.Xmax,
0
);
OffsetPoly
(
1,
&(cp->defn.sb->upArrow->pHdr),
cp->defn.sb->upArrow->pnts,
newX - wnp->bounds.Xmax,
newY - wnp->bounds.Ymax
);
}
wnp->bounds.Xmax = newX;
wnp->bounds.Ymax = newY;
Lcl2GblRect(&(wnp->content));
Lcl2GblRect(wnp->tbRect);
wnp->content.Xmax = newX;
wnp->content.Ymax = newY;
wnp->tbRect->Xmax = newX;
Gbl2LclRect(&(wnp->content));
Gbl2LclRect(wnp->tbRect);
Gbl2LclRect(&(wnp->bounds));
DrawWindow(wnp);
/* Generate Update Events for Windows under bounds */
SetPort(thePort);
if (updateCnt > 0)
FillRect(&update1,_sysBack);
if (updateCnt > 1)
FillRect(&update2,_sysBack);
SetPort(savePort);
ShowCursor();
}
/*--------------------------------------------------------------------------*/
BOOL DragRect(rp, pt)
rect *rp;
point *pt;
{
rect oldR;
COORD x,y;
COUNT button, Xdelta, Ydelta;
penState ps;
GetPenState(&ps);
DupRect(rp,&oldR);
x = rp->Xmin;
y = rp->Ymin;
EventQueue(False);
HideCursor();
ReadMouse(&x,&y,&button);
PenMode(Invert);
FrameRect(&oldR);
while (button & LeftButton)
{
ReadMouse(&x,&y,&button);
if (button < 0)
continue;
Xdelta = x - oldR.Xmin;
Ydelta = y - oldR.Ymin;
if ( (iabs(Xdelta) > _threshold) || (iabs(Ydelta) > _threshold) )
{
FrameRect(&oldR);
OffsetRect(&oldR,Xdelta,Ydelta);
FrameRect(&oldR);
}
}
FrameRect(&oldR);
EventQueue(True);
SetPenState(&ps);
ShowCursor();
pt->X = x;
if (y <= deskTop.Ymin)
pt->Y = deskTop.Ymin - 1;
else
pt->Y = y;
}
/*--------------------------------------------------------------------------*/
void MoveWindow(wnp,topLeft)
WindowPtr wnp;
point *topLeft;
{
metaPort *savePort;
COUNT updateCnt, newX, newY;
rect *bounds, newBounds, update1, update2;
GetPort(&savePort);
if (wnp->shrunk)
bounds = wnp->tbRect;
else
bounds = &(wnp->bounds);
DupRect(bounds,&newBounds);
SetPort(&(wnp->port));
Lcl2GblRect(&newBounds);
newX = (topLeft->X - newBounds.Xmin);
newY = (topLeft->Y - newBounds.Ymin);
updateCnt =
ShiftRect(
&newBounds,
newX,
newY,
&update1,
&update2
);
#if 0
Lcl2GblRect(&update1);
Lcl2GblRect(&update2);
#endif
HideCursor();
MovePortTo(topLeft->X, topLeft->Y);
DrawWindow(wnp);
/* Generate Update Events for Windows under bounds */
SetPort(thePort);
if (updateCnt > 0)
FillRect(&update1,_sysBack);
if (updateCnt > 1)
FillRect(&update2,_sysBack);
ShowCursor();
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
void DragWindow(wnp)
WindowPtr wnp;
{
metaPort savePort;
point newCorner;
rect globRect;
GetPort(&savePort);
SetPort(&(wnp->port));
if (wnp->shrunk)
{
DupRect(wnp->tbRect,&globRect);
}
else
{
DupRect(&(wnp->bounds),&globRect);
}
Lcl2GblRect(&globRect);
SetPort(thePort);
DragRect(&(globRect),&newCorner);
MoveWindow(wnp,&newCorner);
ShowCursor();
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
void TitleColor(pen,back)
COUNT pen, back;
{
_titlePen = pen;
_titleBack = back;
}
/*--------------------------------------------------------------------------*/
void HiliteWindow(wnp, state)
WindowPtr wnp;
COUNT state;
{
metaPort *savePort;
penState ps;
ControlPtr cp;
ScrollBar *sb;
HideCursor();
GetPort(&savePort);
SetPort(&(wnp->port));
GetPenState(&ps);
_drawTitle(wnp,state);
if (wnp->shrunk == False)
{
if ( (cp = (ControlPtr)wnp->VScroll) != (WindowPtr)0)
{
sb = (ScrollBar *)(cp->defn.sb);
_hiliteVScroll(sb,state);
}
}
SetPenState(&ps);
SetPort(savePort);
ShowCursor();
/* Hilite Controls */
}
/*--------------------------------------------------------------------------*/
void ShrinkWindow(wnp)
WindowPtr wnp;
{
metaPort *savePort;
GetPort(&savePort);
SetPort(&(wnp->port));
HideCursor();
InvertRect(wnp->shrink);
if (wnp->shrunk == True)
{
wnp->shrunk = False;
_drawContent(wnp);
}
else
{
/* Generate Update Event for Underlying Windows */
wnp->shrunk = True;
FillRect(&(wnp->content),_sysBack);
}
ShowCursor();
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
void SaveWindow (wnp)
WindowPtr wnp;
{
metaPort *savePort;
GetPort(&savePort);
#if 0
SetPort(thePort);
#endif
wnp->imageSize = ImageSize(&(wnp->port.portRect));
if (wnp->imageSize > 64000)
{
SetDisplay(GrafPg0);
error("SaveWindow()->Image too large\n");
exit(1);
}
wnp->imagePtr = (image *) malloc ( (unsigned int) wnp->imageSize);
if (wnp->imagePtr == (image *)0)
{
SetDisplay(GrafPg0);
error("SaveWindow()->Insufficient memory\n");
exit(1);
}
HideCursor();
ReadImage(&(wnp->port.portRect),wnp->imagePtr); /* Save the window area */
ShowCursor();
SetPort(savePort);
}
/*--------------------------------------------------------------------------*/
void DrawWindow (wnp)
WindowPtr wnp;
{
metaPort *savePort;
penState thisState;
GetPort(&savePort);
SetPort(&(wnp->port));
if ( wnp->type & W_POPUP)
{
SaveWindow(wnp);
}
GetPenState(&thisState);
HideCursor();
switch (wnp->type & 0x0f)
{
case W_PLAIN :
_drawPlain(wnp);
break;
case W_DIALOG :
_drawDialog(wnp);
break;
case W_TITLED:
case W_DOCUMENT:
_drawDocument(wnp);
break;
}
ShowCursor();
SetPort(savePort);
SetPenState(&thisState);
} /* DrawWindow */
/*--------------------------------------------------------------------------*/
void ColorWindow (wnp,bkColor,fgColor,bkPattern,fgPattern)
WindowPtr wnp;
COUNT bkColor,fgColor,bkPattern,fgPattern;
{
if (bkColor != -1)
wnp->port.bkColor = (LONG)bkColor;
if (bkPattern != -1)
wnp->port.bkPat = bkPattern;
if (fgColor != -1)
wnp->port.pnColor = (LONG)fgColor;
if (fgPattern != -1)
wnp->port.pnPat = fgPattern;
} /* ColorWindow */
/*--------------------------------------------------------------------------*/
void RestoreWindow(wnp)
WindowPtr wnp;
{
penState thisState;
if ( (wnp->imagePtr != (image *)0) && (wnp->imageSize != (LONG) 0) )
{
GetPenState(&thisState);
RasterOp (Replace);
WriteImage (&(wnp->port.portRect),wnp->imagePtr); /* Restore the window area */
free(wnp->imagePtr);
wnp->imageSize = (LONG)0;
SetPenState(&thisState);
}
} /* RestoreWindow */
/*--------------------------------------------------------------------------*/
void RemoveWindow (wnp)
WindowPtr wnp;
{
metaPort *savePort;
penState thisState;
GetPort(&savePort);
#if 0
SetPort(thePort);
#endif
GetPenState(&thisState);
if ( (wnp->imagePtr != (image *)0) && (wnp->imageSize != (LONG) 0) )
{
RasterOp (Replace);
WriteImage (&(wnp->port.portRect),wnp->imagePtr); /* Restore the window area */
free(wnp->imagePtr);
wnp->imageSize = (LONG)0;
}
SetPenState(&thisState);
SetPort(savePort);
/* Generate update events for all underlying windows */
} /* Remove Window */
/*--------------------------------------------------------------------------*/
void CloseWindow(wnp)
WindowPtr wnp;
{
RemoveWindow(wnp);
DisposWindow(wnp);
}
/*--------------------------------------------------------------------------*/
WindowPtr NewWindow(type, title, bounds, popUp, visible)
COUNT type;
TEXT *title;
rect *bounds;
BOOL popUp, visible;
{
metaPort *savePort;
WindowPtr temp;
GetPort(&savePort);
if ( (temp = (Window *)calloc(1,sizeof(Window))) == (Window *)0 )
{
error("Allocation Error in \"newWindow\"");
return((Window *)0);
}
temp->type = type;
if (popUp == True)
temp->type += W_POPUP;
InitPort(&(temp->port)); /* Initialize the New Port */
PortBitmap(thePort->portBMap); /* Display is default bitmap */
DupRect(bounds,&(temp->bounds)); /* Set Window Boundaries */
MovePortTo(bounds->Xmin, bounds->Ymin);
PortSize
(
bounds->Xmax - bounds->Xmin + 1,
bounds->Ymax - bounds->Ymin + 1
);
SetOrigin(0,0);
Gbl2LclRect(&(temp->bounds));
switch(type)
{
case W_PLAIN:
DupRect(&(temp->bounds),&(temp->content));
break;
case W_DIALOG:
DupRect(&(temp->bounds),&(temp->content));
InsetRect(&(temp->content),4,4);
break;
case W_TITLED:
case W_DOCUMENT:
DupRect(&(temp->bounds),&(temp->content));
temp->content.Ymin += fntHeight + 4;
if (title != (TEXT *)0)
{
if ( (temp->title=(TEXT *)malloc(strlen(title)+1)) == (TEXT *) 0)
{
error("Allocation Error in \"newWindow\"");
free((UBYTE *)temp);
return((Window *)0);
}
strcpy(temp->title,title);
temp->tLen = StringWidth(title);
}
else
{
temp->title = (TEXT *)0;
temp->tLen = 0;
}
if ( (temp->shrink = (rect *)malloc(sizeof(rect))) == (rect *)0 )
{
error("Allocation Error in \"newWindow\"");
free((UBYTE *)temp->shrink);
return((Window *)0);
}
SetRect(temp->shrink,
temp->bounds.Xmax-26,
temp->bounds.Ymin+3,
temp->bounds.Xmax-11,
temp->bounds.Ymin+15
);
if ( (temp->goAway = (rect *)malloc(sizeof(rect))) == (rect *)0 )
{
error("Allocation Error in \"newWindow\"");
free((UBYTE *)temp->goAway);
return((Window *)0);
}
SetRect(temp->goAway,
temp->bounds.Xmin+12,
temp->bounds.Ymin+3,
temp->bounds.Xmin+27,
temp->bounds.Ymin+15
);
if ( (temp->tbRect = (rect *)malloc(sizeof(rect))) == (rect *)0 )
{
error("Allocation Error in \"newWindow\"");
free((UBYTE *)temp->tbRect);
return((Window *)0);
}
if ( (temp->tRect = (rect *)malloc(sizeof(rect))) == (rect *)0 )
{
error("Allocation Error in \"newWindow\"");
free((UBYTE *)temp->tRect);
return((Window *)0);
}
DupRect(&(temp->bounds),temp->tbRect);
temp->tbRect->Ymax = temp->content.Ymin - 1;
DupRect(temp->tbRect,temp->tRect);
temp->tRect->Xmin =
(((temp->tbRect->Xmax - temp->tbRect->Xmin) - temp->tLen) / 2)
+ temp->tbRect->Xmin - 2;
temp->tRect->Xmax = temp->tRect->Xmin + temp->tLen;
if ( (temp->growBox = (rect *)malloc(sizeof(rect))) == (rect *)0 )
{
error("Allocation Error in \"newWindow\"");
free((UBYTE *)temp->growBox);
return((Window *)0);
}
DupRect(&(temp->bounds),temp->growBox);
temp->growBox->Xmin = temp->growBox->Xmax - 20;
temp->growBox->Ymin = temp->growBox->Ymax - 16;
break;
}
temp->port.bkPat=1;
temp->visible = visible;
temp->shrunk = False;
temp->controls = (ControlPtr)0;
if (visible == True)
DrawWindow(temp);
SetPort(savePort);
return(temp);
}
/*--------------------------------------------------------------------------*/
void DisposWindow(wnp)
WindowPtr wnp;
{
ControlPtr cp;
if ( wnp->title != (TEXT *)0 )
free(wnp->title);
if ( wnp->goAway != (rect *)0 )
free(wnp->goAway);
if ( wnp->shrink != (rect *)0 )
free(wnp->shrink);
if ( wnp->tRect != (rect *)0 )
free(wnp->tRect);
if ( wnp->tbRect != (rect *)0 )
free(wnp->tbRect);
if ( wnp->growBox != (rect *)0 )
free(wnp->growBox);
cp = wnp->controls;
while (cp != (ControlPtr)0)
{
DisposControl(cp);
cp = cp->next;
}
if ( wnp->imagePtr != (image *)0 )
free(wnp->imagePtr);
if (free(wnp) != 0)
error("Invalid WindowPtr in DisposWindow()");
}
/*--------------------------------------------------------------------------*/
void ShowWindow(wnp)
WindowPtr wnp;
{
if (wnp->visible == False)
{
wnp->hidden = True;
DrawWindow(wnp);
}
}
/*--------------------------------------------------------------------------*/
void HideWindow(wnp)
WindowPtr wnp;
{
if (wnp->visible == False)
{
wnp->hidden = True;
}
}
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/