From e0725ee975737a03a758f5f06e2e8fe099004b0d Mon Sep 17 00:00:00 2001 From: Thomas Cherryhomes Date: Fri, 25 Jan 2019 18:42:10 -0600 Subject: [PATCH] Open a window. Get initial resource file dropped in. --- CMakeLists.txt | 1 + PLATOTERM.r | 1 + main.c | 31 ++++++++++++++++--------------- screen.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ screen.h | 10 ++++++++++ 5 files changed, 76 insertions(+), 15 deletions(-) create mode 100755 PLATOTERM.r diff --git a/CMakeLists.txt b/CMakeLists.txt index cc1d68c..54c55c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 2.8) add_application(PLATOTERM + PLATOTERM.r help.c io.c keyboard.c diff --git a/PLATOTERM.r b/PLATOTERM.r new file mode 100755 index 0000000..6810f3f --- /dev/null +++ b/PLATOTERM.r @@ -0,0 +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 diff --git a/main.c b/main.c index 4a7d1a7..a9450b9 100755 --- a/main.c +++ b/main.c @@ -16,23 +16,24 @@ unsigned char running=false; void main(void) { screen_init(); - touch_init(); - help_init(); - NoEcho=padT; - ShowPLATO(splash,sizeof(splash)); - NoEcho=padF; - terminal_initial_position(); - io_init(); + /* touch_init(); */ + /* help_init(); */ + /* NoEcho=padT; */ + /* ShowPLATO(splash,sizeof(splash)); */ + /* NoEcho=padF; */ + /* terminal_initial_position(); */ + /* io_init(); */ running=true; - screen_show_dial(); - screen_greeting(); + /* screen_show_dial(); */ + /* screen_greeting(); */ while (running==true) { - keyboard_main(); - io_main(); - touch_main(); + screen_main(); + /* keyboard_main(); */ + /* io_main(); */ + /* touch_main(); */ } - io_done(); - touch_done(); - screen_done(); + /* io_done(); */ + /* touch_done(); */ + /* screen_done(); */ } diff --git a/screen.c b/screen.c index a7bfd38..255d088 100644 --- a/screen.c +++ b/screen.c @@ -1,6 +1,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "screen.h" #include "font.h" #include "protocol.h" @@ -34,12 +40,54 @@ padRGB current_foreground_rgb_backup={255,255,255}; padRGB current_background_rgb_backup={0,0,0}; int highest_color_index_backup; unsigned char help_active=false; +Rect screenRect; +BitMap globalBitmap; +WindowPtr win; +EventRecord theEvent; +unsigned char is_mono=true; +SysEnvRec environment; +Handle menuBar; /** * screen_init() - Set up the screen */ void screen_init(void) { + InitGraf(&qd.thePort); + InitFonts(); + InitWindows(); + InitMenus(); + + screenRect=qd.screenBits.bounds; + SetRect(&screenRect,screenRect.left+5,screenRect.top+45,screenRect.left+517,screenRect.top+557); + + if (SysEnvirons(1,&environment) == noErr) + is_mono=!environment.hasColorQD; + else + is_mono=true; + + if (is_mono==true) + { + NewWindow(NULL, &screenRect, "\pPLATOTerm", true, 0, (WindowPtr)-1, false, 0); + } + else + { + NewCWindow(NULL, &screenRect, "\pColor PLATOTerm", true, 0, (WindowPtr)-1, false, 0); + } + + SetPort(win); + screenRect=win->portRect; +} + +/** + * screen_main(void) + */ +void screen_main(void) +{ + SystemTask(); + if (GetNextEvent(everyEvent,&theEvent)) + { + } } /** diff --git a/screen.h b/screen.h index f4a833b..7c85980 100755 --- a/screen.h +++ b/screen.h @@ -17,6 +17,11 @@ */ void screen_init(void); +/** + * screen_main(void) + */ +void screen_main(void); + /** * screen_update_colors() - Set the terminal colors */ @@ -93,6 +98,11 @@ void screen_background(padRGB* theColor); */ void screen_paint(padPt* Coord); +/** + * screen_show_status(msg) + */ +void screen_show_status(unsigned char* msg); + /** * screen_show_baud_rate - Show baud rate */