home *** CD-ROM | disk | FTP | other *** search
- #include "AllTools.h"
-
- short oldMBarHeight;
- RgnHandle mBarRgn;
- RgnHandle tempRgn;
- RgnHandle theGrayRgn;
- Boolean alreadyHidden;
-
- void DoFillRect(WindowPtr window, Rect theRect, color theColor, short copyMode, videoInfoPtr theScreen)
- {
- RGBColor oldColor;
- GrafPtr savePort;
-
- GetPort(&savePort);
- SetPort(window);
- PenMode(copyMode);
- GetForeColor(&oldColor);
-
- if ((*theScreen).bitsPerPixel != 1)
- {
- RGBForeColor(&theColor.fillColor);
- PaintRect(&theRect);
- }
- else
- {
- FillRect(&theRect, &theColor.pattColor);
- }
-
- RGBForeColor(&oldColor);
- SetPort(savePort);
- }
-
- void DoInvertRect(WindowPtr window, Rect theRect, color theColor)
- {
- GrafPtr savePort;
-
- GetPort(&savePort);
- SetPort(window);
-
- InvertRect(&theRect);
-
- SetPort(savePort);
- }
-
- void DoFillRgn(WindowPtr window, RgnHandle theRgn, color theColor, short copyMode, videoInfoPtr theScreen)
- {
- RGBColor oldColor;
- GrafPtr savePort;
-
- GetPort(&savePort);
- SetPort(window);
- PenMode(copyMode);
- GetForeColor(&oldColor);
- if ((*theScreen).bitsPerPixel != 1)
- {
- RGBForeColor(&theColor.fillColor);
- PaintRgn(theRgn);
- }
- else
- {
- FillRgn(theRgn, &theColor.pattColor);
- }
- RGBForeColor(&oldColor);
- SetPort(savePort);
- }
-
- void DoDrawRect(WindowPtr window, Rect theRect, color theColor, short copyMode, videoInfoPtr theScreen)
- {
- Pattern patt;
- DrawInfo drawInfo;
-
- drawInfo = SetDrawInfo(window, theColor, copyMode);
-
- GetIndPattern(&patt, 0, 1);
- PenPat(&patt);
-
- DoMoveTo(window, theRect.left, theRect.top);
- DoLineTo(window, theRect.right, theRect.top, theColor, copyMode, theScreen);
- DoLineTo(window, theRect.right, theRect.bottom, theColor, copyMode, theScreen);
- DoLineTo(window, theRect.left, theRect.bottom, theColor, copyMode, theScreen);
- DoLineTo(window, theRect.left, theRect.top, theColor, copyMode, theScreen);
-
- ReSetDrawInfo(drawInfo);
- }
-
- DrawInfo SetDrawInfo(WindowPtr window, color theColor, short copyMode)
- {
- Pattern patt;
- DrawInfo drawInfo;
-
- SetPort(window);
- GetPort(&drawInfo.savePort);
- PenMode(copyMode);
- GetForeColor(&drawInfo.oldColor);
-
- GetIndPattern(&patt, 0, 1);
- PenPat(&patt);
-
- return drawInfo;
- }
-
- void ReSetDrawInfo(DrawInfo drawInfo)
- {
- Pattern patt;
-
- RGBForeColor(&drawInfo.oldColor);
- SetPort(drawInfo.savePort);
- GetIndPattern(&patt, 0, 1);
- PenPat(&patt);
- }
-
- void DoMoveTo(WindowPtr window,short x, short y)
- {
- GrafPtr savePort;
-
- GetPort(&savePort);
- SetPort(window);
- MoveTo(x,y);
- SetPort(savePort);
- }
-
- void DoLineTo(WindowPtr window,short x, short y, color theColor, short copyMode, videoInfoPtr theScreen)
- {
- GrafPtr savePort;
- RGBColor oldColor;
- Pattern patt;
-
- SetPort(window);
- GetPort(&savePort);
- PenMode(copyMode);
- GetForeColor(&oldColor);
-
- if ((*theScreen).bitsPerPixel != 1)
- {
- GetIndPattern(&patt, 0, 1);
- PenPat(&patt);
- RGBForeColor(&theColor.fillColor);
- LineTo(x,y);
- }
- else
- {
- PenPat(&theColor.pattColor);
- LineTo(x,y);
- }
-
- RGBForeColor(&oldColor);
- SetPort(savePort);
- }
-
- void DoLineTo2(short x, short y, color theColor, videoInfoPtr theScreen)
- {
- if ((*theScreen).bitsPerPixel != 1)
- {
- RGBForeColor(&theColor.fillColor);
- LineTo(x,y);
- }
- else
- {
- PenPat(&theColor.pattColor);
- LineTo(x,y);
- }
- }
-
- void MbarInit(void)
- {
- alreadyHidden = FALSE;
- }
-
- void HideMenuBar(void)
- {
- Rect mBarRect;
- if (alreadyHidden == FALSE)
- {
- oldMBarHeight = LMGetMBarHeight();
- LMSetMBarHeight(0); /* make the Menu Bar's height zero */
- SetRect(&mBarRect, qd.screenBits.bounds.left, qd.screenBits.bounds.top,
- qd.screenBits.bounds.right, qd.screenBits.bounds.top + oldMBarHeight);
- mBarRgn = NewRgn();
- tempRgn = NewRgn();
- RectRgn(mBarRgn, &mBarRect);
- theGrayRgn = GetGrayRgn();
- UnionRgn(theGrayRgn, mBarRgn, tempRgn);/* tell the desktop it covers the menu*/
- LMSetGrayRgn(tempRgn); /* bar */
- PaintOne(nil, mBarRgn); /* redraw desktop */
- alreadyHidden = TRUE;
- }
- }
-
- void ShowMenuBar(void)
- {
- if (alreadyHidden == TRUE)
- {
- LMSetMBarHeight(oldMBarHeight); /* make the menu bar's height normal */
- LMSetGrayRgn(theGrayRgn);
- DrawMenuBar();
- DisposeRgn(tempRgn);
- DisposeRgn(mBarRgn);
- alreadyHidden = FALSE;
- }
- }
-
- void SquareCorners(void)
- {
-
- }
-
- void RoundCorners(void)
- {
- }
-
- void GammaFadeOut(void)
- {
- }
-
- void GammaFadeIn(void)
- {
- }
-
- void ChangeBitDepth(short bitDepth, Boolean color)
- {
- GDHandle theScreenHandle;
-
- theScreenHandle = GetTheGDevice();
- if (color != TRUE) SetDepth(theScreenHandle,bitDepth,1,0);
- else
- SetDepth(theScreenHandle,bitDepth,1,1);
- }