Implement enough so program can be exited.

This commit is contained in:
Thomas Cherryhomes 2019-01-25 23:39:26 -06:00
parent e0725ee975
commit e434d7624e
3 changed files with 85 additions and 1 deletions

View File

@ -1 +1 @@
data 'MENU' (128) { $"0080 0000 0000 0000 0000 FFFF FFFF 0114" /* .€........ .. */ $"00" /* . */ }; data 'MENU' (129) { $"0081 0000 0000 0000 0000 FFFF FFFF 0446" /* .<2E>........ .F */ $"696C 6504 5175 6974 0051 0000 00" /* ile.Quit.Q... */ }; data 'MBAR' (128) { data 'MENU' (128) { };
data 'MENU' (128) { data 'MENU' (128) { data 'MENU' (128) { $"0080 0000 0000 0000 0000 FFFF FFFF 0114" /* .€........ .. */ data 'MENU' (128) { $"00" /* . */ data 'MENU' (128) { }; resource 'MENU' (128) { data 'MENU' (128) { data 'MENU' (129) { data 'MENU' (128) { $"0081 0000 0000 0000 0000 FFFF FFFF 0446" /* .<2E>........ .F */ data 'MENU' (128) { $"696C 6504 5175 6974 0051 0000 00" /* ile.Quit.Q... */ { "About PLATOTERM", noIcon, noKey, noMark, plain; "-", noIcon, noKey, noMark, plain; } }; resource 'MENU' (129) { 129, textMenuProc; allEnabled, enabled; "File"; data 'MENU' (128) { data 'MBAR' (128) { "Quit", noIcon, "Q", noMark, plain; } }; resource 'MENU' (130) { 130, textMenuProc; 0, enabled; "Edit"; data 'MENU' (128) { data 'MBAR' (128) { "Undo", noIcon, "Z", noMark, plain; "-", noIcon, noKey, noMark, plain; "Cut", noIcon, "X", noMark, plain; "Copy", noIcon, "C", noMark, plain; "Paste", noIcon, "V", noMark, plain; "Clear", noIcon, noKey, noMark, plain; } }; resource 'MBAR' (128) { { 128, 129, 130 }; }; resource 'SIZE' (-1) { dontSaveScreen, }; enableOptionSwitch, canBackground, multiFinderAware, backgroundAndForeground, dontGetFrontClicks, ignoreChildDiedEvents, is32BitCompatible, isHighLevelEventAware, onlyLocalHLEvents, notStationeryAware, reserved, reserved, reserved, reserved, 100 * 1024, 100 * 1024 };

View File

@ -7,6 +7,7 @@
#include <Events.h>
#include <Fonts.h>
#include <NumberFormatting.h>
#include <Devices.h>
#include "screen.h"
#include "font.h"
#include "protocol.h"
@ -57,6 +58,10 @@ void screen_init(void)
InitFonts();
InitWindows();
InitMenus();
SetMenuBar(GetNewMBar(128));
AppendResMenu(GetMenu(128),'DRVR');
DrawMenuBar();
screenRect=qd.screenBits.bounds;
SetRect(&screenRect,screenRect.left+5,screenRect.top+45,screenRect.left+517,screenRect.top+557);
@ -79,14 +84,82 @@ void screen_init(void)
screenRect=win->portRect;
}
/**
* screen_update_menus() - Update menu state
*/
void screen_update_menus(void)
{
}
/**
* screen_menu_command(menuCommand) - Do menu command.
*/
void screen_menu_command(long menu_command)
{
Str255 str;
WindowRef w;
short menuID = menu_command >> 16;
short menuItem = menu_command & 0xFFFF;
if(menuID == 128)
{
if(menuItem == 1)
{
}
else
{
GetMenuItemText(GetMenu(128), menuItem, str);
OpenDeskAcc(str);
}
}
else if(menuID == 129)
{
switch(menuItem)
{
case 1:
ExitToShell();
break;
}
}
HiliteMenu(0);
}
/**
* screen_main(void)
*/
void screen_main(void)
{
WindowRef currentWindow;
SystemTask();
if (GetNextEvent(everyEvent,&theEvent))
{
switch(theEvent.what)
{
case mouseDown:
switch(FindWindow(theEvent.where,&currentWindow))
{
case inGoAway:
if (TrackGoAway(currentWindow,theEvent.where))
DisposeWindow(currentWindow);
break;
case inDrag:
DragWindow(currentWindow,theEvent.where,&qd.screenBits.bounds);
break;
case inMenuBar:
screen_update_menus();
screen_menu_command(MenuSelect(theEvent.where));
break;
case inContent:
SelectWindow(currentWindow);
break;
case inSysWindow:
SystemClick(&theEvent,currentWindow);
break;
}
case updateEvt:
break;
}
}
}

View File

@ -17,6 +17,17 @@
*/
void screen_init(void);
/**
* screen_update_menus() - Update menu state
*/
void screen_update_menus(void);
/**
* screen_menu_command(menuCommand) - Do menu command.
*/
void screen_menu_command(long menu_command);
/**
* screen_main(void)
*/