home *** CD-ROM | disk | FTP | other *** search
- !short:General Notes
- ^bGeneral Notes^b
-
- ^bGenindex^b, ^bHelp^b, and ^bPopup^b are support programs and functions for
- the BOSSDEMO program. They can, however, serve as valuable aids
- to you in the creation of help screens and popup menus. The code
- is provided to demonstrate how the functions in The Window BOSS
- can be used to create online help screens and popup windows.
-
- Both the C and assembly functions make very heavy use of
- pointers. The code contains numerous checks to ensure that
- memory outside of that in use by the program is not corrupted.
- If you attempt to do something that would cause memory to be
- corrupted an error message will appear and your program will
- exit. This message will usually say that a bad handle was passed
- to some function. You can, if you wish, remove this check by
- modifying the "wns_err" function in the wn_sup.c file.
-
- Generally speaking, the members of the window control block
- (refer to windows.h) should not be modified unless you are
- familiar with how they are used by the various functions.
-
- Although the routines appear to support the multi page
- capabilities of the IBM Color Card, actual support of this
- feature has not been implemented. Invoking the functions with
- references to video pages other than 0 might produce interesting
- but undesired results.
-
- If you are upgrading from a previous version of The Window BOSS
- be sure to re-compile and re-link your application. This will
- eliminate the possibility of any "unusual" errors due to changes
- that may have been made to either the functions or the window
- control block structure.
-
- Several global symbols are used by the various functions:
-
- int ^bwn_dmaflg^b;
- int ^bwn_sbit^b;
-
- ^bwn_dmaflg^b when TRUE enables direct writes into video ram.
- This is the default setting and should work in all cases.
- Setting wn_dmaflg to FALSE will disable these direct writes.
- When ^bwn_dmaflg^b is FALSE the BIOS video routines are used.
- This results in slower screen updates. However, this method
- does have the advantage of being considered "well behaved"
- by IBM's Topview, Microsoft's Windows, and DESQ.
-
- ^bwn_sbit^b controls the window refresh rate on systems with
- color cards. When set to SLOW (defined in windows.h) window
- displays will appear to be painted on the screen rather than
- flash displayed. This is the default value. Setting ^bwn_sbit^b
- to FAST enables flash displays. Artistic use of ^bwn_sbit can
- give your application that extra visual touch. Experiment!
-
- The best way to manipulate the method by which windows are
- updated is via the ^bwn_dmode()^b function. Calling
- ^bwn_dmode(PAINT)^b causes the image to be painted while
- ^bwn_dmode(FLASH)^b causes the image to be flash updated. This
- is the preferred method. Please keep in mind that windows
- are always flash updated on monochrome systems.
-
- From a performance standpoint, the fastest (flicker & snow free)
- screen updates will occur with ^bwn_dmaflg=TRUE^b and ^bwn_sbit=FAST.^b
- The key words here are flicker and snow free. Scrolling speed
- can be increased with, a proportional increase in flicker
- (perhaps), by using ^bwn_scroll()^b function to set the scrolling
- method for the window to BIOS. This technique will provide the
- fastest screen updates and scrolling on color systems.
-
- Several of the compilers support a compile time command line
- parameter that results in structures being byte aligned instead
- of word aligned. In all cases, the default (i.e. no command line
- parameter) option was used to compile the modules in the various
- libraries.
-
- ^uBorland Turbo C^u users who prefer "The Integrated Environment"
- over the "Command-Line Version" MUST define the symbol
- "BORLAND=1". (Select Options, Compiler, Defines and enter
- "^bBORLAND=1^b"in the dialogue box without quotes and in upper case.
-
- ^uMicrosoft Version 5.0^u libraries were generated using the the
- "^b/Zl^b" command line parameter.
-
- ^uMicrosoft QuickC^u users who prefer the programming environment
- must select EXE as output and use the DOS shell (from the FILES
- MENU) to test run their application. Program lists must always
- be created and include ^bMSQCPE.LIB^b. We have found the programming
- environment to be very useful for editing and syntax checking but
- somewhat limited in other areas (i.e. medium model support only).
- Additionally, ^bMSCV4=1^b must be defined in the run options dialog
- box.
-
- Programs such as Wordstar and Lotus change the video mode when
- they run. If your system is equipped with a color monitor and
- your windows are appearing in black and white issue a call to
- ^bv_smode^b to set the video mode to 3. Alternatively, you can use
- the "^uMODE CO80^u" command at DOS level before you run your
- application.
-
- PLEASE - Pass along your comments. The Window BOSS is your tool.
- If, heaven forbid, you find any logic errors let us know. We are
- committed to making The Window BOSS the best price performer
- available. Call, write, or if you prefer, you can reach Phil
- Mongelluzzo via CompuServe [71565,1001]. Fido fans can leave mail
- on our support BBS at (203)-271-1579. There is no reason to sit,
- steam, or complain to those who can not provide any real form of
- support. Lastly, if you use The Window BOSS, register your copy.
- The Shareware System will only work if you support it!
- !short:Link Assistance
- ^bLinking^b
-
- Simply specify the ?WIN.LIB file that corresponds to the
- compiler/memory model you are using. Don't forget to
- include your compilers runtime library as well. The
- following examples should demonstrate the ease of linking.
-
- ^uLattice^u
- link c+hello,hello,,swin+lcm+lc
-
- ^uComputer Innovations^u
- link hello,hello,,swin+c86s2s
-
- ^uDatalight^u
- link c+hello,hello,hello,swin+nl
-
- ^uMicrosoft (3 & 4)^u
- link hello,hello,,swin+slibc
-
- ^uMicrosoft (5.0)^u
- link hello,hello,,swin
-
- ^uMicrosoft QuickC^u
- link hello,hello,,swin
-
- ^uBorland^u
- tlink /c c0s hello,hello,hello,swin emu maths cs
- !short:Tiled Windows
- ^bTiled Windows^b
-
- The Window BOSS fully supports the concept of tiled or
- overlapping windows. That is to say that you can have several
- windows on the screen at the same time and freely access any one
- of them without having to be concerned with the order in which
- they were opened or whether or not any other windows overlap the
- one you wish to access. The Window BOSS employs the "most
- recently used is active" concept. This concept is based on the
- following:
-
- . The last window referenced is the current active
- window.
-
- . The current active window is always the top window
- tile.
-
- For example, let us assume that you have opened three overlapping
- windows in the following order; w1, w2, w3. w3 is considered to
- be the top window tile because it was the last window referenced.
- If you now reference, or explicitly activate, w2 The Window BOSS
- will automatically adjust the screen image to insure that w2 is
- now the top window tile with w3 and w1 being partially hidden by
- w2.
-
- ^bBefore^b ^bAfter^b
-
- +----------+ +----------+
- | ^bW1^b | |^bW1^b |
- | +----------+ | +----------+
- | | ^bW2^b | | | ^uW2^u |
- | | +------------+ | | |----+
- | | | ^uW3^u | | | | ^bW3^b |
- | | | | | | | |
- | | +------------+ | | |----+
- | | | | | |
- | +----------+ | +----------+
- | | | |
- +----------+ +----------+
-
- It is extremely important to keep in mind that The Window BOSS
- will automatically activate (bring to the top) the window being
- referenced. Keep your screen layouts attractive and uncluttered.
- This will minimize window thrashing which is both annoying and
- time consuming.
- !short:Function Assistance
- ^bFunction Assistance and notes^b
-
- The Window BOSS's functions fall into two major groups, those
- that manipulate windows and those that deal with the video or
- keyboard interface at a relatively low level. All window
- manipulation functions being with the prefix "wn_" as in
- "wn_open", while all video and keyboard based functions begin
- with "v_" or "_" as in "^bv_getch^b" and "^b_putch^b". This convention
- makes it easy to remember where to look when you want to do
- something. Additionally, there are several global functions
- which which begin with "wns_". These functions, although visible
- to the outside world, are used internally by The Window BOSS.
-
- The Window BOSS has been tested on the IBMPC/XT/AT and 3270 PC
- equipped with monochrome, CGA, and EGA video boards. All
- functions with the exception of v_sctype(), which does not do
- well on the 3270 PC, work as specified.
-
- Several functions require an attribute byte. The attribute byte
- contains background specific data in the upper 4 bits and
- foreground specific data in the lower 4 bits. Color and bit
- definitions can be found in windows.h. You can use a statement of
- the form: ^uatrib = ((BLUE << 4) | WHITE);^u to set the attribute to
- the correct form. The preceding example would result in a BLUE
- background with WHITE characters. The macro v_setatr in
- windows.h can also be used.
-
- !short:Sample Program
- ^bSample program (hello.c)^b
-
- ^u#include "windows.h"^u
- main()
- {
- ^uWINDOWPTR^u w1; /* window handle */
- int batrib; /* border atrib */
- int watrib; /* window atrib */
-
- /*
- * Set attributes:
- *
- * border - blue/white box
- * window - white background/black letters
- *
- */
-
- batrib = ^uv_setatr^u(BLUE,WHITE,0,0);
- watrib = ^uv_setatr^u(WHITE,BLACK,0,0);
-
- /*
- * Open window at 0,0 - 15 cells wide and 3 cells high
- */
-
- w1 = ^uwn_open^u(0,0,0,15,3,watrib,batrib);
- if(!w1) exit();
-
- /*
- * Print the famous string and wait for key to be struck.
- * Close window on key strike.. exit.
- */
-
- ^uwn_printf^u(w1,"Hello World...");
- ^uv_getch^u();
- ^uwn_close^u(w1);
- }
-
- /* End */
- !short:Listing of WINDOWS.H
- ^uListing of WINDOWS.H^u
-
- /* #define ^bBORLAND^b 1 */
- /* #define ^bMSCV3^b */
- /* #define ^bMSCV4^b */
- /* #define ^bLC2^b */
- /* #define ^bLC3^b */
- /* #define ^bDLC^b */
- /* #define ^bC86^b */
-
- /*
- ** ^uMicrosoft 3.00^u
- */
-
- #ifdef MSCV3
- #define MSC 1
- #define MSC4 0
- #define DLC 0
- #define CI86 0
- #define LC2 0
- #define LC3 0
- #if M_I86SM /* small code, small data */
- #define SPTR 1
- #define LPTR 0
- #endif
- #if M_I86LM /* large code, large data */
- #define SPTR 0
- #define LPTR 1
- #endif
- #if M_I86CM /* small code, large data */
- #define SPTR 0
- #define LPTR 1
- #endif
- #if M_I86MM /* large code, small data */
- #define SPTR 1
- #define LPTR 0
- #endif
- #define LATTICE 1
- #endif
-
- /*
- ** ^uMicrosoft 4.0, 5.0, QuickC^u
- */
-
- #ifdef ^bMSCV4^b
- #define MSC 1
- #define MSC4 1
- #define DLC 0
- #define CI86 0
- #define LC2 0
- #define LC3 0
- #if ^bM_I86SM^b /* small code, small data */
- #define SPTR 1
- #define LPTR 0
- #endif
- #if ^bM_I86LM^b /* large code, large data */
- #define SPTR 0
- #define LPTR 1
- #endif
- #if ^bM_I86CM^b /* small code, large data */
- #define SPTR 0
- #define LPTR 1
- #endif
- #if ^bM_I86MM^b /* large code, small data */
- #define SPTR 1
- #define LPTR 0
- #endif
- #define LATTICE 1
- #endif
-
- /*
- ** ^uBORLAND^u
- */
-
- #ifdef ^bBORLAND^b
- #define MSC 1
- #define MSC4 1
- #define DLC 0
- #define CI86 0
- #define LC2 0
- #define LC3 0
- #if^b __SMALL__^b /* small code, small data */
- #define SPTR 1
- #define LPTR 0
- #endif
- #if ^b__LARGE__^b /* large code, large data */
- #define SPTR 0
- #define LPTR 1
- #endif
- #if ^b__COMPACT__^b /* small code, large data */
- #define SPTR 0
- #define LPTR 1
- #endif
- #if ^b__MEDIUM__^b /* large code, small data */
- #define SPTR 1
- #define LPTR 0
- #endif
- #define ^bLATTICE 1^b
- #endif
-
- /*
- ** ^uComputer Innovations^u
- */
-
- #ifdef ^bC86^b
- #define BORLAND 0
- #define MSCV3 0
- #define MSCV4 0
- #define MSC 0
- #define MSC3 0
- #define MSC4 0
- #define DLC 0
- #define CI86 1
- #define LC2 0
- #define LC3 0
- #ifdef^b_C86_BIG^b
- #define LPTR 1
- #define SPTR 0
- #else
- #define LPTR 0
- #define SPTR 1
- #endif
- #define LATTICE 0
- #endif
- #define TRUE 1 /* truth */
- #define FALSE 0 /* lies */
- #define The_BOSS TRUE /* convienent equate */
-
- #if ^bCI86^b /* NB: ****** */
- struct WORDREGS { /* register layout is */
- unsigned int ax; /* different from the rest !! */
- unsigned int bx;
- unsigned int cx;
- unsigned int dx;
- unsigned int si;
- unsigned int di;
- unsigned int ds; /* <= NB */
- unsigned int es; /* <= NB */
- unsigned int flags;
- };
- struct BYTEREGS {
- unsigned char al, ah;
- unsigned char bl, bh;
- unsigned char cl, ch;
- unsigned char dl, dh;
- };
- union REGS {
- struct WORDREGS x;
- struct BYTEREGS h;
- };
- struct SREGS {
- unsigned int cs;
- unsigned int ss;
- unsigned int ds;
- unsigned int es;
- };
- #endif
-
-
- #if ^bMSCV3^b | ^bMSCV4^b | ^bBORLAND^b /* Microsoft C or BORLAND */
- #define LINT_ARGS /* enforce type checking */
- #if ^bBORLAND^b
- #include "alloc.h" /* Borland */
- #else
- #include "malloc.h" /* for malloc... MSC */
- #endif
- #else /* if not Microsoft C */
- char *malloc(), *calloc(); /* keep everybody happy */
- #endif
-
- #include "stdio.h" /* standard header */
- #include "dos.h" /* Lattice stuff */
- #include "ctype.h" /* character conversion stuff */
- #if ^bMSC4^b
- #include "stdarg.h" /* variable arg list marcos */
- #endif
-
- #define SAVE TRUE /* similar truth */
- #define RESTORE FALSE /* fibs */
- #define PAINT TRUE /* screen update modes */
- #define FLASH FALSE /* ditto */
- #define REPLACE 1 /* for flicker free */
- #define ERASE 0 /* scroll w_sapd & w_sapu */
- #define FAST 0x01 /* fast retrace */
- #define SLOW 0x08 /* slow retrace */
-
- #define NULPTR (char *) 0 /* null pointer */
- #define BEL 0x07 /* beep */
- #define BS 0x08 /* backspace */
- #define NUL '\0' /* NUL char */
- #define ESC 0x1b /* Escape */
- #define CR 0x0d /* carriage return */
- #define LF 0x0a /* linefeed */
- #define DEL 0x7f /* delete */
- #define NAK 0x15 /* ^U */
- #define ETX 0x03 /* ^C */
- #define CAN 0x18 /* ^X */
- #define Del 0x53 /* Del key scan code */
- #define ECHO 0x8000 /* echo disable bit */
-
- #define BIOS 0x01 /* BIOS Scrolling */
- #define DMAS 0x02 /* The BOSS's DMA Scrolling */
-
- /*
- ** ^uExternals^u
- */
-
- extern int wn_dmaflg; /* dma flag */
- extern char wn_sbit; /* retrace test bit 8 slow, 1 fast */
- extern int wn_blank; /* vidon & vidoff control flag */
- extern int wns_bchars[]; /* box chars */
- extern unsigned int wns_mtflg; /* monitor type flag */
- extern int wns_cflag; /* close in progress flag */
-
- extern struct SREGS wns_srp; /* for segread */
-
- extern unsigned wni_seg[]; /* for wns_push/pop */
- extern unsigned wni_off[]; /* ditto */
- extern unsigned wni_ptr[]; /* ditto */
-
- #define BCUL wns_bchars[0] /* some shorthand for later */
- #define BCUR wns_bchars[1]
- #define BCTB wns_bchars[2]
- #define BCSD wns_bchars[3]
- #define BCLL wns_bchars[4]
- #define BCLR wns_bchars[5]
-
- /*
- ** ^uMisc Stuff^u
- */
-
- #if ^bLC2^b | ^bLC3^b | ^bDLC^b | ^bCI86^b
- extern unsigned wns_mtype(); /* make everyone happy */
- #endif
-
- #define WMR wn->bsize /* shorthand */
-
- typedef struct ^bwcb^b /* Window control block */
- {
- int ulx, /* upper left corner x coordinate */
- uly, /* upper left corner y coordinate */
- xsize, /* width of window - INSIDE dimension */
- ysize, /* height of window -INSIDE dimension */
- ccx, /* virtual cursor offset in window */
- ccy,
- style, /* attribute to be used in window */
- bstyle, /* border attribute */
- bsize; /* total border size 0 or 2 only */
- char *scrnsave; /* pointer to screen save buffer */
- int page, /* current video page being used */
- oldx, /* cursor position when window was */
- oldy, /* opened (used for screen restore) */
- wrpflg, /* wrap flag */
- synflg; /* cursor sync flag */
- char *handle; /* my own id */
- char *prevptr; /* linked list - previous */
- char *nextptr; /* linked list - next */
- unsigned tmpseg; /* for activate */
- unsigned tmpoff; /* ditto */
- int smeth; /* scroll method to use */
- } ^bWINDOW,^b ^b*WINDOWPTR;^b
-
- extern WINDOWPTR ^bwns_last;^b /* last window opened */
-
- #if ^bMSCV3^b | ^bMSCV4^b | ^bBORLAND^b /* allow for LINT_ARGS */
- #ifndef GENFNS
- #include "windows.fns" /* enforce type checking */
- #endif
- #else /* and almost lint args */
- struct wcb *wn_open();
- struct wcb *wn_move();
- struct wcb *wn_save();
- char *wn_gets();
- #endif
-
- #define BLACK 0x00 /* foreground */
- #define RED 0x04 /* background */
- #define GREEN 0x02 /* colors */
- #define YELLOW 0x06 /* bg << 4 | fg */
- #define BLUE 0x01
- #define MAGENTA 0x05
- #define CYAN 0x03
- #define WHITE 0x07
- #define BLINK 0x80
- #define BOLD 0x08
- #define NDISPB 0x00 /* non display black */
- #define NDISPW 0x77 /* non display white */
- #define RVIDEO 0x70 /* reverse video */
- #define UNLINE 0x01 /* under line (BLUE) */
-
- #define NVIDEO 0x07 /* normal video */
- #define NORMAL 0x03 /* cyan is normal for me */
-
- /*
- ** ^uDisplay Mode Atributes^u
- */
-
- #define B4025 0 /* black & white 40 x 25 */
- #define C4025 1 /* color 40 x 25 */
- #define B8025 2 /* black & white 80 x 25 */
- #define C8025 3 /* color 80 x 25 */
- #define C320 4 /* color graphics 320 x 200 */
- #define B320 5 /* black & white graphics */
- #define HIRES 6 /* B&W hi res 640 * 200 */
- #define MONO 7 /* monocrome 80 x 25 */
-
- /*
- ** Macro to set attribute byte
- */
-
- #define ^bv_setatr^b(bg,fg,blink,bold) ((blink|(bg<<4))|(fg|bold))
-
- /* End */
-
-