diff --git a/PLATOTERM.r b/PLATOTERM.r index 6810f3f..d61b5d9 100755 --- a/PLATOTERM.r +++ b/PLATOTERM.r @@ -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" /* ......... .F */ $"696C 6504 5175 6974 0051 0000 00" /* ile.Quit.Q... */ }; data 'MBAR' (128) { $"0002 0080 0081" /* .... */ }; \ No newline at end of file +#include "Processes.r" #include "Menus.r" #include "Windows.r" #include "MacTypes.r" resource 'MENU' (128) { 128, textMenuProc; allEnabled, enabled; apple; { "About PLATOTERM", noIcon, noKey, noMark, plain; "-", noIcon, noKey, noMark, plain; } }; resource 'MENU' (129) { 129, textMenuProc; allEnabled, enabled; "File"; { "Quit", noIcon, "Q", noMark, plain; } }; resource 'MENU' (130) { 130, textMenuProc; 0, enabled; "Edit"; { "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, acceptSuspendResumeEvents, enableOptionSwitch, canBackground, multiFinderAware, backgroundAndForeground, dontGetFrontClicks, ignoreChildDiedEvents, is32BitCompatible, isHighLevelEventAware, onlyLocalHLEvents, notStationeryAware, reserved, reserved, reserved, reserved, 100 * 1024, 100 * 1024 }; \ No newline at end of file diff --git a/screen.c b/screen.c index 255d088..0091422 100644 --- a/screen.c +++ b/screen.c @@ -7,6 +7,7 @@ #include #include #include +#include #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,¤tWindow)) + { + 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; + } } } diff --git a/screen.h b/screen.h index 7c85980..cdab83b 100755 --- a/screen.h +++ b/screen.h @@ -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) */