home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- Color Setup Module
-
-
- Copyright (c) 1990 Jeffrey S. Kline
-
-
-
- A user color configuration enhancment utility.
-
-
- In the spirit of "C your Pascal"!
-
-
-
- Share-Ware Release Vers. 1.00
-
-
- For
- Microsoft's Quick-Pascal v1.0 compiler
- and
- Borlands Turbo Pascal compilers Vers. 4.0, 5.0 & 5.5
-
-
-
-
- Introduction:
-
- For some time now, I have been working on and writing many programs and
- utilities for around my office and home as well as for friends. In this
- time, I have not been able to do many of the nicer things with them
- because there just wasn't time. Well, now I have made some time to
- increase the size and types of my libraries to make like with this PC a
- little more easier.
-
- Seems that of late, I've wanted to put personalized touches into all my
- programs and couldn't find an easy way of doing it. One of these just
- happens to be color setups for various screens, data entry lines, and
- so forth. I'm currently in the middle of developing a commercial
- program of which this module will be used. I wanted an easy way of
- calling up the color setup utility and also have it smart and easy
- enough to use both from the programmer standpoint as well as the end
- user of the software that makes use of this module.
-
- Take a "gander" at the source code for the test program that is
- supplied with this archive and you'll see just how easy it is to use. A
- more detailed look here is forthcoming.
-
-
- SPECIAL NOTE REGARDING LIABILITY:
-
- NOTE: Under no circumstances am I liable for any mis-use or in-ability
- to use this code. Further more, I shall not be held accountable for any
- damages that might arise out of the use of or in-ability to use this
- work. This include any consequential or inconsequential damages.
-
- This code has been tested on all the compilers listed and has performed
- flawlessly. If you should have problems with it, most likely, you have
- something wrong in one of your host program's VAR's or TYPE's. You
- should be quite familiar with Pascal coding before attempting to make
- use of this code.
-
- If you like what you see and wish to support the author in his on-going
- endeavors, please remit $15 in personal checkque or money order to the
- address listed at the end of this document. You will be sent a current
- copy of the source code on disk and any further information regarding
- it if deemed necessary.
-
-
- Compatibility:
-
- This code is supplied in Borland compatible TPU's for versions 4.0 and
- 5.0 and 5.5(see note) of their compiler. DEBUG is disabled so as to
- help protect my work. In addition to this a Microsoft QuickPascal QPU
- is supplied for those who either use it solely or in addition to
- Borlands compilers.
-
- This code is fully portable among compilers as well as being
- convertible to Microsoft's Full Pascal compilers. If you should wish to
- get a copy to run under the Full compiler for Microsoft, you must
- register to get the code. No object files will be supplied in this
- archive.
-
- The test program also is fully compatible directly under any of the
- above mentioned compilers.
-
- Also note that it tested fine using Turbo Technojock code and Turbo
- Professional code as well so those of you using those sets of libraries
- will have no trouble.
-
- NOTE: For those who have Turbo Pascal vers. 5.5, you will have to make
- special arrangements with me to get a 5.5 compatible TPU prior to
- registering but... A fully functional test program is supplied to which
- you can make a pretty good evaluation based on what you see on your
- screen and what you see in the source code for the test program.
-
-
- Preparatory:
-
- Before making use of the unit, you must make some things in your host
- program source code. These are listed below with a short description
- about why they are there.
-
- MainFG : Integer; { your host programs main color selector }
- MainBG : Integer; { same but for Background color. }
- SecFG : Integer; { an alternate Forground color selector }
- SecBG : Integer; { alternate Background color selector }
- ... { as many others as you either see fit or want }
- Change : Boolean; { a boolean variable used to make the call to }
- { the function. The return ordinal will tell }
- { you if you need to take any action with it. }
-
- The naming conventions used here are strictly by choice or preference.
- Since this language is very flexible in naming of variables, constants
- and the like, you can essentially use just about any names you wish.
-
- Next thing is to design a routine that will cycle through a loop if you
- will or a REPEAT - UNTIL. The choice is yours how you do it. Also note
- that in this version, the screen is not saved prior to displaying the
- selection window. If you are overlaying a screen you wish to restore,
- you should save it to an array and restore it upon exit. There is a
- nice one contained in the Spreadsheet program that comes with your
- compiler (Borland) and it works pretty well. Basically, if you are
- going to be working with many color selection options, you would want
- to do it this way;
-
- Change := Select_Colors(ColorAttr); { if attribute word is known }
-
- or if attribute word is not known, call it like this;
-
- Change := Select_Colors(Attr(MainFG,MainBG));
- { if attribute word is not known }
-
- Attr(FG,BG) is in the UNIT and is fully available to your program.
-
- ColorAttr is the combined WORD value for the default position in the
- selection window to go to. Most commonly, you would want to place the
- variable "TEXTATTR" or if you are passing a copy of your present
- program colors, use the converter "ATTR(FG,BG)" to combine the
- foreground and background into one byte.
-
- After the function call, test "Change" and if it's TRUE, then you
- should have something like this happen:
-
- If Change then
- Begin
- MainFG := ChosenFG; { copy units var to yours }
- MainBG := ChosenBG; { ditto }
- MainColors := ChosenColors; { ditto, optional }
- End;
-
- If Change is FALSE, this will be because the user pressed the "ESC"
- key. When this happens, you can either go through the same loop above
- or just do nothing. Either way, the function will not alter the colors.
-
- "ChosenFG" and "ChosenBG" are variables that will contain the selected
- color values if "Change" is TRUE. ChosenColors is also in the unit but
- is will contain the selected colors combined into a WORD value (some
- folks just love splitting words!). This is essentially it. In the
- listing above, you are simply getting a copy of the values from the
- vars in the unit to your local programs vars. From there, you call your
- local program vars for the color defaults.
-
-
- What.. More?!
-
- For your convenience, two more procedures have been written to go into
- this module. They are:
-
- EmptyBox(X1,X2,Y1,Y2 : Byte; FG, BG : Integer; Box : Byte);
-
- FilledBox(X1,X2,Y1,Y2 : Byte; FG, BG : Integer; Box : Byte);
-
- Where X1,X2,Y1,Y2 are coordinates for box and FG and BG are the colors
- to use. Box is either a 1 for a single lined box and 2 is double lined.
- Note that no test is made in this version to insure that BOX is either
- 1 or 2 so be careful!
-
- FilledBox is the same as EmptyBox except that it is filled with the
- passed BG color.
-
- WriteCRT(X,Y,Attr : Byte; Ch : Char);
-
- This just does a fast write directly to the video display. Note that on
- older CGA's, snow will be present during a write to the screen. You can
- pass either pointers to Char or Char literals.
-
- WriteLineCRT(X,Y,Attr : Byte; St : String);
-
- This is the same thing except it is used for whole strings. You can
- pass either pointers to strings or string literals. Note that on older
- CGA's, snow will be present during screen writes.
-
- COLOR NAMES are already defined in the unit! The full DOS colors [0..15]
- defined in an array by which your program can reference to pick up the
- color names in string form. (See the example program code)
-
- These functions are here and operate in these manners strictly in this
- version. In a full release version to registered users, direct screen
- writes will function correctly without snow on CGA's as well as be much
- FASTER!
-
- More plans are for mouse support to be added as well as two kinds of
- color selection functions, one for all attributes like this one and one
- with just the normal (NON-BLINKING) attributes in a smaller window.
-
-
- Address any and all correspondence and critiques to:
-
- Jeffrey S. Kline
- Systems 80 Consulting Services
- 10815 W. 88th Terr.
- Overland Park, KS 66214
- (913) 894-0816 (Phone calls you your bill only!)
- GENIE: JSKLINE
-
- PRICE: $15.00 ( US Funds only please )
-
- {end.}
-
-
-
-