mirror of
https://github.com/softdorothy/GliderPRO.git
synced 2024-11-29 07:49:46 +00:00
1 line
15 KiB
C
1 line
15 KiB
C
|
//============================================================================
//----------------------------------------------------------------------------
// MainWindow.c
//----------------------------------------------------------------------------
//============================================================================
#include <NumberFormatting.h>
#include <ToolUtils.h>
#include "Externs.h"
#include "Environ.h"
#include "House.h"
#include "RectUtils.h"
#define kMainWindowID 128
#define kEditWindowID 129
#define kMenuWindowID 130
void DrawOnSplash (void);
void SetPaletteToGrays (void);
void HardDrawMainWindow (void);
void RestoreColorsSlam (void);
CTabHandle theCTab;
PixMapHandle thePMap;
ColorSpec * wasColors;
ColorSpec * newColors;
CursHandle handCursorH, beamCursorH, vertCursorH, horiCursorH;
CursHandle diagCursorH;
Cursor handCursor, beamCursor, vertCursor, horiCursor;
Cursor diagCursor;
Rect workSrcRect;
GWorldPtr workSrcMap;
Rect mainWindowRect;
WindowPtr mainWindow, menuWindow;
short isEditH, isEditV;
short playOriginH, playOriginV;
short splashOriginH, splashOriginV;
short theMode;
Boolean fadeGraysOut, isDoColorFade, splashDrawn;
extern GDHandle thisGDevice;
extern short toolSelected;
extern Boolean noRoomAtAll, isUseSecondScreen;
extern Boolean quickerTransitions, houseIsReadOnly;
//============================================================== Functions
//-------------------------------------------------------------- DrawOnSplash
// Draws additional text on top of splash screen.
void DrawOnSplash (void)
{
Str255 houseLoadedStr;
PasStringCopy("\pHouse: ", houseLoadedStr);
PasStringConcat(houseLoadedStr, thisHouseName);
if ((thisMac.hasQT) && (hasMovie))
PasStringConcat(houseLoadedStr, "\p (QT)");
TextSize(9);
TextFace(1);
TextFont(applFont);
MoveTo(splashOriginH + 436, splashOriginV + 314);
if (thisMac.isDepth == 4)
{
ForeColor(whiteColor);
DrawString(houseLoadedStr);
ForeColor(blackColor);
}
else
{
if (houseIsReadOnly)
ColorText(houseLoadedStr, 5L);
else
ColorText(houseLoadedStr, 28L);
}
#if defined(powerc) || defined(__powerc)
TextSize(12);
TextFace(0);
TextFont(systemFont);
ForeColor(blackColor);
MoveTo(splashOriginH + 5, splashOriginV + 457);
DrawString("\pPowerPC Native!");
ForeColor(whiteColor);
MoveTo(splashOriginH + 4, splashOriginV + 456);
DrawString("\pPowerPC Native!");
ForeColor(blackColor);
#endif
}
//-------------------------------------------------------------- RedrawSplashScreen
void RedrawSplashScreen (void)
{
Rect tempRect;
SetPort((GrafPtr)workSrcMap);
PaintRect(&workSrcRect);
QSetRect(&tempRect, 0, 0, 640, 460);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
DrawOnSplash();
SetPortWindowPort(mainWindow);
// if (quickerTransitions)
// DissBitsChunky(&workSrcRect);
// else
// DissBits(&workSrcRect);
CopyRectMainToWork(&workSrcRect);
}
//-------------------------------------------------------------- UpdateMainWindow
// Redraws the main window (depends on mode were in - splash, editing, playing).
void UpdateMainWindow (void)
{
Rect tempRect;
RgnHandle dummyRgn;
dummyRgn = NewRgn();
SetPortWindowPort(mainWindow);
if (theMode == kEditMode)
{
PauseMarquee();
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
&mainWindowRect, &mainWindowRect, srcCopy,
GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn));
ResumeMarquee();
}
else if ((theMode == kSplashMode) || (theMode == kPlayMode))
{
SetPort((GrafPtr)workSrcMap);
PaintRect(&workSrcRect);
QSetRect(&tempRect, 0, 0, 640, 460);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
&workSrcRect, &mainWindowRect, srcCopy,
GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn));
SetPortWindowPort(ma
|