show state dialog when selected from menu

This commit is contained in:
Matthew Laux 2022-06-29 01:19:35 -05:00
parent 698cc17030
commit e00b998024
2 changed files with 171 additions and 142 deletions

View File

@ -112,17 +112,32 @@ bool ShowOpenBox(void)
return false;
}
DialogPtr stateDialog;
void ShowStateDialog(void)
{
DialogPtr dp;
if (!stateDialog) {
stateDialog = GetNewDialog(DLOG_STATE, 0L, (WindowPtr) -1L);
}
ShowWindow(stateDialog);
SelectWindow(stateDialog);
}
void ShowAboutBox(void)
{
DialogPtr dp;
EventRecord e;
DialogItemIndex hitItem;
dp = GetNewDialog(DLOG_ABOUT, 0L, (WindowPtr) -1L);
DrawDialog(dp);
ModalDialog(NULL, &hitItem);
while(!GetNextEvent(mDownMask, &e));
while(WaitMouseUp());
// DrawDialog(dp);
// while(!GetNextEvent(mDownMask, &e));
// while(WaitMouseUp());
DisposeDialog(dp);
}
@ -156,6 +171,12 @@ void OnMenuAction(long action)
g_running = 0;
}
}
else if (menu == MENU_EMULATION) {
if (item == EMULATION_STATE) {
ShowStateDialog();
}
}
}
void OnMouseDown(EventRecord *pEvt)
@ -195,7 +216,13 @@ int main(int argc, char *argv[])
while(g_running) {
if(WaitNextEvent(everyEvent, &evt, 10, 0) != nullEvent) {
switch(evt.what) {
if (IsDialogEvent(&evt)) {
DialogRef hitBox;
DialogItemIndex hitItem;
if (DialogSelect(&evt, &hitBox, &hitItem)) {
stateDialog = NULL;
}
} else switch(evt.what) {
case mouseDown:
OnMouseDown(&evt);
break;

View File

@ -21,6 +21,7 @@
#define ALRT_4_LINE 129
#define DLOG_ABOUT 128
#define DLOG_STATE 129
#define MBAR_DEFAULT 128
@ -35,8 +36,9 @@
#define FILE_QUIT 4
#define EMULATION_PAUSE 1
#define EMULATION_PREFERENCES 3
#define EMULATION_KEY_MAPPINGS 4
#define EMULATION_STATE 2
#define EMULATION_PREFERENCES 4
#define EMULATION_KEY_MAPPINGS 5
typedef unsigned char bool;
#define true 1