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
|
terminal.c
|
||||||
touch.c
|
touch.c
|
||||||
trace.c
|
trace.c
|
||||||
|
config.c
|
||||||
CREATOR "PLTO"
|
CREATOR "PLTO"
|
||||||
)
|
)
|
||||||
target_link_libraries(PLATOTERM "-lm")
|
target_link_libraries(PLATOTERM "-lm")
|
||||||
|
|
|
@ -48,10 +48,10 @@ resource 'MENU' (130) {
|
||||||
|
|
||||||
resource 'MENU' (131) {
|
resource 'MENU' (131) {
|
||||||
131, textMenuProc;
|
131, textMenuProc;
|
||||||
0, enabled;
|
allEnabled, enabled;
|
||||||
"Settings";
|
"Settings";
|
||||||
{
|
{
|
||||||
"300 baud", noIcon, "3", noMark, plain;
|
"300 baud", noIcon, "3", noMark, Plain;
|
||||||
"1200 baud", noIcon, "1", noMark, plain;
|
"1200 baud", noIcon, "1", noMark, plain;
|
||||||
"2400 baud", noIcon, "2", noMark, plain;
|
"2400 baud", noIcon, "2", noMark, plain;
|
||||||
"9600 baud", noIcon, "6", noMark, plain;
|
"9600 baud", noIcon, "6", noMark, plain;
|
||||||
|
|
19
io.c
19
io.c
|
@ -4,6 +4,7 @@
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define true 1
|
#define true 1
|
||||||
#define false 0
|
#define false 0
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
#define SERIAL_BUFFER_SIZE 16000
|
#define SERIAL_BUFFER_SIZE 16000
|
||||||
|
|
||||||
extern unsigned char trace_active;
|
extern unsigned char trace_active;
|
||||||
|
extern ConfigInfo config;
|
||||||
extern void done(void);
|
extern void done(void);
|
||||||
|
|
||||||
short driverIn;
|
short driverIn;
|
||||||
|
@ -33,18 +35,10 @@ void io_init(void)
|
||||||
handshake.fInX=0;
|
handshake.fInX=0;
|
||||||
|
|
||||||
SerHShake(driverIn,&handshake);
|
SerHShake(driverIn,&handshake);
|
||||||
SerReset(driverOut,baud57600+stop10+noParity+data8);
|
io_set_baud(config.baud);
|
||||||
serial_buffer=NewPtr(SERIAL_BUFFER_SIZE);
|
serial_buffer=NewPtr(SERIAL_BUFFER_SIZE);
|
||||||
|
|
||||||
/* if (serial_buffer!=noErr) */
|
|
||||||
/* done(); */
|
|
||||||
|
|
||||||
SerSetBuf(driverIn,serial_buffer,SERIAL_BUFFER_SIZE);
|
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)
|
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)
|
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 "keyboard.h"
|
||||||
#include "touch.h"
|
#include "touch.h"
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
#include "help.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define true 1
|
#define true 1
|
||||||
#define false 0
|
#define false 0
|
||||||
|
@ -22,14 +22,15 @@ void done(void)
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
|
config_init();
|
||||||
screen_init();
|
screen_init();
|
||||||
touch_init();
|
touch_init();
|
||||||
help_init();
|
|
||||||
NoEcho=padT;
|
NoEcho=padT;
|
||||||
ShowPLATO(splash,sizeof(splash));
|
ShowPLATO(splash,sizeof(splash));
|
||||||
NoEcho=padF;
|
NoEcho=padF;
|
||||||
terminal_initial_position();
|
terminal_initial_position();
|
||||||
io_init();
|
io_init();
|
||||||
|
screen_update_menus();
|
||||||
running=true;
|
running=true;
|
||||||
while (running==true)
|
while (running==true)
|
||||||
{
|
{
|
||||||
|
|
86
screen.c
86
screen.c
|
@ -16,6 +16,8 @@
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "touch.h"
|
#include "touch.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "terminal.h"
|
||||||
|
|
||||||
#define true 1
|
#define true 1
|
||||||
#define false 0
|
#define false 0
|
||||||
|
@ -45,6 +47,7 @@ static AEEventHandlerUPP oappUPP, odocUPP, pdocUPP, quitUPP;
|
||||||
extern unsigned char running;
|
extern unsigned char running;
|
||||||
static long sysv;
|
static long sysv;
|
||||||
extern void done(void);
|
extern void done(void);
|
||||||
|
extern ConfigInfo config;
|
||||||
|
|
||||||
/* Apple Event Handler callbacks */
|
/* Apple Event Handler callbacks */
|
||||||
|
|
||||||
|
@ -174,6 +177,50 @@ void screen_about_dialog(void)
|
||||||
*/
|
*/
|
||||||
void screen_update_menus(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)
|
switch(menuItem)
|
||||||
{
|
{
|
||||||
|
case 1:
|
||||||
|
terminal_set_plato();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
terminal_set_tty();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
io_hang_up();
|
||||||
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
done();
|
done();
|
||||||
break;
|
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);
|
HiliteMenu(0);
|
||||||
|
screen_update_menus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue