mirror of
https://github.com/autc04/Retro68.git
synced 2025-02-16 19:32:07 +00:00
LaunchAPPLServer: a touch of color
This commit is contained in:
parent
7f1eb5692c
commit
e39e0a09c5
@ -82,6 +82,8 @@ bool portsAvailable[] = { false, false, false, false };
|
|||||||
#else
|
#else
|
||||||
bool portsAvailable[] = { true, true, false, false };
|
bool portsAvailable[] = { true, true, false, false };
|
||||||
#endif
|
#endif
|
||||||
|
Boolean hasIconUtils = true;
|
||||||
|
Boolean hasColorQD = true;
|
||||||
|
|
||||||
struct Prefs
|
struct Prefs
|
||||||
{
|
{
|
||||||
@ -132,7 +134,9 @@ void ShowAboutBox()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowRef w = GetNewWindow(128, NULL, (WindowPtr) -1);
|
WindowRef w = hasColorQD ?
|
||||||
|
GetNewCWindow(128, NULL, (WindowPtr) -1)
|
||||||
|
: GetNewWindow(128, NULL, (WindowPtr) -1);
|
||||||
aboutWindow = w;
|
aboutWindow = w;
|
||||||
#if TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_CARBON
|
||||||
Rect screenBounds = (*GetMainDevice())->gdRect;
|
Rect screenBounds = (*GetMainDevice())->gdRect;
|
||||||
@ -155,11 +159,23 @@ void UpdateAboutWindow()
|
|||||||
SetPortWindowPort(aboutWindow);
|
SetPortWindowPort(aboutWindow);
|
||||||
BeginUpdate(aboutWindow);
|
BeginUpdate(aboutWindow);
|
||||||
|
|
||||||
Rect r;
|
Rect portRect;
|
||||||
GetWindowPortBounds(aboutWindow,&r);
|
GetWindowPortBounds(aboutWindow,&portRect);
|
||||||
EraseRect(&r);
|
EraseRect(&portRect);
|
||||||
|
|
||||||
InsetRect(&r, 10,10);
|
Rect r;
|
||||||
|
SetRect(&r, portRect.right/2 - 16, 10, portRect.right/2 + 16, 42);
|
||||||
|
|
||||||
|
if(hasIconUtils)
|
||||||
|
PlotIconID(&r, kAlignAbsoluteCenter, kTransformNone, 128);
|
||||||
|
else
|
||||||
|
PlotIcon(&r, GetResource('ICN#', 128));
|
||||||
|
|
||||||
|
r = portRect;
|
||||||
|
r.left += 10;
|
||||||
|
r.top += 52;
|
||||||
|
r.bottom -= 10;
|
||||||
|
r.right -= 10;
|
||||||
|
|
||||||
Handle h = GetResource('TEXT', 128);
|
Handle h = GetResource('TEXT', 128);
|
||||||
HLock(h);
|
HLock(h);
|
||||||
@ -643,6 +659,9 @@ int main()
|
|||||||
Boolean hasWaitNextEvent = false;
|
Boolean hasWaitNextEvent = false;
|
||||||
Boolean hasGestalt = false;
|
Boolean hasGestalt = false;
|
||||||
Boolean hasAppleEvents = false;
|
Boolean hasAppleEvents = false;
|
||||||
|
hasIconUtils = false;
|
||||||
|
hasColorQD = false;
|
||||||
|
|
||||||
if (is128KROM)
|
if (is128KROM)
|
||||||
{
|
{
|
||||||
UniversalProcPtr trapUnimpl = GetToolTrapAddress(_Unimplemented);
|
UniversalProcPtr trapUnimpl = GetToolTrapAddress(_Unimplemented);
|
||||||
@ -659,6 +678,12 @@ int main()
|
|||||||
long response = 0;
|
long response = 0;
|
||||||
OSErr err = Gestalt(gestaltAppleEventsAttr, &response);
|
OSErr err = Gestalt(gestaltAppleEventsAttr, &response);
|
||||||
hasAppleEvents = err == noErr && response != 0;
|
hasAppleEvents = err == noErr && response != 0;
|
||||||
|
|
||||||
|
err = Gestalt(gestaltIconUtilitiesAttr, &response);
|
||||||
|
hasIconUtils = err == noErr && response != 0;
|
||||||
|
|
||||||
|
err = Gestalt(gestaltQuickdrawVersion, &response);
|
||||||
|
hasColorQD = err == noErr && response != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -94,10 +94,10 @@ data 'TEXT' (128, purgeable) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
resource 'WIND' (128, "About") {
|
resource 'WIND' (128, "About") {
|
||||||
{0, 0, 200, 320}, noGrowDocProc;
|
{0, 0, 242, 320}, noGrowDocProc;
|
||||||
invisible;
|
invisible;
|
||||||
goAway;
|
goAway;
|
||||||
0, "About LaunchAPPLShell";
|
0, "About LaunchAPPLServer";
|
||||||
noAutoCenter;
|
noAutoCenter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,3 +166,23 @@ resource 'ics4' (128, purgeable) {
|
|||||||
$"0000 FF00 FCCC CCCF 0000 0000 0FEF FEF0"
|
$"0000 FF00 FCCC CCCF 0000 0000 0FEF FEF0"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
data 'ppat' (128) {
|
||||||
|
$"0001 0000 001C 0000 004E 0000 0000 FFFF"
|
||||||
|
$"0000 0000 8822 8822 8822 8822 0000 0000"
|
||||||
|
$"8001 0000 0000 0008 0008 0000 0000 0000"
|
||||||
|
$"0000 0048 0000 0048 0000 0000 0001 0001"
|
||||||
|
$"0001 0000 0000 0000 0056 0000 0000 0000"
|
||||||
|
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||||
|
$"CCCC CCCC FFFF"
|
||||||
|
};
|
||||||
|
|
||||||
|
data 'ppat' (129) {
|
||||||
|
$"0001 0000 001C 0000 004E 0000 0000 FFFF"
|
||||||
|
$"0000 0000 77DD 77DD 77DD 77DD 0000 0000"
|
||||||
|
$"8001 0000 0000 0008 0008 0000 0000 0000"
|
||||||
|
$"0000 0048 0000 0048 0000 0000 0001 0001"
|
||||||
|
$"0001 0000 0000 0000 0056 0000 0000 0000"
|
||||||
|
$"0000 0000 0000 0000 0000 0000 0000 0000"
|
||||||
|
$"4444 4444 4444"
|
||||||
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ const short tableTop = 50;
|
|||||||
const short tableLineHeight = 20;
|
const short tableLineHeight = 20;
|
||||||
const short tableBaseline = 15;
|
const short tableBaseline = 15;
|
||||||
|
|
||||||
|
extern Boolean hasColorQD;
|
||||||
|
|
||||||
enum class StatusDisplay::Stat : short
|
enum class StatusDisplay::Stat : short
|
||||||
{
|
{
|
||||||
heapSize,
|
heapSize,
|
||||||
@ -20,7 +22,9 @@ enum class StatusDisplay::Stat : short
|
|||||||
|
|
||||||
StatusDisplay::StatusDisplay()
|
StatusDisplay::StatusDisplay()
|
||||||
{
|
{
|
||||||
statusWindow = GetNewWindow(129, NULL, (WindowPtr) -1);
|
statusWindow = hasColorQD ?
|
||||||
|
GetNewCWindow(129, NULL, (WindowPtr) -1)
|
||||||
|
: GetNewWindow(129, NULL, (WindowPtr) -1);
|
||||||
|
|
||||||
#if TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_CARBON
|
||||||
Rect bounds;
|
Rect bounds;
|
||||||
@ -78,6 +82,12 @@ StatusDisplay::StatusDisplay()
|
|||||||
DiffRgn(background, tmp, background);
|
DiffRgn(background, tmp, background);
|
||||||
}
|
}
|
||||||
DisposeRgn(tmp);
|
DisposeRgn(tmp);
|
||||||
|
|
||||||
|
if(hasColorQD)
|
||||||
|
{
|
||||||
|
progressBg = GetPixPat(128);
|
||||||
|
progressFg = GetPixPat(129);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusDisplay::~StatusDisplay()
|
StatusDisplay::~StatusDisplay()
|
||||||
@ -116,11 +126,7 @@ void StatusDisplay::DrawValue(Stat stat, long val)
|
|||||||
|
|
||||||
void StatusDisplay::Update()
|
void StatusDisplay::Update()
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_CARBON
|
|
||||||
SetPortWindowPort(statusWindow);
|
SetPortWindowPort(statusWindow);
|
||||||
#else
|
|
||||||
SetPort(statusWindow);
|
|
||||||
#endif
|
|
||||||
BeginUpdate(statusWindow);
|
BeginUpdate(statusWindow);
|
||||||
EraseRgn(background);
|
EraseRgn(background);
|
||||||
|
|
||||||
@ -140,19 +146,20 @@ void StatusDisplay::Update()
|
|||||||
progressRect.left+1 + (progressRect.right-progressRect.left-2) * progressDone / progressTotal,
|
progressRect.left+1 + (progressRect.right-progressRect.left-2) * progressDone / progressTotal,
|
||||||
progressRect.bottom-1);
|
progressRect.bottom-1);
|
||||||
|
|
||||||
#if TARGET_API_MAC_CARBON
|
#if TARGET_CPU_68K && !TARGET_RT_MAC_CFM
|
||||||
Pattern fg, bg;
|
if(!hasColorQD)
|
||||||
GetQDGlobalsDarkGray(&fg);
|
FillRect(&r, &qd.dkGray);
|
||||||
GetQDGlobalsLightGray(&bg);
|
else
|
||||||
#else
|
|
||||||
const Pattern& fg = qd.dkGray;
|
|
||||||
const Pattern& bg = qd.ltGray;
|
|
||||||
#endif
|
#endif
|
||||||
|
FillCRect(&r, progressFg);
|
||||||
FillRect(&r, &fg);
|
|
||||||
r.left = r.right;
|
r.left = r.right;
|
||||||
r.right = progressRect.right - 1;
|
r.right = progressRect.right - 1;
|
||||||
FillRect(&r, &bg);
|
#if TARGET_CPU_68K && !TARGET_RT_MAC_CFM
|
||||||
|
if(!hasColorQD)
|
||||||
|
FillRect(&r, &qd.ltGray);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
FillCRect(&r, progressBg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
EraseRect(&progressRect);
|
EraseRect(&progressRect);
|
||||||
|
@ -33,6 +33,8 @@ class StatusDisplay
|
|||||||
Rect valueRects[nValues];
|
Rect valueRects[nValues];
|
||||||
short columnWidths[6];
|
short columnWidths[6];
|
||||||
|
|
||||||
|
PixPatHandle progressBg, progressFg;
|
||||||
|
|
||||||
enum class Stat : short;
|
enum class Stat : short;
|
||||||
|
|
||||||
void DrawValue(Stat stat, ConstStr255Param str);
|
void DrawValue(Stat stat, ConstStr255Param str);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user