#include "WolfDef.h" #include #include #include "PickAMonitor.h" #define PAMStrings 2001 #define NoColorString 1 #define NoDepthString 2 #define NoSizeString 3 #define NoProblemString 4 void CheckMonitor(DialogPtr theWindow, int bitDepth, Boolean colorRequired, short minWidth, short minHeight); void OutlineOK(DialogPtr theDialog, Boolean enabled); /********************************** Take a window pointer and center it onto the current video device **********************************/ void CenterWindowOnMonitor(WindowPtr theWindow, GDHandle theMonitor) { short newH, newV; Rect mRect; mRect = (**theMonitor).gdRect; /* Get the rect of the monitor */ /* Find the difference between the two monitors' sizes */ newH = (mRect.right - mRect.left) - (theWindow->portRect.right - theWindow->portRect.left); newV = (mRect.bottom - mRect.top) - (theWindow->portRect.bottom - theWindow->portRect.top); /* Half the difference so that it's centered top-to-bottom and left-to-right */ /* Add that offset to the upper-left of the monitor */ MoveWindow(theWindow,(newH>>1)+mRect.left,(newV>>1)+mRect.top,TRUE); /* Move and bring to front */ } /********************************** Returns true if the device supports color **********************************/ Boolean SupportsColor(GDHandle theMonitor) { return TestDeviceAttribute(theMonitor,gdDevType); /* Is it color? */ } /********************************** Returns true if the device supports a specific color depth **********************************/ short SupportsDepth(GDHandle theMonitor, int theDepth, Boolean needsColor) { return HasDepth(theMonitor,theDepth,1<visRgn); EndUpdate((WindowPtr) theDialog); return; } //¥ Activate the "This Monitor" button and put up the no problem text. GetIndString(message, PAMStrings, NoProblemString); SetDialogItemText(theHandle, message); GetDialogItem(theDialog, ok, &theType, &theHandle, &theRect); HiliteControl((ControlHandle) theHandle, 0); OutlineOK(theDialog, TRUE); BeginUpdate((WindowPtr) theDialog); UpdateDialog(theDialog, theDialog->visRgn); EndUpdate((WindowPtr) theDialog); } //¥ ---------------------------------------- OutlineOK void OutlineOK(DialogPtr theDialog, Boolean enabled) { GrafPtr savedPort; ColorSpec saveColor; PenState savedState; short theType; Handle theHandle; Rect theRect; GetPenState(&savedState); PenMode(patCopy); PenSize(2, 2); SaveFore(&saveColor); ForeColor(blackColor); GetPort(&savedPort); SetPort((WindowPtr) theDialog); GetDialogItem(theDialog, ok, &theType, &theHandle, &theRect); InsetRect(&theRect, -4, -4); if (enabled) PenPat(&qd.black); else PenPat(&qd.gray); FrameRoundRect(&theRect, 16, 16); SetPort(savedPort); RestoreFore(&saveColor); SetPenState(&savedState); }