home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
dmenu1.zip
/
DM10SRC.ZIP
/
MENU.H
< prev
next >
Wrap
Text File
|
1991-10-15
|
7KB
|
228 lines
#define byte unsigned char
#define MAX_LINE 140
#define MAX_FILE_NAME 80
#define MAX_VARS 9
#define MAX_PALETTES 10
#define PALETTE_SIZE 7
#define MAX_TIME_STR 34
#define MAX_RECURSION 11
#define LEAVE_QUERY_MODE 13
#define CENTER 255
/***************************************************************************/
typedef enum { NO, YES } boolean;
/***************************************************************************/
typedef enum { BACK, TEXT, TITLE, BORDER, HIGHLIGHT, S_BACK, SELECT }
palette_colors;
/***************************************************************************/
typedef enum { MEMORY, FILE_OPEN, SYNTAX, VALUE, POSITION, DISPLAY, ENVIROMENT }
error_type;
/***************************************************************************/
typedef enum { NO_ACTION, MOVE_UP, MOVE_DOWN, GOTO_TOP, GOTO_END, GOTO_ITEM,
DO_ITEM, ESCAPE, TIMER, QUERY, FUNCTION_KEY } action_type;
/***************************************************************************/
struct linked_text
{
struct linked_text *next_line;
char text_line[1];
};
typedef struct linked_text Linked_Text;
/***************************************************************************/
struct item
{
byte title_length, item_number;
struct item *next_item,*last_item;
struct linked_text *first_line;
char title[1];
};
typedef struct item Item;
/***************************************************************************/
struct menu
{
byte offset_x, offset_y, palette, number_of_items,
title_length, longest_title;
struct menu *next_menu;
struct item *first_item;
char title[1];
};
typedef struct menu Menu;
/***************************************************************************/
struct window_record
{
Menu *menu;
Item *item;
int *storage;
byte left, right, width, top, bottom, height;
action_type event;
};
typedef struct window_record Window_Record;
/***************************************************************************/
struct event
{
action_type action;
byte data;
};
typedef struct event Event;
/***************************************************************************/
struct vars
{
char *name, *value;
Linked_Text *text;
};
typedef struct vars Vars;
/***************************************************************************/
/* palettes */
/* BACKground, TEXT, TITLE, BORDER, HIGHLIGHT, Selection BACKground, SELECTion */
byte palette[ MAX_PALETTES ][ PALETTE_SIZE ] = {
{1,15,15,15,14,7,1},{3,1,1,1,1,0,15},
{4,14,14,14,14,7,15},{7,5,1,15,15,5,15},
{0,12,15,1,9,7,1},{0,12,13,1,9,7,15},
{0,11,15,8,7,2,15},{2,0,15,10,14,0,10},
{0,7,15,7,15,7,0},{7,0,0,0,0,0,7} };
/***************************************************************************/
/*Global Variables */
/* global menu defaults */
byte default_x = CENTER, default_y = CENTER,
default_palette, header_palette, error_palette,
message_palette, backdrop_color, footer_color,
backdrop_char = '░', cascade_x = 4, cascade_y = 1;
boolean exitable = YES, shadow = NO, cascade = NO;
/* global pointers */
Menu *first_menu, *current_menu;
Item *current_item;
Linked_Text *current_text;
int far *video_start;
char *current_file;
/* working records */
Window_Record Win[MAX_RECURSION+1];
Event event;
byte win_index;
/* working window */
byte top, bottom, left, right, height, width;
/* file names */
char *backdrop_file = NULL,
far *temp_bat;
/* timers */
byte current_minute = 61,
timer, timer_holder;
/* special items */
Item *timer_text = NULL;
Item *function_key[11];
/* video varibles */
boolean color_monitor;
byte max_screen_x, max_screen_y;
/* mouse variables */
byte last_button, last_x, last_y;
/* shadow stuff */
byte shadow_color, *shad_buf;
/* other variables */
byte l_len;
unsigned int line_count;
boolean first_run;
/***************************************************************************/
/* procedure definitions */
void exit( int );
void Critical_Error(error_type error, char *error_string);
Menu *Allocate_Menu( void );
Item *Allocate_Item( void );
Linked_Text *Allocate_Linked_Text( void );
void Read_Line(char *t_line, FILE *Script );
boolean _fastcall Compare(char *string1, char *string2);
char *After_Space(char *place);
char *After_Equals(char *place);
char *After_Comma(char *place);
byte Get_Palette(char *place, byte def_value);
byte Get_Color(char *place,byte def_value);
byte Get_Value(char *place, byte def_value);
void Parse_Command(char *place,FILE *Script);
void Parse_Menu(char t_line[]);
void Parse_Item(char t_line[]);
void Parse_Item_Text(char t_line[]);
void Parse_Engine( void );
void Parse( char dos_param_1[] );
void Include( char *place );
void Break_Off(void);
void _fastcall Draw(byte x,byte y,char thing,byte color);
byte _fastcall Read_Color(byte x, byte y);
void _fastcall Put_Color(byte x,byte y,byte color);
void _fastcall Fill_Screen(char thing,byte color);
void Hide_Cursor( void );
void Show_Cursor( void );
void Hide_Mouse( void );
void Show_Mouse( void );
void _fastcall Put_Cursor(byte col,byte row);
void Clean_Up( void );
int *Store_Screen(byte x1,byte x2,byte y1,byte y2);
void Restore_Screen(int *storage_addr,byte x1,byte x2,byte y1,byte y2);
void Display_Menu(Item *hi_item);
void Select(Item *new_item);
void Display_Text_Box(char *lines[],byte x1,byte x2,byte y1,byte y2,byte pal);
void Error_Box(char line1[],char line2[]);
void Display_Shadow( byte x1, byte x2, byte y1, byte y2);
void Remove_Shadow( byte x1, byte x2, byte y1, byte y2);
void Blank_Screen( void );
void Update_Time( void );
byte Old_Window(byte x,byte y);
void Update_Mouse( void );
void Scan_For_Letter(char key_input );
void Get_Key_Input( void );
void Wait_For_Event( void );
boolean Windowfy_Menu(Menu *menu);
Item *Number_To_Item(byte number);
Item *Home_Item( void );
Item *End_Item( void );
Item *Move_Up( void );
Item *Move_Down( void );
void Last_Window_Globals( void );
void Remove_Window(byte number_to_remove);
Menu *Find_Menu(char menu_to_find[]);
void Execute_Item( void );
byte Do_Query_Window( Menu *query );
void Exit_Query( void );
void Get_Key_String(char string[],byte x,byte y,byte color);
void String_Query(char *place, char temp[] );
void Choice_Query(char *place, char temp[] );
void Make_Batch( void );
void Monochrome_Defaults( void );
void Get_Video_Info( void );
void Display_Title_Screen( void );
void Set_Up_Enviroment( void );
void Set_Up_Mouse( void );
void Draw_Backdrop( void );
void Draw_Header( void );
void Draw_Footer( void );
void Set_Up_Screen( void );
void main( int argc, char *argv[] );