Category : Files from Magazines
Archive   : DDJSRC.ZIP
Filename : TESTMENU.C

 
Output of file : TESTMENU.C contained in archive : DDJSRC.ZIP
/* --------- testmenu.c ------------ */
#include
#include
#include "window.h"
#include "menu.h"

/* ---------- menu tables --------- */
static char *fselcs[] = {
"Load",
"Save",
"New",
"Quit [Esc]",
NULL
};

static char *eselcs[] = {
"Move [F3]",
"Copy [F4]",
"Delete [F8]",
"Find [F7]",
NULL
};

static char *oselcs[] = {
"Auto Paragraph Reformat ",
"Insert [Ins] ",
NULL
};

static int quit(int,int);
static int reform(int, int);
static int insert(int, int);
static void set_toggles(void);

static char forced[] = {F3,F4,F8,F7};

static char options[] = {'a', INS};

static int (*ffuncs[])()={NULL,NULL,NULL,quit};
static int (*efuncs[])()={NULL,NULL,NULL,NULL};
static int (*ofuncs[])()={reform,insert};

static char filehelp[] =
"Load a file, Save current buffer, Type a new file, Quit";
static char edithelp[] =
"Move, Copy, Delete blocks, Find a string";
static char optnhelp[] =
"Toggle editor options";

MENU emn [] = {
{"File", filehelp, fselcs, NULL, "", ffuncs, 0},
{"Edit", edithelp, eselcs, NULL, forced, efuncs, 0},
{"Options", optnhelp, oselcs, NULL, options, ofuncs, 0},
{NULL}
};

void main()
{
set_toggles();
clear_screen();
menu_select(emn, 1);
clear_screen();
}

/* ---- illustrates toggled menu mode selectors -------- */
int reforming, inserting; /* these are mode variables */

static int reform(hs,vs)
{
reforming ^= TRUE;
set_toggles();
return FALSE;
}

static int insert(hs,vs)
{
inserting ^= TRUE;
set_toggles();
return FALSE;
}

static void set_toggles()
{
strcpy(&oselcs[0][24], reforming ? "(on) " : "(off)");
strcpy(&oselcs[1][24], inserting ? "(on) " : "(off)");
}

/* ---- when TRUE is returned, the menu system exits ----- */
static int quit(hs,vs)
{
return TRUE;
}


  3 Responses to “Category : Files from Magazines
Archive   : DDJSRC.ZIP
Filename : TESTMENU.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/