Skip to content
Snippets Groups Projects
Commit 93e3fd8d authored by rswindell's avatar rswindell
Browse files

Added support for global hot key external programs/modules.

parent 9155f781
No related branches found
No related tags found
No related merge requests found
......@@ -108,6 +108,13 @@ char sbbs_t::inkey(long mode)
if(ch<SP) { /* Control chars */
if(ch==LF) /* ignore LF's in not in raw mode */
return(0);
for(i=0;i<cfg.total_hotkeys;i++)
if(cfg.hotkey[i]->key==ch)
break;
if(i<cfg.total_hotkeys) {
external(cfg.hotkey[i]->cmd,0);
return(0);
}
if(ch==CTRL_O) { /* Ctrl-O toggles pause temporarily */
useron.misc^=UPAUSE;
return(0); }
......
......@@ -335,6 +335,11 @@ typedef struct { /* Command Shells */
} shell_t;
typedef struct {
uchar key;
char cmd[LEN_CMD+1];
} hotkey_t;
typedef struct
{
DWORD size; /* sizeof(scfg_t) */
......@@ -394,6 +399,8 @@ typedef struct
ushort total_gurus; /* Total number of guru files */
shell_t **shell; /* Command shells */
ushort total_shells; /* Total number of command shells */
hotkey_t **hotkey; /* Global hot keys */
ushort total_hotkeys; /* Total number of global hot keys */
/* COM port registers: */
ushort com_base, /* COM base address */
......
......@@ -625,6 +625,31 @@ BOOL read_xtrn_cfg(scfg_t* cfg, read_cfg_text_t* txt)
if(feof(instream)) break;
get_int(cfg->natvpgm[i]->misc,instream); }
/*******************/
/* Global Hot Keys */
/*******************/
get_int(cfg->total_hotkeys,instream);
if(cfg->total_hotkeys) {
if((cfg->hotkey=(hotkey_t **)MALLOC(sizeof(hotkey_t *)*cfg->total_hotkeys))==NULL)
return allocerr(txt,offset,fname,sizeof(hotkey_t *)*cfg->total_hotkeys); }
else
cfg->hotkey=NULL;
for(i=0;i<cfg->total_hotkeys;i++) {
if(feof(instream)) break;
if((cfg->hotkey[i]=(hotkey_t *)MALLOC(sizeof(hotkey_t)))==NULL)
return allocerr(txt,offset,fname,sizeof(hotkey_t));
memset(cfg->hotkey[i],0,sizeof(hotkey_t));
get_int(cfg->hotkey[i]->key,instream);
get_str(cfg->hotkey[i]->cmd,instream);
for(j=0;j<8;j++)
get_int(n,instream);
}
cfg->total_hotkeys=i;
fclose(instream);
if(txt->readit && txt->readit[0])
......
......@@ -1007,6 +1007,15 @@ BOOL DLLCALL write_xtrn_cfg(scfg_t* cfg, int backup_level)
for(i=0;i<cfg->total_natvpgms;i++)
put_int(cfg->natvpgm[i]->misc,stream);
put_int(cfg->total_hotkeys,stream);
for(i=0;i<cfg->total_hotkeys;i++) {
put_int(cfg->hotkey[i]->key,stream);
put_str(cfg->hotkey[i]->cmd,stream);
n=0;
for(j=0;j<8;j++)
put_int(n,stream);
}
fclose(stream);
return(TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment