home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_GEN
/
TVCOLR.ZIP
/
COLUPDT.DOC
< prev
next >
Wrap
Text File
|
1994-02-08
|
14KB
|
303 lines
Notice
======
The changes described in this file DO require the source code to the
Turbo Vision class library. All of Borland's copyrights remain in effect
and I make no claim of ownership or copyright to the modifications described
herein. It's always a good idea to back up the files to be modified in case
you mess something up and, if you do, I'M NOT RESPONSIBLE!
Files you should have received in TVCOLR.ZIP:
=============================================
TVCOLR.DOC -- Document describing extending TV's palette system.
COLUPDT.DOC -- Document describing some TV modifications.
MAPCOLOR.CPP -- A replacement TView::mapColor().
This can be used whether you have the TV source
code or not.
TVCOLR.H -- A default TVCOLR.H file to get you started.
TVCOLR.HDC -- TVCOLR.H fully commented.
TCOLTEXT.H -- TColorText header file.
TCOLTEXT.CPP -- TColorText class code. This class is used
throughout the demo and has colors in TVCOLR.H.
DEMOUMOD.EXE -- Demo using the unmodified TV library.
DEMOMOD.EXE -- Demo using the modifications described in the docs.
DEMO.H -- Demo header file.
DEMO.CPP -- Demo source code.
DEMO.PRJ -- Demo program project file.
DEMNOSRC.PRJ -- Similar to DEMO.PRJ, but for those with no source
code for Turbo Vision.
LINK.H -- Resource file __link() definitions for the demo.
BLDRSC.CPP -- Resource file builder.
BLDRSC.PRJ -- Resource file builder project file. The included
executables have the .RSC file appended to the EXE.
If your copy is incomplete, you can find a full copy in the BCPPDOS
forum on CompuServe in the Turbo Vision library section.
Background Information
======================
While adding a TColorDialog to my application, I found out that unlike
the compiler's IDE, Turbo Vision had no entries for changing a default
button's shortcut color, a selected button's shortcut color, or a selected
label's shortcut color. Thus, the hotkeys for them always seem to stand out
in an aesthetically unsatisfactory way (well, they do to me anyway <g>).
Run DEMOUMOD.EXE and you'll see what I mean. Also, you can't use black on
black as a color (i.e. for a blank desktop background). Finally, if you
ever use apMonochrome, TColorDialog has defined TMonoSelector to be one line
too long so that the "Inverse" radio button shows up twice. I have included
notes on fixing these problems here. You can see the default action by
running DEMOUMOD.EXE and executing the Colors selection on the Options menu.
Look at the hot keys and, when using the monochrome palette, the color
selector.
You might ask, "If you're just adding colors to TButton and TLabel, why
not put them into TVCOLR.H, derive new TButton and TLabel classes, and use
them instead?" I thought of doing that at first, but it won't work well.
It would be fine for any buttons or labels you use in your own dialogs, but
buttons and labels in Turbo Vision's own dialogs (TColorDialog, TFileDialog,
etc) would be unaffected because they would use the normal TButtons and
TLabels with the old palette strings and would still have the same problem.
By directly modifying the underlying source code for those two objects and
rebuilding the library, it takes care of all situations.
Any line numbers given are for the unmodified Turbo Vision 1.03 source
code right from the installation diskettes. If you have been following the
Turbo Vision messages and library in the BCPPDOS forum on CompuServe, there
have been some reports on bug fixes. If you have made them, these line
numbers might not match up exactly. However, you should be able to look
around the general vicinity and find the line(s) in question.
NOTE: AS A PRECAUTION, ALWAYS KEEP BACKUPS OF THE ORIGINAL FILES LISTED
BELOW INCASE YOU DO HAVE PROBLEMS.
Files affected:
APP.H
DIALOGS.H
HELPBASE.H
COLORSEL.CPP
DRIVERS.CPP
MAPCOLOR.CPP
TBUTTON.CPP
TDIALOG.CPP
TLABEL.CPP
TV.LIB
*******************************************************************************
To fix TMonoSelector in COLORSEL.CPP
Line 649 is:
monoSel = new TMonoSelector( TRect( 44, 3, 59, 8 ) );
Change to:
monoSel = new TMonoSelector( TRect( 44, 3, 59, 7 ) );
*******************************************************************************
To allow black on black as a color selection:
COLORSEL.CPP: Lines 341-342 in TColorDisplay::draw() are:
if( c == 0 )
c = errorAttr;
Comment them out or delete both lines.
-------------------------------------------------------------------------------
DRIVERS.CPP: Lines 67-68 and lines 124-125 are both:
OR AH,AH
JE __3
Comment them out or delete both sets of lines.
-------------------------------------------------------------------------------
MAPCOLOR.CPP: Lines 25-26 and lines 35-36 are both:
if( color == 0 )
return errorAttr;
Change both to:
if( color == 0 )
return 0; // Return black on black.
Note that the changes to MAPCOLOR.CPP don't need to be done if you are
going to put the changes described in TVCOLR.DOC into effect. In which
case, you will be replacing the existing MAPCOLOR.CPP with the one supplied
in TVCOLR.ZIP.
*******************************************************************************
I chose to add the two colors for TButton and one color for TLabel
*after* the last normal entry in the base palettes so that it wouldn't muck
up all the other color index assignments currently in effect. I also didn't
just fill them in by using the spaces marked as RESERVED for obvious
reasons. I put them *ahead* of the help window colors so that you aren't
forced to add the help colors to your application if you don't want to or
need to. All of the help color indices are defined in HELPBASE.H so they
were easy to reassign.
To add entries for a default button's shortcut color, selected button's
shortcut color, and for a selected label's shortcut color, do the following:
*******************************************************************************
In TBUTTON.CPP, change line 44 from:
#define cpButton "\x0A\x0B\x0C\x0D\x0E\x0E\x0E\x0F"
To:
#define cpButton "\x0A\x0B\x0C\x0D\x0E\x21\x22\x0F"
*******************************************************************************
In TLABEL.CPP, change line 31 from:
#define cpLabel "\x07\x08\x09\x09"
To:
#define cpLabel "\x07\x08\x09\x23"
*******************************************************************************
In TDIALOG.CPP, change lines 23-24 from:
#define cpDialog "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F"\
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F"
To: (just add '\' to the second line and insert the third line for the palette)
#define cpDialog "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2A\x2B\x2C\x2D\x2E\x2F"\
"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3A\x3B\x3C\x3D\x3E\x3F"\
"\x40\x41\x42"
*******************************************************************************
In DIALOGS.H, optionally add the following lines to the TDialog palette
comments to keep things well documented. These will end up as lines 68-70:
/* 33 = Button shortcut default */
/* 34 = Button shortcut selected */
/* 35 = TLabel shortcut selected */
*******************************************************************************
In APP.H, change lines 138-154 from:
#define cpColor \
"\x71\x70\x78\x74\x20\x28\x24\x17\x1F\x1A\x31\x31\x1E\x71\x00" \
"\x37\x3F\x3A\x13\x13\x3E\x21\x00\x70\x7F\x7A\x13\x13\x70\x7F\x00" \
"\x70\x7F\x7A\x13\x13\x70\x70\x7F\x7E\x20\x2B\x2F\x78\x2E\x70\x30" \
"\x3F\x3E\x1F\x2F\x1A\x20\x72\x31\x31\x30\x2F\x3E\x31\x13\x00\x00"
#define cpBlackWhite \
"\x70\x70\x78\x7F\x07\x07\x0F\x07\x0F\x07\x70\x70\x07\x70\x00" \
"\x07\x0F\x07\x70\x70\x07\x70\x00\x70\x7F\x7F\x70\x07\x70\x07\x00" \
"\x70\x7F\x7F\x70\x07\x70\x70\x7F\x7F\x07\x0F\x0F\x78\x0F\x78\x07" \
"\x0F\x0F\x0F\x70\x0F\x07\x70\x70\x70\x07\x70\x0F\x07\x07\x00\x00"
#define cpMonochrome \
"\x70\x07\x07\x0F\x70\x70\x70\x07\x0F\x07\x70\x70\x07\x70\x00" \
"\x07\x0F\x07\x70\x70\x07\x70\x00\x70\x70\x70\x07\x07\x70\x07\x00" \
"\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
"\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x00\x00"
To: (just add a '\' to the fourth line and insert a fifth line in each palette)
#define cpColor \
"\x71\x70\x78\x74\x20\x28\x24\x17\x1F\x1A\x31\x31\x1E\x71\x00" \
"\x37\x3F\x3A\x13\x13\x3E\x21\x00\x70\x7F\x7A\x13\x13\x70\x7F\x00" \
"\x70\x7F\x7A\x13\x13\x70\x70\x7F\x7E\x20\x2B\x2F\x78\x2E\x70\x30" \
"\x3F\x3E\x1F\x2F\x1A\x20\x72\x31\x31\x30\x2F\x3E\x31\x13\x00\x00" \
"\x2E\x2E\x7E"
#define cpBlackWhite \
"\x70\x70\x78\x7F\x07\x07\x0F\x07\x0F\x07\x70\x70\x07\x70\x00" \
"\x07\x0F\x07\x70\x70\x07\x70\x00\x70\x7F\x7F\x70\x07\x70\x07\x00" \
"\x70\x7F\x7F\x70\x07\x70\x70\x7F\x7F\x07\x0F\x0F\x78\x0F\x78\x07" \
"\x0F\x0F\x0F\x70\x0F\x07\x70\x70\x70\x07\x70\x0F\x07\x07\x00\x00" \
"\x0F\x0F\x7F"
#define cpMonochrome \
"\x70\x07\x07\x0F\x70\x70\x70\x07\x0F\x07\x70\x70\x07\x70\x00" \
"\x07\x0F\x07\x70\x70\x07\x70\x00\x70\x70\x70\x07\x07\x70\x07\x00" \
"\x70\x70\x70\x07\x07\x70\x70\x70\x0F\x07\x07\x0F\x70\x0F\x70\x07" \
"\x0F\x0F\x07\x70\x07\x07\x70\x07\x07\x07\x70\x0F\x07\x07\x00\x00" \
"\x0F\x0F\x0F"
Then, at line 137 insert the following definition:
#define MODIFIED_TV_COLORS
TVCOLR.H uses this #define to see if it should add the extra three
colors to the custom cpAltColor palette and also to the cpDefXXX palettes.
You can also use it as I did in BLDRSC.CPP to skip colors for the
TColorDialog when they aren't defined. This is a better method than the
UNMODIFIED_TURBO_VISION definition I used for a prior release of these
files. The TVCOLR.H in this release will maintain the proper index values
regardless of whether these three colors have been added or not.
*******************************************************************************
In HELPBASE.H, change line 19 from:
#define cHelpWindow "\x40\x41\x42\x43\x44\x45\x46\x47"
To:
#define cHelpWindow "\x43\x44\x45\x46\x47\x48\x49\x4A"
*******************************************************************************
For reference, you can add the following text to the TProgram palette
description in the manual (pages 342-343).
64 65 66 67 68 69 70 71 72 73 74
╔════╤════╤════╤════╤════╤════╤════╤════╤════╤════╤════╗
cpColor ║x2E │x2E │x7E │x37 │x3F │x3A │x13 │x13 │x30 │x3E │x1E ║
╠════╧════╧════╧════╧════╧════╧════╧════╧════╧════╧════╣
╠════╤════╤════╤════╤════╤════╤════╤════╤════╤════╤════╣
cpBlackWhite ║x0F │x0F │x7F │x07 │x0F │x07 │x70 │x70 │x07 │x0F │x70 ║
╠════╧════╧════╧════╧════╧════╧════╧════╧════╧════╧════╣
╠════╤════╤════╤════╤════╤════╤════╤════╤════╤════╤════╣
cpMonochrome ║x0F │x0F │x0F │x07 │x0F │x07 │x70 │x70 │x07 │x0F │x70 ║
╚════╧════╧════╧════╧════╧════╧════╧════╧════╧════╧════╝
│ │ │ │ │ │ │ │ │ │ │
Button shortcut default─┘ │ │ │ │ │ │ │ │ │ │
Button shortcut selected─────┘ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │
TLabel shortcut selected──────────┘ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
Help frame passive─────────────────────┘ │ │ │ │ │ │ │
Help frame active───────────────────────────┘ │ │ │ │ │ │
Help frame icons─────────────────────────────────┘ │ │ │ │ │
Scrollbar page────────────────────────────────────────┘ │ │ │ │
Scrollbar icons────────────────────────────────────────────┘ │ │ │
Normal text─────────────────────────────────────────────────────┘ │ │
Keyword──────────────────────────────────────────────────────────────┘ │
Selected keyword──────────────────────────────────────────────────────────┘
*******************************************************************************
Implementation
==============
That's all there is to it. Once you've made the modifications, change
directories to \BC\TVISION\SOURCE (substitute your path as necessary) and
issue the command: make -fmakefile
I think it's best to rebuild the library because by doing the MAKE,
you can insure that everything that needs updating gets recompiled. I've
included a demo program that illustrates the differences between the
unmodified version and modified version of the code. Look there for
additional comments and notes.
I have seen some other Turbo Vision examples and files on CompuServe
that define their own custom application palette for their included demo
program like I do. If compiled with these changes, the hotkeys for the
buttons and labels will be undefined unless you add the three extra bytes to
their custom palette or enclose them in an #ifdef block like TVCOLR.H does.
*******************************************************************************
Well, I hope you find this useful. I'd appreciate any feedback,
comments, suggestions, questions, etc that you may have on the changes I
implemented. I can be reached on CompuServe E-Mail at 72134,1150 or by
posting a message in Section 11 (Turbo Vision) of the BCPPDOS forum.
Thanks.
Eric Woodruff, CIS ID: 72134,1150
Tue 02/08/94 10:42:28