put in rest of menu update code.
This commit is contained in:
parent
bce4bb82fb
commit
674904814e
|
@ -18,6 +18,7 @@ add_application(PLATOTERM
|
|||
terminal.c
|
||||
touch.c
|
||||
trace.c
|
||||
config.c
|
||||
CREATOR "PLTO"
|
||||
)
|
||||
target_link_libraries(PLATOTERM "-lm")
|
||||
|
|
|
@ -48,10 +48,10 @@ resource 'MENU' (130) {
|
|||
|
||||
resource 'MENU' (131) {
|
||||
131, textMenuProc;
|
||||
0, enabled;
|
||||
allEnabled, enabled;
|
||||
"Settings";
|
||||
{
|
||||
"300 baud", noIcon, "3", noMark, plain;
|
||||
"300 baud", noIcon, "3", noMark, Plain;
|
||||
"1200 baud", noIcon, "1", noMark, plain;
|
||||
"2400 baud", noIcon, "2", noMark, plain;
|
||||
"9600 baud", noIcon, "6", noMark, plain;
|
||||
|
|
19
io.c
19
io.c
|
@ -4,6 +4,7 @@
|
|||
#include "io.h"
|
||||
#include "protocol.h"
|
||||
#include "terminal.h"
|
||||
#include "config.h"
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
@ -11,6 +12,7 @@
|
|||
#define SERIAL_BUFFER_SIZE 16000
|
||||
|
||||
extern unsigned char trace_active;
|
||||
extern ConfigInfo config;
|
||||
extern void done(void);
|
||||
|
||||
short driverIn;
|
||||
|
@ -33,18 +35,10 @@ void io_init(void)
|
|||
handshake.fInX=0;
|
||||
|
||||
SerHShake(driverIn,&handshake);
|
||||
SerReset(driverOut,baud57600+stop10+noParity+data8);
|
||||
io_set_baud(config.baud);
|
||||
serial_buffer=NewPtr(SERIAL_BUFFER_SIZE);
|
||||
|
||||
/* if (serial_buffer!=noErr) */
|
||||
/* done(); */
|
||||
|
||||
SerSetBuf(driverIn,serial_buffer,SERIAL_BUFFER_SIZE);
|
||||
paramBlock.ioCRefNum=driverIn;
|
||||
paramBlock.csCode=kSERDHandshakeRS232;
|
||||
PBControl((ParmBlkPtr)¶mBlock,false);
|
||||
paramBlock.csCode=kSERDAssertDTR;
|
||||
PBControl((ParmBlkPtr)¶mBlock,false);
|
||||
}
|
||||
|
||||
void io_send_byte(unsigned char b)
|
||||
|
@ -81,6 +75,13 @@ void io_send_string(const char* str, int len)
|
|||
*/
|
||||
void io_set_baud(int baud)
|
||||
{
|
||||
SerReset(driverOut,baud+stop10+noParity+data8);
|
||||
paramBlock.ioCRefNum=driverIn;
|
||||
paramBlock.csCode=kSERDHandshakeRS232;
|
||||
PBControl((ParmBlkPtr)¶mBlock,false);
|
||||
paramBlock.csCode=kSERDAssertDTR;
|
||||
PBControl((ParmBlkPtr)¶mBlock,false);
|
||||
config.baud=baud;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
5
main.c
5
main.c
|
@ -5,7 +5,7 @@
|
|||
#include "keyboard.h"
|
||||
#include "touch.h"
|
||||
#include "splash.h"
|
||||
#include "help.h"
|
||||
#include "config.h"
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
@ -22,14 +22,15 @@ void done(void)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
config_init();
|
||||
screen_init();
|
||||
touch_init();
|
||||
help_init();
|
||||
NoEcho=padT;
|
||||
ShowPLATO(splash,sizeof(splash));
|
||||
NoEcho=padF;
|
||||
terminal_initial_position();
|
||||
io_init();
|
||||
screen_update_menus();
|
||||
running=true;
|
||||
while (running==true)
|
||||
{
|
||||
|
|
86
screen.c
86
screen.c
|
@ -16,6 +16,8 @@
|
|||
#include "io.h"
|
||||
#include "keyboard.h"
|
||||
#include "touch.h"
|
||||
#include "config.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
@ -45,6 +47,7 @@ static AEEventHandlerUPP oappUPP, odocUPP, pdocUPP, quitUPP;
|
|||
extern unsigned char running;
|
||||
static long sysv;
|
||||
extern void done(void);
|
||||
extern ConfigInfo config;
|
||||
|
||||
/* Apple Event Handler callbacks */
|
||||
|
||||
|
@ -174,6 +177,50 @@ void screen_about_dialog(void)
|
|||
*/
|
||||
void screen_update_menus(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Update PLATO/TTY mode selector. */
|
||||
CheckItem(GetMenuHandle(129),1,false);
|
||||
CheckItem(GetMenuHandle(129),2,false);
|
||||
|
||||
if (TTY)
|
||||
{
|
||||
CheckItem(GetMenuHandle(129),2,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckItem(GetMenuHandle(129),1,true);
|
||||
}
|
||||
|
||||
/* Update baud rate selector. */
|
||||
for (i=1;i<8;i++)
|
||||
{
|
||||
CheckItem(GetMenuHandle(131),i,false);
|
||||
}
|
||||
switch (config.baud)
|
||||
{
|
||||
case 300:
|
||||
CheckItem(GetMenuHandle(131),1,true);
|
||||
break;
|
||||
case 1200:
|
||||
CheckItem(GetMenuHandle(131),2,true);
|
||||
break;
|
||||
case 2400:
|
||||
CheckItem(GetMenuHandle(131),3,true);
|
||||
break;
|
||||
case 9600:
|
||||
CheckItem(GetMenuHandle(131),4,true);
|
||||
break;
|
||||
case 19200:
|
||||
CheckItem(GetMenuHandle(131),5,true);
|
||||
break;
|
||||
case 38400:
|
||||
CheckItem(GetMenuHandle(131),6,true);
|
||||
break;
|
||||
case 57600:
|
||||
CheckItem(GetMenuHandle(131),7,true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,14 +248,49 @@ void screen_menu_command(long menu_command)
|
|||
{
|
||||
switch(menuItem)
|
||||
{
|
||||
|
||||
case 1:
|
||||
terminal_set_plato();
|
||||
break;
|
||||
case 2:
|
||||
terminal_set_tty();
|
||||
break;
|
||||
case 4:
|
||||
io_hang_up();
|
||||
break;
|
||||
case 5:
|
||||
done();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else if (menuID == 131)
|
||||
{
|
||||
switch(menuItem)
|
||||
{
|
||||
case 1:
|
||||
io_set_baud(300);
|
||||
break;
|
||||
case 2:
|
||||
io_set_baud(1200);
|
||||
break;
|
||||
case 3:
|
||||
io_set_baud(2400);
|
||||
break;
|
||||
case 4:
|
||||
io_set_baud(9600);
|
||||
break;
|
||||
case 5:
|
||||
io_set_baud(19200);
|
||||
break;
|
||||
case 6:
|
||||
io_set_baud(38400);
|
||||
break;
|
||||
case 7:
|
||||
io_set_baud(57600);
|
||||
break;
|
||||
}
|
||||
}
|
||||
HiliteMenu(0);
|
||||
screen_update_menus();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue