Started work on seperating dflat32 console graphics library in to a dll

inital header import.

svn path=/trunk/; revision=2775
This commit is contained in:
Steven Edwards 2002-03-24 15:29:09 +00:00
parent 9ab896569c
commit 7f0bfc685d
13 changed files with 1252 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/* ---------------- classdef.h --------------- */
#ifndef CLASSDEF_H
#define CLASSDEF_H
typedef struct classdefs {
DFCLASS base; /* base window class */
int (*wndproc)(struct window *,enum messages,PARAM,PARAM);
int attrib;
} CLASSDEFS;
extern CLASSDEFS classdefs[];
#define SHADOW 0x0001
#define MOVEABLE 0x0002
#define SIZEABLE 0x0004
#define HASMENUBAR 0x0008
#define VSCROLLBAR 0x0010
#define HSCROLLBAR 0x0020
#define VISIBLE 0x0040
#define SAVESELF 0x0080
#define HASTITLEBAR 0x0100
#define CONTROLBOX 0x0200
#define MINMAXBOX 0x0400
#define NOCLIP 0x0800
#define READONLY 0x1000
#define MULTILINE 0x2000
#define HASBORDER 0x4000
#define HASSTATUSBAR 0x8000
#endif

View file

@ -0,0 +1,56 @@
/* ----------- classes.h ------------ */
/*
* Class definition source file
* Make class changes to this source file
* Other source files will adapt
*
* You must add entries to the color tables in
* CONFIG.C for new classes.
*
* Class Name Base Class Processor Attribute
* ------------ --------- --------------- -----------
*/
ClassDef( NORMAL, -1, NormalProc, 0 )
ClassDef( APPLICATION, NORMAL, ApplicationProc, VISIBLE |
SAVESELF |
CONTROLBOX )
ClassDef( TEXTBOX, NORMAL, TextBoxProc, 0 )
//ClassDef( LISTBOX, TEXTBOX, ListBoxProc, 0 )
ClassDef( EDITBOX, TEXTBOX, EditBoxProc, 0 )
ClassDef( MENUBAR, NORMAL, MenuBarProc, NOCLIP )
ClassDef( POPDOWNMENU, LISTBOX, PopDownProc, SAVESELF |
NOCLIP |
HASBORDER )
#ifdef INCLUDE_PICTUREBOX
ClassDef( PICTUREBOX, TEXTBOX, PictureProc, 0 )
#endif
ClassDef( DIALOG, NORMAL, DialogProc, SHADOW |
MOVEABLE |
CONTROLBOX|
HASBORDER |
NOCLIP )
ClassDef( BOX, NORMAL, BoxProc, HASBORDER )
//ClassDef( BUTTON, TEXTBOX, ButtonProc, SHADOW )
//ClassDef( COMBOBOX, EDITBOX, ComboProc, 0 )
ClassDef( TEXT, TEXTBOX, TextProc, 0 )
ClassDef( RADIOBUTTON, TEXTBOX, RadioButtonProc, 0 )
ClassDef( CHECKBOX, TEXTBOX, CheckBoxProc, 0 )
ClassDef( SPINBUTTON, LISTBOX, SpinButtonProc, 0 )
ClassDef( ERRORBOX, DIALOG, NULL, SHADOW |
HASBORDER )
ClassDef( MESSAGEBOX, DIALOG, NULL, SHADOW |
HASBORDER )
ClassDef( HELPBOX, DIALOG, HelpBoxProc, MOVEABLE |
SAVESELF |
HASBORDER |
NOCLIP |
CONTROLBOX )
ClassDef( STATUSBAR, TEXTBOX, StatusBarProc, NOCLIP )
/*
* ========> Add new classes here <========
*/
/* ---------- pseudo classes to create enums, etc. ---------- */
ClassDef( TITLEBAR, -1, NULL, 0 )
ClassDef( DUMMY, -1, NULL, HASBORDER )

View file

@ -0,0 +1,121 @@
/* ---------------- commands.h ----------------- */
/*
* Command values sent as the first parameter
* in the COMMAND message
*
* Add application-specific commands to this enum
*/
#ifndef COMMANDS_H
#define COMMANDS_H
enum commands {
/* --------------- File menu ---------------- */
ID_OPEN,
ID_NEW,
ID_SAVE,
ID_SAVEAS,
ID_DELETEFILE,
ID_PRINT,
ID_PRINTSETUP,
ID_DOS,
ID_EXIT,
/* --------------- Edit menu ---------------- */
ID_UNDO,
ID_CUT,
ID_COPY,
ID_PASTE,
ID_PARAGRAPH,
ID_CLEAR,
ID_DELETETEXT,
/* --------------- Search Menu -------------- */
ID_SEARCH,
ID_REPLACE,
ID_SEARCHNEXT,
/* --------------- Utilities Menu ------------- */
ID_CALENDAR,
ID_BARCHART,
/* -------------- Options menu -------------- */
ID_INSERT,
ID_WRAP,
ID_LOG,
ID_TABS,
ID_DISPLAY,
ID_SAVEOPTIONS,
/* --------------- Window menu -------------- */
ID_CLOSEALL,
ID_WINDOW,
ID_MOREWINDOWS,
/* --------------- Help menu ---------------- */
ID_HELPHELP,
ID_EXTHELP,
ID_KEYSHELP,
ID_HELPINDEX,
ID_ABOUT,
ID_LOADHELP,
/* --------------- System menu -------------- */
#ifdef INCLUDE_RESTORE
ID_SYSRESTORE,
#endif
ID_SYSMOVE,
ID_SYSSIZE,
#ifdef INCLUDE_MINIMIZE
ID_SYSMINIMIZE,
#endif
#ifdef INCLUDE_MAXIMIZE
ID_SYSMAXIMIZE,
#endif
ID_SYSCLOSE,
/* ---- FileOpen and SaveAs dialog boxes ---- */
ID_FILENAME,
ID_FILES,
ID_DRIVE,
ID_PATH,
/* ----- Search and Replace dialog boxes ---- */
ID_SEARCHFOR,
ID_REPLACEWITH,
ID_MATCHCASE,
ID_REPLACEALL,
/* ----------- Windows dialog box ----------- */
ID_WINDOWLIST,
/* --------- generic command buttons -------- */
ID_OK,
ID_CANCEL,
ID_HELP,
/* -------------- TabStops menu ------------- */
ID_TAB2,
ID_TAB4,
ID_TAB6,
ID_TAB8,
/* ------------ Display dialog box ---------- */
ID_BORDER,
ID_TITLE,
ID_STATUSBAR,
ID_TEXTURE,
ID_SNOWY,
ID_COLOR,
ID_MONO,
ID_REVERSE,
ID_25LINES,
ID_43LINES,
ID_50LINES,
/* ------------- Log dialog box ------------- */
ID_LOGLIST,
ID_LOGGING,
/* ------------ HelpBox dialog box ---------- */
ID_HELPTEXT,
ID_BACK,
ID_PREV,
ID_NEXT,
/* ---------- Print Select dialog box --------- */
ID_PRINTERPORT,
ID_LEFTMARGIN,
ID_RIGHTMARGIN,
ID_TOPMARGIN,
ID_BOTTOMMARGIN,
/* ----------- InputBox dialog box ------------ */
ID_INPUTTEXT
};
#endif

View file

@ -0,0 +1,48 @@
/* ---------------- config.h -------------- */
#ifndef CONFIG_H
#define CONFIG_H
enum colortypes {
STD_COLOR,
SELECT_COLOR,
FRAME_COLOR,
HILITE_COLOR
};
enum grounds { FG, BG };
/* ----------- configuration parameters ----------- */
typedef struct config {
char version[sizeof VERSION];
BOOL InsertMode; /* Editor insert mode */
int Tabs; /* Editor tab stops */
BOOL WordWrap; /* True to word wrap editor */
#ifdef INCLUDE_WINDOWOPTIONS
BOOL Border; /* True for application window border */
BOOL Title; /* True for application window title */
BOOL StatusBar; /* True for appl'n window status bar */
BOOL Texture; /* True for textured appl window */
#endif
// int ScreenLines; /* Number of screen lines (25/43/50) */
char PrinterPort[5];
int LinesPage; /* Lines per printer page */
int CharsLine; /* Characters per printer line */
int LeftMargin; /* Printer margins */
int RightMargin;
int TopMargin;
int BottomMargin;
unsigned char clr[CLASSCOUNT] [4] [2]; /* Colors */
} CONFIG;
extern CONFIG cfg;
extern unsigned char color[CLASSCOUNT] [4] [2];
extern unsigned char bw[CLASSCOUNT] [4] [2];
extern unsigned char reverse[CLASSCOUNT] [4] [2];
BOOL LoadConfig(void);
void SaveConfig(void);
FILE *OpenConfig(char *);
#endif

View file

@ -0,0 +1,487 @@
/* ------------- dflat.h ----------- */
#ifndef DFLAT_H
#define DFLAT_H
//#ifdef BUILD_FULL_DFLAT
#define INCLUDE_MULTI_WINDOWS
#define INCLUDE_LOGGING
#define INCLUDE_SHELLDOS
#define INCLUDE_WINDOWOPTIONS
#define INCLUDE_PICTUREBOX
#define INCLUDE_MINIMIZE
#define INCLUDE_MAXIMIZE
#define INCLUDE_RESTORE
#define INCLUDE_EXTENDEDSELECTIONS
//#endif
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <process.h>
#include <conio.h>
#include <ctype.h>
#include <io.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <time.h>
#include <setjmp.h>
#ifndef VERSION
#define VERSION "Beta Version 0.3"
#endif
void *DFcalloc(size_t, size_t);
void *DFmalloc(size_t);
void *DFrealloc(void *, size_t);
#define MAXMESSAGES 50
#define DELAYTICKS 1
#define FIRSTDELAY 7
#define DOUBLETICKS 5
#define MAXTEXTLEN 65000U /* maximum text buffer */
#define EDITLEN 1024 /* starting length for multiliner */
#define ENTRYLEN 256 /* starting length for one-liner */
#define GROWLENGTH 64 /* buffers grow by this much */
#include "system.h"
#include "config.h"
#include "rect.h"
#include "menu.h"
#include "keys.h"
#include "commands.h"
#include "dialbox.h"
/* ------ integer type for message parameters ----- */
typedef long PARAM;
enum Condition
{
ISRESTORED, ISMINIMIZED, ISMAXIMIZED, ISCLOSING
};
typedef struct window
{
DFCLASS class; /* window class */
char *title; /* window title */
int (*wndproc)(struct window *, enum messages, PARAM, PARAM);
/* ----------------- window colors -------------------- */
char WindowColors[4][2];
/* ---------------- window dimensions ----------------- */
DFRECT rc; /* window coordinates (0/0 to 79/24) */
int ht, wd; /* window height and width */
DFRECT RestoredRC; /* restored condition rect */
/* -------------- linked list pointers ---------------- */
struct window *parent; /* parent window */
struct window *firstchild; /* first child this parent */
struct window *lastchild; /* last child this parent */
struct window *nextsibling; /* next sibling */
struct window *prevsibling; /* previous sibling */
struct window *childfocus; /* child that ha(s/d) focus */
int attrib; /* Window attributes */
PCHAR_INFO videosave; /* video save buffer */
enum Condition condition; /* Restored, Maximized,
Minimized, Closing */
enum Condition oldcondition;/* previous condition */
int restored_attrib; /* attributes when restored */
void *extension; /* menus, dialogs, documents, etc */
struct window *PrevMouse;
struct window *PrevKeyboard;
struct window *MenuBarWnd;/* menu bar */
struct window *StatusBar; /* status bar */
int isHelping; /* > 0 when help is being displayed */
/* ----------------- text box fields ------------------ */
int wlines; /* number of lines of text */
int wtop; /* text line that is on the top display */
unsigned char *text; /* window text */
unsigned int textlen; /* text length */
int wleft; /* left position in window viewport */
int textwidth; /* width of longest line in textbox */
int BlkBegLine; /* beginning line of marked block */
int BlkBegCol; /* beginning column of marked block */
int BlkEndLine; /* ending line of marked block */
int BlkEndCol; /* ending column of marked block */
int HScrollBox; /* position of horizontal scroll box */
int VScrollBox; /* position of vertical scroll box */
unsigned int *TextPointers; /* -> list of line offsets */
/* ----------------- list box fields ------------------ */
int selection; /* current selection */
BOOL AddMode; /* adding extended selections mode */
int AnchorPoint;/* anchor point for extended selections */
int SelectCount;/* count of selected items */
/* ----------------- edit box fields ------------------ */
int CurrCol; /* Current column */
int CurrLine; /* Current line */
int WndRow; /* Current window row */
BOOL TextChanged; /* TRUE if text has changed */
unsigned char *DeletedText; /* for undo */
unsigned DeletedLength; /* Length of deleted field */
BOOL InsertMode; /* TRUE or FALSE for text insert */
BOOL WordWrapMode; /* TRUE or FALSE for word wrap */
unsigned int MaxTextLength; /* maximum text length */
/* ---------------- dialog box fields ----------------- */
int ReturnCode; /* return code from a dialog box */
BOOL Modal; /* True if a modeless dialog box */
CTLWINDOW *ct; /* control structure */
struct window *dfocus; /* control window that has focus */
/* -------------- popdownmenu fields ------------------ */
MENU *mnu; /* points to menu structure */
MBAR *holdmenu; /* previous active menu */
struct window *oldFocus;
/* --------------- help box fields -------------------- */
void *firstword; /* -> first in list of key words */
void *lastword; /* -> last in list of key words */
void *thisword; /* -> current in list of key words */
/* -------------- status bar fields ------------------- */
BOOL TimePosted; /* True if time has been posted */
#ifdef INCLUDE_PICTUREBOX
/* ------------- picture box fields ------------------- */
int VectorCount; /* number of vectors in vector list */
void *VectorList; /* list of picture box vectors */
#endif
} * DFWINDOW;
#include "classdef.h"
#include "video.h"
void LogMessages (DFWINDOW, DFMESSAGE, PARAM, PARAM);
void MessageLog(DFWINDOW);
/* ------- window methods ----------- */
#define ICONHEIGHT 3
#define ICONWIDTH 10
#define WindowHeight(w) ((w)->ht)
#define WindowWidth(w) ((w)->wd)
#define BorderAdj(w) (TestAttribute(w,HASBORDER)?1:0)
#define BottomBorderAdj(w) (TestAttribute(w,HASSTATUSBAR)?1:BorderAdj(w))
#define TopBorderAdj(w) ((TestAttribute(w,HASTITLEBAR) && \
TestAttribute(w,HASMENUBAR)) ? \
2 : (TestAttribute(w,HASTITLEBAR | \
HASMENUBAR | HASBORDER) ? 1 : 0))
#define ClientWidth(w) (WindowWidth(w)-BorderAdj(w)*2)
#define ClientHeight(w) (WindowHeight(w)-TopBorderAdj(w)-\
BottomBorderAdj(w))
#define WindowRect(w) ((w)->rc)
#define GetTop(w) (RectTop(WindowRect(w)))
#define GetBottom(w) (RectBottom(WindowRect(w)))
#define GetLeft(w) (RectLeft(WindowRect(w)))
#define GetRight(w) (RectRight(WindowRect(w)))
#define GetClientTop(w) (GetTop(w)+TopBorderAdj(w))
#define GetClientBottom(w) (GetBottom(w)-BottomBorderAdj(w))
#define GetClientLeft(w) (GetLeft(w)+BorderAdj(w))
#define GetClientRight(w) (GetRight(w)-BorderAdj(w))
#define GetTitle(w) ((w)->title)
#define GetParent(w) ((w)->parent)
#define FirstWindow(w) ((w)->firstchild)
#define LastWindow(w) ((w)->lastchild)
#define NextWindow(w) ((w)->nextsibling)
#define PrevWindow(w) ((w)->prevsibling)
#define GetClass(w) ((w)->class)
#define GetAttribute(w) ((w)->attrib)
#define AddAttribute(w,a) (GetAttribute(w) |= a)
#define ClearAttribute(w,a) (GetAttribute(w) &= ~(a))
#define TestAttribute(w,a) (GetAttribute(w) & (a))
#define isHidden(w) (!(GetAttribute(w) & VISIBLE))
#define SetVisible(w) (GetAttribute(w) |= VISIBLE)
#define ClearVisible(w) (GetAttribute(w) &= ~VISIBLE)
#define gotoxy(w,x,y) cursor(w->rc.lf+(x)+1,w->rc.tp+(y)+1)
BOOL isVisible(DFWINDOW);
DFWINDOW DfCreateWindow(DFCLASS,char *,int,int,int,int,void*,DFWINDOW,
int (*)(struct window *,enum messages,PARAM,PARAM),int);
void AddTitle(DFWINDOW, char *);
void InsertTitle(DFWINDOW, char *);
void DisplayTitle(DFWINDOW, DFRECT *);
void RepaintBorder(DFWINDOW, DFRECT *);
void PaintShadow(DFWINDOW);
void ClearWindow(DFWINDOW, DFRECT *, int);
void writeline(DFWINDOW, char *, int, int, BOOL);
void InitWindowColors(DFWINDOW);
void SetNextFocus(void);
void SetPrevFocus(void);
void RemoveWindow(DFWINDOW);
void AppendWindow(DFWINDOW);
void ReFocus(DFWINDOW);
void SkipApplicationControls(void);
BOOL CharInView(DFWINDOW, int, int);
void CreatePath(char *, char *, int, int);
#define SwapVideoBuffer(wnd, ish, fh) swapvideo(wnd, wnd->videosave, ish, fh)
int LineLength(char *);
DFRECT AdjustRectangle(DFWINDOW, DFRECT);
BOOL isDerivedFrom(DFWINDOW, DFCLASS);
DFWINDOW GetAncestor(DFWINDOW);
void PutWindowChar(DFWINDOW,char,int,int);
void PutWindowLine(DFWINDOW, void *,int,int);
#define BaseWndProc(class,wnd,msg,p1,p2) \
(*classdefs[(classdefs[class].base)].wndproc)(wnd,msg,p1,p2)
#define DefaultWndProc(wnd,msg,p1,p2) \
(classdefs[wnd->class].wndproc == NULL) ? \
BaseWndProc(wnd->class,wnd,msg,p1,p2) : \
(*classdefs[wnd->class].wndproc)(wnd,msg,p1,p2)
struct LinkedList {
DFWINDOW FirstWindow;
DFWINDOW LastWindow;
};
extern DFWINDOW ApplicationWindow;
extern DFWINDOW inFocus;
extern DFWINDOW CaptureMouse;
extern DFWINDOW CaptureKeyboard;
extern int foreground, background;
extern BOOL WindowMoving;
extern BOOL WindowSizing;
extern BOOL VSliding;
extern BOOL HSliding;
extern char DFlatApplication[];
extern char *Clipboard;
extern unsigned ClipboardLength;
extern BOOL ClipString;
/* --------- space between menubar labels --------- */
#define MSPACE 2
/* --------------- border characters ------------- */
#define FOCUS_NW (unsigned char) '\xc9'
#define FOCUS_NE (unsigned char) '\xbb'
#define FOCUS_SE (unsigned char) '\xbc'
#define FOCUS_SW (unsigned char) '\xc8'
#define FOCUS_SIDE (unsigned char) '\xba'
#define FOCUS_LINE (unsigned char) '\xcd'
#define NW (unsigned char) '\xda'
#define NE (unsigned char) '\xbf'
#define SE (unsigned char) '\xd9'
#define SW (unsigned char) '\xc0'
#define SIDE (unsigned char) '\xb3'
#define LINE (unsigned char) '\xc4'
#define LEDGE (unsigned char) '\xc3'
#define REDGE (unsigned char) '\xb4'
/* ------------- scroll bar characters ------------ */
#define UPSCROLLBOX (unsigned char) '\x1e'
#define DOWNSCROLLBOX (unsigned char) '\x1f'
#define LEFTSCROLLBOX (unsigned char) '\x11'
#define RIGHTSCROLLBOX (unsigned char) '\x10'
#define SCROLLBARCHAR (unsigned char) 176
#define SCROLLBOXCHAR (unsigned char) 178
/* ------------------ menu characters --------------------- */
#define CHECKMARK (unsigned char) '\x04' //(SCREENHEIGHT==25?251:4)
#define CASCADEPOINTER (unsigned char) '\x10'
/* ----------------- title bar characters ----------------- */
#define CONTROLBOXCHAR (unsigned char) '\xf0'
#define MAXPOINTER 24 /* maximize token */
#define MINPOINTER 25 /* minimize token */
#define RESTOREPOINTER 18 /* restore token */
/* --------------- text control characters ---------------- */
#define APPLCHAR (unsigned char) 176 /* fills application window */
#define SHORTCUTCHAR '~' /* prefix: shortcut key display */
#define CHANGECOLOR (unsigned char) 174 /* prefix to change colors */
#define RESETCOLOR (unsigned char) 175 /* reset colors to default */
#define LISTSELECTOR 4 /* selected list box entry */
/* --------- message prototypes ----------- */
BOOL DfInitialize (void);
void DfTerminate (void);
void DfPostMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM);
int DfSendMessage (DFWINDOW, DFMESSAGE, PARAM, PARAM);
BOOL DfDispatchMessage (void);
void handshake(void);
SHORT DfGetScreenHeight (void);
SHORT DfGetScreenWidth (void);
/* ---- standard window message processing prototypes ----- */
int ApplicationProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int NormalProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int TextBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int ListBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int EditBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int PictureProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int MenuBarProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int PopDownProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int ButtonProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int ComboProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int TextProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int RadioButtonProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int CheckBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int SpinButtonProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int BoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int DialogProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int SystemMenuProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int HelpBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int MessageBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int CancelBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int ErrorBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int YesNoBoxProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int StatusBarProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
int WatchIconProc(DFWINDOW, DFMESSAGE, PARAM, PARAM);
/* ------------- normal box prototypes ------------- */
void SetStandardColor(DFWINDOW);
void SetReverseColor(DFWINDOW);
BOOL isAncestor(DFWINDOW, DFWINDOW);
#define HitControlBox(wnd, p1, p2) \
(TestAttribute(wnd, CONTROLBOX) && \
p1 == 2 && p2 == 0)
#define WndForeground(wnd) \
(wnd->WindowColors [STD_COLOR] [FG])
#define WndBackground(wnd) \
(wnd->WindowColors [STD_COLOR] [BG])
#define FrameForeground(wnd) \
(wnd->WindowColors [FRAME_COLOR] [FG])
#define FrameBackground(wnd) \
(wnd->WindowColors [FRAME_COLOR] [BG])
#define SelectForeground(wnd) \
(wnd->WindowColors [SELECT_COLOR] [FG])
#define SelectBackground(wnd) \
(wnd->WindowColors [SELECT_COLOR] [BG])
#define HighlightForeground(wnd) \
(wnd->WindowColors [HILITE_COLOR] [FG])
#define HighlightBackground(wnd) \
(wnd->WindowColors [HILITE_COLOR] [BG])
#define WindowClientColor(wnd, fg, bg) \
WndForeground(wnd) = fg, WndBackground(wnd) = bg
#define WindowReverseColor(wnd, fg, bg) \
SelectForeground(wnd) = fg, SelectBackground(wnd) = bg
#define WindowFrameColor(wnd, fg, bg) \
FrameForeground(wnd) = fg, FrameBackground(wnd) = bg
#define WindowHighlightColor(wnd, fg, bg) \
HighlightForeground(wnd) = fg, HighlightBackground(wnd) = bg
/* -------- text box prototypes ---------- */
#define TextLine(wnd, sel) \
(wnd->text + *((wnd->TextPointers) + sel))
void WriteTextLine(DFWINDOW, DFRECT *, int, BOOL);
#define TextBlockMarked(wnd) ( wnd->BlkBegLine || \
wnd->BlkEndLine || \
wnd->BlkBegCol || \
wnd->BlkEndCol)
void MarkTextBlock(DFWINDOW, int, int, int, int);
#define ClearTextBlock(wnd) wnd->BlkBegLine = wnd->BlkEndLine = \
wnd->BlkBegCol = wnd->BlkEndCol = 0;
#define GetText(w) ((w)->text)
#define GetTextLines(w) ((w)->wlines)
void ClearTextPointers(DFWINDOW);
void BuildTextPointers(DFWINDOW);
int TextLineNumber(DFWINDOW, char *);
/* ------------ Clipboard prototypes ------------- */
void CopyTextToClipboard(char *);
void CopyToClipboard(DFWINDOW);
#define PasteFromClipboard(wnd) PasteText(wnd,Clipboard,ClipboardLength)
BOOL PasteText(DFWINDOW, char *, unsigned);
void ClearClipboard(void);
/* --------- menu prototypes ---------- */
int CopyCommand(unsigned char *, unsigned char *, int, int);
void PrepFileMenu(void *, struct Menu *);
void PrepEditMenu(void *, struct Menu *);
void PrepSearchMenu(void *, struct Menu *);
void PrepWindowMenu(void *, struct Menu *);
void BuildSystemMenu(DFWINDOW);
BOOL isActive(MBAR *, int);
char *GetCommandText(MBAR *, int);
BOOL isCascadedCommand(MBAR *,int);
void ActivateCommand(MBAR *,int);
void DeactivateCommand(MBAR *,int);
BOOL GetCommandToggle(MBAR *,int);
void SetCommandToggle(MBAR *,int);
void ClearCommandToggle(MBAR *,int);
void InvertCommandToggle(MBAR *,int);
int BarSelection(int);
/* ------------- list box prototypes -------------- */
BOOL ItemSelected(DFWINDOW, int);
/* ------------- edit box prototypes ----------- */
#define CurrChar (TextLine(wnd, wnd->CurrLine)+wnd->CurrCol)
#define WndCol (wnd->CurrCol-wnd->wleft)
#define isMultiLine(wnd) TestAttribute(wnd, MULTILINE)
void DfSearchText(DFWINDOW);
void DfReplaceText(DFWINDOW);
void DfSearchNext(DFWINDOW);
/* --------- message box prototypes -------- */
DFWINDOW SliderBox(int, char *, char *);
BOOL InputBox(DFWINDOW, char *, char *, char *, int);
BOOL GenericMessage(DFWINDOW, char *, char *, int,
int (*)(struct window *, enum messages, PARAM, PARAM),
char *, char *, int, int, int);
#define DfTestErrorMessage(msg) \
GenericMessage(NULL, "Error", msg, 2, ErrorBoxProc, \
Ok, Cancel, ID_OK, ID_CANCEL, TRUE)
#define DfErrorMessage(msg) \
GenericMessage(NULL, "Error", msg, 1, ErrorBoxProc, \
Ok, NULL, ID_OK, 0, TRUE)
#define DfMessageBox(ttl, msg) \
GenericMessage(NULL, ttl, msg, 1, MessageBoxProc, \
Ok, NULL, ID_OK, 0, TRUE)
#define DfYesNoBox(msg) \
GenericMessage(NULL, NULL, msg, 2, YesNoBoxProc, \
Yes, No, ID_OK, ID_CANCEL, TRUE)
#define DfCancelBox(wnd, msg) \
GenericMessage(wnd, "Wait...", msg, 1, CancelBoxProc, \
Cancel, NULL, ID_CANCEL, 0, FALSE)
void CloseCancelBox(void);
DFWINDOW MomentaryMessage(char *);
int MsgHeight(char *);
int MsgWidth(char *);
/* ------------- dialog box prototypes -------------- */
BOOL DfDialogBox(DFWINDOW, DBOX *, BOOL,
int (*)(struct window *, enum messages, PARAM, PARAM));
void ClearDialogBoxes(void);
BOOL OpenFileDialogBox(char *, char *);
BOOL SaveAsDialogBox(char *);
void GetDlgListText(DFWINDOW, char *, enum commands);
BOOL DfDlgDirList(DFWINDOW, char *, enum commands,
enum commands, unsigned);
BOOL RadioButtonSetting(DBOX *, enum commands);
void PushRadioButton(DBOX *, enum commands);
void PutItemText(DFWINDOW, enum commands, char *);
void PutComboListText(DFWINDOW, enum commands, char *);
void GetItemText(DFWINDOW, enum commands, char *, int);
char *GetDlgTextString(DBOX *, enum commands, DFCLASS);
void SetDlgTextString(DBOX *, enum commands, char *, DFCLASS);
BOOL CheckBoxSetting(DBOX *, enum commands);
CTLWINDOW *FindCommand(DBOX *, enum commands, int);
DFWINDOW ControlWindow(DBOX *, enum commands);
void SetScrollBars(DFWINDOW);
void SetRadioButton(DBOX *, CTLWINDOW *);
void ControlSetting(DBOX *, enum commands, int, int);
void SetFocusCursor(DFWINDOW);
#define GetControl(wnd) (wnd->ct)
#define GetDlgText(db, cmd) GetDlgTextString(db, cmd, TEXT)
#define GetDlgTextBox(db, cmd) GetDlgTextString(db, cmd, TEXTBOX)
#define GetEditBoxText(db, cmd) GetDlgTextString(db, cmd, EDITBOX)
#define GetComboBoxText(db, cmd) GetDlgTextString(db, cmd, COMBOBOX)
#define SetDlgText(db, cmd, s) SetDlgTextString(db, cmd, s, TEXT)
#define SetDlgTextBox(db, cmd, s) SetDlgTextString(db, cmd, s, TEXTBOX)
#define SetEditBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, EDITBOX)
#define SetComboBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, COMBOBOX)
#define SetDlgTitle(db, ttl) ((db)->dwnd.title = ttl)
#define SetCheckBox(db, cmd) ControlSetting(db, cmd, CHECKBOX, ON)
#define ClearCheckBox(db, cmd) ControlSetting(db, cmd, CHECKBOX, OFF)
#define EnableButton(db, cmd) ControlSetting(db, cmd, BUTTON, ON)
#define DisableButton(db, cmd) ControlSetting(db, cmd, BUTTON, OFF)
/* ---- types of vectors that can be in a picture box ------- */
enum VectTypes {VECTOR, SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR};
/* ------------- picture box prototypes ------------- */
void DrawVector(DFWINDOW, int, int, int, int);
void DrawBox(DFWINDOW, int, int, int, int);
void DrawBar(DFWINDOW, enum VectTypes, int, int, int, int);
DFWINDOW WatchIcon(void);
/* ------------- help box prototypes ------------- */
void LoadHelpFile(void);
void UnLoadHelpFile(void);
BOOL DisplayHelp(DFWINDOW, char *);
extern char *ClassNames[];
void BuildFileName(char *, char *);
#endif

View file

@ -0,0 +1,100 @@
/* ----------- dflatmsg.h ------------ */
/*
* message foundation file
* make message changes here
* other source files will adapt
*/
/* -------------- process communication messages ----------- */
DFlatMsg(DFM_START) /* start message processing */
DFlatMsg(DFM_STOP) /* stop message processing */
DFlatMsg(DFM_COMMAND) /* send a command to a window */
/* -------------- window management messages --------------- */
DFlatMsg(CREATE_WINDOW) /* create a window */
DFlatMsg(SHOW_WINDOW) /* show a window */
DFlatMsg(DFM_HIDE_WINDOW) /* hide a window */
DFlatMsg(CLOSE_WINDOW) /* delete a window */
DFlatMsg(SETFOCUS) /* set and clear the focus */
DFlatMsg(PAINT) /* paint the window's data space*/
DFlatMsg(BORDER) /* paint the window's border */
DFlatMsg(TITLE) /* display the window's title */
DFlatMsg(MOVE) /* move the window */
DFlatMsg(DFM_SIZE) /* change the window's size */
#ifdef INCLUDE_MAXIMIZE
DFlatMsg(MAXIMIZE) /* maximize the window */
#endif
#ifdef INCLUDE_MINIMIZE
DFlatMsg(MINIMIZE) /* minimize the window */
#endif
DFlatMsg(RESTORE) /* restore the window */
DFlatMsg(INSIDE_WINDOW) /* test x/y inside a window */
/* ---------------- clock messages ------------------------- */
DFlatMsg(CLOCKTICK) /* the clock ticked */
DFlatMsg(CAPTURE_CLOCK) /* capture clock into a window */
DFlatMsg(RELEASE_CLOCK) /* release clock to the system */
/* -------------- keyboard and screen messages ------------- */
DFlatMsg(KEYBOARD) /* key was pressed */
DFlatMsg(CAPTURE_KEYBOARD) /* capture keyboard into a window */
DFlatMsg(RELEASE_KEYBOARD) /* release keyboard to system */
DFlatMsg(KEYBOARD_CURSOR) /* position the keyboard cursor */
DFlatMsg(CURRENT_KEYBOARD_CURSOR) /*read the cursor position */
DFlatMsg(HIDE_CURSOR) /* hide the keyboard cursor */
DFlatMsg(SHOW_CURSOR) /* display the keyboard cursor */
DFlatMsg(SAVE_CURSOR) /* save the cursor's configuration*/
DFlatMsg(RESTORE_CURSOR) /* restore the saved cursor */
DFlatMsg(SHIFT_CHANGED) /* the shift status changed */
DFlatMsg(WAITKEYBOARD) /* waits for a key to be released */
/* ---------------- mouse messages ------------------------- */
DFlatMsg(MOUSE_TRAVEL) /* set the mouse travel */
DFlatMsg(RIGHT_BUTTON) /* right button pressed */
DFlatMsg(LEFT_BUTTON) /* left button pressed */
DFlatMsg(DFM_DOUBLE_CLICK) /* left button double-clicked */
DFlatMsg(DFM_MOUSE_MOVED) /* mouse changed position */
DFlatMsg(DFM_BUTTON_RELEASED) /* mouse button released */
DFlatMsg(WAITMOUSE) /* wait until button released */
DFlatMsg(TESTMOUSE) /* test any mouse button pressed*/
DFlatMsg(CAPTURE_MOUSE) /* capture mouse into a window */
DFlatMsg(RELEASE_MOUSE) /* release the mouse to system */
/* ---------------- text box messages ---------------------- */
DFlatMsg(ADDTEXT) /* append text to the text box */
DFlatMsg(INSERTTEXT) /* insert line of text */
DFlatMsg(DELETETEXT) /* delete line of text */
DFlatMsg(CLEARTEXT) /* clear the edit box */
DFlatMsg(SETTEXT) /* copy text to text buffer */
DFlatMsg(SCROLL) /* vertical line scroll */
DFlatMsg(HORIZSCROLL) /* horizontal column scroll */
DFlatMsg(SCROLLPAGE) /* vertical page scroll */
DFlatMsg(HORIZPAGE) /* horizontal page scroll */
DFlatMsg(SCROLLDOC) /* scroll to beginning/end */
/* ---------------- edit box messages ---------------------- */
DFlatMsg(GETTEXT) /* get text from an edit box */
DFlatMsg(SETTEXTLENGTH) /* set maximum text length */
/* ---------------- menubar messages ----------------------- */
DFlatMsg(BUILDMENU) /* build the menu display */
DFlatMsg(MB_SELECTION) /* menubar selection */
/* ---------------- popdown messages ----------------------- */
DFlatMsg(BUILD_SELECTIONS) /* build the menu display */
DFlatMsg(CLOSE_POPDOWN) /* tell parent popdown is closing */
/* ---------------- list box messages ---------------------- */
DFlatMsg(LB_SELECTION) /* sent to parent on selection */
DFlatMsg(LB_CHOOSE) /* sent when user chooses */
DFlatMsg(LB_CURRENTSELECTION)/* return the current selection */
DFlatMsg(DFM_LB_GETTEXT) /* return the text of selection */
DFlatMsg(LB_SETSELECTION) /* sets the listbox selection */
/* ---------------- dialog box messages -------------------- */
DFlatMsg(INITIATE_DIALOG) /* begin a dialog */
DFlatMsg(ENTERFOCUS) /* tell DB control got focus */
DFlatMsg(LEAVEFOCUS) /* tell DB control lost focus */
DFlatMsg(ENDDIALOG) /* end a dialog */
/* ---------------- help box messages ---------------------- */
DFlatMsg(DISPLAY_HELP)
/* --------------- application window messages ------------- */
DFlatMsg(ADDSTATUS)
/* --------------- picture box messages -------------------- */
DFlatMsg(DRAWVECTOR)
DFlatMsg(DRAWBOX)
DFlatMsg(DRAWBAR)

View file

@ -0,0 +1,55 @@
/* ----------------- dialbox.h ---------------- */
#ifndef DIALOG_H
#define DIALOG_H
#include <stdio.h>
#define MAXCONTROLS 30
#define MAXRADIOS 20
#define OFF FALSE
#define ON TRUE
/* -------- dialog box and control window structure ------- */
typedef struct {
char *title; /* window title */
int x, y; /* relative coordinates */
int h, w; /* size */
} DIALOGWINDOW;
/* ------ one of these for each control window ------- */
typedef struct {
DIALOGWINDOW dwnd;
DFCLASS class; /* LISTBOX, BUTTON, etc */
char *itext; /* initialized text */
int command; /* command code */
char *help; /* help mnemonic */
BOOL isetting; /* initially ON or OFF */
BOOL setting; /* ON or OFF */
void *wnd; /* window handle */
} CTLWINDOW;
/* --------- one of these for each dialog box ------- */
typedef struct {
char *HelpName;
DIALOGWINDOW dwnd;
CTLWINDOW ctl[MAXCONTROLS+1];
} DBOX;
/* -------- macros for dialog box resource compile -------- */
#define DIALOGBOX(db) DBOX db={ #db,
#define DB_TITLE(ttl,x,y,h,w) {ttl,x,y,h,w},{
#define CONTROL(ty,tx,x,y,h,w,c) \
{{NULL,x,y,h,w},ty, \
(ty==EDITBOX||ty==COMBOBOX?NULL:tx), \
c,#c,(ty==BUTTON?ON:OFF),OFF,NULL},
#define ENDDB {{NULL}} }};
#define Cancel " Cancel "
#define Ok " OK "
#define Yes " Yes "
#define No " No "
#endif

View file

@ -0,0 +1,31 @@
/* ------------------- htree.h -------------------- */
#ifndef HTREE_H
#define HTREE_H
typedef unsigned int BYTECOUNTER;
/* ---- Huffman tree structure for building ---- */
struct htree {
BYTECOUNTER cnt; /* character frequency */
int parent; /* offset to parent node */
int right; /* offset to right child node */
int left; /* offset to left child node */
};
/* ---- Huffman tree structure in compressed file ---- */
struct htr {
int right; /* offset to right child node */
int left; /* offset to left child node */
};
extern struct htr *HelpTree;
void buildtree(void);
FILE *OpenHelpFile(void);
void HelpFilePosition(long *, int *);
void *GetHelpLine(char *);
void SeekHelpLine(long, int);
#endif

View file

@ -0,0 +1,119 @@
/* ----------- keys.h ------------ */
#ifndef KEYS_H
#define KEYS_H
#define OFFSET 0x1000
#define RUBOUT 8 /* BACHSPACE KEY */
#define BELL 7
#define ESC 27
#define ALT_BS (197+OFFSET)
#define ALT_DEL (184+OFFSET)
#define SHIFT_DEL (198+OFFSET)
#define CTRL_INS (186+OFFSET)
#define SHIFT_INS (185+OFFSET)
#define SHIFT_F8 (219+OFFSET)
#define F1 (187+OFFSET)
#define F2 (188+OFFSET)
#define F3 (189+OFFSET)
#define F4 (190+OFFSET)
#define F5 (191+OFFSET)
#define F6 (192+OFFSET)
#define F7 (193+OFFSET)
#define F8 (194+OFFSET)
#define F9 (195+OFFSET)
#define F10 (196+OFFSET)
#define CTRL_F1 (222+OFFSET)
#define CTRL_F2 (223+OFFSET)
#define CTRL_F3 (224+OFFSET)
#define CTRL_F4 (225+OFFSET)
#define CTRL_F5 (226+OFFSET)
#define CTRL_F6 (227+OFFSET)
#define CTRL_F7 (228+OFFSET)
#define CTRL_F8 (229+OFFSET)
#define CTRL_F9 (230+OFFSET)
#define CTRL_F10 (231+OFFSET)
#define ALT_F1 (232+OFFSET)
#define ALT_F2 (233+OFFSET)
#define ALT_F3 (234+OFFSET)
#define ALT_F4 (235+OFFSET)
#define ALT_F5 (236+OFFSET)
#define ALT_F6 (237+OFFSET)
#define ALT_F7 (238+OFFSET)
#define ALT_F8 (239+OFFSET)
#define ALT_F9 (240+OFFSET)
#define ALT_F10 (241+OFFSET)
#define HOME (199+OFFSET)
#define UP (200+OFFSET)
#define PGUP (201+OFFSET)
#define BS (203+OFFSET) /* CURSOR LEFT KEY */
#define FWD (205+OFFSET) /* CURSOR RIGHT KEY */
#define END (207+OFFSET)
#define DN (208+OFFSET)
#define PGDN (209+OFFSET)
#define INS (210+OFFSET)
#define DEL (211+OFFSET)
#define CTRL_HOME (247+OFFSET)
#define CTRL_PGUP (132+OFFSET)
#define CTRL_BS (243+OFFSET)
#define CTRL_FIVE (143+OFFSET)
#define CTRL_FWD (244+OFFSET)
#define CTRL_END (245+OFFSET)
#define CTRL_PGDN (246+OFFSET)
#define SHIFT_HT (143+OFFSET)
#define ALT_A (158+OFFSET)
#define ALT_B (176+OFFSET)
#define ALT_C (174+OFFSET)
#define ALT_D (160+OFFSET)
#define ALT_E (146+OFFSET)
#define ALT_F (161+OFFSET)
#define ALT_G (162+OFFSET)
#define ALT_H (163+OFFSET)
#define ALT_I (151+OFFSET)
#define ALT_J (164+OFFSET)
#define ALT_K (165+OFFSET)
#define ALT_L (166+OFFSET)
#define ALT_M (178+OFFSET)
#define ALT_N (177+OFFSET)
#define ALT_O (152+OFFSET)
#define ALT_P (153+OFFSET)
#define ALT_Q (144+OFFSET)
#define ALT_R (147+OFFSET)
#define ALT_S (159+OFFSET)
#define ALT_T (148+OFFSET)
#define ALT_U (150+OFFSET)
#define ALT_V (175+OFFSET)
#define ALT_W (145+OFFSET)
#define ALT_X (173+OFFSET)
#define ALT_Y (149+OFFSET)
#define ALT_Z (172+OFFSET)
#define ALT_1 (0xf8+OFFSET)
#define ALT_2 (0xf9+OFFSET)
#define ALT_3 (0xfa+OFFSET)
#define ALT_4 (0xfb+OFFSET)
#define ALT_5 (0xfc+OFFSET)
#define ALT_6 (0xfd+OFFSET)
#define ALT_7 (0xfe+OFFSET)
#define ALT_8 (0xff+OFFSET)
#define ALT_9 (0x80+OFFSET)
#define ALT_0 (0x81+OFFSET)
#define ALT_HYPHEN (130+OFFSET)
#define RIGHTSHIFT 0x01
#define LEFTSHIFT 0x02
#define CTRLKEY 0x04
#define ALTKEY 0x08
#define SCROLLLOCK 0x10
#define NUMLOCK 0x20
#define CAPSLOCK 0x40
#define INSERTKEY 0x80
struct keys {
int keycode;
char *keylabel;
};
extern struct keys keys[];
#endif

View file

@ -0,0 +1,63 @@
/* ------------ menu.h ------------- */
#ifndef MENU_H
#define MENU_H
#define MAXPULLDOWNS 15
#define MAXSELECTIONS 20
#define MAXCASCADES 3 /* nesting level of cascaded menus */
/* ----------- popdown menu selection structure
one for each selection on a popdown menu --------- */
struct PopDown {
unsigned char *SelectionTitle; /* title of the selection */
int ActionId; /* the command executed */
int Accelerator; /* the accelerator key */
int Attrib; /* INACTIVE | CHECKED | TOGGLE | CASCADED*/
char *help; /* Help mnemonic */
};
/* ----------- popdown menu structure
one for each popdown menu on the menu bar -------- */
typedef struct Menu {
char *Title; /* title on the menu bar */
void (*PrepMenu)(void *, struct Menu *); /* function */
char *StatusText; /* text for the status bar */
int CascadeId; /* command id of cascading selection */
int Selection; /* most recent selection */
struct PopDown Selections[MAXSELECTIONS+1];
} MENU;
/* ----- one for each menu bar ----- */
typedef struct MenuBar {
int ActiveSelection;
MENU PullDown[MAXPULLDOWNS+1];
} MBAR;
/* --------- macros to define a menu bar with
popdowns and selections ------------- */
#define SEPCHAR "\xc4"
#define DEFMENU(m) MBAR m = {-1,{
#define POPDOWN(ttl,func,stat) {ttl,func,stat,-1,0,{
#define CASCADED_POPDOWN(id,func) {NULL,func,NULL,id,0,{
#define SELECTION(stxt,acc,id,attr) {stxt,acc,id,attr,#acc},
#define SEPARATOR {SEPCHAR},
#define ENDPOPDOWN {NULL}}},
#define ENDMENU {(void *)-1} }};
/* -------- menu selection attributes -------- */
#define INACTIVE 1
#define CHECKED 2
#define TOGGLE 4
#define CASCADED 8
/* --------- the standard menus ---------- */
extern MBAR MainMenu;
extern MBAR SystemMenu;
extern MBAR *ActiveMenuBar;
int MenuHeight(struct PopDown *);
int MenuWidth(struct PopDown *);
#endif

View file

@ -0,0 +1,24 @@
/* ----------- rect.h ------------ */
#ifndef RECT_H
#define RECT_H
typedef struct {
int lf,tp,rt,bt;
} DFRECT;
#define within(p,v1,v2) ((p)>=(v1)&&(p)<=(v2))
#define RectTop(r) (r.tp)
#define RectBottom(r) (r.bt)
#define RectLeft(r) (r.lf)
#define RectRight(r) (r.rt)
#define InsideRect(x,y,r) (within((x),RectLeft(r),RectRight(r))\
&& \
within((y),RectTop(r),RectBottom(r)))
#define ValidRect(r) (RectRight(r) || RectLeft(r) || \
RectTop(r) || RectBottom(r))
#define RectWidth(r) (RectRight(r)-RectLeft(r)+1)
#define RectHeight(r) (RectBottom(r)-RectTop(r)+1)
DFRECT subRectangle(DFRECT, DFRECT);
DFRECT ClientRect(void *);
DFRECT RelativeWindowRect(void *, DFRECT);
DFRECT ClipRectangle(void *, DFRECT);
#endif

View file

@ -0,0 +1,99 @@
/* --------------- system.h -------------- */
#ifndef SYSTEM_H
#define SYSTEM_H
//#if MSC | WATCOM
#include <direct.h>
//#else
//#include <dir.h>
//#endif
#define swap(a,b){int x=a;a=b;b=x;}
/* ------- platform-dependent values ------ */
#define KEYBOARDPORT 0x60
#define FREQUENCY 100
#define COUNT (1193280L / FREQUENCY)
#define ZEROFLAG 0x40
#define MAXSAVES 50
//#define SCREENWIDTH (80)
//#define SCREENHEIGHT (25)
HANDLE hInput;
HANDLE hOutput;
SHORT sScreenHeight;
SHORT sScreenWidth;
/* ---------- keyboard prototypes -------- */
int AltConvert(int);
void GetKey(PINPUT_RECORD);
int getshift(void);
BOOL keyhit(void);
void beep(void);
/* ---------- cursor prototypes -------- */
void curr_cursor(int *x, int *y);
void cursor(int x, int y);
void hidecursor(void);
void unhidecursor(void);
void savecursor(void);
void restorecursor(void);
void normalcursor(void);
void set_cursor_size(unsigned t);
void videomode(void);
void SwapCursorStack(void);
/* ------------ timer macros -------------- */
#define timed_out(timer) (timer==0)
#define set_timer(timer, secs) timer=(secs)*182/10+1
#define disable_timer(timer) timer = -1
#define timer_running(timer) (timer > 0)
#define countdown(timer) --timer
#define timer_disabled(timer) (timer == -1)
#ifndef TURBOC
#ifndef BCPP
/* ============= Color Macros ============ */
#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
#define keyhit kbhit
#endif
#endif
typedef enum messages {
#ifdef WATCOM
WATCOMFIX1 = -1,
#endif
#undef DFlatMsg
#define DFlatMsg(m) m,
#include "dflatmsg.h"
MESSAGECOUNT
} DFMESSAGE;
typedef enum window_class {
#ifdef WATCOM
WATCOMFIX2 = -1,
#endif
#define ClassDef(c,b,p,a) c,
#include "classes.h"
CLASSCOUNT
} DFCLASS;
#endif

View file

@ -0,0 +1,18 @@
/* ---------------- video.h ----------------- */
#ifndef VIDEO_H
#define VIDEO_H
#include "rect.h"
void GetVideo(DFRECT, PCHAR_INFO);
void StoreVideo(DFRECT, PCHAR_INFO);
void wputch(DFWINDOW, int, int, int);
char GetVideoChar(int, int);
void PutVideoChar(int, int, int);
void wputs(DFWINDOW, void *, int, int);
void scroll_window(DFWINDOW, DFRECT, int);
#define videochar(x,y) (GetVideoChar(x,y) & 0xFF)
#endif