⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtype.h

📁 SECS I, SECS II协议通讯源码
💻 H
字号:
/*
 * menus type definitions
 */
#ifndef TYPEDEF_H
#define TYPEDEF_H 0

// Basic types
#include "utype.h"

/* Character buffer size for local character buffers */
#define LOCAL_BUF_SIZE 160

// Per character, bit width and height
#define CharCols 8
#define CharRows 20
#define UnderlineRow 18

// Per screen, rows and cols
#define ScreenRows 24
#define ScreenCols 80

/* Box types */
//#define BX_OUTER  0
//#define BX_CURVED	9
//#define BX_INNER	18
//#define BX_DOUBLE	27
#define BX_THIN	1
#define BX_THICK 2
#define BX_IN 4
#define BX_OUT 8
#define BX_FULL 16
#define BX_THICKBUTTON (BX_THICK | BX_OUT)
#define BX_THINBUTTON ( BX_THIN | BX_OUT)
#define BX_THICKFIELD ( BX_THICK | BX_IN)
#define BX_THINFIELD (BX_THIN | BX_IN)

/* Colors */
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define LIGHTGRAY 7
#define DARKGRAY 8
#define LIGHTBLUE 9
#define LIGHTGREEN 10
#define LIGHTCYAN 11
#define LIGHTRED 12
#define LIGHTMAGENTA 13
#define YELLOW 14
#define WHITE 15

/* Rendition status flags */
#define RN_UPDATED  0x8000
#define RN_LOCKOUT 0x4000

#define RN_REVERSE 0x1000
#define RN_BLINK  0x0800
#define RN_BOLD   0x0400
#define RN_UNDERLINE  0x0200
#define RN_CONCEAL  0x0100

#define RN_BLUNKSTATE 0x0080
#define RN_BLUNKREVERSE 0x0040
#define RN_BLUNKUL 0x0020
#define RN_BLINKFAST 0x0010
#define RN_BLINKUL 0x0008

#define RN_WIDE   0x0004
#define RN_TALL		0x0002
//#define RN_TALLTOP  0x0002
//#define RN_TALLBOTTOM 0x0001
#define RN_PURETEXT	0x0001
#define RN_NEWMASK(a) ( ScreenLocked ? ((a) | RN_LOCKOUT | RN_UPDATED) \
          & ~(RN_BLUNKSTATE | RN_BLUNKUL | RN_BLUNKREVERSE) \
        : (a) & ~(RN_LOCKOUT | RN_UPDATED | RN_BLUNKSTATE | RN_BLUNKUL | RN_BLUNKREVERSE))
/* RGB update flag */
#define RGB_UPDATE_ALL -1
#define RGB_SELECT_RED 0
#define RGB_SELECT_GREEN 1
#define RGB_SELECT_BLUE 2

// Repaint flags
#define RP_DELETE 0x01
#define RP_ADD  0x02
#define RP_CONAME 0x10
#define RP_MENU 0x20
#define RP_SUBTITLE 0x40
#define RP_STATUSBOX 0x80
#define RP_ALARMS 0x100
#define RP_FIRST_INIT 0x200
#define RP_NONE 0
#define RP_FULL (RP_CONAME | RP_MENU | RP_SUBTITLE | RP_STATUSBOX | RP_ALARMS)

// Flags used when calling a user function during button ops
#define MF_BEFOREPRESS 0xc1
#define MF_AFTERPRESS 0xc2
#define MF_SCANNING 0xc3
#define MF_PRESET_CHANGE 0xc4
#define MF_VIDEOCOMPLETE 0xc5

/* Menu button video mode definitions */
#define VM_GENERIC    0xf0
#define VM_PB     0xf1
#define VM_MODIFY   0xf2
#define VM_MENU     0xf3
#define VM_VMENU		0xf4
#define VM_PRESET		0xf5
#define VM_BLINK		0xf6
#define VM_PRESS		0xf7
#define VM_EXITMENU	0xf8
#define VM_MAINMENU	0xf9
#define VM_SETPASS	0xfa
#define VM_CLEANSCREEN 0xfb
// Menu buton audio mode definitions
#define AM_NONE			0
#define AM_BEEP			1
#define AM_HOLD			3
#define AM_SPECIAL	4

// Color menu button ids
#define CB_EXIT 0xc0
#define CB_SAVE 0xc1
#define CB_USEOLD 0xc2
#define CB_USEDEFAULTS 0xc3

// Edit menu button ids
#define EB_CYCLE 0xc0
#define EB_DAY 0xc1
#define EB_DEL 0xc2
#define EB_INS 0xc3
#define EB_DOWN 0xc4
#define EB_LEFT 0xc5
#define EB_RIGHT 0xc6
#define EB_UP 0xc7
#define EB_CLEAR 0xc8
#define EB_ENTER 0xc9
#define EB_EXIT 0xca
#define EB_RUBOUT 0xcb
#define EB_SAVE 0xcc
#define EB_RESTORE 0xcd
#define EB_SPACE 0xce

// Preset menu button ids
#define MB_USEDEF 0xc0
#define MB_CLEAR 0xc1
#define MB_RUBOUT 0xc2
#define MB_EXIT 0xc3
#define MB_ENTER 0xc4

// Password menu button ids
#define PB_LOWEST 0xc0
#define PB_SHIFT 0xc0
#define PB_ENTER 0xc1
#define PB_CLEAR 0xc2
#define PB_RUBOUT 0xc3
#define PB_EXIT 0xc4
#define PB_SAVE 0xc5
#define PB_RESTORE 0xc6
#define PB_FACTORY 0xc7
#define PB_UP 0xc8
#define PB_DOWN 0xc9
#define PB_PAGE 0xca


// Status display button ids
#define SB_NEXT 0xc0
#define SB_LAST 0xc1
#define SB_METRIC 0xc2
#define SB_EXIT 0xc3

// Verify menu button ids
#define VF_YES 0xc0
#define VF_NO 0xc1
#define VF_QUIT 0xc2

// Verify menu return codes
#define VF_NONE      0x4000
#define VF_DISPLAYED 0x4001
#define VF_ERASED    0x4002
#define VF_COMPLETE  0x4003

/* Menu button flags */
#define MNP_FLOAT		0x0000
#define MNF_LASTITEM	0x0001
#define MNF_SHIDE		0x0002
#define MNF_DHIDE		0x0004
#define MNF_DISPLAY 0x0008
#define MNF_NOREMOTE 0x0010
#define MNF_NOSAVE 0x0020
#define MNF_NOPASSET 0x0040
#define MNF_INVISIBLE 0x080

// Alarm button was scanned as depressed
#define MBS_ALARM 0x4000
#define MBS_NONE -1

// Positions of boxes & buttons
typedef struct {
  int ulrow;      // UL row
  int ulcol;      // UL col
  int lrrow;      // LR row
  int lrcol;      // LR col
} BOX;

// Renditions structure
typedef struct {
  ushort state;     // Display flags
  BYTE fg;        // Foreground color
  BYTE bg;        // Background color
} REND;

// Rendition initialization structure
typedef struct {
  REND *variable; // The variable to initialize
  PTEXT *text;    // Rendition menu text
  REND value;     // the initial value
  REND work;      // Save space for the current rendition
} RENDINI;

// RGB colors
typedef struct {
  BYTE red;       // The RED intensity
  BYTE green;     // the GREEN intensity
  BYTE blue;      // the BLUE intensity
} RGBcolors;

// Each character on the screen
typedef struct {
  REND attrib;
  KJCHAR theChar;
} SCREENCHAR;


/* The following structures have data used by individual buttons in a menu */
/* Pushbuttons are represented by this structure */
typedef struct {
  BOOL *select; // Pointer to select boolean
  BOOL *on; // Pointer to on boolean
} PBREC;

// Preset buttons are represented by this structure
typedef struct {  PRESET *preset;// Preset value
          ACTUAL *actual;  //Actual value
          INTVAL *preset_list; // Pointer to list of presets
          int *preset_id; // Pointer to variable to use to select the preset
          INTVAL lolim, hilim; // Limits
	} PREREC;

// New menus are represented by this structure
typedef struct {
  void *themenu;  // Pointer to menu,
                  // is void because is a forward reference
  BOX *thebuttons; // Pointer to buttons to use
  int ButtonsPerMenu;  // Number of buttons on the menu
  int startofs;   // Menus can use this to pass up a first set of buttons
  int midofs;     // And to pass up a second set
  FUNC init;  	  // Initialize routine
  FUNC scan;    	// Scan routine
  FUNC paint;		  // Paint routine
} MENUREC;

// Verify questions lists look like this
typedef struct {
  PTEXT *text;    // The question
  BOOL answer;        // The correct answer
} QLIST;

// Verify menus are represented by this structure
typedef struct {
  MENUREC *menurecord;  // Pointer to menu button info
  BOX *fields; // Query fields
  PTEXT *message; // Message to display at top
  QLIST *questions; // Questions to ask
  int *state;
} VMENREC;

// Each button in a menu is represented by this structure
typedef struct {
      PTEXT *text;        // Text
      BYTE keyID; 				// Type of button
		  BYTE videoMode;		  // video mode
			BYTE audioMode;			// Audio mode
      BYTE paslvl;	      // Password level
      BYTE defpaslvl;     // Default password level
      BYTE hpos;          // Hold position
      uint flags;         // Other flags
      REND *rend;         // Rendition
      FUNC routine;       // Routine to execute (if non-zero)
      FUNCDATA data;      // Data passed to routine
      // Button-specific data
      union { void *generic;  // Generic pointer
        MENUREC *menurec; // Menu buttons use this
        PBREC *pbrec;     // Pushbuttons use this
        MODIFY *modrec;   // Modify buttons use this
        PREREC *prerec;   // Preset buttons use this
        VMENREC *vmenrec; // Verify buttons use this
          } q ;
	} MENU;

// Alarm state flags
#define MA_HIDDEN 0x0001
#define MA_GHOSTED  0x0002
#define MA_BLINKING 0x0004
#define MA_SOLID  0x0008

// Alarm items are each of this structure
typedef struct {
          PTEXT *text;    // text
          BOOL *current;  // Pointer to alarm  boolean
	  uint state;     // Current state
	} ALARM;

// STatus box entries have this format
typedef struct {
          PTEXT *text;    // text
          BOOL *current;  // Pointer to statusbox boolean
          REND *rend;     // Pointer to rendition
	} STATUSBOX;

// Various status display enty flags
#define SDI_NULLITEM	((PTEXT *) -1)
#define SDI_END		((PTEXT *) 0)
// Shortcuts for status display entries
#define SD_NULLITEM { SDI_NULLITEM, 0, 0, 0, 0, 0 }
#define SD_END    { SDI_END, 0, 0, 0, 0, 0 }

// Status display entries have this format
typedef struct {
     PTEXT *text;       // text
     BOOL *hidden;      // True if to hide entry
     REND *textrend;    // Rendition of text
     PRESET *preset;    // Preset value
     ACTUAL *actual;    // Actual value
     REND *valuerend;   // Rendition of numbers
	} STATUSITEM;

// Each status display is represented by this structure
typedef struct {
      PTEXT *text;      // Name of display
      STATUSITEM *item; // Pointer to list of items
		} STATUSDISPLAY;
#endif /* TYPEDEF_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -