From b3610d1484559337909034c54c05297ea4125ff2 Mon Sep 17 00:00:00 2001 From: Thomas Cherryhomes Date: Fri, 1 Feb 2019 16:16:58 -0600 Subject: [PATCH] Add PLTO creator code, so icon works. Add more menu items to resource file. Temporarily comment out mono paint. --- CMakeLists.txt | 1 + PLATOTERM.r | 25 ++++++++++-- screen.c | 108 ++++++++++++++++++++++++------------------------- 3 files changed, 77 insertions(+), 57 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54c55c1..97d9f7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ add_application(PLATOTERM terminal.c touch.c trace.c + CREATOR "PLTO" ) target_link_libraries(PLATOTERM "-lm") diff --git a/PLATOTERM.r b/PLATOTERM.r index 1787221..3c42c2f 100755 --- a/PLATOTERM.r +++ b/PLATOTERM.r @@ -6,7 +6,7 @@ type 'PLTO' as 'STR '; resource 'PLTO' (0, purgeable) { - "PLATOTerm 0.1" + "PLATOTerm 0.5" }; resource 'MENU' (128) { @@ -22,8 +22,12 @@ resource 'MENU' (128) { resource 'MENU' (129) { 129, textMenuProc; allEnabled, enabled; - "File"; + "Terminal"; { + "PLATO Mode", noIcon, "P", noMark, plain; + "TTY Mode", noIcon, "T", noMark, plain; + "-",noIcon, noKey, noMark, plain; + "Hang Up",noIcon, "H", noMark, plain; "Quit", noIcon, "Q", noMark, plain; } }; @@ -42,8 +46,23 @@ resource 'MENU' (130) { } }; +resource 'MENU' (131) { + 131, textMenuProc; + 0, enabled; + "Settings"; + { + "300 baud", noIcon, "3", noMark, plain; + "1200 baud", noIcon, "1", noMark, plain; + "2400 baud", noIcon, "2", noMark, plain; + "9600 baud", noIcon, "6", noMark, plain; + "19200 baud", noIcon, "9", noMark, plain; + "38400 baud", noIcon, "8", noMark, plain; + "57600 baud", noIcon, "7", noMark, plain; + } +}; + resource 'MBAR' (128) { - { 128, 129, 130 }; + { 128, 129, 130, 131 }; }; resource 'SIZE' (-1) { diff --git a/screen.c b/screen.c index 875dfcd..9d9bd0c 100644 --- a/screen.c +++ b/screen.c @@ -186,7 +186,7 @@ void screen_menu_command(long menu_command) switch(menuItem) { - case 1: + case 5: done(); break; } @@ -614,65 +614,65 @@ void screen_paint(padPt* Coord) */ void screen_mono_paint(padPt* Coord) { - static unsigned short xStack[512]; - static unsigned short yStack[512]; - int x=screen_scale_x(Coord->x); - int y=screen_scale_y(Coord->y); - unsigned char stackentry = 1; - unsigned short spanAbove, spanBelow; - unsigned char oldColor=GetPixel(x,y); +/* static unsigned short xStack[512]; */ +/* static unsigned short yStack[512]; */ +/* int x=screen_scale_x(Coord->x); */ +/* int y=screen_scale_y(Coord->y); */ +/* unsigned char stackentry = 1; */ +/* unsigned short spanAbove, spanBelow; */ +/* unsigned char oldColor=GetPixel(x,y); */ - if (oldColor==1) - return; +/* if (oldColor==1) */ +/* return; */ - do - { - unsigned short startx; - while (x > 0 && GetPixel(x-1,y)==oldColor) - --x; +/* do */ +/* { */ +/* unsigned short startx; */ +/* while (x > 0 && GetPixel(x-1,y)==oldColor) */ +/* --x; */ - spanAbove = spanBelow = false; - startx=x; +/* spanAbove = spanBelow = false; */ +/* startx=x; */ - while(GetPixel(x,y)==oldColor) - { - if (y < (512)) - { - unsigned char belowColor=GetPixel(x,y); - if (!spanBelow && belowColor==oldColor) - { - xStack[stackentry] = x; - yStack[stackentry] = y+1; - ++stackentry; - spanBelow = true; - } - else if (spanBelow && belowColor!=oldColor) - spanBelow = false; - } +/* while(GetPixel(x,y)==oldColor) */ +/* { */ +/* if (y < (512)) */ +/* { */ +/* unsigned char belowColor=GetPixel(x,y); */ +/* if (!spanBelow && belowColor==oldColor) */ +/* { */ +/* xStack[stackentry] = x; */ +/* yStack[stackentry] = y+1; */ +/* ++stackentry; */ +/* spanBelow = true; */ +/* } */ +/* else if (spanBelow && belowColor!=oldColor) */ +/* spanBelow = false; */ +/* } */ - if (y > 0) - { - unsigned char aboveColor=GetPixel(x,y); - if (!spanAbove && aboveColor==oldColor) - { - xStack[stackentry] = x; - yStack[stackentry] = y-1; - ++stackentry; - spanAbove = true; - } - else if (spanAbove && aboveColor!=oldColor) - spanAbove = false; - } - ++x; - } - MoveTo(startx,y); - LineTo(x-1,y); - --stackentry; - x = xStack[stackentry]; - y = yStack[stackentry]; - } - while (stackentry); +/* if (y > 0) */ +/* { */ +/* unsigned char aboveColor=GetPixel(x,y); */ +/* if (!spanAbove && aboveColor==oldColor) */ +/* { */ +/* xStack[stackentry] = x; */ +/* yStack[stackentry] = y-1; */ +/* ++stackentry; */ +/* spanAbove = true; */ +/* } */ +/* else if (spanAbove && aboveColor!=oldColor) */ +/* spanAbove = false; */ +/* } */ +/* ++x; */ +/* } */ +/* MoveTo(startx,y); */ +/* LineTo(x-1,y); */ +/* --stackentry; */ +/* x = xStack[stackentry]; */ +/* y = yStack[stackentry]; */ +/* } */ +/* while (stackentry); */ } /**