mirror of
https://github.com/marciot/mac-tip.git
synced 2025-01-15 22:30:20 +00:00
Added speaker toggle
This commit is contained in:
parent
5ab24df256
commit
1af5e74aea
Binary file not shown.
@ -130,6 +130,9 @@ bool TBMouseDown( TBHandle tb, Point where, WindowPtr whichWindow ) {
|
|||||||
HLock( (Handle) tb );
|
HLock( (Handle) tb );
|
||||||
TBRec &my = **tb;
|
TBRec &my = **tb;
|
||||||
|
|
||||||
|
// Return if hidden
|
||||||
|
if((*my.scroll)->contrlVis == 0) return 0;
|
||||||
|
|
||||||
ControlHandle whichCntl;
|
ControlHandle whichCntl;
|
||||||
short partCode = FindControl(where, whichWindow, &whichCntl);
|
short partCode = FindControl(where, whichWindow, &whichCntl);
|
||||||
if (partCode) {
|
if (partCode) {
|
||||||
|
@ -8,17 +8,6 @@
|
|||||||
|
|
||||||
#include "tip.h"
|
#include "tip.h"
|
||||||
|
|
||||||
// ----------------------- Test Monitor Panel Definitions -------------------
|
|
||||||
#define SET_RECT(LEFT, TOP, RIGHT, BOTTOM) {TOP, LEFT, BOTTOM, RIGHT}
|
|
||||||
|
|
||||||
Rect CS_Stat = SET_RECT(114, 8, 242, 28);
|
|
||||||
Rect TP_Perc = SET_RECT( 12, 56, 409, 72);
|
|
||||||
Rect SS_Jaz = SET_RECT( 12, 94, 409, 126);
|
|
||||||
Rect SS_Sid0 = SET_RECT( 12, 94, 409, 110);
|
|
||||||
Rect TL_Sect = SET_RECT( 75, 154, 203, 170);
|
|
||||||
Rect ES_Read = SET_RECT(346, 154, 409, 170);
|
|
||||||
Rect SE_Rect = SET_RECT(222, 154, 255, 221);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* WinMain
|
* WinMain
|
||||||
*
|
*
|
||||||
@ -110,18 +99,6 @@ void WndProc(long iMessage, uint16_t wParam) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BtnList tipBtns[] = {
|
|
||||||
{IDB_BACK, szBack, 157, 301, 80, 24},
|
|
||||||
{IDB_NEXT, szNext, 236, 301, 80, 24},
|
|
||||||
{IDB_QUIT, szQuit, 402, 301, 45, 24},
|
|
||||||
// For Mac TIP only
|
|
||||||
{IDB_TEST, szPressToStart, 157, 301, 150, 24},
|
|
||||||
{IDB_EXPL, "Explain", 330, 301, 60, 24},
|
|
||||||
{IDB_OKAY, "Okay", 380, 301, 65, 24},
|
|
||||||
{IDB_READ, "Open in SimpleText...", 210, 301, 160, 24},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SUNKEN FIELDS
|
* SUNKEN FIELDS
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -369,7 +346,10 @@ void TestMonitorWndProc() {
|
|||||||
PaintTextArray(TestGrayText, GRAY_COLOR);
|
PaintTextArray(TestGrayText, GRAY_COLOR);
|
||||||
PaintTestPhase();
|
PaintTestPhase();
|
||||||
|
|
||||||
// TODO: paint the little speaker icon
|
// paint the little speaker icon
|
||||||
|
Rect theRect;
|
||||||
|
SetRect(&theRect, 232, 191, 232+16, 191+16);
|
||||||
|
PlotIconID(&theRect, atTopLeft, 0, 129);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -436,5 +416,7 @@ void AllowProgramExit() {
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
void ErrorSound() {
|
void ErrorSound() {
|
||||||
SysBeep(10);
|
if(SendMessage(hSoundCheckbox, BM_GETCHECK) == BST_CHECKED) {
|
||||||
|
SysBeep(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,8 @@ enum {
|
|||||||
#define WM_COMMAND 2
|
#define WM_COMMAND 2
|
||||||
#define SW_SHOW 1
|
#define SW_SHOW 1
|
||||||
#define SW_HIDE 2
|
#define SW_HIDE 2
|
||||||
|
#define BM_GETCHECK 1
|
||||||
|
#define BST_CHECKED 1
|
||||||
|
|
||||||
void SetRGBColor(long color, RGBColor *rgbColor);
|
void SetRGBColor(long color, RGBColor *rgbColor);
|
||||||
void SetColor(long color);
|
void SetColor(long color);
|
||||||
@ -91,6 +93,7 @@ void SetWindowText(int id, const char *str);
|
|||||||
void EnableWindow(int id, bool enabled);
|
void EnableWindow(int id, bool enabled);
|
||||||
void ShowWindow(ControlHandle hCntl, int state);
|
void ShowWindow(ControlHandle hCntl, int state);
|
||||||
void ShowWindow(int id, int state);
|
void ShowWindow(int id, int state);
|
||||||
|
long SendMessage(int id, int msg);
|
||||||
void InvalidateRect(int id);
|
void InvalidateRect(int id);
|
||||||
void Rectangle(int left, int top, int right, int bottom);
|
void Rectangle(int left, int top, int right, int bottom);
|
||||||
void DrawEdge(Rect *qrc, int edge, int grfFlags);
|
void DrawEdge(Rect *qrc, int edge, int grfFlags);
|
||||||
@ -221,6 +224,7 @@ extern const char *szQuit;
|
|||||||
#define IDB_EXPL 0xFF04
|
#define IDB_EXPL 0xFF04
|
||||||
#define IDB_OKAY 0xFF05
|
#define IDB_OKAY 0xFF05
|
||||||
#define IDB_READ 0xFF06
|
#define IDB_READ 0xFF06
|
||||||
|
#define IDB_BEEP 0xFF07
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
hDefault,
|
hDefault,
|
||||||
@ -228,6 +232,7 @@ enum {
|
|||||||
hTestMonitor,
|
hTestMonitor,
|
||||||
hTestButton = IDB_TEST,
|
hTestButton = IDB_TEST,
|
||||||
hExitButton = IDB_QUIT,
|
hExitButton = IDB_QUIT,
|
||||||
|
hSoundCheckbox,
|
||||||
// Extras added by MLT
|
// Extras added by MLT
|
||||||
hExplainWnd = IDB_EXPL
|
hExplainWnd = IDB_EXPL
|
||||||
};
|
};
|
||||||
@ -239,10 +244,13 @@ typedef struct {
|
|||||||
int y;
|
int y;
|
||||||
int w;
|
int w;
|
||||||
int h;
|
int h;
|
||||||
|
int type;
|
||||||
ControlHandle hndl;
|
ControlHandle hndl;
|
||||||
} BtnList;
|
} BtnList;
|
||||||
extern BtnList tipBtns[];
|
extern BtnList tipBtns[];
|
||||||
|
|
||||||
|
extern Rect CS_Stat, TP_Perc, SS_Jaz, SS_Sid0, TL_Sect, ES_Read, SE_Rect;
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* FUNCTION PROTOTYPES
|
* FUNCTION PROTOTYPES
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -43,7 +43,7 @@ void DoMouseDown(EventRecord &event);
|
|||||||
void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion);
|
void DoMouseMove(EventRecord &event, RgnHandle *cursorRegion);
|
||||||
void DoDiskEvent(EventRecord &event);
|
void DoDiskEvent(EventRecord &event);
|
||||||
void SetPage(TipPage page);
|
void SetPage(TipPage page);
|
||||||
ControlHandle FindControl(int id);
|
ControlHandle FindCntlHandle(int id);
|
||||||
OSErr GetExplanationFSSpec(const char *name, FSSpec *docSpec);
|
OSErr GetExplanationFSSpec(const char *name, FSSpec *docSpec);
|
||||||
void OpenExplanationInSimpleText();
|
void OpenExplanationInSimpleText();
|
||||||
|
|
||||||
@ -131,9 +131,11 @@ void NewTipWindow() {
|
|||||||
tipBtns[i].y + tipBtns[i].h - mainWndOrigin.v
|
tipBtns[i].y + tipBtns[i].h - mainWndOrigin.v
|
||||||
);
|
);
|
||||||
StrToPascal(title, tipBtns[i].name);
|
StrToPascal(title, tipBtns[i].name);
|
||||||
tipBtns[i].hndl = NewControl(tipWindow, &rect, title, false, 0, 0, 0, 0, tipBtns[i].id);
|
tipBtns[i].hndl = NewControl(tipWindow, &rect, title, false, 0, 0, 1, tipBtns[i].type, tipBtns[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetControlValue(FindCntlHandle(IDB_BEEP),1); // Check the sound control
|
||||||
|
|
||||||
page = kExplainPage;
|
page = kExplainPage;
|
||||||
GetDC(hExplainWnd);
|
GetDC(hExplainWnd);
|
||||||
|
|
||||||
@ -176,7 +178,7 @@ void DisposeTipWindow() {
|
|||||||
DisposeWindow(tipWindow);
|
DisposeWindow(tipWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlHandle FindControl(int id) {
|
ControlHandle FindCntlHandle(int id) {
|
||||||
for(int i = 0; tipBtns[i].name; i++) {
|
for(int i = 0; tipBtns[i].name; i++) {
|
||||||
if (tipBtns[i].id == id)
|
if (tipBtns[i].id == id)
|
||||||
return tipBtns[i].hndl;
|
return tipBtns[i].hndl;
|
||||||
@ -309,11 +311,12 @@ void DoMouseDown(EventRecord &event) {
|
|||||||
GetPort(&oldPort);
|
GetPort(&oldPort);
|
||||||
SetPort(thisWindow);
|
SetPort(thisWindow);
|
||||||
GlobalToLocal(&mouse);
|
GlobalToLocal(&mouse);
|
||||||
const bool hitButton = (!TBMouseDown(richText, mouse, thisWindow)) &&
|
int part;
|
||||||
(FindControl(mouse, thisWindow, &thisControl) == inButton) &&
|
const bool hitCntl = (!TBMouseDown(richText, mouse, thisWindow)) &&
|
||||||
(TrackControl(thisControl, mouse, 0) == inButton);
|
(FindControl(mouse, thisWindow, &thisControl)) &&
|
||||||
|
(part = TrackControl(thisControl, mouse, 0));
|
||||||
SetPort(oldPort);
|
SetPort(oldPort);
|
||||||
if(hitButton) {
|
if(hitCntl && (part == inButton) || (part == inCheckBox)) {
|
||||||
int id = GetControlReference(thisControl);
|
int id = GetControlReference(thisControl);
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case IDB_OKAY:
|
case IDB_OKAY:
|
||||||
@ -325,6 +328,12 @@ void DoMouseDown(EventRecord &event) {
|
|||||||
case IDB_READ:
|
case IDB_READ:
|
||||||
OpenExplanationInSimpleText();
|
OpenExplanationInSimpleText();
|
||||||
break;
|
break;
|
||||||
|
case IDB_BEEP:
|
||||||
|
SetPort(thisWindow);
|
||||||
|
SetControlValue(thisControl, 1 - GetControlValue(thisControl));
|
||||||
|
SetPort(oldPort);
|
||||||
|
printf("Value: %d\n", GetControlValue(thisControl));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
WndProc(WM_COMMAND, id);
|
WndProc(WM_COMMAND, id);
|
||||||
break;
|
break;
|
||||||
@ -407,6 +416,7 @@ void SetPage(TipPage newPage) {
|
|||||||
ShowWindow(IDB_TEST, SW_SHOW);
|
ShowWindow(IDB_TEST, SW_SHOW);
|
||||||
ShowWindow(IDB_EXPL, SW_SHOW);
|
ShowWindow(IDB_EXPL, SW_SHOW);
|
||||||
ShowWindow(IDB_QUIT, SW_SHOW);
|
ShowWindow(IDB_QUIT, SW_SHOW);
|
||||||
|
ShowWindow(IDB_BEEP, SW_SHOW);
|
||||||
break;
|
break;
|
||||||
case kExplainPage:
|
case kExplainPage:
|
||||||
ShowWindow(IDB_TEST, SW_HIDE);
|
ShowWindow(IDB_TEST, SW_HIDE);
|
||||||
@ -414,6 +424,7 @@ void SetPage(TipPage newPage) {
|
|||||||
ShowWindow(IDB_NEXT, SW_HIDE);
|
ShowWindow(IDB_NEXT, SW_HIDE);
|
||||||
ShowWindow(IDB_EXPL, SW_HIDE);
|
ShowWindow(IDB_EXPL, SW_HIDE);
|
||||||
ShowWindow(IDB_QUIT, SW_HIDE);
|
ShowWindow(IDB_QUIT, SW_HIDE);
|
||||||
|
ShowWindow(IDB_BEEP, SW_HIDE);
|
||||||
ShowWindow(IDB_OKAY, SW_SHOW);
|
ShowWindow(IDB_OKAY, SW_SHOW);
|
||||||
ShowWindow(IDB_READ, SW_SHOW);
|
ShowWindow(IDB_READ, SW_SHOW);
|
||||||
ShowWindow((*richText)->scroll, SW_SHOW);
|
ShowWindow((*richText)->scroll, SW_SHOW);
|
||||||
@ -703,7 +714,7 @@ unsigned long GetSystemTime() {
|
|||||||
void SetWindowText(int id, const char *str) {
|
void SetWindowText(int id, const char *str) {
|
||||||
Str255 pStr;
|
Str255 pStr;
|
||||||
StrToPascal(pStr, str);
|
StrToPascal(pStr, str);
|
||||||
ControlHandle hCntl = FindControl(id);
|
ControlHandle hCntl = FindCntlHandle(id);
|
||||||
if(hCntl) {
|
if(hCntl) {
|
||||||
GetDC(hDefault);
|
GetDC(hDefault);
|
||||||
SetCTitle(hCntl, pStr);
|
SetCTitle(hCntl, pStr);
|
||||||
@ -715,7 +726,7 @@ void SetWindowText(int id, const char *str) {
|
|||||||
* ENABLE WINDOW
|
* ENABLE WINDOW
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void EnableWindow(int id, bool enabled) {
|
void EnableWindow(int id, bool enabled) {
|
||||||
ControlHandle hCntl = FindControl(id);
|
ControlHandle hCntl = FindCntlHandle(id);
|
||||||
if(hCntl) {
|
if(hCntl) {
|
||||||
GetDC(hDefault);
|
GetDC(hDefault);
|
||||||
HiliteControl(hCntl, enabled ? 0 : 255);
|
HiliteControl(hCntl, enabled ? 0 : 255);
|
||||||
@ -733,7 +744,7 @@ void ShowWindow(ControlHandle hCntl, int state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShowWindow(int id, int state) {
|
void ShowWindow(int id, int state) {
|
||||||
ControlHandle hCntl = FindControl(id);
|
ControlHandle hCntl = FindCntlHandle(id);
|
||||||
if(hCntl) {
|
if(hCntl) {
|
||||||
GetDC(hDefault);
|
GetDC(hDefault);
|
||||||
ShowWindow(hCntl, state);
|
ShowWindow(hCntl, state);
|
||||||
@ -741,6 +752,19 @@ void ShowWindow(int id, int state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* SEND MESSAGE
|
||||||
|
*******************************************************************************/
|
||||||
|
long SendMessage(int id, int msg) {
|
||||||
|
if(msg == BM_GETCHECK) {
|
||||||
|
ControlHandle hCntl = FindCntlHandle(id);
|
||||||
|
if(hCntl) {
|
||||||
|
return GetControlValue(hCntl) ? BST_CHECKED: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* INVALIDATE RECT
|
* INVALIDATE RECT
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -162,7 +162,33 @@ TextList TestGrayText[] = {
|
|||||||
{155, 39, "Testing Progress"},
|
{155, 39, "Testing Progress"},
|
||||||
{129, 77, "Spare Sectors Consumed"},
|
{129, 77, "Spare Sectors Consumed"},
|
||||||
{61, 135, "Testing Location"},
|
{61, 135, "Testing Location"},
|
||||||
/*{219, 135, "Sound"},*/
|
{219, 135, "Sound"},
|
||||||
{297, 135, "Error Summary"},
|
{297, 135, "Error Summary"},
|
||||||
{0,0,0}
|
{0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------- Test Monitor Panel Definitions -------------------
|
||||||
|
|
||||||
|
#define SET_RECT(LEFT, TOP, RIGHT, BOTTOM) {TOP, LEFT, BOTTOM, RIGHT}
|
||||||
|
|
||||||
|
Rect CS_Stat = SET_RECT(114, 8, 242, 28);
|
||||||
|
Rect TP_Perc = SET_RECT( 12, 56, 409, 72);
|
||||||
|
Rect SS_Jaz = SET_RECT( 12, 94, 409, 126);
|
||||||
|
Rect SS_Sid0 = SET_RECT( 12, 94, 409, 110);
|
||||||
|
Rect TL_Sect = SET_RECT( 75, 154, 203, 170);
|
||||||
|
Rect ES_Read = SET_RECT(346, 154, 409, 170);
|
||||||
|
Rect SE_Rect = SET_RECT(222, 154, 255, 221);
|
||||||
|
|
||||||
|
BtnList tipBtns[] = {
|
||||||
|
{IDB_BACK, szBack, 157, 301, 80, 24},
|
||||||
|
{IDB_NEXT, szNext, 236, 301, 80, 24},
|
||||||
|
{IDB_QUIT, szQuit, 402, 301, 45, 24},
|
||||||
|
{IDB_BEEP, "", 252, 211, 22, 22, checkBoxProc},
|
||||||
|
// For Mac TIP only
|
||||||
|
{IDB_TEST, szPressToStart, 157, 301, 150, 24},
|
||||||
|
{IDB_EXPL, "Explain", 330, 301, 60, 24},
|
||||||
|
{IDB_OKAY, "Okay", 380, 301, 65, 24},
|
||||||
|
{IDB_READ, "Open in SimpleText...", 210, 301, 160, 24},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user